Bitcoin Forum
December 14, 2024, 09:36:00 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Broadcast a raw transaction to the network - error  (Read 191 times)
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
January 10, 2021, 01:02:00 AM
Merited by ABCbits (1)
 #1

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.

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
BitMaxz
Legendary
*
Offline Offline

Activity: 3472
Merit: 3204


Playbet.io - Crypto Casino and Sportsbook


View Profile WWW
January 10, 2021, 02:31:13 AM
 #2

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.

███████████████
█████████████████████
██████▄▄███████████████
██████▐████▄▄████████████
██████▐██▀▀▀██▄▄█████████
████████▌█████▀██▄▄██████
██████████████████▌█████
█████████████▀▄██▀▀██████
██████▐██▄▄█▌███████████
██████▐████▀█████████████
██████▀▀███████████████
█████████████████████
███████████████

.... ..Playbet.io..Casino & Sportsbook.....Grab up to  BTC + 800 Free Spins........
████████████████████████████████████████
██████████████████████████████████████████████
██████▄▄████████████████████████████████████████
██████▐████▄▄█████████████████████████████████████
██████▐██▀▀▀██▄▄██████████████████████████████████
████████▌█████▀██▄▄█████▄███▄███▄███▄█████████████
██████████████████▌████▀░░██▌██▄▄▄██████████████
█████████████▀▄██▀▀█████▄░░██▌██▄░░▄▄████▄███████
██████▐██▄▄█▌██████████▀███▀███▀███▀███▀█████████
██████▐████▀██████████████████████████████████████
██████▀▀████████████████████████████████████████
██████████████████████████████████████████████
████████████████████████████████████████
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
January 10, 2021, 03:00:22 AM
 #3

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.

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
pooya87
Legendary
*
Offline Offline

Activity: 3668
Merit: 11107


Crypto Swap Exchange


View Profile
January 10, 2021, 05:22:02 AM
 #4

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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
nc50lc
Legendary
*
Offline Offline

Activity: 2632
Merit: 6512


Self-proclaimed Genius


View Profile
January 10, 2021, 07:11:23 AM
 #5

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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
January 10, 2021, 03:04:17 PM
 #6

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.

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
nc50lc
Legendary
*
Offline Offline

Activity: 2632
Merit: 6512


Self-proclaimed Genius


View Profile
January 11, 2021, 02:30:40 AM
Last edit: January 11, 2021, 03:30:57 AM by nc50lc
 #7

-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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
January 11, 2021, 08:59:58 PM
 #8

-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?

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
ranochigo
Legendary
*
Offline Offline

Activity: 3052
Merit: 4443


Crypto Swap Exchange


View Profile
January 12, 2021, 01:11:48 AM
Merited by ABCbits (1), nc50lc (1)
 #9

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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
January 14, 2021, 06:46:40 PM
 #10

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?

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
ranochigo
Legendary
*
Offline Offline

Activity: 3052
Merit: 4443


Crypto Swap Exchange


View Profile
January 14, 2021, 07:03:24 PM
Merited by OgNasty (1), darkv0rt3x (1)
 #11

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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
January 15, 2021, 11:59:43 PM
 #12

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!

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!