Commonly you’d use walletcreatefundedpsbt
after which walletprocesspsbt
. However since you have solely obtained two cash in your pockets that you simply need to sweep you may merely use sendall
.
Let’s stroll by means of a copy of your state of affairs. I’ve created two regtest-WIF-encoded personal keys:
cRZ9wuYhwKYm82rXfSk9hhc9beJy6p7rV4y3aoAdzqFD6YAUVQcJ
(akin to029d759b09cec94b6f2bd322cedd5d136e7f24a4936998fe24da09827d8a12e9dd
)cVFkDn9fS1rwU1SR7geC3rgoGNXLpZXsnrCq2gutYVsGA2FoLpCD
(akin to03bd0d0b820dae844107803c9323fe73e81b9adf8abe329930ae9311dab6c3573e
)
I am creating a brand new pockets and importing a tr()
and wpkh()
descriptor.
$ bitcoin-cli -regtest createwallet repro_stackexchange
{
"identify": "repro_stackexchange",
"warning": ""
}
$ bitcoin-cli -regtest -rpcwallet=repro_stackexchange importdescriptors '[{"desc":"tr(cRZ9wuYhwKYm82rXfSk9hhc9beJy6p7rV4y3aoAdzqFD6YAUVQcJ)#uj39yr2v","timestamp":"now"},{"desc":"wpkh(cVFkDn9fS1rwU1SR7geC3rgoGNXLpZXsnrCq2gutYVsGA2FoLpCD)#nayxphlw","timestamp":"now"}]'
[
{
"success": true
},
{
"success": true
}
]
Now i am sending a coin to every descriptor:
$ bitcoin-cli -named -regtest -rpcwallet=important sendtoaddress handle=bcrt1ps66a3wss3l0ay0agnkd57cfu6qrw26z632e0kez0ppjzkyaq0vhskxlrvs quantity=0.00042 fee_rate=1
b2e975dee4ab0c68748e85fc847d7ef3fef44f53ee95e4765b1cc2b2c33939d2
$ bitcoin-cli -named -regtest -rpcwallet=important sendtoaddress handle=bcrt1q9vsfxgf4t3wmtj9429g539txyv4p2qnuak03sv quantity=0.00043 fee_rate=1
e34a3b8116f328d2b1529134dfcc795fbe27eae3991eeb017bc582879cb73b81
We are able to see that the copy pockets obtained the 2 cash:
$ bitcoin-cli -regtest -rpcwallet=repro_stackexchange listunspent 0
[
{
"txid": "e34a3b8116f328d2b1529134dfcc795fbe27eae3991eeb017bc582879cb73b81",
"vout": 0,
"address": "bcrt1q9vsfxgf4t3wmtj9429g539txyv4p2qnuak03sv",
"label": "",
"scriptPubKey": "00142b209321355c5db5c8b55151489566232a15027c",
"amount": 0.00043000,
"confirmations": 0,
"ancestorcount": 1,
"ancestorsize": 130,
"ancestorfees": 130,
"spendable": true,
"solvable": true,
"desc": "wpkh([2b209321]03bd0d0b820dae844107803c9323fe73e81b9adf8abe329930ae9311dab6c3573e)#k6qfdnw5",
"parent_descs": [
"wpkh(03bd0d0b820dae844107803c9323fe73e81b9adf8abe329930ae9311dab6c3573e)#45n94hja"
],
"protected": false
},
{
"txid": "b2e975dee4ab0c68748e85fc847d7ef3fef44f53ee95e4765b1cc2b2c33939d2",
"vout": 1,
"handle": "bcrt1ps66a3wss3l0ay0agnkd57cfu6qrw26z632e0kez0ppjzkyaq0vhskxlrvs",
"label": "",
"scriptPubKey": "512086b5d8ba108fdfd23fa89d9b4f613cd006e5685a8ab2fb644f08642b13a07b2f",
"quantity": 0.00042000,
"confirmations": 0,
"ancestorcount": 1,
"ancestorsize": 154,
"ancestorfees": 154,
"spendable": true,
"solvable": true,
"desc": "tr([caa3ae90]9d759b09cec94b6f2bd322cedd5d136e7f24a4936998fe24da09827d8a12e9dd)#e2lr407t",
"parent_descs": [
"tr(9d759b09cec94b6f2bd322cedd5d136e7f24a4936998fe24da09827d8a12e9dd)#u9ras3xm"
],
"protected": false
}
]
Now i am going to get the transactions confirmed and sweep the cash utilizing sendall
:
$ bitcoin-cli -regtest -rpcwallet=important generatetoaddress 1 $(bitcoin-cli -regtest -rpcwallet=important getnewaddress)
$ bitcoin-cli -named -regtest -rpcwallet=repro_stackexchange sendall recipients="["bcrt1qre2fezscuke8qaj9ham2klddj2rt7m4s78tvqq"]" fee_rate=1
{
"txid": "a39b70bf4636bb78053d10a3bc03eb6866e6777e84aeb274bb4002a543b7bb99",
"full": true
}
Let’s examine the transaction. It does certainly spend the 2 cash from the pockets (one Taproot and one native segwit v0 as you may see from the witness):
$ bitcoin-cli -regtest getrawtransaction a39b70bf4636bb78053d10a3bc03eb6866e6777e84aeb274bb4002a543b7bb99 1
{
"txid": "a39b70bf4636bb78053d10a3bc03eb6866e6777e84aeb274bb4002a543b7bb99",
"hash": "be1fcf89ec92649ee0780a8ea86ade1512a7fff6cfc8f75430b1115f1321b8f1",
"model": 2,
"dimension": 298,
"vsize": 167,
"weight": 667,
"locktime": 0,
"vin": [
{
"txid": "e34a3b8116f328d2b1529134dfcc795fbe27eae3991eeb017bc582879cb73b81",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"304402201e3ba83ca58a357e72d9df4d555f11a747e128ab2131868cb5620afc9b383d540220011c6fe77e37ed8ca83d50870fc5cc3995ecbd1cbd6305ede59bd4fd8aa05c2901",
"03bd0d0b820dae844107803c9323fe73e81b9adf8abe329930ae9311dab6c3573e"
],
"sequence": 4294967293
},
{
"txid": "b2e975dee4ab0c68748e85fc847d7ef3fef44f53ee95e4765b1cc2b2c33939d2",
"vout": 1,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"6cd85a806478d00f062e0bd7a43f46d7be082e4287819fcf07d3dda1d6a613a11e1197d15021f87aad16a697e326181d82156ff957fcb6593f5d030f33516471"
],
"sequence": 4294967293
}
],
"vout": [
{
"value": 0.00084833,
"n": 0,
"scriptPubKey": {
"asm": "0 1e549c8a18e5b2707645bf76ab7dad9286bf6eb0",
"desc": "addr(bcrt1qre2fezscuke8qaj9ham2klddj2rt7m4s78tvqq)#5gumgp89",
"hex": "00141e549c8a18e5b2707645bf76ab7dad9286bf6eb0",
"address": "bcrt1qre2fezscuke8qaj9ham2klddj2rt7m4s78tvqq",
"type": "witness_v0_keyhash"
}
}
],
"hex": "02000000000102813bb79c8782c57b01eb1e99e3ea27be5f79ccdf349152b1d228f316813b4ae30000000000fdffffffd23939c3b2c21c5b76e495ee534ff4fef37e7d84fc858e74680cabe4de75e9b20100000000fdffffff01614b0100000000001600141e549c8a18e5b2707645bf76ab7dad9286bf6eb00247304402201e3ba83ca58a357e72d9df4d555f11a747e128ab2131868cb5620afc9b383d540220011c6fe77e37ed8ca83d50870fc5cc3995ecbd1cbd6305ede59bd4fd8aa05c29012103bd0d0b820dae844107803c9323fe73e81b9adf8abe329930ae9311dab6c3573e01406cd85a806478d00f062e0bd7a43f46d7be082e4287819fcf07d3dda1d6a613a11e1197d15021f87aad16a697e326181d82156ff957fcb6593f5d030f3351647100000000"
}