Skip to content

Database structure

Artem Poltorzhitskiy edited this page May 9, 2023 · 2 revisions

Database documentation

token_balance
Name Type Description
owner_id bigint Identity of owner address
contract_id bigint Identity of contract address
token_id numeric Token id
balance numeric Token balance
class
Name Type Description
id bigint Unique internal identity
type bigint Class type. It’s a binary mask.
hash bytea Class hash
abi bytea Class abi in a raw
height bigint Block height of the first class occurance
cairo smallint Cairo version of class
deploy
Name Type Description
id bigint Unique internal identity
height bigint Block height
class_id bigint Class id
contract_id bigint Contract address id
position bigint Order in block
time timestamp with time zone Time of block
status bigint
hash bytea Transaction hash
contract_address_salt bytea A random salt that determines the account address
constructor_calldata ARRAY Raw constructor calldata
parsed_calldata jsonb Calldata parsed according to contract ABI
dipdup_head_status
Name Type Description
name text
status text
last_time timestamp with time zone
last_height bigint
event
Name Type Description
id bigint Unique internal identity
height bigint Block height
time timestamp with time zone Time of block
invoke_id bigint Parent invoke id
declare_id bigint Parent declare id
deploy_id bigint Parent deploy id
deploy_account_id bigint Parent deploy account id
l1_handler_id bigint Parent l1 handler id
fee_id bigint Parent fee invocation id
internal_id bigint Parent internal transaction id
order bigint Order in block
contract_id bigint Contract address id
from_id bigint From address id
keys ARRAY Raw event keys
data ARRAY Raw event data
name text Event name
parsed_data jsonb Event data parsed according to contract ABI
block
Name Type Description
id bigint Unique internal identity
height bigint The number (height) of this block
time timestamp with time zone The time the sequencer created this block before executing transactions
version text The version of the Starknet protocol used when creating this block
tx_count bigint Transactions count in block
invoke_count bigint Ivokes count in block
declare_count bigint Declares count in block
deploy_count bigint Deploys count in block
deploy_account_count bigint Deploy accounts count in block
l1_handler_count bigint L1 handlers count in block
storage_diff_count bigint Storage diffs count in block
status bigint Block status
hash bytea Block hash
parent_hash bytea The hash of this block’s parent
new_root bytea The state commitment after this block
sequencer_address bytea The Starknet address of the sequencer who created this block
declare
Name Type Description
id bigint Unique internal identity
height bigint Block height
class_id bigint Declared class id
version bigint Declare transaction version
position bigint Order in block
sender_id bigint Sender address id
contract_id bigint Contract address id
time timestamp with time zone Time of block
status bigint Status of block
hash bytea Transaction hash
max_fee numeric The maximum fee that the sender is willing to pay for the transaction
nonce numeric The transaction nonce
internal_tx
Name Type Description
id bigint Unique internal identity
height bigint Block height
time timestamp with time zone Time of block
invoke_id bigint Parent invoke id
declare_id bigint Parent declare id
deploy_id bigint Parent deploy id
deploy_account_id bigint Parent deploy account id
l1_handler_id bigint Parent l1 handler id
internal_id bigint Parent internal transaction id
class_id bigint Class id
caller_id bigint Caller address id
contract_id bigint Contract address id
status smallint Status in blockchain (unknown - 1 , not received - 2 , received - 3 . pending - 4 , rejected - 5 , accepted on l2 - 6 , accepted on l1 - 7 )
entrypoint_type smallint Entrypoint type (unknown - 1 , external - 2 , constructor - 3 , l1 handler - 4)
call_type smallint Call type (unknwown - 1 , call - 2 , delegate - 3)
hash bytea Transaction hash
selector bytea Called selector
entrypoint text Entrypoint name
result ARRAY Raw result
calldata ARRAY Raw calldata
parsed_calldata jsonb Calldata parsed according to contract ABI
parsed_result jsonb Result parsed according to contract ABI
storage_diff
Name Type Description
id bigint Unique internal identity
height bigint Block height
contract_id bigint Contract id which storage was changed
key bytea Storage key
value bytea Data
l1_handler
Name Type Description
id bigint Unique internal identity
height bigint Block height
time timestamp with time zone Time of block
status bigint Status in blockchain (unknown - 1 , not received - 2 , received - 3 , pending - 4 , rejected - 5 , accepted on l2 - 6 , accepted on l1 - 7 )
hash bytea Transaction hash
contract_id bigint Contract address id
position bigint Order in block
selector bytea Called selector
entrypoint text Entrypoint name
max_fee numeric The maximum fee that the sender is willing to pay for the transaction
nonce numeric The transaction nonce
call_data ARRAY Raw calldata
parsed_calldata jsonb Calldata parsed according to contract ABI
message
Name Type Description
id bigint Unique internal identity
height bigint Block height
time timestamp with time zone Time of block
invoke_id bigint Parent invoke id
declare_id bigint Parent declare id
deploy_id bigint Parent deploy id
deploy_account_id bigint Parent deploy account id
l1_handler_id bigint Parent l1 handler id
fee_id bigint Parent fee invocation id
internal_id bigint Parent internal transaction id
contract_id bigint Contract address id
order bigint Order in block
from_id bigint From address id
to_id bigint To address id
selector text Called selector
nonce numeric The transaction nonce
payload ARRAY Message payload
proxy
Name Type Description
id bigint Unique internal identity
contract_id bigint Proxy contract id
hash bytea Proxy contract hash
selector bytea Proxy contract selector (for modules)
entity_type smallint Entity type behind proxy (0 - class , 1 - contract)
entity_id bigint Entity id behind proxy
entity_hash bytea Entity hash behind proxy
token
Name Type Description
id bigint Unique internal identity
deploy_height bigint Block height when token was deployed
deploy_time timestamp with time zone Time of block when token was deployed
contract_id bigint Token contract id
owner_id bigint Token owner id
type smallint Token type (1 - ERC20 , 2 - ERC721 , 3 - ERC1155)
metadata jsonb Token metadata which was used as a constructor arguments
state
Name Type Description
id bigint Unique internal identity
name text
last_height bigint Last block height
last_time timestamp with time zone Time of last block
invokes_count bigint Total invokes count
deploys_count bigint Total deploys count
deploy_accounts_count bigint Total deploy accounts count
declares_count bigint Total declares count
l1_handlers_count bigint Total l1 handlers count
tx_count bigint Total transactions count
last_class_id bigint Last internal class id
last_address_id bigint Last internal address id
last_tx_id bigint Last internal transaction id
last_event_id bigint Last internal event id
transfer
Name Type Description
id bigint Unique internal identity
height bigint Block height
time timestamp with time zone Block time
contract_id bigint Token contract id
from_id bigint Id address which transfer from
to_id bigint Id address which transfer to
amount numeric Amount of transfer
token_id numeric Id token which was transferred
invoke_id bigint Parent invoke id
declare_id bigint Parent declare id
deploy_id bigint Parent deploy id
deploy_account_id bigint Parent deploy account id
l1_handler_id bigint Parent l1 handler id
fee_id bigint Parent fee invocation id
internal_id bigint Parent internal transaction id
address
Name Type Description
id bigint Unique internal identity
class_id bigint Class identity. It is NULL for ethereum addresses.
height bigint Block number of the first address occurrence.
hash bytea Address hash.
deploy_account
Name Type Description
id bigint Unique internal identity
height bigint Block height
class_id bigint Class id
contract_id bigint Contract address id
position bigint Order in block
time timestamp with time zone Time of block
status bigint
hash bytea Transaction hash
contract_address_salt bytea A random salt that determines the account address
max_fee numeric The maximum fee that the sender is willing to pay for the transaction
nonce numeric The transaction nonce
constructor_calldata ARRAY Raw constructor calldata
parsed_calldata jsonb Calldata parsed according to contract ABI
fee
Name Type Description
id bigint Unique internal identity
height bigint Block height
time timestamp with time zone Time of block
contract_id bigint Contract address id
caller_id bigint Caller address id
class_id bigint Class id
invoke_id bigint Parent invoke id
declare_id bigint Parent declare id
deploy_id bigint Parent deploy id
deploy_account_id bigint Parent deploy account id
l1_handler_id bigint Parent l1 handler id
entrypoint_type smallint Entrypoint type (unknown - 1 , external - 2 , constructor - 3 , l1 handler - 4)
call_type smallint Call type (unknwown - 1 , call - 2 , delegate - 3)
status smallint Status in blockchain (unknown - 1 , not received - 2 , received - 3 , pending - 4 , rejected - 5 , accepted on l2 - 6 , accepted on l1 - 7 )
selector bytea Called selector
entrypoint text Entrypoint name
calldata ARRAY Raw calldata
result ARRAY Raw result
parsed_calldata jsonb Calldata parsed according to contract ABI
invoke
Name Type Description
id bigint Unique internal identity
height bigint Block height
time timestamp with time zone Time of block
status bigint Status in blockchain (unknown - 1 , not received - 2 , received - 3 , pending - 4 , rejected - 5 , accepted on l2 - 6 , accepted on l1 - 7 )
hash bytea Transaction hash
version bigint Version of invoke transaction
position bigint Order in block
contract_id bigint Contract address id
entrypoint_selector bytea Called selector
entrypoint text Entrypoint name
max_fee numeric The maximum fee that the sender is willing to pay for the transaction
nonce numeric The transaction nonce
call_data ARRAY Raw calldata
parsed_calldata jsonb Calldata parsed according to contract ABI