Author

Topic: Broadcast a raw transaction to the network - error (Read 175 times)

hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
Thanks for the explanation. I now understand what indexing means in this context. I, indeed, misunderstood you mostly because I didn't know about these small details you just explained. Thank you, @ranochigo!
legendary
Activity: 2954
Merit: 4158
Ok, this is new to me. So what the hell is inside 400Gb of data that IBD gets into your storage? If it's not all the transactions, blocks and all sort of data that is stored in a blockchain, what data is using so much space in our storages?
It is mostly the blocks. Other than that, the chainstate takes a smaller amount and it contains all the UTXOs. What I meant was, transactions are not indexed. This means that you cannot just ask Bitcoin Core what's the raw transaction or the information of TXID X because it won't know where to look for it. That's where txindex comes in to properly index each transaction and gives Bitcoin Core a pointer to know where to look for that specific transaction.

And the reason I thought Bitcoin core need to rescan the blockchain when a new address is imported was to be able to retrieve only information about that address. And when I say "rescan the blockchain", I am actually thinking about the 400Gb of data I have in my storage. So, if Bitcoin core doesn't store all the transactions in this database, where is Bitcoin Core going to rescan? In other connected peers around the network?
Yes. Bitcoin Core does store the blocks and their transactions, I think you misunderstood what I was saying. The reason why you have to rescan is because Bitcoin Core doesn't maintain an address index.
I'm not sure I understood your statement here. What you mean by parsing the blockchain into the address format?
Bitcoin Core does not organize all of the transactions by their addresses. If a user were to try to get information about an address, like importing a watch-only address, Bitcoin Core will rescan through the whole blockchain to find transactions that is related to that address. Addresses don't exist at a protocol level in the first place.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
Bitcoin Core does not index all of the transactions by default.

Ok, this is new to me. So what the hell is inside 400Gb of data that IBD gets into your storage? If it's not all the transactions, blocks and all sort of data that is stored in a blockchain, what data is using so much space in our storages?

That is why Bitcoin Core needs to rescan the entire blockchain every time you import an address and also why you can't import used addresses without having to reindex pruned nodes.

I'm not running a pruned node.
And the reason I thought Bitcoin core need to rescan the blockchain when a new address is imported was to be able to retrieve only information about that address. And when I say "rescan the blockchain", I am actually thinking about the 400Gb of data I have in my storage. So, if Bitcoin core doesn't store all the transactions in this database, where is Bitcoin Core going to rescan? In other connected peers around the network?

Bitcoin Core also does not parse the blockchain into the addresses format which is why you can't search up addresses to find the TXes related to them.

I'm not sure I understood your statement here. What you mean by parsing the blockchain into the address format?
legendary
Activity: 2954
Merit: 4158
Indeed, but what I don't understand is if I have the entire blockchain available for my node to search, and if the txid is inside some block, why can't the node find it by the txid even if the addresses are not imported into the node? Like, isn't it supposed that all the historical info is store in the blockchain? So why a node needs the address to be able to find txids?
Bitcoin Core does not index all of the transactions by default. That is why Bitcoin Core needs to rescan the entire blockchain every time you import an address and also why you can't import used addresses without having to reindex pruned nodes. Bitcoin Core also does not parse the blockchain into the addresses format which is why you can't search up addresses to find the TXes related to them.

Importing an address forces Bitcoin Core to use some computing power to scan the blockchain for transactions related to your address.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
-snip-
Code:
bitcoin-cli gettransaction TXID true
The true at the end did nothing different, but to be honest, I'm ok with it because I already have the funds where they were supposed to be! So, I'm not sure why it's like that, but in web browsers, all seems to match.
So it seems like your online Bitcoin Core doesn't have the watch-only addresses of neither the input(s) nor output(s) of that transaction.
because the flag adds the wallet's watch-only balance in the calculation.

