Hey everyone,
I’m reaching out because I’ve tried a bunch of things to fix my problem but haven’t had any luck. Hoping you guys can give me a hand.
So first off, here’s my setup:
Bitcoin Core version v24.0.1 (release build)
MacOS 14.0
Shell: zsh
My full Bitcoin node is running with txindex=1, and I’m using `./bitcoind`. All of this is happening through the `./bitcoin-cli` command.
I’ve picked a wallet and listed the unspent outputs. My goal is to combine multiple inputs into a single output.
I chose three transactions for testing and one address for change.
I tried to create my transaction from `rawtransaction`, but I’m thinking maybe I should go a different route. I also attempted `walletcreatefundedpsbt`, but I ran into an error saying 'Insufficient funds.'
So, I manually selected my UTXOs and built the raw transaction like this:
./bitcoin-cli -rpcwallet=MY_WALLET createrawtransaction "[{\"txid\":\"tx_id_1\",\"vout\": 0, \"scriptPubKey\":\"Script_1\"}, {\"txid\":\"tx_id_2\",\"vout\": 1, \"scriptPubKey\":\"Script_2\"}, {\"txid\":\"tx_id_3\",\"vout\": 1, \"scriptPubKey\":\"Script_3\"}]" "[{\"recipient\" : amt}]"
Then I went to sign it with `signrawtransactionwithwallet`, but got this error:
{
"txid": "tx_id_1",
"vout": 0,
"witness": [
],
"scriptSig": "",
"sequence": 4294967293,
"error": "Witness program was passed an empty witness"
}
This happens for all UTXOs.
I even tried signing each ScriptPubKey as a message with `signmessage` but I need the private key for that. When I attempt `dumpvkey`, I get an error saying 'Only legacy wallets are supported by this command.'
Just to note, my wallet is Taproot.
Using bitcoin-cli to handle witness for a valid transaction from rawtransaction
8 replies 496 views
Make sure UTXOs have spendable funds in it.
To get list of all available spendable UTXOs use 'listunspent' in the command console.
To create Raw transaction, Use 'createrawtransaction ' command and make sure scriptPubKey provided are correct for each UTXO.
To Sign Raw transaction, use 'signrawtransactionwithwallet'
After Signing, verify the signed transaction by 'decoderawtransaction' command.
Now Broadcast your transaction
To get your private key in bitcoin core, use 'dumpprivkey' followed by the respective address
Ok thanks for your answer but I well double checked and info are correct.
It's really during the 'signrawtransactionwithwallet' step where the problem cames out caused by Witness program was passed an empty witness.
But I don't find how to manage with witness. I followed your previous step to build my first transactioon and it was good. But for this one it doesn't work.
Are you certain that all of the inputs that you have specified belong to the wallet? You have the correct vout values? When you used listunspent, did it say that those utxos are spendable?
Can you also post the output of getwalletinfo?
> Are you certain that all of the inputs that you have specified belong to the wallet?
Yes it's in the output of ./bitcoin-cli -rpcwallet=MY_WALLET listunspent
> You have the correct vout values?
Yes the vout is the right one. And I think that I should have another error if the problem comes from vout.
> When you used listunspent, did it say that those utxos are spendable?
Yes each of them are spendable.
> Can you also post the output of getwalletinfo?
{
"walletname": "cor",
"walletversion": 169900,
"format": "sqlite",
"balance": 0.00071184,
"unconfirmed_balance": 0.00000000,
"immature_balance": 0.00000000,
"txcount": 44,
"keypoolsize": 1000,
"keypoolsize_hd_internal": 0,
"paytxfee": 0.00000000,
"private_keys_enabled": false,
"avoid_reuse": true,
"scanning": false,
"descriptors": true,
"external_signer": false
}
I don't know if it's important or new but each output looks like this :
{
"txid": "d13...",
"vout": 0,
"address": "bc1p...",
"label": "",
"scriptPubKey": "5120...",
"amount": 0.00010000,
"confirmations": 43033,
"spendable": true,
"solvable": true,
"desc": "descriptor",
"parent_descs": [
"another_descriptor"
],
"reused": false,
"safe": true
}
[moderator's note: consecutive posts merged]
How did you create this wallet? It does not have private keys enabled, so you will be unable to sign any transactions.
Aaaaah !
I created with ord command-line
Then you need to look at ord's documentation, and probably be using it to send as well. The private keys are not in Bitcoin Core so there's nothing that you can do with it directly to send.
Ok ! Yes totally you're right !
Thanks a lot for all your help !!!🙏🙏🙏
Related topics
- Using two different Bitcoin versions without messing up blockchain data 3
- bitcoin-qt sync issues and slow speeds 6
- Recovering a Bitcoin wallet and address 8
- Creating a list of non-zero wallets and their balances using Python 4
- Pending Transaction Issues 19
- Difference between witness and signscript explained 5