Internal data structures of blockchain objects and network messages.
Blockchain Objects
Signed transaction
Version 1 and 2
Field Name
Type
Length
Transaction type
Byte (constant, value=4)
1
Version
Byte (constant, value=2)
1
Transaction specific bytes
​
​
Proofs version
Byte (constant, value=1)
1
Proof size (N)
Short
2
Proof
Array[Byte]
N
​
​
​
Version 3
Field Name
Type
Length
Transaction type
Byte (constant, value=4)
1
Version
Byte (constant, value=2)
1
Timestamp
Long
8
Sender's key type
KeyType (Byte)
1
Sender's public key
PublicKey (Array[Byte])
32 | 33
Fee
Long
8
Transaction specific bytes
​
​
Sponsor's key type
KeyType (Byte)
1
Sponsor's public key
PublicKey (Array[Byte])
0 | 32 | 33
Proofs version
Byte (constant, value=1)
1
Proof size (N)
Short
2
Proof
Array[Byte]
N
​
​
​
Block
Field Name
Type
Length
Version (0x02 for Genesis block, 0x03 for common block)
Byte
0
Timestamp
Long
1
Parent block signature
Bytes
64
Consensus block length (always 40 bytes)
Int
4
Base target
Long
8
Generation signature*
Bytes
32
Transactions block length (N)
Int
8
Transaction #1 bytes
Bytes
M1
...
...
...
Transaction #K bytes
Bytes
MK
Generator's public key
Bytes
32
Block's signature
Bytes
64
Generation signature is calculated as blake2b256 hash of the following bytes:
Field Name
Type
Length
Previous block's generation signature
Bytes
32
Generator's public key
Bytes
32
Block's signature is calculated from the following bytes:
Field Name
Type
Length
Version (0x02 for Genesis block, 0x03 for common block)
Byte
0
Timestamp
Long
1
Parent block signature
Bytes
64
Consensus block length (always 40 bytes)
Int
4
Base target
Long
8
Generation signature*
Bytes
32
Transactions block length (N)
Int
8
Transaction #1 bytes
Bytes
M1
...
...
...
Transaction #K bytes
Bytes
MK
Generator's public key
Bytes
32
Network messages
Network message structure
All network messages share the same structure, except the Handshake.
Field name
Type
Length
Packet length (BigEndian)
Int
4
Magic Bytes
Bytes
4
Content ID
Byte
1
Payload length
Int
4
Payload checksum
Bytes
4
Payload
Bytes
N
Magic Bytes are 0x12 0x34 0x56 0x78. Payload checksum is the first 4 bytes of FastHash of Payload bytes. FastHash is the hash function Blake2b256(data).
Handshake message
Handshake is used to start communication between two nodes.
Field name
Type
Length
Application name length (N)
Byte
1
Application name (UTF-8 encoded bytes)
Bytes
N
Application version major
Int
4
Application version minor
Int
4
Application version patch
Int
4
Node name length (M)
Byte
1
Node name (UTF-8 encoded bytes)
Bytes
M
Node nonce
Long
8
Declared address length (K) or 0 if no declared address was set
Int
4
Declared address bytes (if length is not 0)
Bytes
K
Timestamp
Long
8
GetPeers message
GetPeers message is sent when sending node wants to know of other nodes on network.