RPosts: 8 · Reputation: 92
Hey everyone,
I’m having trouble signing a raw transaction and I keep getting hit with the message "Witness program was passed an empty witness," which is really throwing me off.
So here's what I've got: I’m using a P2WSH address to set up a 2-of-3 multisig. I create the raw transaction using an unspent UTXO, and that part works perfectly. Then I get this 0200 hex string for the raw transaction, and I try to sign it using one of the wallets in my multisig.
Here's my process:
- Grab an unspent UTXO
- Create the raw transaction
- Get the 0200 hex string
- Attempt to sign it with signrawtransactionwithwallet
The scriptPubKey I'm using is: 0020a194d46d50030743524e6ceaee1a93232fae9a434a5f0f4238514d18c62d2323 and the redeemScript is 5221028e7ddd8cbb55983fd50a13ff1fc57714e5c32e9852406ad701a13bd1fbedb1a52102be48ffd641af599c59158511cdd4c99e9cfa6a3ba221420da3ce7f507ed48e72103461f3cece9363b05f1a076c6c7f4e3580cb9d8c13684034a02c1fab6391b217853ae.
Looks good to me, but every time I try to run it, I get that empty witness error. I’m not sure what I’m missing here. The redeemScript and scriptPubKey seem fine, plus when I check using getaddressinfo on the multisig address, I’m getting the right "hex" response.
I could really use some help with this. I’ve been at it for about 6 hours and just can’t figure it out. It’s frustrating because signing the raw transaction on sites like Coinbin works without a hitch, so I’m guessing my Bitcoin node is a lot stricter about this stuff.
GrPosts: 1025 · Reputation: 2646
I've tried to reproduce it in v28.0 but I didn't come across any issue, it went smoothly with out without prevtxs.
The entire testing process (in RegTest):
AFAIK, that error usually occur when the transaction that you're signing is non-standard or uncommon. (can you share the unsigned raw transaction?)
Neither of those values will result with that error. If ever your scriptPubKey or WitnessScript are wrong, the error should be specific to those values.
Additionally, since you've used prevtxs and since it's SegWit, you're required to include the amount but that didn't caused the error.
RPosts: 8 · Reputation: 92
Yes, heres the unsigned raw transaction: 0200000001909b345aa6f80b94f51b97dbaa9f2d6a56a81646ee301b57f67ce78ed07b9e6200000 00000fdffffff02ee280000000000001600140919778cc3bfd64cb3718c09f9aa3c43ce0ae36c49 01000000000000160014f65df156aaeef3504189ee81f6f156eda4ad012400000000
i also tried specifying the "amount" => 0.000013 but the error persists, whats a way to fix this if the values are correct - do i need to specify something intentionally or ? I also read the issue is coming from it being non-standard/uncommon but i am a bit confused what that means or how to resolve this.
You did import the descriptors on both wallets - is that the way to resolve this ? I also tried importing the descriptors which threw me an error due to one wallet using private keys, importing it on the multisig wallet works just fine.
RPosts: 8 · Reputation: 92
Yes, once imported on the participant server wallet i could get rid of this issue - getting "Unable to sign input, invalid stack size (possibly missing key)" now but thats at least a way to work forward, i will research more on it now - thanks alot already!
Ok i think i understand, i have to import the descriptor to my wallet partipant and then sign it, thats why it cannot fill the witness probably.
GrPosts: 1025 · Reputation: 2646
That's how signrawtransactionwithwallet command does since it's a wallet RPC command, it'll use the private key(s) derived from the wallet's descriptors.
Otherwise, signrawtransactionwithkey should be used but the private key wif must be provided.
The error is self-explanatory.
The correct descriptor must be imported to the wallet to be able to sign that transaction.
Here's one reference: https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md
But please consider the suggestions in your other thread about using the "send" workflow instead of doing it manually (since you're using wallet commands anyways) .