Native Tokens
What is a Native Token?
Native tokens are the gas tokens of a blockchain or network. For example Ethereum (ETH) is the native token for the Ethereum blockchain and Polygon (MATIC) is the native token for the Polygon blockchain. Some networks like L2s or rollups use the native token from their underlying networks. For example ETH is used as the native token on the Optimism Layer 2 Optimistic Rollup network.
Native tokens do not have ERC20 functions like transferFrom
, balanceOf
, etc. and as such must be treated differently from basic tokens with respect to obtaining balances and handling value transfers. This difference is abstracted by the Portals API allowing you to treat native tokens and basic tokens in the same way. The Portals API treats the zero address (i.e. 0x0000000000000000000000000000000000000000
) as the native token on its own chain (e.g. ETH on Ethereum is assigned the zero address).
Properties of a Native Token
The object shown below is an example of a response for a native token returned by the the Portals API.
Prop | Example | Description |
---|---|---|
id | "ethereum" | The ID of the token |
key | "ethereum:0x0000000000000000000000000000000000000000" | A unique key identifying this token |
name | "Ethereum' | The formatted name of the token |
symbol | "ETH" | The symbol of the token |
image | "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1595348880" | An image representing the token |
price | 1288.4 | The current USD price of the token |
liquidity | 200661759398 | The current USD market cap of the token |
tokens | [] | An array of underlying tokens belonging to this token. See below for more details |
platform | "native" | The platform the token belongs to |
address | "0x0000000000000000000000000000000000000000" | The address of the token |
addresses | {"ethereum": "0x0000000000000000000000000000000000000000", "optimism": "0x0000000000000000000000000000000000000000"} | An object containing the addresses of the token on other networks |
network | "ethereum" | The network this token exists on |
updatedAt | "2022-10-21T10:39:30.243Z" | The date and time of the last update for this token |
Additional considerations
- For native tokens, the
address
prop is always the zero address (i.e.0x0000000000000000000000000000000000000000
). - The
liquidity
prop refers to market capitalization (i.e. price * circulating supply). - The
tokens
array will be empty as native tokens are not composed of other tokens like LP Tokens.