Ruby Gem for the EtherScan API https://etherscan.io/apis
Ruby Gem for the EtherScan API https://etherscan.io/apis
Add this line to your application’s Gemfile:
gem 'etherscan_api', require: 'etherscan'
And then execute:
$ bundle
Or install it yourself using:
$ gem install etherscan_api
Get your api key: https://etherscan.io/myapikey
# config/initializers/etherscan.rbEtherscan.configure do |config|config.key = 'my_api_key'end
etherscan = Etherscan::Tokens.new# Get ERC20-Token TotalSupply by ContractAddresscontract_address = '0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c'etherscan.total_supply(contract_address)# Get ERC20-Token Account Balance for TokenContractAddresscontract_address = '0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c'address = '0xb36efd48c9912bd9fd58b67b65f7438f6364a256'etherscan.balance(address, contract_address)
Copyright (c) 2018 David Paluy. See LICENSE.txt for
further details.