An indexer for Zilliqa Stakers built with Subsquid SDK. This
indexer specifically targets the Deposit
contract.
Environment Variable | Description |
---|---|
ETH_RPC_URL |
URL of the Zilliqa JSON RPC endpoint |
ETH_RPC_BLOCKS_BATCH_SIZE |
Number of blocks to fetch in each batch |
CONTRACT_ADDRESS |
Address of the target contract |
FROM_BLOCK_NUMBER |
Block number to start indexing from |
DB_URL |
URL of the PostgreSQL database |
-
Create a
.env
file: Include the required environment variables as mentioned above. For the prototestnet, an example.env
file looks like this:ETH_RPC_URL=https://api.zq2-prototestnet.zilliqa.com ETH_RPC_BLOCKS_BATCH_SIZE=10000 CONTRACT_ADDRESS=0x00000000005A494C4445504F53495450524F5859 FROM_BLOCK_NUMBER=7522968 DB_URL=postgresql://postgres:postgres@localhost:5432/zilliqa
-
Run the Docker container:
docker run --env-file .env ghcr.io/blockscout/zilliqa-stakers-squid:0.1.0
Note: Replace
0.1.0
with the desired version tag.
For development setup, refer to the development environment setup guide.
If you use the Nix package manager, the provided flake.nix
can simplify
the setup. Using direnv will automatically configure your environment.
If you modify the graphql.schema
, you need to regenerate the
TypeORM classes:
npx squid-typeorm-codegen
Note: The schema must comply with the zilliqa_stakers
schema defined in
the Blockscout backend. See the Explorer.Chain.Zilliqa.Staker
module and the
corresponding migrations in apps/explorer/priv/zilliqa/migrations
1.
-
Create a
.env
file: Include the required environment variables as mentioned above. -
Compile the application:
npx tsc
-
Run the indexer:
node -r dotenv/config lib/main.js
Footnotes
-
Refer to the
Explorer.Chain.Zilliqa.Staker
module and corresponding migrations inapps/explorer/priv/zilliqa/migrations
. ↩