I have taproot output which can be spend through 3 different script paths. In general all of those script paths are some kind of multisig.
In my wallet I have key which is part of those multi-sigs. The key was created by using getnewaddress
and then getaddressinfo
rpc endpoints.
Now I want to create signature for one of those spending paths by using walletprocesspsbt
endpoint.
My current status is that I am able to do that for simple scripts.
For example, if my script path has script in form:
<key1> OP_CHECKSIGVERIFY <key2> OP_CHECKSIG
Where key1
is controlled by my wallet, I am able to obtain signature with following psbt:
{
"tx": {
"txid": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
"hash": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
"version": 2,
"size": 82,
"vsize": 82,
"weight": 328,
"locktime": 0,
"vin": [
{
"txid": "8821c890aea7bf0c850a190a56841d0a8868aab71062a8b37b59b07db098909d",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 0
}
],
"vout": [
{
"value": 0.00098000,
"n": 0,
"scriptPubKey": {
"asm": "0 7238e566467d97144f21a0698b3e5b4d5c3c4765",
"desc": "addr(bcrt1qwguw2ejx0kt3gnep5p5ck0jmf4wrc3m9hq96m4)#6azty5uq",
"hex": "00147238e566467d97144f21a0698b3e5b4d5c3c4765",
"address": "bcrt1qwguw2ejx0kt3gnep5p5ck0jmf4wrc3m9hq96m4",
"type": "witness_v0_keyhash"
}
}
]
},
"global_xpubs": [
],
"psbt_version": 0,
"proprietary": [
],
"unknown": {
},
"inputs": [
{
"witness_utxo": {
"amount": 0.00100000,
"scriptPubKey": {
"asm": "1 e20f096ae701b95fdb45f76b8e5d89882bedfae1fc9ffc343b1539825a15a1c4",
"desc": "rawtr(e20f096ae701b95fdb45f76b8e5d89882bedfae1fc9ffc343b1539825a15a1c4)#865n9v42",
"hex": "5120e20f096ae701b95fdb45f76b8e5d89882bedfae1fc9ffc343b1539825a15a1c4",
"address": "bcrt1pug8sj6h8qxu4lk697a4cuhvf3q47m7hplj0lcdpmz5ucyks458zq398wqk",
"type": "witness_v1_taproot"
}
},
"witness_script": {
"asm": "2283868d5ee6960d988c91ff8f1efcd10676dc7b9af2c5c3197a9c1dee537fb5 OP_CHECKSIGVERIFY 5ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223 OP_CHECKSIG",
"hex": "202283868d5ee6960d988c91ff8f1efcd10676dc7b9af2c5c3197a9c1dee537fb5ad205ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223ac",
"type": "nonstandard"
},
"taproot_scripts": [
{
"script": "202283868d5ee6960d988c91ff8f1efcd10676dc7b9af2c5c3197a9c1dee537fb5ad205ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223ac",
"leaf_ver": 192,
"control_blocks": [
"c150929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0f5e193bf9eebda98862ea7c29c86a29d2124c907705b05f20b93218a471226473e2f5345f81ebc365f9dcf17f8bb49b777df103efab236de5598d01ea84c54e1"
]
}
],
"taproot_bip32_derivs": [
{
"pubkey": "5ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223",
"master_fingerprint": "00000000",
"path": "m",
"leaf_hashes": [
]
}
],
"taproot_internal_key": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0",
"taproot_merkle_root": "04c239dd79e3787440cb0cb7b35c211b122db9bf54d953ffa0b548bf39ddd1e9"
}
],
"outputs": [
{
}
],
"fee": 0.00002000
}
and after signing I get psbt with new field taproot_script_path_sigs
:
{
"tx": {
"txid": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
"hash": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
"version": 2,
"size": 82,
"vsize": 82,
"weight": 328,
"locktime": 0,
"vin": [
{
"txid": "8821c890aea7bf0c850a190a56841d0a8868aab71062a8b37b59b07db098909d",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 0
}
],
"vout": [
{
"value": 0.00098000,
"n": 0,
"scriptPubKey": {
"asm": "0 7238e566467d97144f21a0698b3e5b4d5c3c4765",
"desc": "addr(bcrt1qwguw2ejx0kt3gnep5p5ck0jmf4wrc3m9hq96m4)#6azty5uq",
"hex": "00147238e566467d97144f21a0698b3e5b4d5c3c4765",
"address": "bcrt1qwguw2ejx0kt3gnep5p5ck0jmf4wrc3m9hq96m4",
"type": "witness_v0_keyhash"
}
}
]
},
"global_xpubs": [
],
"psbt_version": 0,
"proprietary": [
],
"unknown": {
},
"inputs": [
{
"witness_utxo": {
"amount": 0.00100000,
"scriptPubKey": {
"asm": "1 e20f096ae701b95fdb45f76b8e5d89882bedfae1fc9ffc343b1539825a15a1c4",
"desc": "rawtr(e20f096ae701b95fdb45f76b8e5d89882bedfae1fc9ffc343b1539825a15a1c4)#865n9v42",
"hex": "5120e20f096ae701b95fdb45f76b8e5d89882bedfae1fc9ffc343b1539825a15a1c4",
"address": "bcrt1pug8sj6h8qxu4lk697a4cuhvf3q47m7hplj0lcdpmz5ucyks458zq398wqk",
"type": "witness_v1_taproot"
}
},
"witness_script": {
"asm": "2283868d5ee6960d988c91ff8f1efcd10676dc7b9af2c5c3197a9c1dee537fb5 OP_CHECKSIGVERIFY 5ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223 OP_CHECKSIG",
"hex": "202283868d5ee6960d988c91ff8f1efcd10676dc7b9af2c5c3197a9c1dee537fb5ad205ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223ac",
"type": "nonstandard"
},
"taproot_script_path_sigs": [
{
"pubkey": "5ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223",
"leaf_hash": "cc54275b75e262eb3da81db55f4692a4b6052cfb71cc00f88ef54c016c911216",
"sig": "c2504a8574137f7b25797439893ab16efe6ec2424b60dc3f9a896c6cd0cbed7369411dbdbddcbe88f54f041dda60911a0636021b76f9f9f2680666dedd9a34a4"
}
],
"taproot_scripts": [
{
"script": "202283868d5ee6960d988c91ff8f1efcd10676dc7b9af2c5c3197a9c1dee537fb5ad205ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223ac",
"leaf_ver": 192,
"control_blocks": [
"c150929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0f5e193bf9eebda98862ea7c29c86a29d2124c907705b05f20b93218a471226473e2f5345f81ebc365f9dcf17f8bb49b777df103efab236de5598d01ea84c54e1"
]
}
],
"taproot_bip32_derivs": [
{
"pubkey": "5ef18b0ee964644e719ebd3deed6f19ed16a7b66d119446b6a7e4a71130fe223",
"master_fingerprint": "00000000",
"path": "m",
"leaf_hashes": [
]
}
],
"taproot_internal_key": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0",
"taproot_merkle_root": "04c239dd79e3787440cb0cb7b35c211b122db9bf54d953ffa0b548bf39ddd1e9"
}
],
"outputs": [
{
}
],
"fee": 0.00002000
}
I am failing to do the same, when I have more complex scripts like:
<key1> OP_CHECKSIGVERIFY <key2> OP_CHECKSIG <key3> OP_CHECKSIGADD 1 OP_GREATERTHANOREQUAL
where key3
is controlled by my wallet.
After I send psbt:
{
"tx": {
"txid": "a87941d58431cd09c2d116c1cc06ed55e0c62203a976ea0be72b365c73f4ecd4",
"hash": "a87941d58431cd09c2d116c1cc06ed55e0c62203a976ea0be72b365c73f4ecd4",
"version": 2,
"size": 82,
"vsize": 82,
"weight": 328,
"locktime": 0,
"vin": [
{
"txid": "bfbadf7f017d9a4351c6a0d677440ce0413a6fb2941337c87ecff973698f410d",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 0
}
],
"vout": [
{
"value": 0.00098000,
"n": 0,
"scriptPubKey": {
"asm": "0 7977cce5169ecc596a32fdff65c6a244be9710a6",
"desc": "addr(bcrt1q09mueegknmx9j63jlhlkt34zgjlfwy9xav6wcq)#cr0chwt0",
"hex": "00147977cce5169ecc596a32fdff65c6a244be9710a6",
"address": "bcrt1q09mueegknmx9j63jlhlkt34zgjlfwy9xav6wcq",
"type": "witness_v0_keyhash"
}
}
]
},
"global_xpubs": [
],
"psbt_version": 0,
"proprietary": [
],
"unknown": {
},
"inputs": [
{
"witness_utxo": {
"amount": 0.00100000,
"scriptPubKey": {
"asm": "1 0100d055acf66f6cd1f777fa61f8164f78778393029347eca6af5334270385ec",
"desc": "rawtr(0100d055acf66f6cd1f777fa61f8164f78778393029347eca6af5334270385ec)#p43tkhf0",
"hex": "51200100d055acf66f6cd1f777fa61f8164f78778393029347eca6af5334270385ec",
"address": "bcrt1pqyqdq4dv7ehke50hwlaxr7qkfau80qunq2f50m9x4afngfcrshkqh68rw9",
"type": "witness_v1_taproot"
}
},
"witness_script": {
"asm": "94979a92a8e36fb070a0455d8621c3db5b93cdc3a943702effa70b3438428bb5 OP_CHECKSIGVERIFY 7d7a4a305ecc5c9cbfef7f17cab1f127fd16746de66715f12c68ef65d2f1e535 OP_CHECKSIG 8682e046c6de4d4a28e6df60830525d779e2e4ea897bd439492061a3f1edb339 OP_CHECKSIGADD 1 OP_GREATERTHANOREQUAL",
"hex": "2094979a92a8e36fb070a0455d8621c3db5b93cdc3a943702effa70b3438428bb5ad207d7a4a305ecc5c9cbfef7f17cab1f127fd16746de66715f12c68ef65d2f1e535ac208682e046c6de4d4a28e6df60830525d779e2e4ea897bd439492061a3f1edb339ba51a2",
"type": "nonstandard"
},
"taproot_scripts": [
{
"script": "2094979a92a8e36fb070a0455d8621c3db5b93cdc3a943702effa70b3438428bb5ad207d7a4a305ecc5c9cbfef7f17cab1f127fd16746de66715f12c68ef65d2f1e535ac208682e046c6de4d4a28e6df60830525d779e2e4ea897bd439492061a3f1edb339ba51a2",
"leaf_ver": 192,
"control_blocks": [
"c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac070a51f0529b1675a42bfb5e12f2d8f40422a2b4e6643bd92c90aea1a3af3e4878c554e3a01b0fe563a991bba70924174e83f06237ff0cf21e11f51139d814837"
]
}
],
"taproot_bip32_derivs": [
{
"pubkey": "7d7a4a305ecc5c9cbfef7f17cab1f127fd16746de66715f12c68ef65d2f1e535",
"master_fingerprint": "00000000",
"path": "m",
"leaf_hashes": [
]
}
],
"taproot_internal_key": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0",
"taproot_merkle_root": "4f26390aace2c87c38c3ec639bb661697903832d2d3e20ab29a2fee6e2443188"
}
],
"outputs": [
{
}
],
"fee": 0.00002000
}
I receive the same psbt back without any signatures.
So question here is, what additional data should I put into psbt to sign this more complex script ?