This is an indexing layer for Starknet written in Golang that operates on top of the Node API and stores data in a Postgres database.
It can be used in multiple ways and for various purposes:
What you can build with DipDup:
Check out the repository wiki to learn more about the indexer internals:
Also check out the cmd/rpc_tester folder with simple events indexers for Starknet.ID and Loot Survivor.
Public deployments with reasonable rate limits are available for testing and prototyping:
https://starknet-mainnet-gql.dipdup.net/v1/graphql
Querying token balances for a given account.
query GetTokenBalances {
token_balance(
where: {owner: {hash: {_eq: "\\x06ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678"}}}
) {
owner_id
balance
token {
metadata
id
type
contract {
hash
}
}
}
}
Few things to note:
owner_id
\\x
(instead of usual 0x
)1 - ERC20 | 2 - ERC721 | 3 - ERC1155
Querying messages and l1_handler
operations for the StarkGate contract.
query GetStarkGateMessages {
message(
where: {contract: {hash: {_eq: "\\x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82"}}}
order_by: {id: desc}
limit: 5
) {
payload
time
to {
hash
}
}
l1_handler(
where: {contract: {hash: {_eq: "\\x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82"}}}
order_by: {id: desc}
limit: 5
) {
parsed_calldata
time
status
entrypoint
}
}
Notes on the response:
message.to.hash
field – those are Ethereum L1 addressesl1_handler.parsed_calldata
is the original calldata (also available) decoded according with the ABI provided by the sequencer node APIl1_handler.status
is also an enum, check out the docstrings/wiki for details unknown - 1 , not received - 2 , received - 3 , pending - 4 , rejected - 5 , accepted on l2 - 6 , accepted on l1 - 7
Querying Starknet.ID events.
query GetStarknetIDs {
event(
where: {contract: {hash: {_eq: "\\x06ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678"}}, name: {_eq: "domain_to_addr_update"}}
limit: 20
order_by: {id: desc}
) {
parsed_data
time
}
}
query GetSithSwapTransfers {
transfer(
where: {to: {class: {hash: {_eq: "\\x07eb597ad7d9ba28ea1db162cdb99e265fe22bcb00e9b690e188c2203de9e005"}}}}
limit: 50
order_by: {id: desc}
) {
amount
from {
hash
}
to {
hash
}
token_id
contract {
hash
}
time
}
}
Querying execution trace for a SithSwap swap.
query GetExecutionTrace {
internal_tx(
where: {hash: {_eq: "\\x07563ba09f924376edfdaf94b11941680867993d9caf271ae791ff4e89740177"}}
order_by: {id: asc}
) {
parsed_calldata
parsed_result
entrypoint
caller {
hash
}
call_type
contract {
hash
}
}
}
DipDup Vertical for Starknet is a federated API including the following services:
Project is supported by Starkware and Starknet Foundation via OnlyDust platform