Sunday, December 22, 2024

multi signature – The best way to spend a multisig descriptor pockets transaction?

I’m in search of the right method to spend multisig outputs with descriptor pockets bitcoin-cli.

In regtest, I efficiently created a funding transaction tx1 with the next outputs:

out:0 sh(multi(1,KEY1,KEY2))

out:1 wsh(multi(1,KEY3,KEY4,KEY5))

I used bitcoin-cli -regtest deriveaddresses to get P2SH_ADDRESS and P2WSH_ADDRESS from these descriptors after which

bitcoin-cli -regtest -rpcwallet="$WALLET" createrawtransaction '''
  [
    {
      "txid": "'$prev_tx'",
      "vout": 0
    }
  ]
''' '''
  {
    "'$P2SH_ADDRESS'": 3,
    "'$P2WSH_ADDRESS'": 2,
    "'$CHANGE_ADDRESS'": 18
  }
'''

Then I broadcast and mined this transaction.

Now I wish to create a spending transaction, that spends each of those inputs, utilizing

PSBT=$( bitcoin-cli -regtest -named createpsbt inputs=""'[
  {
    "txid": "tx1",
    "vout": 0
  },
  {
    "txid": "tx1",
    "vout": 1
  },
]''' outputs=""'[
  {
    "'$ADDRESS1'": 1
  },
  {
    "'$ADDRESS2'": 1
  },
  {
    "$CHANGE_ADDRESS": 4
  }
]''')

My important query:

  • how do I add enter info to this PSBT (i.e. redeemScript for inp:0 and witnessScript for inp:1)? What’s the trendy appropriate method to get a redeemScript and a witnessScript given output descriptors?

My second query:

  • say KEY1,KEY3 belong to wallet1, and KEY2,KEY4,KEY5 belong to wallet2. I wish to spend out:0 utilizing KEY1 and out:1 utilizing KEY4.
    I attempted to easily signal with each wallets: bitcoin-cli -regtest -rpcwallet=walletN walletprocesspsbt $PSBT however is it potential to pick the particular key (i.e. pockets on this case) between KEY1 and KEY2 to spend the sh(multi(1,KEY1,KEY2)) vout:0, these keys are from the completely different wallets? And is it even appropriate to make use of walletprocesspsbt on this case?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles