Network messages¶
This section describes the structure of network messages in the Waves Enterprise blockchain platform.
Network message¶
All network messages, except Handshake, are based on the following structure:
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Payload |
Bytes |
N |
Magic Bytes are 0x12, 0x34, 0x56, 0x78. Payload checksum is first 4 bytes of_FastHash_of Payload bytes. FastHash is hash function Blake2b256(data).
Handshake message¶
Handshake message is intended for primary data exchange between two nodes. An authorized handshake contains the node owner’s blockchain address and signature. Unsigned handshakes are not accepted.
Authorized Handshake¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
HandshakeType |
byte |
1 |
2 |
Application name length (N) |
Byte |
1 |
3 |
Application name (UTF-8 encoded bytes) |
Bytes |
N |
4 |
Application version major |
Int |
4 |
5 |
Application version minor |
Int |
4 |
6 |
Application version patch |
Int |
4 |
7 |
Consensus name lenght (P) |
Byte |
1 |
8 |
Consensus name lenght (UTF-8 encoded bytes) |
Bytes |
P |
9 |
Node name length (M) |
Byte |
1 |
10 |
Node name (UTF-8 encoded bytes) |
Bytes |
M |
12 |
Node nonce |
Long |
8 |
13 |
Declared address length (K) or 0 if no declared address was set |
Int |
4 |
14 |
Declared address bytes (if length is not 0) |
Bytes |
K |
15 |
Peer port |
Int |
4 |
16 |
Node owner address |
Bytes |
26 |
17 |
Signature |
Bytes |
64 |
GetPeers message¶
GetPeers message is sent to request network addresses of network participants.
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x01) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
Peers message¶
Peers message is a response to a GetPeers request.
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x02) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Peers count (N) |
Int |
4 |
7 |
Peer #1 IP address |
Bytes |
4 |
8 |
Peer #1 port |
Int |
4 |
… |
… |
… |
… |
6 + 2 * N - 1 |
Peer #N IP address |
Bytes |
4 |
6 + 2 * N |
Peer #N port |
Int |
4 |
GetSignatures message¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x14) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Block IDs count (N) |
Int |
4 |
7 |
Block #1 ID |
Bytes |
64 |
… |
… |
… |
… |
6 + N |
Block #N ID |
Bytes |
64 |
Signatures message¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x15) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Block signatures count (N) |
Int |
4 |
7 |
Block #1 signature |
Bytes |
64 |
… |
… |
… |
… |
6 + N |
Block #N signature |
Bytes |
64 |
GetBlock message¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x16) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Block ID |
Bytes |
64 |
Block message¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x17) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Block bytes (N) |
Bytes |
N |
Score message¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x18) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Score (N bytes) |
BigInt |
N |
Transaction message¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x19) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Transaction (N bytes) |
Bytes |
N |
Checkpoint message¶
Field order number |
Field |
Type |
Field size in bytes |
---|---|---|---|
1 |
Packet length (BigEndian) |
Int |
4 |
2 |
Magic Bytes |
Bytes |
4 |
3 |
Content ID (0x64) |
Byte |
1 |
4 |
Payload length |
Int |
4 |
5 |
Payload checksum |
Bytes |
4 |
6 |
Checkpoint items count (N) |
Int |
4 |
7 |
Checkpoint #1 height |
Long |
8 |
8 |
Checkpoint #1 signature |
Bytes |
64 |
… |
… |
… |
… |
6 + 2 * N - 1 |
Checkpoint #N height |
Long |
8 |
6 + 2 * N |
Checkpoint #N signature |
Bytes |
64 |