1

How can I retrieve the default token symbol of an Ethereum network via json-rpc?

Ethereum would return "ETH"
Ethereum classic would return "ETC"
S-K'
  • 113
  • 4

1 Answers1

4

Use Web3's getChainId() to get the chain ID.

Then map the returned chain ID into the list of known networks from https://chainid.network/chains.json, where the currency symbol is in the nativeCurrency nested object.

Richard Horrocks
  • 37,835
  • 13
  • 87
  • 144