Bitcoin Forum
May 10, 2024, 09:33:35 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: compare and relate raw transaction info with block explorer's info  (Read 196 times)
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


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


View Profile
February 02, 2020, 11:30:46 AM
Merited by LoyceV (4), Quickseller (1), ABCbits (1), Heisenberg_Hunter (1)
 #1

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 <hash string>

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

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
1715376815
Hero Member
*
Offline Offline

Posts: 1715376815

View Profile Personal Message (Offline)

Ignore
1715376815
Reply with quote  #2

1715376815
Report to moderator
1715376815
Hero Member
*
Offline Offline

Posts: 1715376815

View Profile Personal Message (Offline)

Ignore
1715376815
Reply with quote  #2

1715376815
Report to moderator
1715376815
Hero Member
*
Offline Offline

Posts: 1715376815

View Profile Personal Message (Offline)

Ignore
1715376815
Reply with quote  #2

1715376815
Report to moderator
"There should not be any signed int. If you've found a signed int somewhere, please tell me (within the next 25 years please) and I'll change it to unsigned int." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715376815
Hero Member
*
Offline Offline

Posts: 1715376815

View Profile Personal Message (Offline)

Ignore
1715376815
Reply with quote  #2

1715376815
Report to moderator
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4177



View Profile
February 02, 2020, 11:36:45 AM
 #2

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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5594


Self-proclaimed Genius


View Profile
February 02, 2020, 12:15:07 PM
 #3

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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


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


View Profile
February 02, 2020, 03:21:58 PM
 #4

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

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


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


View Profile
February 02, 2020, 03:22:56 PM
 #5

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

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


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


View Profile
February 02, 2020, 03:39:43 PM
 #6

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:

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

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
February 02, 2020, 04:18:04 PM
Merited by ABCbits (3), nc50lc (2), Heisenberg_Hunter (2)
 #7

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.

darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


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


View Profile
February 02, 2020, 06:24:58 PM
 #8

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?

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

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
February 02, 2020, 07:48:01 PM
Merited by ABCbits (1), darkv0rt3x (1)
 #9

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.

darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


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


View Profile
February 02, 2020, 08:33:23 PM
 #10

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

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

Activity: 3444
Merit: 10558



View Profile
February 03, 2020, 03:36:28 AM
 #11

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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5594


Self-proclaimed Genius


View Profile
February 03, 2020, 04:02:58 AM
 #12

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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


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


View Profile
February 03, 2020, 11:37:28 PM
 #13

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.

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!