How do I return token amount in USD using web3js ..or is there some kindof API to be used ?

For instance , say user has 3ETH and also want the user balance to show in USD just as metamask does

1 Answer 1


Ethereum doesn't do that.

You need a price source which could be on-chain or off-chain. Off-chain would be an exchange or other service, e.g CoinMarketCap and that would be an API. On-chain could be a price Oracle or liquidity pool, e.g. ChainLink or Uniswap. There are many in both cases.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.