Author

Topic: compare and relate raw transaction info with block explorer's info (Read 196 times)

hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
I've used testnet in the past while I was building a small bash script. But I never issued any raw transaction until this weekend. Now I have already made 2! heheh.
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
As far as I know, it will fail to decode the RAW transaction if it isn't signed.
That is not true. decoderawtransaction will decode unsigned transactions. This is intentional. Users need to be able to decode and understand their transaction before it is signed
Thanks, I'll look in to that.
There must be something wrong with the (quicker) tool that I'm using on creating Raw transactions, core can't decode it unless it's signed.
I haven't used "createrawtransaction" for my test.
legendary
Activity: 3430
Merit: 10505
I didn't mean to cancel a broadcast transaction. I meant to undo the 1st 2 steps. createrawtransaction and signrawtransactionwithkey. After I issue these 2 commands, do I need to issue any command to undo those 2 or just redo them with the correct/updated parameters (in case I enter some wrong parameter by mistake)...

these commands don't store anything or make any changes to be undone later, they simply return a result which you can discard if you don't want. for example after signrawtransactionwithkey you can discard the result and recall it with another value again.

FWIW you can also use all of this in testnet so that you don't have to worry about messing things up and losing money and also not worry about sharing any sensitive information either for your privacy or security. run bitcoin core with -testnet command to do it. keep in mind that it is a separate network so you'll need to download testnet blockchain and testnet coins have no value.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
I didn't mean to cancel a broadcast transaction. I meant to undo the 1st 2 steps. createrawtransaction and signrawtransactionwithkey. After I issue these 2 commands, do I need to issue any command to undo those 2 or just redo them with the correct/updated parameters (in case I enter some wrong parameter by mistake)...
staff
Activity: 3374
Merit: 6530
Just writing some code
Ok, so that means that if I decode the transaction after signed, I'll get the same values as the block explorers will tell me after I broadcast it?
Yes.

Another question I have is that after I sign a transaction and I want to cancel it, do I need to undo any action or I just ignore it and issue the createrawtransaction and signrawtransactionwithkey commands again and broadcast the last one?
Transactions cannot be canceled. There is no undo nor can you force any nodes on the network to forget about your transaction.

You can try to replace a transaction with another if you have it set to signal BIP125 RBF. In your original transaction, you need to set the replaceable argument of createrawtransaction to true. So you would do something like
Code:
createrawtransaction '[....]' '[.....]' 0 true
That 0 is needed for the locktime. Setting it to 0 just means no locktime.

When you send your replacement transaction, you need to use the same inputs but also pay a higher fee. Note that replacing a transaction is not guaranteed to work. Not all nodes support RBF, and various network issues may cause your original transaction to still be mined. Furthermore, you can only replace transactions that have not yet been included in a block.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
Ok, so that means that if I decode the transaction after signed, I'll get the same values as the block explorers will tell me after I broadcast it?

Another question I have is that after I sign a transaction and I want to cancel it, do I need to undo any action or I just ignore it and issue the createrawtransaction and signrawtransactionwithkey commands again and broadcast the last one?
staff
Activity: 3374
Merit: 6530
Just writing some code
As far as I know, it will fail to decode the RAW transaction if it isn't signed.
That is not true. decoderawtransaction will decode unsigned transactions. This is intentional. Users need to be able to decode and understand their transaction before it is signed

Ok, I could use the decoderawtransactio before and after signing the transaction. But the extra parameter True in decoderawtransaction is not accepted, unless I used it wrong. I just added the word True at the end of the command. I'm not sure it needs any JSON special chars to be accepted.
Use a lowercase t. so it's true not True.

Anyway, I hope I don't run into trouble (risk) of disclosing any private info by sharing these 2 images. I hope that no one is going to take the pictures, process them and be able to undo the white lines I draw to hide possible sensitive private information present in the decoded transaction details.
There is no private information contained in a transaction that can cause Bitcoin loss. Transactions are completely public information, so anyone can go look up your transaction in a node anyways and learn all of the details that you have tried to hide. The only "private" information are txids which may allow others to link this transaction to your identity which reduces your privacy.



