<p>Yes. Such descriptors are referred to as ranged descriptors.</p>
<p>In a descriptor, keys are provided in the form of a Key expression. Key expressions can be individual keys themselves, or BIP 32 extended keys, followed by derivation information. The derivation information can end with a <code>*</code> to indicate that child keys should be derived. In that case, the descriptor is a ranged descriptor and each child key derived becomes a key in the output script.</p>
<p>If you then imagine the ranged descriptor like a higher form of an xpub, then you would have &quot;derived descriptors&quot; at each child index. Child index 0 would be a descriptor with everything the same as the parent except the xpubs. Those are replaced by the key derived at index 0. Index 1 has the keys derived at index 1, and so on.</p>
<p>One thing to note with ranged descriptors is that the indexes move in lockstep to avoid any combinatorial blowup. So if there are multiple xpubs in a descriptor, all of the keys are derived at the same child index. Index 0 has all keys derived using index 0, index 1 has all keys derived using index 1, etc.</p>

CC BY-SA 4.0
2021-11-19T14:44:56.200Z
I'm struggling to understand how Miniscript and Descriptors work together? Is the idea that I can replace A and B in the following script with an xpub? Original miniscript: `and_v(v:pk(A),pk(B))` Miniscript with embedded descriptors:    
`and_v(v:pk([b33.../44'/0'/0']xpubApf/1/*),pk([f34.../44'/0'/0']xpub6ER.../1/*))`
max
CC BY-SA 4.0
2021-11-19T17:20:53.750Z
@max Descriptors are more than just the pubkeys. They are really the expressions `sh()`, `multi()`, `tr()`, `wsh()`, etc. Descriptors create the output scripts whereas Miniscript describes the inner scripts. For example, a descriptor would be `wsh(and_v(v:pk(xpub..../*),pk(xpub.../*)))`. The descriptor is the outer `wsh(...)` expression and the miniscript is the inner `and_v(v:pk(xpub..../*),pk(xpub.../*))`
Ava Chow
CC BY-SA 4.0
2021-11-20T20:25:11.123Z
Thanks Andrew, I think I get it now. Descriptors are primarily for understanding what kind of address/output script to use, while miniscript is used to describe contractual logic.
max
CC BY-SA 4.0
2021-08-03T17:34:22.270Z
2021-08-03T17:34:22.270Z
Ava Chow
<p>Output descriptors provide a standard to make address bodies more exchangeable between various wallet implementations. It seems that an output descriptor can be used to encode any Miniscript expression for one specific key. Can they also be used to produce a sequence output scripts that all use the same Miniscript expression applied to a chain of derived keys?</p>

<address-generation><output-script-descriptors><miniscript>
Can output descriptors be used to encode any Miniscript expression?
Murch
# Can output descriptors be used to encode any Miniscript expression?

(Asked by: username_0 on 2021-08-03)

Output descriptors provide a standard to make address bodies more exchangeable between various wallet implementations. It seems that an output descriptor can be used to encode any Miniscript expression for one specific key. Can they also be used to produce a sequence output scripts that all use the same Miniscript expression applied to a chain of derived keys?

**Tags:** address-generation, output-script-descriptors, miniscript


---

## 1 answers

### Answer by username_1 on 2021-08-03. Score: 5 | Accepted answer

Yes. Such descriptors are referred to as ranged descriptors.

In a descriptor, keys are provided in the form of a Key expression. Key expressions can be individual keys themselves, or BIP 32 extended keys, followed by derivation information. The derivation information can end with a `*` to indicate that child keys should be derived. In that case, the descriptor is a ranged descriptor and each child key derived becomes a key in the output script.

If you then imagine the ranged descriptor like a higher form of an xpub, then you would have "derived descriptors" at each child index. Child index 0 would be a descriptor with everything the same as the parent except the xpubs. Those are replaced by the key derived at index 0. Index 1 has the keys derived at index 1, and so on.

One thing to note with ranged descriptors is that the indexes move in lockstep to avoid any combinatorial blowup. So if there are multiple xpubs in a descriptor, all of the keys are derived at the same child index. Index 0 has all keys derived using index 0, index 1 has all keys derived using index 1, etc.

> **Comments:**
> **username_2**: I'm struggling to understand how Miniscript and Descriptors work together? Is the idea that I can replace A and B in the following script with an xpub? Original miniscript: `and_v(v:pk(A),pk(B))` Miniscript with embedded descriptors:     `and_v(v:pk([b33.../44'/0'/0']xpubApf/1/*),pk([f34.../44'/0'/0']xpub6ER.../1/*))`  
> **username_1**: @username_2 Descriptors are more than just the pubkeys. They are really the expressions `sh()`, `multi()`, `tr()`, `wsh()`, etc. Descriptors create the output scripts whereas Miniscript describes the inner scripts. For example, a descriptor would be `wsh(and_v(v:pk(xpub..../*),pk(xpub.../*)))`. The descriptor is the outer `wsh(...)` expression and the miniscript is the inner `and_v(v:pk(xpub..../*),pk(xpub.../*))`  
> **username_2**: Thanks Andrew, I think I get it now. Descriptors are primarily for understanding what kind of address/output script to use, while miniscript is used to describe contractual logic.  

---

