1

With regards to the monero Genesis TX breakdown. I'm still puzzled as to how they got the Decimal number (17592186044415) = (ffffffffffff03) in the genesis block.

Does one simply use a Hex to Decimal converter ? What conversion is used ? I thought it was a hexadecimal number but I don't get the correct one when converting ffffffffffff03.

user36303
  • 34,928
  • 2
  • 58
  • 123
W. Kadou
  • 125
  • 8

1 Answers1

2

The encoding of a varint is answered in this comment. It's not a straight hex string to decimal conversion.

From the specification:

Varints are a method of serializing integers using one or more bytes. Smaller numbers take a smaller number of bytes.

Each byte in a varint, except the last byte, has the most significant bit (msb) set – this indicates that there are further bytes to come. The lower 7 bits of each byte are used to store the two's complement representation of the number in groups of 7 bits, least significant group first.

Therefore, you first drop the MSB of each 8 bit group then reverse the order of the remaining 7 bit groups (because varints store numbers with the least significant group first).

So in the case of FFFFFFFFFFFF03:

FFFFFFFFFFFF03 = 11111111111111111111111111111111111111111111111100000011
converts to
0000011111111111111111111111111111111111111111111
which is
17592186044415
jtgrassie
  • 19,601
  • 4
  • 17
  • 54