Indeed, but what I don't understand is if I have the entire blockchain available for my node to search, and if the txid is inside some block, why can't the node find it by the txid even if the addresses are not imported into the node? Like, isn't it supposed that all the historical info is store in the blockchain? So why a node needs the address to be able to find txids?
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
-snip-
Code:
bitcoin-cli gettransaction TXID true
The true at the end did nothing different, but to be honest, I'm ok with it because I already have the funds where they were supposed to be! So, I'm not sure why it's like that, but in web browsers, all seems to match.
So it seems like your online Bitcoin Core doesn't have the watch-only addresses of neither the input(s) nor output(s) of that transaction.
because the flag adds the wallet's watch-only balance in the calculation.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
However I still have a small doubt because my bitcoin-cli gettransaction my_transactionID output says "amount": 0.00000000 but if I paste the txID in any web blockchain explorer, values seems to match.
Was it done in the online wallet with watch-only addresses? If so, add "true" at the end of the command and the real value should be displayed.
Eg.:
Code:
bitcoin-cli gettransaction TXID true

The true at the end did nothing different, but to be honest, I'm ok with it because I already have the funds where they were supposed to be! So, I'm not sure why it's like that, but in web browsers, all seems to match.
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
However I still have a small doubt because my bitcoin-cli gettransaction my_transactionID output says "amount": 0.00000000 but if I paste the txID in any web blockchain explorer, values seems to match.
Was it done in the online wallet with watch-only addresses? If so, add "true" at the end of the command and the real value should be displayed.
Eg.:
Code:
bitcoin-cli gettransaction TXID true
legendary
Activity: 3430
Merit: 10505
There was something wrong with your scripts, it is not possible to say for sure but usually this error is seen when there are items left on the stack when they shouldn't like when you provide 3 signatures for a 2of3 multi-sig. It can happen for other reasons too.

The interpreter returns it here and here
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
I finally made it and the worst of all is that I can't even say what was wrong.
In the meantime I could fix that error and then I got another one, but eventually I made it (or at least I think I did).
However I still have a small doubt because my bitcoin-cli gettransaction my_transactionID output says "amount": 0.00000000 but if I paste the txID in any web blockchain explorer, values seems to match.
legendary
Activity: 3234
Merit: 2943
Block halving is coming.
Can you try this below when signing it on an offline node instead of using "signrawtransactionwithwallet" replace them with "signrawtransactionwithkey"

Sample command:
Code:
signrawtransactionwithkey "myhex" "[\"key1\",\"key2\"]"

Code:
signrawtransactionwithkey '0200000001ffab477941a9eba13b89bd815947a4c1daccc3a42dfb090c1006479eee1fe78e0000000000ffffffff0180841e000000000017a914d0c3f50336b5f109207d722c692191ff86263e968700000000' '[" $privKey "]' '[{"txid":"8ee71fee9e4706100c09fb2da4c3ccdac1a4475981bd893ba1eba9417947abff","vout":0,"scriptPubKey":"a91429c3d920cd18e34db9035c4322474aae4465792187","redeemScript":"00143b88811e01b3efaa0bcd9da16ef85ef3a1583349","amount":0.02641617}]'
Souce: https://bitcoin.stackexchange.com/questions/93987/cant-send-raw-transaction-bitcoin-core-0-19-1-non-mandatory-script-verify-fla

Never tested this yet but someone shares it from the source above related to the error you get.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
Hello.

I run a bitcoin node for a while now and I am trying to create a raw, transaction, sign it with an offline node I have, and then, broadcast it to the network with the online node.

So, everything seems to be fine with the createrawtransaction command and also with the signrawtransactionwithwallet in my offline node, but when I try to broadcast the he string to the network, I get the following error:

Code:
non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)

Same error happens if I use signrawtransactionwithkey.

The origin address and the change address are the same and were created in my offline node, so the PK resides there. The destiny address is one other address that I just created out of my 2 nodes (online and offline).

What am I missing? I can provide the addresses, txids, hex strings etc, if needed but I would rather keep them private.
Jump to: