--- title: Starknet data reference description: "Starknet: DNA data data reference guide." diataxis: reference updatedAt: 2025-09-03 --- # Starknet data reference This page contains reference about the available data in Starknet DNA streams. ### Related pages - [Starknet data filter reference](/docs/networks/starknet/filter) ## Filter ID All filters have an associated ID. To help clients correlate filters with data, the filter ID is included in the `filterIds` field of all data objects. This field contains the list of _all filter IDs_ that matched a piece of data. ## Nullable fields **Important**: most fields are nullable to allow evolving the protocol. You should always assert the presence of a field for critical indexers. ## Field elements Apibara represents Starknet field elements as hex-encode strings. ```ts export type FieldElement = `0x${string}`; ``` ## Data types ### Block The root object is the `Block`. ```ts export type Block = { header?: BlockHeader; transactions: Transaction[]; receipts: TransactionReceipt[]; events: Event[]; messages: MessageToL1[]; storageDiffs: StorageDiff[]; contractChanges: ContractChange[]; nonceUpdates: NonceUpdate[]; }; ``` ### Block header This is the block header, which contains information about the block. ```ts export type BlockHeader = { blockHash?: FieldElement; parentBlockHash?: FieldElement; blockNumber?: bigint; sequencerAddress?: FieldElement; newRoot?: FieldElement; timestamp?: Date; starknetVersion?: string; l1GasPrice?: ResourcePrice; l1DataGasPrice?: ResourcePrice; l1DataAvailabilityMode?: "blob" | "calldata"; }; export type ResourcePrice = { priceInFri?: FieldElement; priceInWei?: FieldElement; }; ``` **Properties** - `blockHash`: the block hash. - `parentBlockHash`: the block hash of the parent block. - `blockNumber`: the block number. - `sequencerAddress`: the sequencer address. - `newRoot`: the new state root. - `timestamp`: the block timestamp. - `starknetVersion`: the Starknet version. - `l1GasPrice`: the L1 gas price. - `l1DataGasPrice`: the L1 data gas price. - `l1DataAvailabilityMode`: the L1 data availability mode. - `priceInFri`: the price of L1 gas in the block, in units of fri (10^-18 $STRK). - `priceInWei`: the price of L1 gas in the block, in units of wei (10^-18 $ETH). ### Event An event is emitted by a transaction. ```ts export type Event = { filterIds: number[]; address?: FieldElement; keys: FieldElement[]; data: FieldElement[]; eventIndex?: number; transactionIndex?: number; transactionHash?: FieldElement; transactionStatus?: "succeeded" | "reverted"; }; ``` **Properties** - `address`: the address of the contract that emitted the event. - `keys`: the keys of the event. - `data`: the data of the event. - `eventIndex`: the index of the event in the block. - `transactionIndex`: the index of the transaction that emitted the event. - `transactionHash`: the hash of the transaction that emitted the event. - `transactionStatus`: the status of the transaction that emitted the event. **Relevant filters** - `filter.events` - `filter.transactions[].includeEvents` - `filter.events[].includeSiblings` - `filter.messages[].includeEvents` ### Transaction Starknet has different types of transactions, all of them are grouped together in the `Transaction` type. Common transaction information is accessible in the `meta` field. ```ts export type TransactionMeta = { transactionIndex?: number; transactionHash?: FieldElement; transactionStatus?: "succeeded" | "reverted"; }; export type Transaction = { filterIds: number[]; meta?: TransactionMeta; transaction?: | InvokeTransactionV0 | InvokeTransactionV1 | InvokeTransactionV3 | L1HandlerTransaction | DeployTransaction | DeclareTransactionV0 | DeclareTransactionV1 | DeclareTransactionV2 | DeclareTransactionV3 | DeployAccountTransactionV1 | DeployAccountTransactionV3; }; ``` **Properties** - `meta`: transaction metadata. - `transaction`: the transaction type. - `meta.transactionIndex`: the index of the transaction in the block. - `meta.transactionHash`: the hash of the transaction. - `meta.transactionStatus`: the status of the transaction. **Relevant filters** - `filter.transactions` - `filter.events[].includeTransaction` - `filter.messages[].includeTransaction` ```ts export type InvokeTransactionV0 = { _tag: "invokeV0"; invokeV0: { maxFee?: FieldElement; signature: FieldElement[]; contractAddress?: FieldElement; entryPointSelector?: FieldElement; calldata: FieldElement[]; }; }; ``` **Properties** - `maxFee`: the maximum fee for the transaction. - `signature`: the signature of the transaction. - `contractAddress`: the address of the contract that will receive the call. - `entryPointSelector`: the selector of the function that will be called. - `calldata`: the calldata of the transaction. ```ts export type InvokeTransactionV1 = { _tag: "invokeV1"; invokeV1: { senderAddress?: FieldElement; calldata: FieldElement[]; maxFee?: FieldElement; signature: FieldElement[]; nonce?: FieldElement; }; }; ``` **Properties** - `senderAddress`: the address of the account that will send the transaction. - `calldata`: the calldata of the transaction. - `maxFee`: the maximum fee for the transaction. - `signature`: the signature of the transaction. - `nonce`: the nonce of the transaction. ```ts export type ResourceBounds = { maxAmount?: bigint; maxPricePerUnit?: bigint; }; export type ResourceBoundsMapping = { l1Gas?: ResourceBounds; l2Gas?: ResourceBounds; }; export type InvokeTransactionV3 = { _tag: "invokeV3"; invokeV3: { senderAddress?: FieldElement; calldata: FieldElement[]; signature: FieldElement[]; nonce?: FieldElement; resourceBounds?: ResourceBoundsMapping; tip?: bigint; paymasterData: FieldElement[]; accountDeploymentData: FieldElement[]; nonceDataAvailabilityMode?: "l1" | "l2"; feeDataAvailabilityMode?: "l1" | "l2"; }; }; ``` **Properties** - `senderAddress`: the address of the account that will send the transaction. - `calldata`: the calldata of the transaction. - `signature`: the signature of the transaction. - `nonce`: the nonce of the transaction. - `resourceBounds`: the resource bounds of the transaction. - `tip`: the tip of the transaction. - `paymasterData`: the paymaster data of the transaction. - `accountDeploymentData`: the account deployment data of the transaction. - `nonceDataAvailabilityMode`: the nonce data availability mode of the transaction. - `feeDataAvailabilityMode`: the fee data availability mode of the transaction. ```ts export type L1HandlerTransaction = { _tag: "l1Handler"; l1Handler: { contractAddress?: FieldElement; entryPointSelector?: FieldElement; calldata: FieldElement[]; nonce?: bigint; }; }; ``` **Properties** - `contractAddress`: the address of the contract that will receive the call. - `entryPointSelector`: the selector of the function that will be called. - `calldata`: the calldata of the transaction. - `nonce`: the nonce of the transaction. ```ts export type DeployTransaction = { _tag: "deploy"; deploy: { contractAddressSalt?: FieldElement; constructorCalldata: FieldElement[]; classHash?: FieldElement; }; }; ``` **Properties** - `contractAddressSalt`: the salt used to compute the contract address. - `constructorCalldata`: the calldata used to initialize the contract. - `classHash`: the class hash of the contract. ```ts export type DeclareTransactionV0 = { _tag: "declareV0"; declareV0: { senderAddress?: FieldElement; maxFee?: FieldElement; signature: FieldElement[]; classHash?: FieldElement; }; }; ``` **Properties** - `senderAddress`: the address of the account that will send the transaction. - `maxFee`: the maximum fee for the transaction. - `signature`: the signature of the transaction. - `classHash`: the class hash of the contract. ```ts export type DeclareTransactionV1 = { _tag: "declareV1"; declareV1: { senderAddress?: FieldElement; maxFee?: FieldElement; signature: FieldElement[]; classHash?: FieldElement; nonce?: FieldElement; }; }; ``` **Properties** - `senderAddress`: the address of the account that will send the transaction. - `maxFee`: the maximum fee for the transaction. - `signature`: the signature of the transaction. - `classHash`: the class hash of the contract. - `nonce`: the nonce of the transaction. ```ts export type DeclareTransactionV2 = { _tag: "declareV2"; declareV2: { senderAddress?: FieldElement; maxFee?: FieldElement; signature: FieldElement[]; classHash?: FieldElement; nonce?: FieldElement; compiledClassHash?: FieldElement; }; }; ``` **Properties** - `senderAddress`: the address of the account that will send the transaction. - `maxFee`: the maximum fee for the transaction. - `signature`: the signature of the transaction. - `classHash`: the class hash of the contract. - `nonce`: the nonce of the transaction. - `compiledClassHash`: the compiled class hash of the contract. ```ts export type ResourceBounds = { maxAmount?: bigint; maxPricePerUnit?: bigint; }; export type ResourceBoundsMapping = { l1Gas?: ResourceBounds; l2Gas?: ResourceBounds; }; export type DeclareTransactionV3 = { _tag: "declareV3"; declareV3: { senderAddress?: FieldElement; maxFee?: FieldElement; signature: FieldElement[]; classHash?: FieldElement; nonce?: FieldElement; compiledClassHash?: FieldElement; resourceBounds?: ResourceBoundsMapping; tip?: bigint; paymasterData: FieldElement[]; accountDeploymentData: FieldElement[]; nonceDataAvailabilityMode?: "l1" | "l2"; feeDataAvailabilityMode?: "l1" | "l2"; }; }; ``` **Properties** - `senderAddress`: the address of the account that will send the transaction. - `maxFee`: the maximum fee for the transaction. - `signature`: the signature of the transaction. - `classHash`: the class hash of the contract. - `nonce`: the nonce of the transaction. - `compiledClassHash`: the compiled class hash of the contract. - `resourceBounds`: the resource bounds of the transaction. - `tip`: the tip of the transaction. - `paymasterData`: the paymaster data of the transaction. - `accountDeploymentData`: the account deployment data of the transaction. - `nonceDataAvailabilityMode`: the nonce data availability mode of the transaction. - `feeDataAvailabilityMode`: the fee data availability mode of the transaction. ```ts export type DeployAccountTransactionV1 = { _tag: "deployAccountV1"; deployAccountV1: { maxFee?: FieldElement; signature: FieldElement[]; nonce?: FieldElement; contractAddressSalt?: FieldElement; constructorCalldata: FieldElement[]; classHash?: FieldElement; }; }; ``` **Properties** - `maxFee`: the maximum fee for the transaction. - `signature`: the signature of the transaction. - `nonce`: the nonce of the transaction. - `contractAddressSalt`: the salt used to compute the contract address. - `constructorCalldata`: the calldata used to initialize the contract. - `classHash`: the class hash of the contract. ```ts export type DeployAccountTransactionV3 = { _tag: "deployAccountV3"; deployAccountV3: { signature: FieldElement[]; nonce?: FieldElement; contractAddressSalt?: FieldElement; constructorCalldata: FieldElement[]; n; classHash?: FieldElement; resourceBounds?: ResourceBoundsMapping; tip?: bigint; paymasterData: FieldElement[]; nonceDataAvailabilityMode?: "l1" | "l2"; feeDataAvailabilityMode?: "l1" | "l2"; }; }; ``` **Properties** - `signature`: the signature of the transaction. - `nonce`: the nonce of the transaction. - `contractAddressSalt`: the salt used to compute the contract address. - `constructorCalldata`: the calldata used to initialize the contract. - `classHash`: the class hash of the contract - `resourceBounds`: the resource bounds of the transaction. - `tip`: the tip of the transaction. - `paymasterData`: the paymaster data of the transaction. - `nonceDataAvailabilityMode`: the nonce data availability mode of the transaction. - `feeDataAvailabilityMode`: the fee data availability mode of the transaction. ### Transaction receipt The receipt of a transaction contains information about the execution of the transaction. ```ts export type TransactionReceipt = { filterIds: number[]; meta?: TransactionReceiptMeta; receipt?: | InvokeTransactionReceipt | L1HandlerTransactionReceipt | DeclareTransactionReceipt | DeployTransactionReceipt | DeployAccountTransactionReceipt; }; export type TransactionReceiptMeta = { transactionIndex?: number; transactionHash?: FieldElement; actualFee?: FeePayment; executionResources?: ExecutionResources; executionResult?: ExecutionSucceeded | ExecutionReverted; }; export type InvokeTransactionReceipt = { _tag: "invoke"; invoke: {}; }; export type L1HandlerTransactionReceipt = { _tag: "l1Handler"; l1Handler: { messageHash?: Uint8Array; }; }; export type DeclareTransactionReceipt = { _tag: "declare"; declare: {}; }; export type DeployTransactionReceipt = { _tag: "deploy"; deploy: { contractAddress?: FieldElement; }; }; export type DeployAccountTransactionReceipt = { _tag: "deployAccount"; deployAccount: { contractAddress?: FieldElement; }; }; export type ExecutionSucceeded = { _tag: "succeeded"; succeeded: {}; }; export type ExecutionReverted = { _tag: "reverted"; reverted: { reason: string; }; }; export type FeePayment = { amount?: FieldElement; unit?: "wei" | "strk"; }; ``` **Relevant filters** - `filter.transactions[].includeReceipt` - `filter.events[].includeReceipt` - `filter.messages[].includeReceipt` ### Message to L1 A message to L1 is sent by a transaction. ```ts export type MessageToL1 = { filterIds: number[]; fromAddress?: FieldElement; toAddress?: FieldElement; payload: FieldElement[]; messageIndex?: number; transactionIndex?: number; transactionHash?: FieldElement; transactionStatus?: "succeeded" | "reverted"; }; ``` **Properties** - `fromAddress`: the address of the contract that sent the message. - `toAddress`: the address of the contract that received the message. - `payload`: the payload of the message. - `messageIndex`: the index of the message in the block. - `transactionIndex`: the index of the transaction that sent the message. - `transactionHash`: the hash of the transaction that sent the message. - `transactionStatus`: the status of the transaction that sent the message. **Relevant filters** - `filter.messages` - `filter.transactions[].includeMessages` - `filter.events[].includeMessages` ### Storage diff A storage diff is a change to the storage of a contract. ```ts export type StorageDiff = { filterIds: number[]; contractAddress?: FieldElement; storageEntries: StorageEntry[]; }; export type StorageEntry = { key?: FieldElement; value?: FieldElement; }; ``` **Properties** - `contractAddress`: the contract whose storage changed. - `storageEntries`: the storage entries that changed. - `key`: the key of the storage entry that changed. - `value`: the new value of the storage entry that changed. **Relevant filters** - `filter.storageDiffs` ### Contract change A change in the declared or deployed contracts. ```ts export type ContractChange = { filterIds: number[]; change?: DeclaredClass | ReplacedClass | DeployedContract; }; export type DeclaredClass = { _tag: "declaredClass"; declaredClass: { classHash?: FieldElement; compiledClassHash?: FieldElement; }; }; export type ReplacedClass = { _tag: "replacedClass"; replacedClass: { contractAddress?: FieldElement; classHash?: FieldElement; }; }; export type DeployedContract = { _tag: "deployedContract"; deployedContract: { contractAddress?: FieldElement; classHash?: FieldElement; }; }; ``` **Relevant filters** - `filter.contractChanges` ### Nonce update A change in the nonce of a contract. ```ts export type NonceUpdate = { filterIds: number[]; contractAddress?: FieldElement; nonce?: FieldElement; }; ``` **Properties** - `contractAddress`: the address of the contract whose nonce changed. - `nonce`: the new nonce of the contract. **Relevant filters** - `filter.nonceUpdates`