API Reference

Many of Blockpour's API endpoints accept a token parameter. Unless otherwise specified the token parameter can be either a token address or a token symbol.

For example pool snapshots for the YFI token on Ethereum can be queried as follows:

https://services.blockpour.com/api/pools/snapshots/reserves/token/YFI?network=ethereum
https://services.blockpour.com/api/pools/snapshots/reserves/token/0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e?network=ethereum

Token Symbol vs. Token Key

📘

Token Key

The token key is a property set only for legitimate and well-known tokens. If set, it's usually the same as the token symbol.

Token symbols represent the ERC20 token symbol that is encoded in the smart contract itself. Blockpour additionally introduces the concept of token keys to tackle the issue of distinguishing legitimate tokens on multiple chains.

For most well-known tokens the token symbol and the token key will be the same. In some cases, a given token has a different symbol on different chains. In that case, we will set a common token key that corresponds to the token symbol that.

For example, the Avalanche token is deployed on several networks:

  • 0x85f138bfee4ef8e540890cfb48f620571d67eda3 on Ethereum with the symbol WAVAX
  • 0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b on Polygon with the symbol AVAX

These tokens all represent the same native avalanche token and can in theory be exchange at or close to a 1:1 ratio. Therefore both are being assigned a token_key set to AVAX.

This allows users to query tokens that represent the same base asset easily.

Not all tokens have a token key. In particular tokens that are not traded very often or scam tokens will not be issued a token key. This allows users to find the legitimate versions of a token. For example many tokens have an ERC20 symbol USDC but only a few tokens represent the actual USDC token.

When querying the blockpour API, you can choose to use either the token addresses or the token keys (~ symbol). While we do our best to insure the token keys correspond to the actual tokens, we recommend that you use token addresses in production applications.

Tokens on multiple chains.

Mapping tokens to symbols and multiple chains is complex.

An ERC20 token for a project on Ethereum can have several corresponding ERC20 tokens on a different chain if it is mapped through multiple bridges (for example Celer and Wormhole).

When querying by token key, the data corresponding to the most traded token on a given network will be returned. so we recommend using the token addresses for production applications

Verifying token addresses

To quickly verify that a given token key is mapping to the correct address, you can use the /tokens/:token endpoint to verify that you are indeed querying the correct token.

For example to verify you have the correct DAI address on Optimism:

https://services.blockpour.com/api/tokens/DAI?network=optimism

The first token (most traded token) returned by this API query. will map to the given symbol.

🚧

Using token addresses is recommend for production applications

For production applications we recommend using token addresses to remove all ambiguity as to the data you are querying.

If you need to query data for tokens on multiple chains, we recommend using the advanced endpoints (POST requests)

Get swaps by token ids (advanced)
Get token average price (advanced)
Get pool events by token ids (advanced)