-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Wallet Descriptor Support for Transaction Indexing #407
feat: add Wallet Descriptor Support for Transaction Indexing #407
Conversation
This is really cool, thank you @qustavo 🚀 |
Thanks for taking the time to review, and definitively yes, I'd like to get onboard with how you test this. |
@qustavo sounds great, could you shoot me a message - ludovic at hiro so? |
components/chainhook-sdk/Cargo.toml
Outdated
@@ -42,6 +42,8 @@ dashmap = "5.4.0" | |||
fxhash = "0.2.1" | |||
lazy_static = "1.4.0" | |||
regex = "1.9.3" | |||
miniscript = "10.0.0" | |||
bitcoin = "0.30.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qustavo we may not need this dep, can you confirm if we can remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Could you add a test case to the |
b094ac1
to
edf4da0
Compare
441e7a8
to
bdb7914
Compare
added |
The test was designed around the OpReturn matcher only. This change generalizes it so that we can test other matchers. This is preparatory work to introduce Wallet descriptor testing.
This introduces support for wallet descriptors. Descriptors provide a compact and semi-standardized method for describing how scripts and addresses within a wallet are generated[1]. Chainhooks users that want to track addresses derived from an extended pubkey or a multisig-wallet for example, can now rely on this feature instead of defining one predicate per address. For example if we wanted to track the first 3 addressed generated by the following descriptor: ``` wpkh(tprv8ZgxMBicQKsPePxn6j3TjvB2MBzQkuhGgc6oRh2WZancZQgxktcnjZJ44XdsRiw3jNkbVTK9JW6KFHvnRKgAMtSyuBevMJprSkZ4PTfmTgV/84'/1'/0'/0/*) ``` which reads: describe a P2WPKH output with the specified extended public key, and produces these BIP84 addresses: ``` bcrt1qzy2rdyvu8c57qd8exyyp0mw7dk5drsu9ewzdsu bcrt1qsfsjnagr29m8h3a3vdand2s85cg4cefkcwk2fy bcrt1qauewfytqe5mtr0xwp786r6fl39kmum2lr65kmj ``` we could use the following predicate: ```json ... "networks": { "regtest": { "if_this": { "scope": "outputs", "descriptor": { "expression": "wpkh(tprv8ZgxMBicQKsPePxn6j3TjvB2MBzQkuhGgc6oRh2WZancZQgxktcnjZJ44XdsRiw3jNkbVTK9JW6KFHvnRKgAMtSyuBevMJprSkZ4PTfmTgV/84'/1'/0'/0/*)", "range": [0,3] } }, "then_that": { "file_append": { "path": "txns.txt" } } } } ... ``` 1: https://bitcoindevkit.org/descriptors/
bdb7914
to
5616a6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @qustavo!
🎉 This PR is included in version 1.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This introduces support for wallet descriptors.
Descriptors provide a compact and semi-standardized method for describing how scripts and addresses within a wallet are generated[1].
Chainhooks users that want to track addresses derived from an extended pubkey or a multisig-wallet for example, can now rely on this feature instead of defining one predicate per address.
For example if we wanted to track the first 3 addressed generated by the following descriptor:
which reads: describe a P2WPKH output with the specified extended public key, and produces these BIP84 addresses:
we could use the following predicate:
1: https://bitcoindevkit.org/descriptors/