The difference in size is because you are comparing your unsigned transaction to the signed one. createrawtransaction creates an unsigned transaction signrawtransactionwithkey will modify the transaction and add signatures to it.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
Ok, I could use the decoderawtransactio before and after signing the transaction. But the extra parameter True in decoderawtransaction is not accepted, unless I used it wrong. I just added the word True at the end of the command. I'm not sure it needs any JSON special chars to be accepted.

Anyway, I hope I don't run into trouble (risk) of disclosing any private info by sharing these 2 images. I hope that no one is going to take the pictures, process them and be able to undo the white lines I draw to hide possible sensitive private information present in the decoded transaction details.


This is the decoderawtransaction with the hash string returned by the createrawtransaction command:


This is the decoderawtransaction with the hash string returned by the signrawtransactionwithkey command:
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
As far as I know, it will fail to decode the RAW transaction if it isn't signed.

@darkv0rt3x Your transaction has witness data, try to add "true" to the end of decoderawtransaction.
eg. decoderawtransaction "RAW_TX" true

Note: I have failed to reproduce your issue, mine always shows the correct sizes for either native or nested SegWit.
Unsigned transactions returns the error: TX decode failed.
I'm using Bitcoin Core version v0.19.0.1 (release build) Windows.

I don't want to go against what you say, but I'm almost sure I could use the decoderawtransaction before I signed it. But I think I still can try it again.
Gimme a couple of minutes...
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
When you use the decoderawtransaction command, was your raw transaction signed? Signed raw transaction has a higher size than the unsigned ones due to the inclusion of the signature.

When we issue the createrawtransaction command, we get an hash string. I supposed this is the hash string you say as being the "not signed".
Then I sign the transaction and I get another hash string. This is the signed transaction, obviously.

I can't remember now, but I think I tried both hash strings and those 4 fields were exactly the same. But with the first hash string, there was less information with the decoderawtransaction than there was with the 2nd hash string (signed).

The weird thing is that after the broadcast, I get the same values compared to the ones I get from blockchain explorers.

Thanks
Dark
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
As far as I know, it will fail to decode the RAW transaction if it isn't signed.

@darkv0rt3x Your transaction has witness data, try to add "true" to the end of decoderawtransaction.
eg. decoderawtransaction "RAW_TX" true

Note: I have failed to reproduce your issue, mine always shows the correct sizes for either native or nested SegWit.
Unsigned transactions returns the error: TX decode failed.
I'm using Bitcoin Core version v0.19.0.1 (release build) Windows.
legendary
Activity: 2954
Merit: 4158
When you use the decoderawtransaction command, was your raw transaction signed? Signed raw transaction has a higher size than the unsigned ones due to the inclusion of the signature.
hero member
Activity: 1176
Merit: 647
I rather die on my feet than to live on my knees
Hello.

I did my first raw transaction yesterday, however I would like to try to understand some of the details showed when I issued the command:
Code:
bitcoin-cli decoderawtransaction 

I'm using Debian Buster and Bitcoin Core RPC client version v0.18.1 (Debian repository version).

When I decoded the transaction to try to see the size per byte so that I could find a good fee value for my transaction according to the time I would be willing to wait for it, I find values that I cannot relate and/or compare to the values I got after the transaction was broadcast.

So I wanted to try to understand this.

The values I got for the dedocerawtransaction comman, were, before the transaction:

Code:
"version": 2,
"size": 82,
"vsize": 82,
"weight": 328,
"locktime": 0,

However, when I issued the command sendrawtransaction and checkif it's txID in Blockchair, I got this:



And now, after the transaction has been proccessed (confirmed) by the blockchain, if I run the decoderawtransaction command again, I get different values:

Code:
"version": 2,
"size": 214,
"vsize": 133,
"weight": 529,
"locktime": 0,

which already matches some of the values of the Blockchair explorer values.

So, what can be said about the values returned by the decoderawtransaction before it has been confirmed by the blockchain? How can I find the real size of the transaction, so that I can choose a reasonable fee amount?

Thanks
Dark
Jump to: