Skip to content

Messages and Requests

Nodes communicate in two ways:

  • One-to-one communication with messages and requests
  • One-to-many communication by gossiping

Nodes identify each message or request by the TYPE_ID and their RequestKind. Messages have a MessageMarker and don’t require a response, and requests have a RequestMarker and always require a response. For simplicity, we will focus on the interactions of messages and requests between node A and node B.

Validator Message/Request

These messages and requests are specific to validators.

10_199 Request Proposal

Tendermint proposals are gossiped among validators so they can vote on them. However, validators can miss a proposal and notice it by witnessing other validators vote on it. In this specific context, the validator missing the proposal can send this request and receive the proposal in question.

Request

FieldTypeDescription
validator_idu16Identifies the validator sending the request. This allows the receiver to quickly verify that the validator ID matches the sender
block_numberu32The corresponding block of the proposal
round_numberu32The round number of the round the node is missing
proposal_hashBlake2sHashThe hash of the block proposal

Response

FieldTypeDescription
proposalMacroHeaderThe macro block header proposal
roundu32The round number of the corresponding proposal
valid_roundOption<u32>Indicates if it is a valid proposal
signatureSchnorrSignatureThe signature of the block’s leader
signeru16The signer of the sender of the request

10_124 Tendermint Update - Message

FieldTypeDescription
messageTaggedAggregationMessage<AggregateMessage>The aggregated message containing validator signatures
heightu32The height of the Tendermint proposal

10_123 Skip Block Update - Message

FieldTypeDescription
level_updateLevelUpdate<SignedSkipBlockMessage>The level update containing the signed skip block message
infoSkipBlockInfoContains information about the skip block

Messages are used to notify other nodes about votes for skip blocks and Tendermint proposals. The Handel aggregation protocol facilitates this process by aggregating small sets of votes into a single signature. These votes are processed in levels, with aggregated signatures passed from one level to the next until a single aggregated signature is obtained. This final signature determines whether the conditions for producing a skip block or a macro block are met.

Requests

Requests guide nodes in the blockchain, whether for sync, resync, to subscribe for addresses, or to locate a node in the chain. Node A requests and node B provides the data requested.

ID TypeNameDescription
200Request Macro ChainRequest for all the election blocks and the last checkpoint blocks of the latest batch
202Request Batch SetRequest for the information of a batch
204Request History ChunkRequest the history chunk of a specific index
207Request BlockRequest for a block given a block hash
209Request Missing BlocksRequest any missing blocks given a block hash
210Request HeadRequest the block header of a given block hash
211Request ZKPRequest a zkp for sync or resync
212Request ChunkRequest for a specific part of the the state trie
213Request Transactions ProofRequest for a proof on a specific transaction
214Request Transaction Receipts by AddressRequest for a set of receipts of a specific address
215Request Trie ProofRequest for a proof of a specific address balance
216Request Blocks ProofRequest for a proof on a specific block
217Request Subscribe to AddressRequest for a specific address subscription
218Request Trie DiffRequest for differences in the trie to complete a partial trie based on a block hash

200 Request Macro Chain

This request guides a node within the macro chain. If the node is far from the desired point and max_epochs is set low, it may need multiple requests to different peers.

Request

FieldTypeDescription
locatorsVec<Blake2bHash>A vector block hashes that the node knows to guide the network to identify the position of the node
max_epochsu16The maximum number of epochs the node wishes to receive in response per request. The node can send this request to multiple peers if necessary

Response

FieldTypeDescription
epochsOption<Vec<Blake2bHash>>A list of hashes of the election blocks following the provided locators. If the max_epochs limit is not sufficient to reach the most recent election block, the node may need to send additional requests
checkpointOption<Checkpoint>The last checkpoint block of the most recent epoch included in the response

202 Request Batch Set

Given the hash from the last request, node A can request node B's information about the given batch. This request follows the response from request 200, where the vector of hashes received is used to feed into this request.

Request

FieldTypeDescription
hashBlake2bHashThe hash of the last response from request 200; this request should be made for each hash received in the 200 response

Response

FieldTypeDescription
election_macro_blockOption<MacroBlock>The election block of the given batch
batch_setsVec<BatchSet>A vector of batch sets

Each BatchSet includes the following:

FieldTypeDescription
macro_blockOption<MacroBlock>The closing macro block of the given batch
history_lenu32The total history length of the given macro block

204 Request History Chunk

Transactions are stored in the history tree, and nodes that want to know parts of the transaction history must request it in chunks. Each history chunk has around 1000 items, so the node can request several chunks from multiple other nodes to build its history tree and, in the end, calculate its history root hash against the chain’s history root hash.

Request

FieldTypeDescription
epoch_numberu32The epoch number for which the node wants to receive history items
block_numberu32The block number of the last macro block of the corresponding chunk index
chunk_indexu64The range of history items the node wants to receive. For example, if set to 2, the history items from 1000 to 1999 are requested

Response

FieldTypeDescription
chunkOption<HistoryTreeChunk>The requested chunk of history items, if available

The HistoryTreeChunk provides both the proof and the actual history of transactions within the requested chunk. This ensures the integrity and completeness of the historical data being requested.

207 Request Block

This request allows a node to obtain a specific block by its hash, optionally including the body of a micro block.

Request

FieldTypeDescription
hashBlake2bHashThe hash of the block that is being requested
include_micro_bodiesboolIndicates whether to include the body if the requested block is a micro block

