<blockquote>
<p>For example, an address for a simple P2SH script puzzle like x+5=6 will always be the same address, so my understanding is that should not be ranged.</p>
</blockquote>
<p>Descriptors cannot express such a script, so that example is irrelevant.</p>
<blockquote>
<p>Where can I understand the general logic for ranged vs non ranged descriptors?</p>
</blockquote>
<p>A descriptor is ranged if it has a <code>/*</code> in a derivation path somewhere, as that will be expanded differently for each position. If there are no expressions with <code>*</code> in it, then it is not ranged as clearly every position will yield the same script.</p>
<p>See the descriptors <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md" rel="nofollow noreferrer">reference document</a> for Bitcoin Core for details of the descriptor language.</p>
<blockquote>
<p>And also in particular, for the case of P2SH where the script can be almost anything.</p>
</blockquote>
<p>The same is true for P2WSH or P2TR; inside, arbitrary scripts can be placed, but descriptors can only express a small portion of that. In Bitcoin Core 24.0, <a href="https://bitcoin.sipa.be/miniscript/" rel="nofollow noreferrer">miniscript</a> descriptors can be used inside P2WSH (just watchonly, though), which greatly expands the power descriptors have. Even with that, it cannot express arbitrary scripts like the x+5=6 puzzle.</p>

CC BY-SA 4.0
2022-10-29T22:20:21.157Z
Can you elaborate "...yield the same script", particularly the scenario when it would yield a different script? and what determines if it can have an *? Maybe my confusion comes from the relationship with HD Keys and particularly, in P2SH when the script can be a multifirm with several keys, thanks
Bitcoin_1o1
CC BY-SA 4.0
2022-10-29T22:34:34.077Z
What determines if it can have an `*`? Nothing. It has that when you put one in. It's valid in KEY expressions in the descriptor language, which occur as argument to `pk()`, `pkh()`, `multi`, `multi_a`, `tr`, ... Read the reference I linked to for a full explanation of the language. I don't understand the rest of your comment.
Pieter Wuille
CC BY-SA 4.0
2022-10-30T19:56:52.733Z
Thanks @Pieter, I have read the reference, and I'm also reviewing other materials, Andrew Chow's interview with Stephan Livera, I will post my remaining doubts, if any, in another question.
Bitcoin_1o1
CC BY-SA 4.0
2022-10-29T21:55:26.457Z
2022-10-29T21:55:26.457Z
Pieter Wuille
<p>For example, an address for a simple  P2SH script puzzle like x+5=6 will always be the same address, so my understanding is that should not be ranged. Where can I understand the general logic for ranged vs non ranged descriptors? And also in particular, for the case of P2SH where the script can be almost anything.</p>

<p2sh><output-script-descriptors>
What determines if a descriptor can have ranges?
Bitcoin_1o1
# What determines if a descriptor can have ranges?

(Asked by: username_0 on 2022-10-29)

For example, an address for a simple P2SH script puzzle like x+5=6 will always be the same address, so my understanding is that should not be ranged. Where can I understand the general logic for ranged vs non ranged descriptors? And also in particular, for the case of P2SH where the script can be almost anything.

**Tags:** p2sh, output-script-descriptors


---

## 1 answers

### Answer by username_1 on 2022-10-29. Score: 0 | Accepted answer

> For example, an address for a simple P2SH script puzzle like x+5=6 will always be the same address, so my understanding is that should not be ranged.

Descriptors cannot express such a script, so that example is irrelevant.

> Where can I understand the general logic for ranged vs non ranged descriptors?

A descriptor is ranged if it has a `/*` in a derivation path somewhere, as that will be expanded differently for each position. If there are no expressions with `*` in it, then it is not ranged as clearly every position will yield the same script.

See the descriptors [reference document](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md) for Bitcoin Core for details of the descriptor language.

> And also in particular, for the case of P2SH where the script can be almost anything.

The same is true for P2WSH or P2TR; inside, arbitrary scripts can be placed, but descriptors can only express a small portion of that. In Bitcoin Core 24.0, [miniscript](https://bitcoin.sipa.be/miniscript/) descriptors can be used inside P2WSH (just watchonly, though), which greatly expands the power descriptors have. Even with that, it cannot express arbitrary scripts like the x+5=6 puzzle.

> **Comments:**
> **username_0**: Can you elaborate "...yield the same script", particularly the scenario when it would yield a different script? and what determines if it can have an *? Maybe my confusion comes from the relationship with HD Keys and particularly, in P2SH when the script can be a multifirm with several keys, thanks  
> **username_1**: What determines if it can have an `*`? Nothing. It has that when you put one in. It's valid in KEY expressions in the descriptor language, which occur as argument to `pk()`, `pkh()`, `multi`, `multi_a`, `tr`, ... Read the reference I linked to for a full explanation of the language. I don't understand the rest of your comment.  
> **username_0**: Thanks @username_1, I have read the reference, and I'm also reviewing other materials, Andrew Chow's interview with Stephan Livera, I will post my remaining doubts, if any, in another question.  

---

