Skip to main content

Flow Access API Specification

The Access API is implemented as a gRPC service.

A language-agnostic specification for this API is defined using Protocol Buffers, which can be used to generate client libraries in a variety of programming languages.

Flow Access Node Endpoints

NetworkGRPCWeb GRPCREST
Mainnetaccess.mainnet.nodes.onflow.org:9000mainnet.onflow.orgrest-mainnet.onflow.org
Testnetaccess.devnet.nodes.onflow.org:9000testnet.onflow.orgrest-testnet.onflow.org

Ping

Ping will return a successful response if the Access API is ready and available.

rpc Ping(PingRequest) returns (PingResponse)

If a ping request returns an error or times out, it can be assumed that the Access API is unavailable.

Request

message PingRequest {}

Response

message PingResponse {}

Block Headers

The following methods query information about block headers.

GetLatestBlockHeader

GetLatestBlockHeader gets the latest sealed or unsealed block header.

rpc GetLatestBlockHeader (GetLatestBlockHeaderRequest) returns (BlockHeaderResponse)

Request

message GetLatestBlockHeaderRequest {
bool is_sealed = 1;
}

Response

message BlockHeaderResponse {
entities.BlockHeader block = 1;
entities.BlockStatus block_status = 2;
entities.Metadata metadata = 3;
}

GetBlockHeaderByID

GetBlockHeaderByID gets a block header by ID.

rpc GetBlockHeaderByID (GetBlockHeaderByIDRequest) returns (BlockHeaderResponse)

Request

message GetBlockHeaderByIDRequest {
bytes id = 1;
}

Response

message BlockHeaderResponse {
entities.BlockHeader block = 1;
entities.BlockStatus block_status = 2;
entities.Metadata metadata = 3;
}

GetBlockHeaderByHeight

GetBlockHeaderByHeight gets a block header by height.

rpc GetBlockHeaderByHeight (GetBlockHeaderByHeightRequest) returns (BlockHeaderResponse)

Request

message GetBlockHeaderByHeightRequest {
uint64 height = 1;
}

Response

message BlockHeaderResponse {
entities.BlockHeader block = 1;
entities.BlockStatus block_status = 2;
entities.Metadata metadata = 3;
}

Blocks

The following methods query information about full blocks.

GetLatestBlock

GetLatestBlock gets the full payload of the latest sealed or unsealed block.

rpc GetLatestBlock (GetLatestBlockRequest) returns (BlockResponse)

Request

message GetLatestBlockRequest {
bool is_sealed = 1;
bool full_block_response = 2;
}

Response

message BlockResponse {
entities.Block block = 1;
entities.BlockStatus block_status = 2;
entities.Metadata metadata = 3;
}

GetBlockByID

GetBlockByID gets a full block by ID.

rpc GetBlockByID (GetBlockByIDRequest) returns (BlockResponse)

Request

message GetBlockByIDRequest {
bytes id = 1;
bool full_block_response = 2;
}

Response

message BlockResponse {
entities.Block block = 1;
entities.BlockStatus block_status = 2;
entities.Metadata metadata = 3;
}

GetBlockByHeight

GetBlockByHeight gets a full block by height.

rpc GetBlockByHeight (GetBlockByHeightRequest) returns (BlockResponse)

Request

message GetBlockByHeightRequest {
uint64 height = 1;
bool full_block_response = 2;
}

Response

message BlockResponse {
entities.Block block = 1;
entities.BlockStatus block_status = 2;
entities.Metadata metadata = 3;
}

Collections

The following methods query information about collections.

GetCollectionByID

GetCollectionByID gets a collection by ID.

rpc GetCollectionByID (GetCollectionByIDRequest) returns (CollectionResponse)

Request

message GetCollectionByIDRequest {
bytes id = 1;
}

Response

message CollectionResponse {
entities.Collection collection = 1;
entities.Metadata metadata = 2;
}

GetFullCollectionByID

GetFullCollectionByID gets a collection by ID, which contains a set of transactions.

rpc GetFullCollectionByID(GetFullCollectionByIDRequest) returns (FullCollectionResponse);

Request

message GetFullCollectionByIDRequest {
bytes id = 1;
}

Response

message FullCollectionResponse {
repeated entities.Transaction transactions = 1;
entities.Metadata metadata = 2;
}

Transactions

The following methods can be used to submit transactions and fetch their results.

SendTransaction

SendTransaction submits a transaction to the network.

rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse)

SendTransaction determines the correct cluster of collection nodes that is responsible for collecting the transaction based on the hash of the transaction and forwards the transaction to that cluster.

Request

SendTransactionRequest message contains the transaction that is being request to be executed.

message SendTransactionRequest {
entities.Transaction transaction = 1;
}

Response

SendTransactionResponse message contains the ID of the submitted transaction.

message SendTransactionResponse {
bytes id = 1;
entities.Metadata metadata = 2;
}

GetTransaction

GetTransaction gets a transaction by ID.

If the transaction is not found in the access node cache, the request is forwarded to a collection node.

Currently, only transactions within the current epoch can be queried.

rpc GetTransaction (GetTransactionRequest) returns (TransactionResponse)

Request

GetTransactionRequest contains the ID of the transaction that is being queried.

message GetTransactionRequest {
bytes id = 1;
bytes block_id = 2;
bytes collection_id = 3;
entities.EventEncodingVersion event_encoding_version = 4;
}

Response

TransactionResponse contains the basic information about a transaction, but does not include post-execution results.

message TransactionResponse {
entities.Transaction transaction = 1;
entities.Metadata metadata = 2;
}

GetTransactionsByBlockID

GetTransactionsByBlockID gets all the transactions for a specified block.

rpc GetTransactionsByBlockID(GetTransactionsByBlockIDRequest) returns (TransactionsResponse);

Request

message GetTransactionsByBlockIDRequest {
bytes block_id = 1;
entities.EventEncodingVersion event_encoding_version = 2;
}

Response

message TransactionsResponse {
repeated entities.Transaction transactions = 1;
entities.Metadata metadata = 2;
}

GetTransactionResult

GetTransactionResult gets the execution result of a transaction.

rpc GetTransactionResult (GetTransactionRequest) returns (TransactionResultResponse)

Request

message GetTransactionRequest {
bytes id = 1;
bytes block_id = 2;
bytes collection_id = 3;
entities.EventEncodingVersion event_encoding_version = 4;
}

Response

message TransactionResultResponse {
entities.TransactionStatus status = 1;
uint32 status_code = 2;
string error_message = 3;
repeated entities.Event events = 4;
bytes block_id = 5;
bytes transaction_id = 6;
bytes collection_id = 7;
uint64 block_height = 8;
entities.Metadata metadata = 9;
uint64 computation_usage = 10;
}

GetTransactionResultByIndex

GetTransactionResultByIndex gets a transaction's result at a specified block and index.

rpc GetTransactionResultByIndex(GetTransactionByIndexRequest) returns (TransactionResultResponse);

Request

message GetTransactionByIndexRequest {
bytes block_id = 1;
uint32 index = 2;
entities.EventEncodingVersion event_encoding_version = 3;
}

Response

message TransactionResultResponse {
entities.TransactionStatus status = 1;
uint32 status_code = 2;
string error_message = 3;
repeated entities.Event events = 4;
bytes block_id = 5;
bytes transaction_id = 6;
bytes collection_id = 7;
uint64 block_height = 8;
entities.Metadata metadata = 9;
uint64 computation_usage = 10;
}

GetTransactionResultsByBlockID

GetTransactionResultsByBlockID gets all the transaction results for a specified block.

rpc GetTransactionResultsByBlockID(GetTransactionsByBlockIDRequest) returns (TransactionResultsResponse);

Request

message GetTransactionsByBlockIDRequest {
bytes block_id = 1;
entities.EventEncodingVersion event_encoding_version = 2;
}

Response

message TransactionResultsResponse {
repeated TransactionResultResponse transaction_results = 1;
entities.Metadata metadata = 2;
}

GetSystemTransaction

GetSystemTransaction gets the system transaction for a block.

rpc GetSystemTransaction(GetSystemTransactionRequest) returns (TransactionResponse);

Request

message GetSystemTransactionRequest {
bytes block_id = 1;
}

Response

message TransactionResponse {
entities.Transaction transaction = 1;
entities.Metadata metadata = 2;
}

GetSystemTransactionResult

GetSystemTransactionResult gets the system transaction result for a block.

rpc GetSystemTransactionResult(GetSystemTransactionResultRequest) returns (TransactionResultResponse);

Request

message GetSystemTransactionResultRequest {
bytes block_id = 1;
entities.EventEncodingVersion event_encoding_version = 2;
}

Response

message TransactionResultResponse {
entities.TransactionStatus status = 1;
uint32 status_code = 2;
string error_message = 3;
repeated entities.Event events = 4;
bytes block_id = 5;
bytes transaction_id = 6;
bytes collection_id = 7;
uint64 block_height = 8;
entities.Metadata metadata = 9;
uint64 computation_usage = 10;
}

Accounts

GetAccount

GetAccount gets an account by address at the latest sealed block.

⚠️ Warning: this function is deprecated. It behaves identically to GetAccountAtLatestBlock and will be removed in a future version.

rpc GetAccount(GetAccountRequest) returns (GetAccountResponse)

Request

message GetAccountRequest {
bytes address = 1;
}

Response

message GetAccountResponse {
entities.Account account = 1;
entities.Metadata metadata = 2;
}

GetAccountAtLatestBlock

GetAccountAtLatestBlock gets an account by address.

The access node queries an execution node for the account details, which are stored as part of the sealed execution state.

rpc GetAccountAtLatestBlock(GetAccountAtLatestBlockRequest) returns (AccountResponse)

Request

message GetAccountAtLatestBlockRequest {
bytes address = 1;
}

Response

message AccountResponse {
entities.Account account = 1;
entities.Metadata metadata = 2;
}

GetAccountAtBlockHeight

GetAccountAtBlockHeight gets an account by address at the given block height.

The access node queries an execution node for the account details, which are stored as part of the execution state.

rpc GetAccountAtBlockHeight(GetAccountAtBlockHeightRequest) returns (AccountResponse)

Request

message GetAccountAtBlockHeightRequest {
bytes address = 1;
uint64 block_height = 2;
}

Response

message AccountResponse {
entities.Account account = 1;
entities.Metadata metadata = 2;
}

GetAccountBalanceAtLatestBlock

GetAccountBalanceAtLatestBlock gets an account's balance by address from the latest sealed block.

rpc GetAccountBalanceAtLatestBlock(GetAccountBalanceAtLatestBlockRequest) returns (AccountBalanceResponse);

Request

message GetAccountBalanceAtLatestBlockRequest {
bytes address = 1
}

Response

message AccountBalanceResponse {
uint64 balance = 1;
entities.Metadata metadata = 2;
}

GetAccountBalanceAtBlockHeight

GetAccountBalanceAtBlockHeight gets an account's balance by address at the given block height.

rpc GetAccountBalanceAtBlockHeight(GetAccountBalanceAtBlockHeightRequest) returns (AccountBalanceResponse);

Request

message GetAccountBalanceAtBlockHeightRequest {
bytes address = 1;
uint64 block_height = 2;
}

Response

message AccountBalanceResponse {
uint64 balance = 1;
entities.Metadata metadata = 2;
}

GetAccountKeyAtLatestBlock

GetAccountKeyAtLatestBlock gets an account's public key by address and key index from the latest sealed block.

rpc GetAccountKeyAtLatestBlock(GetAccountKeyAtLatestBlockRequest) returns (AccountKeyResponse);

Request

message GetAccountKeyAtLatestBlockRequest {
// address of account
bytes address = 1;
// index of key to return
uint32 index = 2;
}

Response

message AccountKeyResponse {
entities.AccountKey account_key = 1;
entities.Metadata metadata = 2;
}

GetAccountKeyAtBlockHeight

GetAccountKeyAtBlockHeight gets an account's public key by address and key index at the given block height.

rpc GetAccountKeyAtBlockHeight(GetAccountKeyAtBlockHeightRequest) returns (AccountKeyResponse);

Request

message GetAccountKeyAtBlockHeightRequest {
// address of account
bytes address = 1;
// height of the block
uint64 block_height = 2;
// index of key to return
uint32 index = 3;
}

Response

message AccountKeyResponse {
entities.AccountKey account_key = 1;
entities.Metadata metadata = 2;
}

GetAccountKeysAtLatestBlock

GetAccountKeysAtLatestBlock gets an account's public keys by address from the latest sealed block.

rpc GetAccountKeysAtLatestBlock(GetAccountKeysAtLatestBlockRequest) returns (AccountKeysResponse);

Request

message GetAccountKeysAtLatestBlockRequest {
// address of account
bytes address = 1;
}

Response

message AccountKeysResponse {
repeated entities.AccountKey account_keys = 1;
entities.Metadata metadata = 2;
}

GetAccountKeysAtBlockHeight

GetAccountKeysAtBlockHeight gets an account's public keys by address at the given block height.

rpc GetAccountKeysAtBlockHeight(GetAccountKeysAtBlockHeightRequest) returns (AccountKeysResponse);

Request

message GetAccountKeysAtBlockHeightRequest {
// address of account
bytes address = 1;
uint64 block_height = 2;
}

Response

message AccountKeysResponse {
repeated entities.AccountKey account_keys = 1;
entities.Metadata metadata = 2;
}

Scripts

ExecuteScriptAtLatestBlock

ExecuteScriptAtLatestBlock executes a read-only Cadence script against the latest sealed execution state.

This method can be used to read execution state from the blockchain. The script is executed on an execution node and the return value is encoded using the JSON-Cadence data interchange format.

rpc ExecuteScriptAtLatestBlock (ExecuteScriptAtLatestBlockRequest) returns (ExecuteScriptResponse)

This method is a shortcut for the following:

header = GetLatestBlockHeader()
value = ExecuteScriptAtBlockID(header.ID, script)

Request

message ExecuteScriptAtLatestBlockRequest {
bytes script = 1;
repeated bytes arguments = 2;
}

Response

message ExecuteScriptResponse {
bytes value = 1;
entities.Metadata metadata = 2;
uint64 computation_usage = 3;
}

ExecuteScriptAtBlockID

ExecuteScriptAtBlockID executes a ready-only Cadence script against the execution state at the block with the given ID.

This method can be used to read account state from the blockchain. The script is executed on an execution node and the return value is encoded using the JSON-Cadence data interchange format.

rpc ExecuteScriptAtBlockID (ExecuteScriptAtBlockIDRequest) returns (ExecuteScriptResponse)

Request

message ExecuteScriptAtBlockIDRequest {
bytes block_id = 1;
bytes script = 2;
repeated bytes arguments = 3;
}

Response

message ExecuteScriptResponse {
bytes value = 1;
entities.Metadata metadata = 2;
uint64 computation_usage = 3;
}

ExecuteScriptAtBlockHeight

ExecuteScriptAtBlockHeight executes a ready-only Cadence script against the execution state at the given block height.

This method can be used to read account state from the blockchain. The script is executed on an execution node and the return value is encoded using the JSON-Cadence data interchange format.

rpc ExecuteScriptAtBlockHeight (ExecuteScriptAtBlockHeightRequest) returns (ExecuteScriptResponse)

Request

message ExecuteScriptAtBlockHeightRequest {
uint64 block_height = 1;
bytes script = 2;
repeated bytes arguments = 3;
}

Response

message ExecuteScriptResponse {
bytes value = 1;
entities.Metadata metadata = 2;
uint64 computation_usage = 3;
}

Events

The following methods can be used to query for on-chain events.

GetEventsForHeightRange

GetEventsForHeightRange retrieves events emitted within the specified block range.

rpc GetEventsForHeightRange(GetEventsForHeightRangeRequest) returns (GetEventsForHeightRangeResponse)

Events can be requested for a specific sealed block range via the start_height and end_height (inclusive) fields and further filtered by event type via the type field.

If start_height is greater than the current sealed chain height, then this method will return an error.

If end_height is greater than the current sealed chain height, then this method will return events up to and including the latest sealed block.

The event results are grouped by block, with each group specifying a block ID, height and block timestamp.

Event types are name-spaced with the address of the account and contract in which they are declared.

Request

message GetEventsForHeightRangeRequest {
string type
uint64 start_height = 2;
uint64 end_height = 3;
entities.EventEncodingVersion event_encoding_version = 4;
}

Response

message EventsResponse {
message Result {
bytes block_id = 1;
uint64 block_height = 2;
repeated entities.Event events = 3;
google.protobuf.Timestamp block_timestamp = 4;
}
repeated Result results = 1;
entities.Metadata metadata = 2;
}

GetEventsForBlockIDs

GetEventsForBlockIDs retrieves events for the specified block IDs and event type.

rpc GetEventsForBlockIDs(GetEventsForBlockIDsRequest) returns (GetEventsForBlockIDsResponse)

Events can be requested for a list of block IDs via the block_ids field and further filtered by event type via the type field.

The event results are grouped by block, with each group specifying a block ID, height and block timestamp.

Request

message GetEventsForBlockIDsRequest {
string type = 1;
repeated bytes block_ids = 2;
entities.EventEncodingVersion event_encoding_version = 3;
}

Response

message EventsResponse {
message Result {
bytes block_id = 1;
uint64 block_height = 2;
repeated entities.Event events = 3;
google.protobuf.Timestamp block_timestamp = 4;
}
repeated Result results = 1;
entities.Metadata metadata = 2;
}

Network Parameters

Network parameters provide information about the Flow network. Currently, it only includes the chain ID. The following method can be used to query for network parameters.

GetNetworkParameters

GetNetworkParameters retrieves the network parameters.

rpc GetNetworkParameters (GetNetworkParametersRequest) returns (GetNetworkParametersResponse)

Request

message GetNetworkParametersRequest {}

Response

message GetNetworkParametersResponse {
string chain_id = 1;
}
FieldDescription
chain_idChain ID helps identify the Flow network. It can be one of flow-mainnet, flow-testnet or flow-emulator

GetNodeVersionInfo

GetNodeVersionInfo gets information about a node's current versions.

rpc GetNodeVersionInfo (GetNodeVersionInfoRequest) returns (GetNodeVersionInfoResponse);

Request

message GetNodeVersionInfoRequest {}

Response

message GetNodeVersionInfoResponse {
entities.NodeVersionInfo info = 1;
}

Protocol state snapshot

The following method can be used to query the latest protocol state snapshot.

GetLatestProtocolStateSnapshot

GetLatestProtocolStateSnapshot retrieves the latest Protocol state snapshot serialized as a byte array. It is used by Flow nodes joining the network to bootstrap a space-efficient local state.

rpc GetLatestProtocolStateSnapshot (GetLatestProtocolStateSnapshotRequest) returns (ProtocolStateSnapshotResponse);

Request

message GetLatestProtocolStateSnapshotRequest {}

Response

message ProtocolStateSnapshotResponse {
bytes serializedSnapshot = 1;
entities.Metadata metadata = 2;
}

GetProtocolStateSnapshotByBlockID

GetProtocolStateSnapshotByBlockID retrieves the latest sealed protocol state snapshot by block ID. Used by Flow nodes joining the network to bootstrap a space-efficient local state.

rpc GetProtocolStateSnapshotByBlockID(GetProtocolStateSnapshotByBlockIDRequest) returns (ProtocolStateSnapshotResponse);

Request

message GetProtocolStateSnapshotByBlockIDRequest {
bytes block_id = 1;
}

Response

message ProtocolStateSnapshotResponse {
bytes serializedSnapshot = 1;
entities.Metadata metadata = 2;
}

GetProtocolStateSnapshotByHeight

GetProtocolStateSnapshotByHeight retrieves the latest sealed protocol state snapshot by block height. Used by Flow nodes joining the network to bootstrap a space-efficient local state.

rpc GetProtocolStateSnapshotByHeight(GetProtocolStateSnapshotByHeightRequest) returns (ProtocolStateSnapshotResponse);

Request

message GetProtocolStateSnapshotByHeightRequest {
uint64 block_height = 1;
}

Response

message ProtocolStateSnapshotResponse {
bytes serializedSnapshot = 1;
entities.Metadata metadata = 2;
}

Execution results

The following method can be used to query the for execution results for a given block.

GetExecutionResultForBlockID

GetExecutionResultForBlockID retrieves execution result for given block. It is different from Transaction Results, and contain data about chunks/collection level execution results rather than particular transactions. Particularly, it contains EventsCollection hash for every chunk which can be used to verify the events for a block.

rpc GetExecutionResultForBlockID(GetExecutionResultForBlockIDRequest) returns (ExecutionResultForBlockIDResponse);

Request

message GetExecutionResultForBlockIDRequest {
bytes block_id = 1;
}

Response

message ExecutionResultForBlockIDResponse {
flow.ExecutionResult execution_result = 1;
entities.Metadata metadata = 2;
}

GetExecutionResultByID

GetExecutionResultByID returns Execution Result by its ID. It is different from Transaction Results, and contain data about chunks/collection level execution results rather than particular transactions. Particularly, it contains EventsCollection hash for every chunk which can be used to verify the events for a block.

rpc GetExecutionResultByID(GetExecutionResultByIDRequest) returns (ExecutionResultByIDResponse);

Request

message GetExecutionResultByIDRequest {
bytes id = 1;
}

Response

message ExecutionResultByIDResponse {
flow.ExecutionResult execution_result = 1;
entities.Metadata metadata = 2;
}

Entities

Below are in-depth descriptions of each of the data entities returned or accepted by the Access API.

Block

message Block {
bytes id = 1;
bytes parent_id = 2;
uint64 height = 3;
google.protobuf.Timestamp timestamp = 4;
repeated CollectionGuarantee collection_guarantees = 5;
repeated BlockSeal block_seals = 6;
repeated bytes signatures = 7;
repeated ExecutionReceiptMeta execution_receipt_metaList = 8;
repeated ExecutionResult execution_result_list = 9;
BlockHeader block_header = 10;
bytes protocol_state_id = 11;
}
FieldDescription
idSHA3-256 hash of the entire block payload
heightHeight of the block in the chain
parent_idID of the previous block in the chain
timestampTimestamp of when the proposer claims it constructed the block.
NOTE: It is included by the proposer, there are no guarantees on how much the time stamp can deviate from the true time the block was published.
Consider observing blocks' status changes yourself to get a more reliable value
collection_guaranteesList of collection guarantees
block_sealsList of block seals
signaturesBLS signatures of consensus nodes
execution_receipt_metaListList of execution-receipt-meta
execution_result_listList of execution results
block_headerA summary of a block
protocol_state_idThe root hash of protocol state.

The detailed semantics of block formation are covered in the block formation guide.

Block Header

A block header is a summary of a block and contains only the block ID, height, and parent block ID.

message BlockHeader {
bytes id = 1;
bytes parent_id = 2;
uint64 height = 3;
google.protobuf.Timestamp timestamp = 4;
bytes payload_hash = 5;
uint64 view = 6;
repeated bytes parent_voter_ids = 7;
bytes parent_voter_sig_data = 8;
bytes proposer_id = 9;
bytes proposer_sig_data = 10;
string chain_id = 11;
bytes parent_voter_indices = 12;
TimeoutCertificate last_view_tc = 13;
uint64 parent_view = 14;
}
FieldDescription
idSHA3-256 hash of the entire block payload
parent_idID of the previous block in the chain
heightHeight of the block in the chain
timestampThe time at which this block was proposed
payload_hashA hash of the payload of this block
viewView number during which this block was proposed.
parent_voter_idsAn array that represents all the voters ids for the parent block
parent_voter_sig_dataAn aggregated signature over the parent block
chain_idChain ID helps identify the Flow network. It can be one of flow-mainnet, flow-testnet or flow-emulator
parent_voter_indicesA bitvector that represents all the voters for the parent block
last_view_tcA timeout certificate for previous view, it can be nil. It has to be present if previous round ended with timeout
parent_viewA number at which parent block was proposed

Block Seal

A block seal is an attestation that the execution result of a specific block has been verified and approved by a quorum of verification nodes.

message BlockSeal {
bytes block_id = 1;
bytes execution_receipt_id = 2;
repeated bytes execution_receipt_signatures = 3;
repeated bytes result_approval_signatures = 4;
}
FieldDescription
block_idID of the block being sealed
execution_receipt_idID execution receipt being sealed
execution_receipt_signaturesBLS signatures of verification nodes on the execution receipt contents
result_approval_signaturesBLS signatures of verification nodes on the result approval contents

Block Status

enum BlockStatus {
UNKNOWN = 0;
FINALIZED = 1;
SEALED = 2;
}
ValueDescription
UNKNOWNThe block status is not known
FINALIZEDThe consensus nodes have finalized the block
SEALEDThe verification nodes have verified the block

Collection

A collection is a batch of transactions that have been included in a block. Collections are used to improve consensus throughput by increasing the number of transactions per block.

message Collection {
bytes id = 1;
repeated bytes transaction_ids = 2;
}
FieldDescription
idSHA3-256 hash of the collection contents
transaction_idsOrdered list of transaction IDs in the collection

Collection Guarantee

A collection guarantee is a signed attestation that specifies the collection nodes that have guaranteed to store and respond to queries about a collection.

message CollectionGuarantee {
bytes collection_id = 1;
repeated bytes signatures = 2;
bytes reference_block_id = 3;
bytes signature = 4;
repeated bytes signer_ids = 5; // deprecated!! value will be empty. replaced by signer_indices
bytes signer_indices = 6;
}
FieldDescription
collection_idSHA3-256 hash of the collection contents
signaturesBLS signatures of the collection nodes guaranteeing the collection
reference_block_idDefines expiry of the collection
signatureGuarantor signatures
signer_idsAn array that represents all the signer ids
signer_indicesEncoded indices of the signers

Transaction

A transaction represents a unit of computation that is submitted to the Flow network.

message Transaction {
bytes script = 1;
repeated bytes arguments = 2;
bytes reference_block_id = 3;
uint64 gas_limit = 4;
ProposalKey proposal_key = 5;
bytes payer = 6;
repeated bytes authorizers = 7;
repeated Signature payload_signatures = 8;
repeated Signature envelope_signatures = 9;
}

message TransactionProposalKey {
bytes address = 1;
uint32 key_id = 2;
uint64 sequence_number = 3;
}

message TransactionSignature {
bytes address = 1;
uint32 key_id = 2;
bytes signature = 3;
}
FieldDescription
scriptRaw source code for a Cadence script, encoded as UTF-8 bytes
argumentsArguments passed to the Cadence script, encoded as JSON-Cadence bytes
reference_block_idBlock ID used to determine transaction expiry
proposal_keyAccount key used to propose the transaction
payerAddress of the payer account
authorizersAddresses of the transaction authorizers
signaturesSignatures from all signer accounts

The detailed semantics of transaction creation, signing and submission are covered in the transaction submission guide.

Proposal Key

The proposal key is used to specify a sequence number for the transaction. Sequence numbers are covered in more detail here.

FieldDescription
addressAddress of proposer account
key_idID of proposal key on the proposal account
sequence_numberSequence number for the proposal key

Transaction Signature

FieldDescription
addressAddress of the account for this signature
key_idID of the account key
signatureRaw signature byte data

Transaction Status

enum TransactionStatus {
UNKNOWN = 0;
PENDING = 1;
FINALIZED = 2;
EXECUTED = 3;
SEALED = 4;
EXPIRED = 5;
}
ValueDescription
UNKNOWNThe transaction status is not known.
PENDINGThe transaction has been received by a collector but not yet finalized in a block.
FINALIZEDThe consensus nodes have finalized the block that the transaction is included in
EXECUTEDThe execution nodes have produced a result for the transaction
SEALEDThe verification nodes have verified the transaction (the block in which the transaction is) and the seal is included in the latest block
EXPIREDThe transaction was submitted past its expiration block height.

Account

An account is a user's identity on Flow. It contains a unique address, a balance, a list of public keys and the code that has been deployed to the account.

message Account {
bytes address = 1;
uint64 balance = 2;
bytes code = 3;
repeated AccountKey keys = 4;
map<string, bytes> contracts = 5;
}
FieldDescription
addressA unique account identifier
balanceThe account balance
codeThe code deployed to this account (deprecated, use contracts instead)
keysA list of keys configured on this account
contractsA map of contracts or contract interfaces deployed on this account

The code and contracts fields contain the raw Cadence source code, encoded as UTF-8 bytes.

More information on accounts can be found here.

Account Key

An account key is a reference to a public key associated with a Flow account. Accounts can be configured with zero or more public keys, each of which can be used for signature verification when authorizing a transaction.

message AccountKey {
uint32 index = 1;
bytes public_key = 2;
uint32 sign_algo = 3;
uint32 hash_algo = 4;
uint32 weight = 5;
uint32 sequence_number = 6;
bool revoked = 7;
}
FieldDescription
idIndex of the key within the account, used as a unique identifier
public_keyPublic key encoded as bytes
sign_algoSignature algorithm
hash_algoHash algorithm
weightWeight assigned to the key
sequence_numberSequence number for the key
revokedFlag indicating whether or not the key has been revoked

More information on account keys, key weights and sequence numbers can be found here.

Event

An event is emitted as the result of a transaction execution. Events are either user-defined events originating from a Cadence smart contract, or built-in Flow system events.

message Event {
string type = 1;
bytes transaction_id = 2;
uint32 transaction_index = 3;
uint32 event_index = 4;
bytes payload = 5;
}
FieldDescription
typeFully-qualified unique type identifier for the event
transaction_idID of the transaction the event was emitted from
transaction_indexZero-based index of the transaction within the block
event_indexZero-based index of the event within the transaction
payloadEvent fields encoded as JSON-Cadence values

Execution Result

Execution result for a particular block.

message ExecutionResult {
bytes previous_result_id = 1;
bytes block_id = 2;
repeated Chunk chunks = 3;
repeated ServiceEvent service_events = 4;
}
FieldDescription
previous_result_idIdentifier of parent block execution result
block_idID of the block this execution result corresponds to
chunksZero or more chunks
service_eventsZero or more service events

Execution Receipt Meta

ExecutionReceiptMeta contains the fields from the Execution Receipts that vary from one executor to another

message ExecutionReceiptMeta {
bytes executor_id = 1;
bytes result_id = 2;
repeated bytes spocks = 3;
bytes executor_signature = 4;
}
FieldDescription
executor_idIdentifier of the executor node
result_idIdentifier of block execution result
spocksSPoCK
executor_signatureSignature of the executor

Chunk

Chunk described execution information for given collection in a block

message Chunk {
uint32 CollectionIndex = 1;
bytes start_state = 2;
bytes event_collection = 3;
bytes block_id = 4;
uint64 total_computation_used = 5;
uint32 number_of_transactions = 6;
uint64 index = 7;
bytes end_state = 8;
bytes execution_data_id = 9;
bytes state_delta_commitment = 10;
}
FieldDescription
CollectionIndexIdentifier of a collection
start_stateState commitment at start of the chunk
event_collectionHash of events emitted by transactions in this chunk
block_idIdentifier of a block
total_computation_usedTotal computation used by transactions in this chunk
number_of_transactionsNumber of transactions in a chunk
indexIndex of chunk inside a block (zero-based)
end_stateState commitment after executing chunk
execution_data_idIdentifier of a execution data
state_delta_commitmentA commitment over sorted list of register changes

Service Event

Special type of events emitted in system chunk used for controlling Flow system.

message ServiceEvent {
string type = 1;
bytes payload = 2;
}
FieldDescription
typeType of an event
payloadJSON-serialized content of an event

Subscriptions

SubscribeEvents

SubscribeEvents streams events for all blocks starting at the requested start block, up until the latest available block. Once the latest is reached, the stream will remain open and responses are sent for each new block as it becomes available.

Events within each block are filtered by the provided EventFilter, and only those events that match the filter are returned. If no filter is provided, all events are returned.

Responses are returned for each block containing at least one event that matches the filter. Additionally, heatbeat responses (SubscribeEventsResponse with no events) are returned periodically to allow clients to track which blocks were searched. Clients can use this information to determine which block to start from when reconnecting.

