How to Index Elysium and Build an API for Any Contract

- We turn a contract on Elysium into a live GraphQL API with HyperIndex and host it on Envio Cloud. HyperSync has Elysium's full history, so there's no node or archive RPC to run.
- The example is WHYPE, Elysium's wrapped HYPE. Swap in your own contract's ABI and address and the steps are the same.
- WHYPE is a proxy, so step 1 fetches the implementation's ABI and keeps just the standard
Transferevent beforeenvio initgenerates the project. - Current HyperIndex releases have Elysium built in, so there's nothing to configure for the data source. Pin the version in
envio init, as shown below. - Hand the build to your coding agent with our prompt, written from the finished indexer.
Your frontend, dashboard or bot on Elysium will sooner or later need your contract's history as something it can query. You can run an archive node, loop eth_getLogs against a shared RPC, or use an indexer. We built an indexer, and checked every number it produced against HyperSync before writing this up.
Elysium is a general purpose L2 for Hyperliquid, built by Kinetiq. It settles to HyperEVM, uses HYPE for gas and makes blocks every 100ms, according to its docs.
In this tutorial, you'll take WHYPE, Elysium's wrapped HYPE, from its ABI to a hosted GraphQL API with Envio's HyperIndex. You'll scaffold the indexer, write and test a handler that tracks every transfer, run it locally, and deploy it on Envio Cloud. The same steps work for any contract on Elysium, and we explain the choices we made along the way.
You'll need Node.js 22.15 or newer, pnpm, jq, Docker for the local run, the GitHub CLI (gh) for the deploy, and a free Envio API token.
Elysium RPC, Chain ID and Explorer
| Property | Value |
|---|---|
| Chain ID | 99901 (mainnet), 99801 (testnet) |
| Stack | Arbitrum Orbit L2, settling to HyperEVM |
| Gas token | HYPE |
| HyperSync | https://elysium.hypersync.xyz or https://99901.hypersync.xyz |
| HyperRPC (read only) | https://elysium.rpc.hypersync.xyz or https://99901.rpc.hypersync.xyz |
| Public RPC | https://rpc.elysium.kinetiq.xyz |
| Explorer | elysium.kinetiq.xyz/explorer |
The chain ID, public RPC and explorer come from Elysium's connection docs. HyperSync and HyperRPC both have Elysium's full history from block 0, and both need a free Envio API token.
What We're Building
WHYPE lives at 0xbA876237B0F021A6c6D852d6c26E107997cC5E81. Wrapping HYPE mints WHYPE as a transfer from the zero address, and unwrapping burns it as a transfer to the zero address, so one event covers everything. The indexer keeps two things.
Account, one row per holder, with how much WHYPE came in and went out since the start blockTotals, the running count of transfers and how much HYPE was wrapped and unwrapped
It's busy. In the roughly 100,000 blocks before we wrote this, WHYPE logged 78,669 transfers.
Build It With Your Coding Agent
If you'd rather hand this to a coding agent, the prompt below comes from the finished indexer. Give the agent our current docs first, so it works from live syntax rather than memory.
claude mcp add --transport http envio-docs https://docs.envio.dev/mcp
Cursor and VS Code use the same endpoint, and an agent with shell access can use envio tools search-docs instead. Both are on the MCP server page. Once envio init has run, the project also carries Envio's agent skills in .claude/skills, so Claude Code opened in that folder already knows HyperIndex. To build it yourself, skip to the steps.
Show the full prompt
Build me an Envio HyperIndex indexer for WHYPE transfers on Elysium (chain ID
99901), then get it ready to deploy on Envio Cloud.
Before writing code, read the current HyperIndex docs rather than working from
memory. Use the envio-docs MCP server (docs_search, docs_fetch) if you have it,
otherwise `envio tools search-docs <query>`. Look up the configuration file,
schema, event handlers and testing.
THE CONTRACT
WHYPE on Elysium is a proxy at 0xbA876237B0F021A6c6D852d6c26E107997cC5E81.
Index its standard Transfer(address indexed from, address indexed to,
uint256 value) event. Mints (wraps) come from the zero address and burns
(unwraps) go to it.
SETUP
Use Node.js 22.15 or newer, pnpm and Docker. Pin the HyperIndex version, since
`pnpx envio init` without one can install a release that doesn't know
Elysium. WHYPE is a proxy, so fetch the implementation's ABI and keep only the
standard Transfer event:
IMPL=$(curl -s "https://elysium.kinetiq.xyz/api?module=contract&action=getsourcecode&address=0xbA876237B0F021A6c6D852d6c26E107997cC5E81" \
| jq -r '.result[0].Implementation')
curl -s "https://elysium.kinetiq.xyz/api?module=contract&action=getabi&address=$IMPL" \
| jq '.result | fromjson | map(select(.type == "event" and .name == "Transfer" and (.inputs | length) == 3))' > WHYPE.json
export ENVIO_API_TOKEN=<token from https://envio.dev/app/api-tokens>
pnpx envio@3.19.0 init contract-import local -d elysium-whype \
-n elysium-whype -l typescript -a ./WHYPE.json --contract-name WHYPE \
-b 99901 -c 0xbA876237B0F021A6c6D852d6c26E107997cC5E81 \
--single-contract --all-events
init saves the token to .env, and the generated .gitignore keeps .env out of
git. Never print the token or commit it.
TRAPS
- Index Transfer(address indexed from, address indexed to, uint256 value).
WHYPE's ABI also declares a Transfer with a bytes data field. It only comes
from transferAndCall, which also emits the standard Transfer, so indexing
both would double count. Keep it out of the ABI you give init.
- HyperSync is Elysium's default data source, so config.yaml needs no rpc or
hypersync_config block. If codegen fails with "Failed to automatically find
HyperSync endpoint for the chain 99901", the HyperIndex version is too old.
Upgrade to envio 3.19.0 or later (pnpm add envio@3.19.0). npm's latest tag
still points at 3.17.1, so envio@latest doesn't fix it.
- Set start_block to about 30,000 blocks (roughly an hour) behind the head.
Get the head with `curl -s https://elysium.hypersync.xyz/height`, which
needs no token. Don't hardcode an old block: WHYPE logs hundreds of
thousands of transfers a day, and the free Development plan on Envio Cloud
has a 100,000 events processed soft limit.
- Neither codegen nor dev typechecks. Run `pnpm exec tsc --noEmit`.
- Simulated test events need block numbers at or after start_block, or the
test indexer filters them out. Move them whenever start_block changes.
WHAT TO STORE
Account (id, netChange, transfersIn, transfersOut) for every non-zero address,
and Totals (transfers, wrapped, unwrapped, lastBlock). Call it netChange, not
balance, because anything held before start_block is invisible. Lowercase
addresses before using them as ids.
DEPLOY
Push the project to a new GitHub repository without .env. A person then signs
in at https://envio.dev/app/login and installs the Envio Deployments GitHub App
on that repository. After that, follow
https://docs.envio.dev/docs/HyperIndex/envio-cloud-cli#deploy-from-an-agent-or-ci
to add the indexer and deploy it with the envio-cloud CLI.
REPORT BACK
Report the block range you synced, the events processed, the Totals row and
the GraphQL endpoint if you deployed. Check the transfer count against
HyperSync for the same range. Give the numbers you actually got.
Index Elysium Step by Step
You need Node.js 22.15 or newer, pnpm, jq and Docker for the local run, plus the GitHub CLI for the deploy. The quickstart lists the prerequisites.
1. Get the ABI
The first thing we noticed was that asking Elysium's explorer for WHYPE's ABI gave us three admin events and nothing about transfers. WHYPE is a proxy, so the ABI you want belongs to its implementation contract. We ask the explorer's API for the implementation address, then fetch that contract's ABI. The indexer still listens to the proxy's address, since that's where the events come from.
Reading the implementation's ABI, we found WHYPE is also a bridged token that declares two Transfer events. One is the standard ERC-20 Transfer(from, to, value). The other adds a bytes data field and only comes from transferAndCall, which emits the standard Transfer as well, so indexing both would count those transfers twice. We only want the standard one, so the jq filter keeps just that event, and envio init generates exactly what we index.
mkdir elysium-indexer && cd elysium-indexer
IMPL=$(curl -s "https://elysium.kinetiq.xyz/api?module=contract&action=getsourcecode&address=0xbA876237B0F021A6c6D852d6c26E107997cC5E81" \
| jq -r '.result[0].Implementation')
curl -s "https://elysium.kinetiq.xyz/api?module=contract&action=getabi&address=$IMPL" \
| jq '.result | fromjson | map(select(.type == "event" and .name == "Transfer" and (.inputs | length) == 3))' > WHYPE.json
For your own contract, the build output from Foundry or Hardhat works too.
2. Scaffold the Indexer
Current HyperIndex releases have Elysium built in, but pnpx envio init without a version can still install one that doesn't, so pin it. Set your API token first, and init saves it to .env for local runs.
export ENVIO_API_TOKEN=your-token-here
pnpx envio@3.19.0 init contract-import local \
-d elysium-whype -n elysium-whype -l typescript \
-a ./WHYPE.json --contract-name WHYPE \
-b 99901 -c 0xbA876237B0F021A6c6D852d6c26E107997cC5E81 \
--single-contract --all-events
cd elysium-whype
Init writes config.yaml with the Transfer event, schema.graphql, a handler in src/handlers/WHYPE.ts and a starter test, then installs dependencies and runs codegen. It also drops 17 Envio agent skills into .claude/skills, covering config, schema, handlers, testing, performance and the Envio Cloud CLI.
3. Set the Start Block
Open config.yaml. Init already has the right event and address, so the only change is start_block. WHYPE is busy, making hundreds of thousands of transfers a day, so start about an hour behind the head to keep the first sync small. HyperSync's height endpoint works without a token.
START=$(( $(curl -s https://elysium.hypersync.xyz/height | jq .height) - 30000 ))
echo $START
Put that number in start_block. We wrote this at block 15,400,000, so yours will be higher.
# yaml-language-server: $schema=./node_modules/envio/evm.schema.json
name: elysium-whype
disable_default_cross_chain: true
chains:
- id: 99901 # Elysium mainnet. HyperSync is the default data source.
start_block: 15400000 # replace with your $START, about an hour behind the head
contracts:
- name: WHYPE
address:
- "0xbA876237B0F021A6c6D852d6c26E107997cC5E81" # the proxy, not the implementation
events:
- event: Transfer(address indexed from, address indexed to, uint256 value)
strict_hex_type: true
There's no rpc or hypersync_config entry, because HyperSync is Elysium's default data source.
4. Define the Schema
Replace schema.graphql. We called the field netChange rather than balance on purpose. The indexer only sees transfers from the start block onwards, so anything an account held before that is invisible, and calling it a balance would be wrong. Start from WHYPE's deployment block if you want true balances.
type Account {
id: ID! # holder address
netChange: BigInt! # WHYPE in minus WHYPE out since start_block, 18 decimals
transfersIn: Int!
transfersOut: Int!
}
type Totals {
id: ID! # "whype"
transfers: Int!
wrapped: BigInt! # HYPE wrapped into WHYPE (transfers from the zero address)
unwrapped: BigInt! # WHYPE unwrapped back to HYPE (transfers to the zero address)
lastBlock: Int!
}
5. Write the Handler
Replace src/handlers/WHYPE.ts. The event handlers docs cover the API.
import { indexer } from "envio";
// Wrapping HYPE mints WHYPE as a transfer from the zero address, and
// unwrapping burns it as a transfer to the zero address.
const ZERO = "0x0000000000000000000000000000000000000000";
indexer.onEvent(
{ contract: "WHYPE", event: "Transfer" },
async ({ event, context }) => {
const { from, to, value } = event.params;
const sender = from.toLowerCase();
const receiver = to.toLowerCase();
const [totals, fromAccount, toAccount] = await Promise.all([
context.Totals.getOrCreate({
id: "whype",
transfers: 0,
wrapped: 0n,
unwrapped: 0n,
lastBlock: 0,
}),
sender === ZERO ? undefined : context.Account.get(sender),
receiver === ZERO ? undefined : context.Account.get(receiver),
]);
context.Totals.set({
...totals,
transfers: totals.transfers + 1,
wrapped: totals.wrapped + (sender === ZERO ? value : 0n),
unwrapped: totals.unwrapped + (receiver === ZERO ? value : 0n),
lastBlock: event.block.number,
});
// A transfer to yourself leaves the balance unchanged, so count it once.
if (sender !== ZERO && sender === receiver) {
context.Account.set({
id: sender,
netChange: fromAccount?.netChange ?? 0n,
transfersIn: (fromAccount?.transfersIn ?? 0) + 1,
transfersOut: (fromAccount?.transfersOut ?? 0) + 1,
});
return;
}
if (sender !== ZERO) {
context.Account.set({
id: sender,
netChange: (fromAccount?.netChange ?? 0n) - value,
transfersIn: fromAccount?.transfersIn ?? 0,
transfersOut: (fromAccount?.transfersOut ?? 0) + 1,
});
}
if (receiver !== ZERO) {
context.Account.set({
id: receiver,
netChange: (toAccount?.netChange ?? 0n) + value,
transfersIn: (toAccount?.transfersIn ?? 0) + 1,
transfersOut: toAccount?.transfersOut ?? 0,
});
}
},
);
The self-transfer branch is the one detail we'd point out in review. Without it, the second set for the same account would overwrite the first, and an account that sent WHYPE to itself would end up with a made-up gain.
6. Test It
Replace src/indexer.test.ts. createTestIndexer runs the handler against simulated events, with no network or database. Give the events block numbers at or after your start_block, or the test indexer filters them out and tells you nothing reached a handler. Set START_BLOCK in the test to the same value as in config.yaml, so the two move together. The testing docs cover the rest.
import { describe, it } from "vitest";
import { createTestIndexer } from "envio";
const ZERO = "0x0000000000000000000000000000000000000000";
const ALICE = "0x1111111111111111111111111111111111111111";
const BOB = "0x2222222222222222222222222222222222222222";
const START_BLOCK = 15400000; // the start_block in config.yaml
describe("WHYPE Transfer", () => {
it("tracks wraps, transfers and unwraps", async (t) => {
const indexer = createTestIndexer();
const transfer = (from: string, to: string, value: bigint, number: number) => ({
contract: "WHYPE" as const,
event: "Transfer" as const,
block: { number },
params: { from, to, value },
});
await indexer.process({
chains: {
99901: {
simulate: [
transfer(ZERO, ALICE, 10n, START_BLOCK + 1), // Alice wraps 10
transfer(ALICE, BOB, 4n, START_BLOCK + 2), // Alice sends Bob 4
transfer(BOB, ZERO, 1n, START_BLOCK + 3), // Bob unwraps 1
],
},
},
});
const alice = await indexer.Account.getOrThrow(ALICE);
const bob = await indexer.Account.getOrThrow(BOB);
t.expect(alice.netChange).toBe(6n);
t.expect(bob.netChange).toBe(3n);
const totals = await indexer.Totals.getOrThrow("whype");
t.expect(totals.transfers).toBe(3);
t.expect(totals.wrapped).toBe(10n);
t.expect(totals.unwrapped).toBe(1n);
});
});
Codegen and the dev server don't typecheck your handlers, so run the typechecker as well.
pnpm codegen
pnpm exec tsc --noEmit
pnpm test
Test Files 1 passed (1)
Tests 1 passed (1)
7. Run It Locally
Start Docker, then run the indexer.
pnpm dev
pnpm dev starts Postgres and Hasura in Docker and syncs from your start block through HyperSync. Open http://localhost:8080 for the Hasura console. The local admin secret is testing. This query returns the totals and the accounts with the biggest net inflow.
{
Totals {
transfers
wrapped
unwrapped
lastBlock
}
Account(order_by: { netChange: desc }, limit: 3) {
id
netChange
transfersIn
transfersOut
}
}
Here's what that query returned on our deployment, which started at block 14,500,000, trimmed to the top three accounts. Values are in wei with 18 decimals, so the top account's netChange of 1127008376643709235226 is about 1,127 WHYPE.
{
"data": {
"Totals": [
{
"transfers": 151671,
"wrapped": "71941812697132573605384",
"unwrapped": "71131086947665635480777",
"lastBlock": 14620171
}
],
"Account": [
{ "id": "0xef3ac7034eac6bf3b37d3a78b6a510c7c8ac53c0", "netChange": "1127008376643709235226", "transfersIn": 3715, "transfersOut": 5074 },
{ "id": "0xcd82337e7d2d1ab66699457a8e25b4d8e78ca259", "netChange": "287603885175954919762", "transfersIn": 1091, "transfersOut": 1603 },
{ "id": "0xd329b88ba62483918c3f6c9421178345cf9eebc2", "netChange": "266069315504862630760", "transfersIn": 5213, "transfersOut": 6235 }
]
}
}
There's no end_block, so once the backfill finishes the indexer follows Elysium's head and every new transfer lands as it happens.
Deploy It on Envio Cloud
Envio Cloud runs the database, the GraphQL API and the syncing for you, and deploys from GitHub. Indexers there don't need your HyperSync token, and the generated .gitignore already keeps .env out of the repository.
First, push the project to a new GitHub repository.
# envio init already created a git repository on main
git add -A && git commit -m "WHYPE transfers on Elysium"
gh repo create elysium-whype --private --source . --push
Two steps then happen once in a browser. Sign in to the Envio app with GitHub, then install the Envio Deployments GitHub App on the repository you just created. After that we did the rest from a terminal with the envio-cloud CLI.
npx envio-cloud login
npx envio-cloud repos -o json # the repository should be listed
npx envio-cloud indexer add --name elysium-whype --repo elysium-whype --branch main --yes
# Envio Cloud builds commits pushed after `indexer add`, so push one
git commit --allow-empty -m "Deploy" && git push origin main
COMMIT=$(git rev-parse HEAD | cut -c1-7)
npx envio-cloud deployment status elysium-whype $COMMIT --watch-till-synced --timeout 30m
npx envio-cloud deployment endpoint elysium-whype $COMMIT
Here's what our deployment reported once it caught up with the chain.
CHAIN ID COMPLETION % BLOCK HEIGHT PROCESSED BLOCK EVENTS PROCESSED READY
-------- -------- -------- -------- -------- --------
99901 100.00% 14536864 14536864 31614 yes
deployment endpoint prints the hosted GraphQL URL, and the query from step 7 works against it unchanged. To check the numbers, we compared them with HyperSync directly. Our deployment had counted 31,654 transfers by block 14,536,913, and HyperSync returned the same 31,654 Transfer logs for that range. Do the same check on your own contract before you trust the API.
Mind the free plan. The Development plan has a soft limit of 100,000 events processed and removes deployments after 30 days, and WHYPE alone can pass that limit in a few hours. A recent start_block is fine for trying things out. For full history, use a Production plan. The pricing page and the fair usage rules have the details.
What We'd Tell Another Builder
- Check the numbers against the source. Before trusting our deployed API, we compared its transfer count with HyperSync for the same block range. Both said 31,654. It's the cheapest test you'll run, and it catches a wrong address, event or start block straight away.
- Read the ABI before you generate from it. Proxies put admin events where you expect your token's events, and bridged tokens can declare the same event name twice. Checking the event list first means you generate exactly what you plan to index.
- Start recent, then backfill. A recent
start_blocklet us check the whole flow end to end on a small sync before deciding how much history we needed. - Name fields for what they hold.
netChangeinstead of balance stops someone downstream treating a partial window as a full balance. - Use HyperSync or a provider for history. When we tried a backfill over Elysium's public RPC, it rate limited us until the sync stalled, which matches Elysium's own advice to use a provider endpoint for production traffic.
Troubleshooting
These are the problems you're most likely to hit, and what fixes them.
| Problem | Fix |
|---|---|
The indexer runs but Totals stays empty | Check that config.yaml lists Transfer(address indexed from, address indexed to, uint256 value), the event WHYPE emits. |
The ABI only has AdminChanged, BeaconUpgraded and Upgraded | You fetched a proxy's ABI. Fetch the implementation's ABI and keep the proxy's address in the config. |
Failed to automatically find HyperSync endpoint for the chain 99901 | Your HyperIndex version doesn't have Elysium built in. Upgrade to envio 3.19.0 or later with pnpm add envio@3.19.0. npm's latest tag still points at 3.17.1. |
simulate: 3 items you passed to simulate never reached a handler | The simulated events are before start_block. Give them later block numbers. |
Examples to Start From
- Index Uniswap v4 swaps with HyperIndex, our docs example for v4 pools and swaps on any chain where the PoolManager is deployed
- elysium-uniswap-v4-indexer, every Uniswap v4 pool created on Elysium
- elysium-hype-deposits-indexer, every native HYPE deposit into Elysium through its bridge, indexed on the HyperEVM side
- hyperindex-use-cases, more HyperIndex examples across chains
- How to build a HyperEVM indexer, for the chain Elysium settles to
Frequently Asked Questions
Which Transfer Event Should I Index for Tokens on Elysium?
Index the standard ERC-20 Transfer(address indexed from, address indexed to, uint256 value). Bridged tokens on Elysium such as WHYPE and USDC also declare Transfer(address,address,uint256,bytes) for transferAndCall. WHYPE has never emitted it, and the token's source shows transferAndCall emits the standard Transfer as well, so the three argument event covers every transfer. Mints and burns show up as transfers from and to the zero address.
How Do I Fix "Failed to Automatically Find HyperSync Endpoint" for Chain 99901?
Upgrade to envio 3.19.0 or later with pnpm add envio@3.19.0. npm's latest tag still points at 3.17.1, so envio@latest won't fix it. That message means your version predates Elysium's built-in support, so it has no data source for chain 99901 in config.yaml. To stay on the older version, add hypersync_config with url: https://99901.hypersync.xyz to the chain, and don't also keep an RPC marked for sync, because HyperIndex won't take both as the historical data source.
Can I Index Elysium over RPC Instead of HyperSync?
Yes. In config.yaml, give the Elysium chain (id: 99901) an rpc list with one entry whose url is your Elysium RPC and whose for is sync. Without for: sync, HyperIndex keeps HyperSync as the data source. Use a provider endpoint rather than the public RPC, as Elysium's connection docs suggest. The RPC sync docs cover the trade-offs.
How Do I Get the ABI for a Proxy Contract on Elysium?
Ask the explorer API for the proxy's implementation address with action=getsourcecode, then fetch that address's ABI with action=getabi, as in step 1. Give envio init the implementation's ABI and the proxy's address, since the proxy emits the events.
Do I Need to Run an Elysium Node to Build an API?
No. HyperIndex reads Elysium's full history from HyperSync, which needs only a free Envio API token, and Envio Cloud hosts the indexer, its database and the GraphQL endpoint. Elysium's own docs suggest an archive endpoint for historical reads and indexing, which is the part HyperSync covers. You still need an RPC for anything that writes to the chain, like sending transactions from your app.
What Is the Elysium Chain ID and RPC URL?
Elysium mainnet is chain ID 99901, and its public RPC is https://rpc.elysium.kinetiq.xyz, according to Elysium's connection docs. For indexing, HyperSync at https://elysium.hypersync.xyz serves the full chain history, and HyperRPC at https://elysium.rpc.hypersync.xyz takes read only JSON-RPC calls. The 99901 hostnames work too, and both need an Envio API token.
Can I Bring a Subgraph to Elysium?
Yes, by converting it to HyperIndex. The subgraph migration guide maps subgraph.yaml to config.yaml and covers the schema differences, and Migrate Using AI walks a coding agent through rewriting the handlers in TypeScript.
Can I Index Elysium Testnet?
Elysium testnet is chain ID 99801, with a public RPC at https://testnet-rpc.elysium.kinetiq.xyz, according to Elysium's connection docs. HyperSync serves Elysium mainnet only, so to index testnet, change the chain ID to 99801 and add an rpc entry for that URL marked for: sync, as in the RPC answer above.
Build With Envio
Envio turns your Elysium contracts into a live GraphQL API. Elysium is built into HyperIndex, HyperSync serves its full history so there's no node to run, and Envio Cloud hosts the indexer for you. Start indexing Elysium, and if you're building on Elysium, come talk to us about your data needs.
Website | X | Discord | Telegram | GitHub | YouTube | Reddit
Jordyn Laurier

