Index Robinhood Chain data with a subgraph: a worked example
Deploy a Goldsky subgraph for one Robinhood Chain contract: the config file, the deploy command, and one GraphQL query that returns the data.

Account Executive
You can index a Robinhood Chain contract with a subgraph and not write any mapping code. Goldsky Subgraphs run on Robinhood Chain mainnet and testnet, so you give us a contract address and its ABI, and we generate the indexing code, deploy it, and return a GraphQL endpoint. In this guide we'll index the WETH contract on Robinhood Chain mainnet. You'll end up with one entity for each event, and your dapp can read both with one GraphQL request.

The contract
Start with the address, and take it from Robinhood's contract list (opens in a new tab). WETH on Robinhood Chain mainnet is at 0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73, and a token with the same name and a different address isn't the canonical token.
This address is a proxy. Its implementation contract is 0xC6B81b429797E0f555440b70cD99e032D7AE947e, and the block explorer (opens in a new tab) has the verified ABI. The example indexes two events:
Transfer(address indexed from, address indexed to, uint256 value)Approval(address indexed owner, address indexed spender, uint256 value)
So you index the proxy address, but with the ABI of the implementation contract. Every WETH log carries the proxy address, and the implementation ABI is what describes the token events.
Path A: no mapping code, from the ABI
An instant subgraph needs just one JSON config file, which names the ABI file and one contract instance. Save the ABI from the block explorer as weth-abi.json, and then write the config:
{
"version": "1",
"name": "robinhood-weth",
"abis": {
"weth": {
"path": "./weth-abi.json"
}
},
"instances": [
{
"abi": "weth",
"address": "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",
"startBlock": 0,
"chain": "robinhood-mainnet"
}
]
}The chain value is the Subgraphs network name, robinhood-mainnet. Set startBlock to the block that deployed the contract, which you'll find on the explorer, so that the subgraph doesn't scan earlier blocks. Our low-code subgraphs guide (opens in a new tab) explains each field.
Then deploy the config file:
goldsky subgraph deploy robinhood-weth/1.0.0 --from-abi robinhood-weth-config.jsonThat one command is the whole deployment. We generate the schema and the mappings from the config, build the subgraph, and deploy it, and the CLI prints the endpoint.
Path B: a subgraph with your own mappings
If you've already built a subgraph with the Graph CLI, you can deploy it from source instead. In subgraph.yaml, the network: field of the data source takes the same name, robinhood-mainnet.
yarn codegen
yarn build
goldsky subgraph deploy robinhood-weth/1.0.0 --path .Our deploy guide (opens in a new tab) covers a subgraph from source and a move from another host.
Watch the chain name on both paths, because Subgraphs and Turbo Pipelines spell it differently. A subgraph uses robinhood-mainnet, and a Turbo pipeline uses robinhood_mainnet. Our supported networks page (opens in a new tab) has both names for each chain.
The query
An instant subgraph names each entity after its event. In our no-code subgraph guide (opens in a new tab), the NounCreated event becomes the nounCreateds entity, so by the same rule Transfer becomes transfers and Approval becomes approvals. Each entity has the event parameters plus three fields that we add: block_number, transactionHash_, and timestamp_.
query LatestWethTransfers($count: Int = 5) {
transfers(first: $count, orderBy: block_number, orderDirection: desc) {
id
block_number
transactionHash_
timestamp_
from
to
value
}
}The response is a list of up to 5 transfers, newest first. You can query while the subgraph is still indexing, but the newest onchain data only appears once indexing reaches the chain head.
| Endpoint | URL | Access |
|---|---|---|
| Public | https://api.goldsky.com/api/public/<project_id>/subgraphs/<subgraph name>/<version or tag>/gn | On by default. The default rate limit is 50 requests per 10 seconds. |
| Private | The same URL with /api/private | Off by default. Each request sends an Authorization: Bearer <token> header. |
To turn the private endpoint on, run goldsky subgraph update robinhood-weth/1.0.0 --private-endpoint enabled. Our GraphQL endpoints page (opens in a new tab) covers tokens and both settings.
Operations
Version changes. A tag (opens in a new tab) is a name that points at one version. Your app queries the tag, and you move the tag when a new version is ready:
goldsky subgraph tag create robinhood-weth/2.0.0 --tag prodWebhooks. A subgraph webhook (opens in a new tab) sends each INSERT, UPDATE, or DELETE on an entity to your URL:
goldsky subgraph webhook create robinhood-weth/1.0.0 --name "weth-transfers" --url "https://example.com/hook" --entity "transfers"Reorgs. A subgraph stores every version of an entity with a block_range column that shows the blocks for which the row is valid. Your webhook consumer can use that column to tell a changed entity from a change that a reorg rolled back.
When a subgraph is not the right tool
A subgraph is the right fit when you want a GraphQL API over one contract or a few contracts. If your team wants the same events as rows in its own Postgres, ClickHouse, or Kafka, use Turbo Pipelines (opens in a new tab) instead. Our post on the Robinhood Chain data on Goldsky lists the datasets.
For the chain ID, the public RPC URLs, and an Edge RPC endpoint, see our Robinhood Chain RPC endpoint guide.
FAQ
Does Goldsky support subgraphs on Robinhood Chain?
Yes, on mainnet and testnet. Our Robinhood Chain page lists Subgraphs, Turbo Pipelines, Compose, and Edge RPC.
Which network name goes in the config or the manifest?robinhood-mainnet for mainnet. The Turbo name robinhood_mainnet is for Turbo pipelines only.
Is there a path with no config file?
Yes. goldsky subgraph init starts a wizard that asks for the contract address, the network, and the start block. Our post on contract data without indexing code goes through it on Ethereum. For a proxy contract such as WETH, use the config file in this guide, because it takes the ABI of the implementation contract.
How do I start?
Install the CLI with curl https://goldsky.com | sh and run goldsky login. Then deploy the config file from Path A.