rpc SubscribeEvents(SubscribeEventsRequest) returns (stream SubscribeEventsResponse)

Request

message SubscribeEventsRequest {
bytes start_block_id = 1;
uint64 start_block_height = 2;
EventFilter filter = 3;
uint64 heartbeat_interval = 4;
entities.EventEncodingVersion event_encoding_version = 5;
}
FieldDescription
start_block_idThe first block to search for events. Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument error is returned. If neither are provided, the latest sealed block is used
start_block_heightBlock height of the first block to search for events. Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument error is returned. If neither are provided, the latest sealed block is used
filterFilter to apply to events for each block searched. If no filter is provided, all events are returned
heartbeat_intervalInterval in block heights at which the server should return a heartbeat message to the client
event_encoding_versionPreferred event encoding version of the block events payload. Possible variants: CCF, JSON-CDC

Response

message SubscribeEventsResponse {
bytes block_id = 1;
uint64 block_height = 2;
repeated entities.Event events = 3;
google.protobuf.Timestamp block_timestamp = 4;
uint64 message_index = 5;
}

SubscribeExecutionData

SubscribeExecutionData streams execution data for all blocks starting at the requested start block, up until the latest available block. Once the latest is reached, the stream will remain open and responses are sent for each new execution data as it becomes available.

rpc SubscribeExecutionData(SubscribeExecutionDataRequest) returns (stream SubscribeExecutionDataResponse)

Request

message SubscribeExecutionDataRequest {
bytes start_block_id = 1;
uint64 start_block_height = 2;
entities.EventEncodingVersion event_encoding_version = 3;
}
FieldDescription
start_block_idThe first block to get execution data for. Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument error is returned. If neither are provided, the latest sealed block is used
start_block_heightBlock height of the first block to get execution data for. Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument error is returned. If neither are provided, the latest sealed block is used
event_encoding_versionPreferred event encoding version of the block events payload. Possible variants: CCF, JSON-CDC

Response

message SubscribeExecutionDataResponse {
uint64 block_height = 1;
entities.BlockExecutionData block_execution_data = 2;
google.protobuf.Timestamp block_timestamp = 3;
}

Execution data

EventFilter

EventFilter defines the filter to apply to block events. Filters are applied as an OR operation, i.e. any event matching any of the filters is returned. If no filters are provided, all events are returned. If there are any invalid filters, the API will return an InvalidArgument error.

message EventFilter {
repeated string event_type = 1;
repeated string contract = 2;
repeated string address = 3;
}
FieldDescription
event_typeA list of full event types to include.
Event types have 2 formats:
_ Protocol events: flow.[event name]
_ Smart contract events: A.[contract address].[contract name].[event name]
contractA list of contracts who's events should be included. Contracts have the following name formats:
_ Protocol events: flow
_ Smart contract events: A.[contract address].[contract name]
This filter matches on the full contract including its address, not just the contract's name
addressA list of addresses who's events should be included. Addresses must be Flow account addresses in hex format and valid for the network the node is connected to. i.e. only a mainnet address is valid for a mainnet node. Addresses may optionally include the 0x prefix

Execution data streaming API

Execution Data API

The ExecutionDataAPI provides access to block execution data over gRPC, including transactions, events, and register data (account state). It’s an optional API, which makes use of the Execution Sync protocol to trustlessly download data from peers on the network.

execution data protobuf file

The API is disabled by default. To enable it, specify a listener address with the cli flag --state-stream-addr.

Below is a list of the available CLI flags to control the behavior of the API

FlagTypeDescription
state-stream-addrstringListener address for API. e.g. 0.0.0.0:9003. If no value is provided, the API is disabled. Default is disabled.
execution-data-cache-sizeuint32Number of block execution data objects to store in the cache. Default is 100.
state-stream-global-max-streamsuint32Global maximum number of concurrent streams. Default is 1000.
state-stream-max-message-sizeuintMaximum size for a gRPC response message containing block execution data. Default is 2010241024 (20MB).
state-stream-event-filter-limitsstringEvent filter limits for ExecutionData SubscribeEvents API. These define the max number of filters for each type. e.g. EventTypes=100,Addresses=20,Contracts=50. Default is 1000 for each.
state-stream-send-timeoutdurationMaximum wait before timing out while sending a response to a streaming client. Default is 30s.
state-stream-send-buffer-sizeuintMaximum number of unsent responses to buffer for a stream. Default is 10.
state-stream-response-limitfloat64Max number of responses per second to send over streaming endpoints. This effectively applies a rate limit to responses to help manage resources consumed by each client. This is mostly used when clients are querying data past data. e.g. 3 or 0.5. Default is 0 which means no limit.