P2P message format

Block header (shell)

Name Size Contents
level 4 bytes signed 32-bit integer
proto 1 byte unsigned 8-bit integer
predecessor 32 bytes bytes
timestamp 8 bytes signed 64-bit integer
validation_pass 1 byte unsigned 8-bit integer
operations_hash 32 bytes bytes
# bytes in field “fitness” 4 bytes unsigned 30-bit integer
fitness Variable sequence of $fitness.elem
context 32 bytes bytes
protocol_data Variable bytes

fitness.elem

Name Size Contents
# bytes in next field 4 bytes unsigned 30-bit integer
Unnamed field 0 Variable bytes

Operation (shell)

Name Size Contents
branch 32 bytes bytes
data Variable bytes

Block_header (alpha-specific)

Name Size Contents
priority 2 bytes unsigned 16-bit integer
proof_of_work_nonce 8 bytes bytes
? presence of field “seed_nonce_hash” 1 byte boolean (0 for false, 255 for true)
seed_nonce_hash 32 bytes bytes
signature 64 bytes bytes

Operation (alpha-specific)

Name Size Contents
contents Variable sequence of $operation.alpha.contents
signature 64 bytes bytes

scripted.contracts

Name Size Contents
# bytes in next field 4 bytes unsigned 30-bit integer
code Variable bytes
# bytes in next field 4 bytes unsigned 30-bit integer
storage Variable bytes

contract_id (22 bytes, 8-bit tag)

Implicit (tag 0)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
Signature.Public_key_hash 21 bytes $public_key_hash

Originated (tag 1)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
Contract_hash 20 bytes bytes
padding 1 byte padding

N.t

A variable length sequence of bytes, encoding a Zarith number. Each byte has a running unary size bit: the most significant bit of each byte tells is this is the last byte in the sequence (0) or if there is more to read (1). Size bits ignored, data is then the binary representation of the absolute value of the number in little endian order.

Name Size Contents
N.t Determined from data bytes

public_key (Determined from data, 8-bit tag)

Ed25519 (tag 0)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
Ed25519.Public_key 32 bytes bytes

Secp256k1 (tag 1)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
Secp256k1.Public_key 33 bytes bytes

P256 (tag 2)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
P256.Public_key 33 bytes bytes

public_key_hash (21 bytes, 8-bit tag)

Ed25519 (tag 0)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
Ed25519.Public_key_hash 20 bytes bytes

Secp256k1 (tag 1)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
Secp256k1.Public_key_hash 20 bytes bytes

P256 (tag 2)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
P256.Public_key_hash 20 bytes bytes

fitness.elem

Name Size Contents
# bytes in next field 4 bytes unsigned 30-bit integer
Unnamed field 0 Variable bytes

block_header.alpha.full_header

Name Size Contents
level 4 bytes signed 32-bit integer
proto 1 byte unsigned 8-bit integer
predecessor 32 bytes bytes
timestamp 8 bytes signed 64-bit integer
validation_pass 1 byte unsigned 8-bit integer
operations_hash 32 bytes bytes
# bytes in field “fitness” 4 bytes unsigned 30-bit integer
fitness Variable sequence of $fitness.elem
context 32 bytes bytes
priority 2 bytes unsigned 16-bit integer
proof_of_work_nonce 8 bytes bytes
? presence of field “seed_nonce_hash” 1 byte boolean (0 for false, 255 for true)
seed_nonce_hash 32 bytes bytes
signature 64 bytes bytes

inlined.endorsement.contents (5 bytes, 8-bit tag)

Endorsement (tag 0)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
level 4 bytes signed 32-bit integer

inlined.endorsement

Name Size Contents
branch 32 bytes bytes
operations 5 bytes $inlined.endorsement.contents
signature Variable bytes

operation.alpha.contents (Determined from data, 8-bit tag)

Endorsement (tag 0)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
level 4 bytes signed 32-bit integer

Seed_nonce_revelation (tag 1)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
level 4 bytes signed 32-bit integer
nonce 32 bytes bytes

Double_endorsement_evidence (tag 2)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
# bytes in next field 4 bytes unsigned 30-bit integer
op1 Variable $inlined.endorsement
# bytes in next field 4 bytes unsigned 30-bit integer
op2 Variable $inlined.endorsement

Double_baking_evidence (tag 3)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
# bytes in next field 4 bytes unsigned 30-bit integer
bh1 Determined from data $block_header.alpha.full_header
# bytes in next field 4 bytes unsigned 30-bit integer
bh2 Determined from data $block_header.alpha.full_header

Activate_account (tag 4)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
pkh 20 bytes bytes
secret 20 bytes bytes

Proposals (tag 5)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
source 21 bytes $public_key_hash
period 4 bytes signed 32-bit integer
# bytes in next field 4 bytes unsigned 30-bit integer
proposals Variable sequence of bytes

Ballot (tag 6)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
source 21 bytes $public_key_hash
period 4 bytes signed 32-bit integer
proposal 32 bytes bytes
ballot 1 byte signed 8-bit integer

Reveal (tag 7)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
source 22 bytes $contract_id
fee Determined from data $N.t
counter Determined from data $N.t
gas_limit Determined from data $N.t
storage_limit Determined from data $N.t
public_key Determined from data $public_key

Transaction (tag 8)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
source 22 bytes $contract_id
fee Determined from data $N.t
counter Determined from data $N.t
gas_limit Determined from data $N.t
storage_limit Determined from data $N.t
amount Determined from data $N.t
destination 22 bytes $contract_id
? presence of field “parameters” 1 byte boolean (0 for false, 255 for true)
parameters Determined from data $fitness.elem

Origination (tag 9)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
source 22 bytes $contract_id
fee Determined from data $N.t
counter Determined from data $N.t
gas_limit Determined from data $N.t
storage_limit Determined from data $N.t
manager_pubkey 21 bytes $public_key_hash
balance Determined from data $N.t
spendable 1 byte boolean (0 for false, 255 for true)
delegatable 1 byte boolean (0 for false, 255 for true)
? presence of field “delegate” 1 byte boolean (0 for false, 255 for true)
delegate 21 bytes $public_key_hash
? presence of field “script” 1 byte boolean (0 for false, 255 for true)
script Determined from data $scripted.contracts

Delegation (tag 10)

Name Size Contents
Tag 1 byte unsigned 8-bit integer
source 22 bytes $contract_id
fee Determined from data $N.t
counter Determined from data $N.t
gas_limit Determined from data $N.t
storage_limit Determined from data $N.t
? presence of field “delegate” 1 byte boolean (0 for false, 255 for true)
delegate 21 bytes $public_key_hash