Lens Chain BigQuery Schemas
Tables Schema of Lens Chain BigQuery.
addresses
This table stores information about all addresses on the network, including smart contracts.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| address | bytea | The blockchain address (in bytes format) | |
| bytecode | bytea | Contract bytecode for smart contract addresses | |
| createdInBlockNumber | bigint | Block number when this address was created | |
| creatorTxHash | bytea | Transaction hash that created this address | |
| creatorAddress | bytea | Address that created this address (contract deployer) | |
| createdInLogIndex | integer | Log index within the block where this address was created | |
| isEvmLike | boolean | Whether the address follows EVM address format |
blocks
This table contains information about each block in the blockchain.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Block number | |
| nonce | varchar | Block nonce value | |
| difficulty | integer | Mining difficulty at this block | |
| gasLimit | varchar(128) | Maximum gas allowed in this block | |
| gasUsed | varchar(128) | Total gas used by all transactions in this block | |
| baseFeePerGas | varchar(128) | Base fee per gas unit in this block | |
| l1BatchNumber | bigint | Layer 1 batch number that includes this block | |
| l1TxCount | integer | Number of L1 transactions in this block | |
| l2TxCount | integer | Number of L2 transactions in this block | |
| hash | bytea | Block hash | |
| parentHash | bytea | Hash of the parent block | |
| miner | bytea | Address of the miner/validator who produced this block | |
| extraData | bytea | Additional data included in the block | |
| timestamp | timestamp | Timestamp when the block was mined |
transactions
This table stores all transactions processed on the network.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Unique transaction identifier | |
| nonce | bigint | Transaction nonce (unique per sender address) | |
| transactionIndex | integer | Index position of transaction in the block | |
| gasLimit | varchar(128) | Maximum gas allowed for this transaction | |
| gasPrice | varchar(128) | Gas price in wei | |
| maxFeePerGas | varchar(128) | Maximum fee per gas (EIP-1559) | |
| maxPriorityFeePerGas | varchar(128) | Maximum priority fee per gas (EIP-1559) | |
| value | varchar(128) | Amount of cryptocurrency transferred | |
| chainId | integer | Chain identifier | |
| blockNumber | bigint | Block number where this transaction was included | |
| type | integer | Transaction type | |
| accessList | jsonb | Access list for EIP-2930 transactions | |
| l1BatchNumber | bigint | Layer 1 batch number that includes this transaction | |
| fee | varchar | Transaction fee | |
| isL1Originated | boolean | Whether the transaction originated from Layer 1 | |
| receivedAt | timestamp | Timestamp when the transaction was received by the network | |
| hash | bytea | Transaction hash | |
| to | bytea | Recipient address | |
| from | bytea | Sender address | |
| data | bytea | Transaction data/input | |
| blockHash | bytea | Hash of the block containing this transaction | |
| receiptStatus | integer | Transaction receipt status (1 = success, 0 = failure) | |
| gasPerPubdata | varchar | Gas per public data | |
| error | varchar | Error message if the transaction failed | |
| revertReason | varchar | Reason for transaction reversion if applicable |
transactionReceipts
This table contains the receipts generated after transaction execution.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Unique receipt identifier | |
| transactionIndex | integer | Index position of transaction in the block | |
| type | integer | Receipt type | |
| gasUsed | varchar(128) | Amount of gas used by this transaction | |
| effectiveGasPrice | varchar(128) | Effective gas price for this transaction | |
| blockNumber | bigint | Block number containing this transaction | |
| cumulativeGasUsed | varchar(128) | Cumulative gas used up to this transaction in the block | |
| byzantium | boolean | Whether the receipt uses Byzantium format | |
| status | integer | Transaction status code | |
| transactionHash | bytea | Hash of the transaction | |
| to | bytea | Recipient address | |
| from | bytea | Sender address | |
| contractAddress | bytea | Address of newly created contract, if applicable | |
| root | bytea | State root (pre-Byzantium) | |
| logsBloom | bytea | Bloom filter for indexed event logs | |
| blockHash | bytea | Hash of the block containing this transaction |
logs
This table stores event logs emitted during transaction execution.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Unique log identifier | |
| blockNumber | bigint | Block number containing this log | |
| transactionIndex | integer | Index position of transaction in the block | |
| removed | boolean | Whether the log was removed due to chain reorganization | |
| logIndex | integer | Index position of log in the transaction | |
| transactionHash | bytea | Hash of the transaction that generated this log | |
| address | bytea | Address that generated this log | |
| data | bytea | Non-indexed log parameters | |
| topics | ARRAY | Indexed log topics | |
| timestamp | timestamp | Timestamp of the block containing this log |
transfers
This table records all asset transfers that occur on the network.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Unique transfer identifier | |
| blockNumber | bigint | Block number containing this transfer | |
| amount | varchar(128) | Amount transferred | |
| type | USER-DEFINED | Transfer type | |
| fields | jsonb | Additional fields specific to this transfer | |
| from | bytea | Sender address | |
| to | bytea | Recipient address | |
| transactionHash | bytea | Hash of the transaction that caused this transfer | |
| tokenAddress | bytea | Address of the token being transferred | |
| logIndex | integer | Index position of the log that recorded this transfer | |
| transactionIndex | integer | Index position of transaction in the block | |
| timestamp | timestamp | Timestamp of the block containing this transfer | |
| isFeeOrRefund | boolean | Whether this transfer is a fee payment or refund | |
| isInternal | boolean | Whether this is an internal transfer | |
| tokenType | USER-DEFINED | Type of token being transferred |
addressTransfers
This table maps addresses to their transfers for efficient querying.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Unique record identifier | |
| transferNumber | bigint | Reference to the transfer.number | |
| address | bytea | The address involved in the transfer | |
| blockNumber | bigint | Block number containing this transfer | |
| timestamp | timestamp | Timestamp of the block containing this transfer | |
| isFeeOrRefund | boolean | Whether this transfer is a fee payment or refund | |
| logIndex | integer | Index position of the log that recorded this transfer | |
| tokenAddress | bytea | Address of the token being transferred | |
| fields | jsonb | Additional fields specific to this transfer | |
| isInternal | boolean | Whether this is an internal transfer | |
| tokenType | USER-DEFINED | Type of token being transferred | |
| type | USER-DEFINED | Transfer type |
addressTransactions
This table maps addresses to transactions for efficient querying.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Unique record identifier | |
| transactionHash | bytea | Transaction hash | |
| address | bytea | Address involved in the transaction | |
| blockNumber | bigint | Block number containing this transaction | |
| receivedAt | timestamp | Timestamp when the transaction was received | |
| transactionIndex | integer | Index position of transaction in the block |
tokens
This table stores information about tokens on the network.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Unique token identifier | |
| symbol | varchar | Token symbol | |
| name | varchar | Token name | |
| decimals | integer | Number of decimal places | |
| blockNumber | bigint | Block number when this token was created | |
| l2Address | bytea | Layer 2 address of this token | |
| l1Address | bytea | Layer 1 address of this token | |
| transactionHash | bytea | Hash of the transaction that created this token | |
| logIndex | integer | Index position of the log that recorded this token creation | |
| usdPrice | double precision | Current USD price | |
| liquidity | double precision | Token liquidity | |
| iconURL | varchar | URL to token icon | |
| offChainDataUpdatedAt | timestamp | Timestamp when off-chain data was last updated |
balances
This table tracks token balances for addresses.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| address | bytea | Owner address | |
| tokenAddress | bytea | Token address | |
| blockNumber | bigint | Block number at which this balance was recorded | |
| balance | varchar(128) | Token balance amount |
batches
This table stores information about Layer 2 batch processing for rollups.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| number | bigint | Batch number | |
| rootHash | bytea | Root hash of the batch | |
| l1GasPrice | varchar(128) | Layer 1 gas price at the time of this batch | |
| l2FairGasPrice | varchar(128) | Layer 2 fair gas price for this batch | |
| commitTxHash | bytea | Hash of the transaction that committed this batch | |
| committedAt | timestamp | Timestamp when this batch was committed | |
| proveTxHash | bytea | Hash of the transaction that proved this batch | |
| provenAt | timestamp | Timestamp when this batch was proven | |
| executeTxHash | bytea | Hash of the transaction that executed this batch | |
| executedAt | timestamp | Timestamp when this batch was executed | |
| l1TxCount | integer | Number of Layer 1 transactions in this batch | |
| l2TxCount | integer | Number of Layer 2 transactions in this batch | |
| timestamp | timestamp | Timestamp of the batch |
counterStates
This table tracks the processing state of various tables for synchronization purposes.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| tableName | varchar(64) | Name of the table being tracked | |
| lastProcessedRecordNumber | bigint | Last processed record number |
counters
This table maintains various counters for database operations.
| Column | Type | Description | |
|---|---|---|---|
| createdAt | timestamp | Timestamp when this record was created | |
| updatedAt | timestamp | Timestamp when this record was last updated | |
| id | uuid | Unique counter identifier | |
| count | bigint | Current counter value | |
| tableName | varchar(64) | Table this counter is associated with | |
| queryString | varchar | Query string used for this counter |