Sunday, December 22, 2024

json rpc – How can I signal customized tapscript leaf utilizing bitcoind `walletprocesspsbt` rpc endpoint?

I’ve taproot output which may be spend by way of 3 totally different script paths. Generally all of these script paths are some type of multisig.

In my pockets I’ve key which is a part of these multi-sigs. The important thing was created through the use of getnewaddress after which getaddressinfo rpc endpoints.

Now I wish to create signature for a type of spending paths through the use of walletprocesspsbt endpoint.

My present standing is that I’m able to try this for easy scripts.

For instance, if my script path has script in kind:

<key1> OP_CHECKSIGVERIFY <key2> OP_CHECKSIG

The place key1 is managed by my pockets, I’m able to acquire signature with following psbt:

{
  "tx": {
    "txid": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
    "hash": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
    "model": 2,
    "measurement": 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": [
    {
    }
  ],
  "price": 0.00002000
}

and after signing I get psbt with new area taproot_script_path_sigs:

{
  "tx": {
    "txid": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
    "hash": "e576917eea32cb8d98daf233bfbfa94b6b9ba450cb18e255bbd826a7862bcde1",
    "model": 2,
    "measurement": 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": [
    {
    }
  ],
  "price": 0.00002000
}

I’m failing to do the identical, when I’ve extra advanced scripts like:

<key1> OP_CHECKSIGVERIFY <key2> OP_CHECKSIG <key3> OP_CHECKSIGADD 1 OP_GREATERTHANOREQUAL

the place key3 is managed by my pockets.

After I ship psbt:

{
  "tx": {
    "txid": "a87941d58431cd09c2d116c1cc06ed55e0c62203a976ea0be72b365c73f4ecd4",
    "hash": "a87941d58431cd09c2d116c1cc06ed55e0c62203a976ea0be72b365c73f4ecd4",
    "model": 2,
    "measurement": 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": [
    {
    }
  ],
  "price": 0.00002000
}

I obtain the identical psbt again with none signatures.

So query right here is, what extra information ought to I put into psbt to signal this extra advanced script ?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles