Schema

This page describes the Sort databases, tables and columns you'll use to query your contract data.

Databases

NameDescription
ethereumDatabase for decoded Ethereum transactions
goerliDatabase for decoded Goerli (Ethereum testnet) transactions
polygonDatabase for decoded Polygon transactions

Example

select * from ethereum.block limit 1; -- or polygon.block or goerli.block

Tables

block

The block table stores information about .. yep, the indexed block.

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
block_hashVARCHAR66NOT NULL UNIQUE
block_numberINTEGERNOT NULLCan change for block re-orgs
chainVARCHAR16NOT NULL"ethereum", "polygon" or "goerli"
context_idUUIDNOT NULLInternal use. Will likely be removed in the future.
num_transactionsINT4Number of transactions sort parsed in the block
parent_block_hashVARCHAR66null if during a block re-org or partial transaction index
timestampTIMESTAMPNOT NULL

transaction

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
transaction_hashVARCHAR66NOT NULL UNIQUE
block_idUUIDNOT NULLFK constraint to block.id
fromVARCHAR42NOT NULL
toVARCHAR42NOT NULL
historicalBOOLNOT NULL
valueNUMERICNOT NULLIn wei
gas_limitNUMERIC
gas_priceNUMERIC
gas_usedNUMERIC
max_fee_per_gasNUMERIC
max_priority_fee_per_gasNUMERIC
priority_fee_per_gasNUMERIC
functionVARCHARNOT NULLABI parsed function name
paramsJSONBNOT NULLABI parsed parameters for function
nonceNUMERICNOT NULL
context_idUUIDNOT NULLInternal use. Will likely be removed in the future.
parse_successfulBOOLNOT NULLInternal use. Will likely be removed in the future.

transaction_log

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
transaction_idUUIDNOT NULLFK constraint to transaction.id
contract_addressVARCHAR42NOT NUL
indexINT4NOT NULL
eventVARCHARNOT NULLABI-parsed name of the event log
paramsJSONBNOT NULLABI-parsed event log parameters

transaction_log_param

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
transaction_log_idUUIDNOT NULLFK constraint to transaction_log.id
eventVARCHARNOT NULLSignature of emitting event
pathVARCHARNOT NULLName of parameter in for this transaction_log_param entry
bool_valBOOLValue from the transaction log for this parameter in BOOL format
num_valNUMERICValue from the transaction log for this parameter in NUMERIC format
bin_valBYTEAValue from the transaction log for this parameter in BYTEA format
str_valTEXTValue from the transaction log for this parameter in TEXT format

transaction_param

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
transaction_idUUIDNOT NULLFK constraint to transaction.id
functionVARCHARNOT NULL
pathVARCHARNOT NULLName of parameter in for this transaction_param entry
bool_valBOOLValue from the transaction log for this parameter in BOOL format
num_valNUMERICValue from the transaction log for this parameter in NUMERIC format
bin_valBYTEAValue from the transaction log for this parameter in BYTEA format
str_valTEXTValue from the transaction log for this parameter in TEXT format

nft_metadata

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
last_updated_transaction_idUUIDNOT NULLTransaction ID this was last updated in. See also transaction.id
contract_addressVARCHAR42NOT NULL
token_idINT8NOT NULLERC721 tokenId
nameVARCHAR200ERC721 Metadata JSON Schema name field
descriptionVARCHAR1000ERC721 Metadata JSON Schema description field
image_uriVARCHAR1000ERC721 Metadata JSON Schema image field
metadata_contentJSONBNOT NULLContent of the ERC721 Metadata JSON call for tokenUri in JSON format
last_updatedTIMESTAMPNOT NULLRecord last updated time
token_uriVARCHAR2000NOT NULLtokenUri() in ERC721Metadata for this tokenId

contract_method_execution

See Timed Contract Function Calls

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
contract_addressVARCHAR42NOT NULLThe contract on which the method was executed.
methodVARCHARNOT NULLThe name of the executed contract method. Based on ABI stored in ABI table.
timestampTIMESTAMPNOT NULLTime the method was executed (not the block timestamp).
paramsJSONBJSON encoded parameters passed to the method, if any.
resultJSONBJSON-encoded result. See also the contract_method_execution_result table which provides these same results in a format which may be easier to work with in SQL.
block_numberINT4NOT NULLBlock number this was fired off in. See also block.block_number.

contract_method_execution_result

See Timed Contract Function Calls

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
contract_method_execution_idUUIDNOT NULLForeign key constraint to contract_method_execution.id
pathVARCHARNOT NULLThe JSON path to the value represented by this row.
bool_valBOOLValue located at path from the execution for this parameter in BOOL format
num_valNUMERICValue from the execution for this parameter in NUMERIC format
bin_valBYTEAValue from the execution for this parameter in BYTEA format
str_valTEXTValue from the execution for this parameter in TEXT format

abi

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
contract_addressVARCHAR42NOT NULL
interfaceJSONBNOT NULL
decimalsNUMERICIf this is an ERC-20 token, ERC-20's decimals field
symbolVARCHAR64If this is an ERC-20 token, ERC-20's symbol field
nameVARCHAR64If this is an ERC-20 token, ERC-20's name field

abi_hash

ColumnTypeLengthDefaultConstraintsDescription
idUUIDgen_random_uuid()NOT NULL
abi_idUUIDNOT NULLFK constraint to abi
event_sig_hashVARCHAR66NOT NULLThe full event/function sig hash (not just 4 bytes) of the abi
inputsJSONBNOT NULLInput surface (parameters) as JSON-encoded format.
nameVARCHAR64NOT NULLName of function/variable/event
typeVARCHAR32NOT NULLType of ABI item (error, constructor, function, fallback, receive, event)
anonymousBOOL