< sipa>
sdaftuar_: also added a mention of BIP339 in the release notes
< luke-jr>
bips.md?
< luke-jr>
oh already there too ☺
< HelloShitty>
Hello
< HelloShitty>
I was suggested to come here to ask for help with an error I am getting while trying to broadcast a raw transaction to the network
< HelloShitty>
I have 2 nodes. One is online and the other one is offline (only to create addresses and sign transactions)
< sipa>
HelloShitty: ok
< sipa>
so far so good
< HelloShitty>
So, I create a raw transaction in my online node
< HelloShitty>
copy the hex string to the offline node
< HelloShitty>
Then sign it with 'signrawtransactionwithkey'
< HelloShitty>
copy back the transaction hex to the online node
< HelloShitty>
and I try to broacast it to the network, but I get this error:
< HelloShitty>
non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)
< sipa>
this means your signature is invalid, most likely
< sipa>
is it a segwit transaction? (spending segwit outputs)?
< HelloShitty>
ok, and how can the signature fail?
< HelloShitty>
yes, all bc1 addresses
< sipa>
is it possible you didn't tell signrawtransactionwithkey what the input amounts were?
< sipa>
that goes into the signature, so if it doesn't have that information, the signature will likely be invalid
< sipa>
i suggest you use the PSBT RPCs instead; they pass all that information along
< HelloShitty>
hum
< HelloShitty>
Let me check
< sipa>
see doc/psbt.md for more information
< HelloShitty>
The amount in the 3rd argument needs to be the input amount?
< HelloShitty>
I guess I might have failed there
< HelloShitty>
I think I used the amount I wanted to send to the destination address
< sipa>
it's an array of the UTXOs being spent
< sipa>
the amounts are the amounts of those UTXOs
< HelloShitty>
So, if I have 2 outputs, destiniy address and change address, I have to give those two outputs to the signrawtransactionwithkey command?
< sipa>
no
< sipa>
you have to provide information about the outputs being *spent*
< sipa>
not the ones being created; those are already in the raw transaction
< sipa>
really, use the PSBT commands
< HelloShitty>
meaning that it's actually the utxo from the origin address
< sipa>
they do all of this automatically
< sipa>
raw transactions are a pain
< HelloShitty>
I like to try to do them because they "force" us to know a bit better how things go under the hood
< HelloShitty>
I'll try once more, if I fail again, I'll try what you suggested
< sipa>
well, for PSBT there is a decodepsbt command that'll tell you exactly what's being passed around
< sipa>
but that's a fair point
< sipa>
the 3rd argument to signrawtransactionwithkey is ~the output from listunspent on the online machine
< sipa>
for the UTXOs being spent
< HelloShitty>
yes
< HelloShitty>
The sendrawtransaction in now complaining from another thing
< HelloShitty>
so the signature is now correct, apparently
< sipa>
what error do you get now?
< HelloShitty>
min relay fee not met, 0 < 141
< HelloShitty>
I set a fee of 28 sats per byte
< HelloShitty>
the transaction is 141 bytes
< HelloShitty>
vBytes I should say
< sipa>
seems you didn't
< HelloShitty>
that would be 3948 sats
< HelloShitty>
but I used 4000
< HelloShitty>
I can show you the decoded transaction
< HelloShitty>
woul you take a look at it?
< sipa>
maybe the transaction was 141 before you signed it, but now it's larger?
< phantomcircuit>
0 < 141 implies that the fee is actually 0
< HelloShitty>
ok, so let me try to clear this once more
< HelloShitty>
about the sign command
< HelloShitty>
I have this address with lets say 0.05 BTC. I want to send to a new address 0.01 and the change back to the same original address
< HelloShitty>
the value I must use in "amount" field of signrawtransactionwithkey is 0.05?
< sipa>
addresses are irrelevant
< sipa>
what matters is the value of the UTXOs you're spending
< sipa>
use PSBT :)
< HelloShitty>
ok, but in my case, the original address has only 1 utxo
< HelloShitty>
this utxo has 0.05 BTC
< sipa>
ok, yes
< HelloShitty>
So, this is the value (0.05) I must use in that "amount" field, right?
< sipa>
this is getting a bit too long for this channel; i suggest posting on bitcoin.stackexchange.com for help if it still doesn't work
< sipa>
yes
< HelloShitty>
ok, thank you and I'm sorry
< HelloShitty>
sipa:
< HelloShitty>
I'm happy, I made it (not with psbt though)
< HelloShitty>
but can't tell you what was wrong because I can't tell it myself
< aj>
oh yay, `--enable-suppress-external-warnings` stops clang complaining about qt headers leacking override so i can drop my "stoopid qt" patch. would it make sense to have that on by default with `--enable-werror`?