I’m on the lookout for the right solution 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 major query:
- how do I add enter data to this
PSBT
(i.e. redeemScript forinp:0
and witnessScript forinp:1
)? What’s the fashionable right solution to get a redeemScript and a witnessScript given output descriptors?
My second query:
- say
KEY1,KEY3
belong towallet1
, andKEY2,KEY4,KEY5
belong towallet2
. I wish to spendout:0
utilizingKEY1
andout:1
utilizingKEY4
.
I attempted to easily signal with each wallets:bitcoin-cli -regtest -rpcwallet=walletN walletprocesspsbt $PSBT
however is it potential to pick the precise key (i.e. pockets on this case) betweenKEY1
andKEY2
to spend thesh(multi(1,KEY1,KEY2)) vout:0
, these keys are from the completely different wallets? And is it even right to make use ofwalletprocesspsbt
on this case?