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 $alpha.operation.alpha.contents

signature

64 bytes

bytes

alpha.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

alpha.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

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

default (tag 0)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

root (tag 1)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

do (tag 2)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

set_delegate (tag 3)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

remove_delegate (tag 4)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

named (tag 255)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

# bytes in next field

1 byte

unsigned 8-bit integer

Unnamed field 0

Variable

bytes

X_0

Name

Size

Contents

entrypoint

Determined from data

$alpha.entrypoint

# bytes in next field

4 bytes

unsigned 30-bit integer

value

Variable

bytes

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

alpha.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

alpha.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

alpha.inlined.endorsement

Name

Size

Contents

branch

32 bytes

bytes

operations

5 bytes

$alpha.inlined.endorsement.contents

signature

Variable

bytes

alpha.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

$alpha.inlined.endorsement

# bytes in next field

4 bytes

unsigned 30-bit integer

op2

Variable

$alpha.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

$alpha.block_header.alpha.full_header

# bytes in next field

4 bytes

unsigned 30-bit integer

bh2

Determined from data

$alpha.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 107)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

source

21 bytes

$public_key_hash

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 108)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

source

21 bytes

$public_key_hash

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

$alpha.contract_id

? presence of field “parameters”

1 byte

boolean (0 for false, 255 for true)

parameters

Determined from data

$X_0

Origination (tag 109)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

source

21 bytes

$public_key_hash

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

balance

Determined from data

$N.t

? presence of field “delegate”

1 byte

boolean (0 for false, 255 for true)

delegate

21 bytes

$public_key_hash

script

Determined from data

$alpha.scripted.contracts

Delegation (tag 110)

Name

Size

Contents

Tag

1 byte

unsigned 8-bit integer

source

21 bytes

$public_key_hash

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