-1

I am currently learning about bitcoin, and I came up to this: https://medium.datadriveninvestor.com/bitcoin-raw-transaction-breakdown-c0a5a3aa8688 to know more about raw tx.

What I cannot understand is that, he is sending bitcoin 0.00156636 BTC = 156636 Sat, then why in raw tx the value is like: 60e3160000000000

And are those zeros at end always written?

How miner fee is written?

Link to blockchain.com regarding transaction detail: https://www.blockchain.com/btc/tx/2621c2609d114f652dadf6fd95820c021da1cf2d0ac15e0361fd5d136e30a3c4

0

2 Answers 2

2

I already answered this for you here

The amount should be encoded as 8 bytes, in little-endian format. If you want to send 1 million satoshis, this would be 0x40420F0000000000.

The zeroes are always written because the value must be 8 bytes long, least significant byte first. Note that this is in hexadecimal not decimal.

The miner fee is not written in the transaction. It is calculated by subtracting the total value of the outputs from the total value of the inputs. The difference is the fee.

1

Actually, the value of this transaction (2621c2609d114f652dadf6fd95820c021da1cf2d0ac15e0361fd5d136e30a3c4) is 255d020000000000, with is an 8-byte little-endian version of 0.00154917 BTC. For interpreting it, you reverse all bytes. Ignoring all redundant zeroes, you get 0x025d25 with is the hex value for 154917 sats or 0.00154917 BTC.

This transaction, once parsed, looks like this:
01000000: Version. Little-endian representation of 1
0x01: Input count, one in this case
72f5d096ce8d2055d46db83cd969265f99146f09c30fd9c7b4e77e46830b6e7e00000000: Previous output, the first 64 digits are txid and the remaining 8, the index of a UTXO being spent.
0x6a: Size of the scriptSig, 106 in this case
473044022033bff843a014d1958eeb6f6dda47879a6cdab139cb85a818905c8e4f034c4bed022028361e8e3f43df257f31cd6c502b155facf70256d230e5cd059a8b83ef864f360121027580575d62d199ea4560451402b035eeb9786972d2c1a2c17b6e798d97265dda: A relly big scriptSig
0xffffffff: nSequence
01: Output count, just one
255d020000000000: Value in sats and little-endian
0x19: Size of the scriptPubkey
76a9145030f21fe34949ccacdd9505c50f223c5685f70588ac: Spk
00000000: nLockTime

Source: bitcoinWiki

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.