delvingbitcoin
Combined summary - Tr(): rawnode() and rawleaf() support
Recent discussions within the Bitcoin development community, particularly surrounding Issue 24114 and insights from a Partial Descriptors Gist, have led to the proposal of two new descriptors for Taproot (tr()): rawnode(HEXHASH)
and rawleaf(HEXSCRIPT,[HEXLEAFVER])
.
These innovations aim at enhancing the flexibility and efficiency of specifying branches and scripts in Taproot trees. The rawnode
descriptor allows users to define a branch using a merkle hash directly, which caters to scenarios requiring Need-to-Know-Branches (N2KB), simplification of TR trees, or when information in certain branches is omitted. This functionality was underscored by a use case demonstrating significant simplification in descriptor notation.
Furthermore, the introduction of rawleaf
facilitates the addition of raw scripts with varied leaf versions into the Taproot tree, supporting an argument that descriptors should convey script and leaf version information analogously to PSBTs. This discussion raises questions about the potential redundancy between rawnode
and rawleaf
, suggesting that further exploration into their distinct advantages or the possibility of merging functionalities under a unified descriptor could be beneficial.
The development and testing of these concepts have been advanced through a proof of concept, specifically through the creation of RawNodeDescriptor
and RawLeafDescriptor
subclasses. These are tailored exclusively for P2TR contexts, enhancing the Bitcoin scripting capabilities significantly. Notably, the inference mechanism for descriptors has been refined; if no taptree is inferred and the Merkle root remains non-null, a simplified tr(internal_key,rawnode(merkle_root))
descriptor is proposed in lieu of the traditional rawtr(tr_public_key)
approach. This modification suggests a strategic shift towards optimizing the inferencing process, although its benefits over existing methodologies warrant further discussion and validation.