erc20_metadata
Returns metadata (name, symbol, decimals) for a given erc20 contract address.
name ,symbol and decimals are optional methods in the ERC-20 token standard. Therefore, not all contracts will respond correctly to calls requesting this information. While the incorrectness or absence of name and symbolcan be an inconvenience, having the correct decimalsis crucial in displaying token balances or converting user inputs accurately when communicating with the contract.
Supported on Ethereum, BNB Chain, Optimism, and Arbitrum.

Parameters

Object - An object with the following fields (required):
  • contractAddress(hex string, required) - the contract address for erc20 token.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • nextPageIndex(integer number) - next page (if exists, else blank).
    • result(object, defined below) - an object with the following fields:
  • Object schema:
    • name(string) - the name of the token.
    • symbol(string) - the symbol of the token.
    • decimals(integer number) - the number of decimals of the token.

Example

Request

curl https://api.blockvision.org/v2/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "erc20_metadata",
"params": {
"contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
},
"id": 1
}'

Response

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"symbol": "Test",
"decimals": 18,
"name": "Demo"
}
}
Copy link
Outline
Parameters
Returns
Example
Request
Response