Response

The node receives either a MicroBlock or a MacroBlock.

209 Request Missing Blocks

This request allows node A to fetch any blocks that it misses, using known block hashes as locators to identify the blocks it needs.

Request

FieldTypeDescription
target_hashBlake2bHashThe hash of the block that is being targeted; the nodes knows this hash because of previous requests
include_micro_bodiesboolIndicates whether to include bodies for micro blocks
locatorsVec<Blake2bHash>A set of hashes of blocks known to the requester, ordered from newest to oldest
directionDirectionThe direction indicates whether to search forward (main chain blocks only) or backward (including blocks from inferior chains, more resource-intensive)

Response

FieldTypeDescription
blocksOption<Vec<Block>>An optional vector of blocks. If the request is successful, this field contains the blocks that were requested

210 Request Head

This request has no fields and serves to check if the node is synced with others.

Request

RequestDescription
RequestHead{}empty request

Response

FieldTypeDescription
microBlake2bHashThe hash of the current micro block
r#macroBlake2bHashThe hash of the current macro block
electionBlake2bHashThe hash of the current election block

211 Request ZKP

Light and full nodes use this request to sync with the blockchain by obtaining a light proof instead of downloading all blocks.

Request

FieldTypeDescription
block_numberu32Specifies the block number the node already has (can be the Genesis block if it is first connecting).
request_election_blockboolIndicates whether the node wants only the proof or the proof along with the corresponding election block.

Response

The node receives a RequestZKPResponse enum, which can be one of the following:

VariantTypeDescription
Proof(ZKProof, Option<MacroBlock>)Contains a ZKProof and an optional MacroBlock
Outdatedu32Indicates that the node's given block number is outdated

212 Request Chunk

This request is used by full nodes to sync with the blockchain state by requesting chunks of data as the blockchain progresses. Nodes can request one chunk at a time, using the data received in the previous request to make the subsequent request, until they are up-to-date and their local state matches the network state.

Request

FieldTypeDescription
start_keyKeyNibblesThe last part of the state tree the node knows (from the previous response)
limitu32The maximum size of the chunk per request

Response

The node receives a ResponseChunk enum, which can be one of the following:

VariantTypeDescription
ChunkChunkContains the chunk of the state tree that the node needs to add to its partial trie
IncompleteStateNoneIndicates that the node's state is incomplete and needs further chunks

Fields of Chunk:

FieldTypeDescription
block_numberu32The block number corresponding to the chunk
block_hashBlake2bHashThe block hash corresponding to the chunk
chunkTrieChunkThe chunk of the state tree that the node needs

213 Request Transactions Proof

This request is specific for light nodes that want a proof of a specific transaction. Only history and full nodes respond to this request.

Request

FieldTypeDescription
hashesVec<Blake2bHash>The hashes of the transactions
block_numberOption<u32>The block number of the corresponding transactions (optional)

Response

FieldTypeDescription
proofOption<HistoryTreeProof>The proof that includes the extended transactions (optional)
blockOption<Block>The complete block (optional)

214 Request Transaction Receipts by Address

This request is used to obtain transaction receipts for a specific address. Only history nodes can respond to this request.

Request

FieldTypeDescription
addressAddressThe address for which the node wants to obtain receipts
maxOption<u16>The maximum number of receipts per request (optional)

Response

FieldTypeDescription
receiptsVec<(Blake2bHash, u32)>A vector of tuples containing the transaction hashes and corresponding block numbers

215 Request Trie Proof

This request is used to prove the balance of specific addresses.

Request

FieldTypeDescription
keysVec<KeyNibbles>Addresses for which the accounts trie proof is requested. This consists of an internal representation of the address

Response

FieldTypeDescription
proofOption<TrieProof>The accounts’ trie proof (optional)
block_hashOption<Blake2bHash>The hash of the block corresponding to the proof (optional)

216 Request Blocks Proof

This request is used to obtain a list of election macro blocks that reference each other. It is used to prove that a block is in the blockchain.

Request

FieldTypeDescription
election_headu32The block number of the corresponding election macro block header
blocksVec<u32>A vector of block numbers for which proof is requested

Response

FieldTypeDescription
proofOption<BlockInclusionProof>The proof consists of an interlink chain from the current election head down to the target block (optional)

217 Request Subscribe to Address

This request is used to subscribe or unsubscribe to updates for specific addresses.

Request

FieldTypeDescription
operationAddressSubscriptionOperationThe type of subscription operation: subscribe or unsubscribe
addressesVec<Address>A list of addresses that are of interest to the peer

Response

FieldTypeDescription
resultResult<(), SubscribeToAddressesError>The result of the subscription request. This indicates success or provides an error if the request failed

218 Request Trie Diff

This request is used by nodes that are building their partial trie and may need to download the missing parts to complete their trie. It helps nodes to synchronize their state by obtaining the necessary differences for a specific block, especially when they depend on parts that have not been downloaded yet.

Request

FieldTypeDescription
block_hashBlake2bHashThe hash of the block for which the trie differences are requested

Response

The node receives a ResponseTrieDiff enum, which can be one of the following:

VariantDescription
PartialDiff(TrieDiff)Contains the differences in the trie needed to complete the partial trie
UnknownBlockHashIndicates that the provided block hash is unknown
IncompleteStateIndicates that the node's state is incomplete and further differences are needed