What's in a Bitcoin Cash transaction

1 141
Avatar for Read.Cash
5 years ago

Something we've always wanted to draw. How does a Bitcoin Cash transaction look like inside. Mostly useful for people going to develop and work on the protocol.

Bitcoin Cash Transaction inside

A note on lock_time :

0 - Not locked 
< 500000000 - Block number at which this transaction is unlocked 
>= 500000000 - UNIX timestamp at which this transaction is unlocked 

If all transaction inputs have final (0xffffffff) sequence numbers 
then lock_time is irrelevant.

What is a "varint" - a compact representation of a number:

>= 0 && <= 252	
1 byte: uint8_t

>= 253 && <= 0xffff	
3 bytes: 0xfd followed by the number as uint16_t

>= 0x10000 && <= 0xffffffff	
5 bytes: 0xfe followed by the number as uint32_t

>= 0x100000000 && <= 0xffffffffffffffff	
9 bytes: 0xff followed by the number as uint64_t

Transaction ID

Take sha256 of the bytes making a transaction twice and then reverse the byte order. Source.

More information:

4
$ 0.50
$ 0.25 from @Mr-Zwets
$ 0.10 from @sploit
$ 0.05 from @Telesfor
+ 2
Sponsors of Read.Cash
empty
empty
Avatar for Read.Cash
5 years ago

Comments

Really interesting!

$ 0.00
5 years ago