All Projects → MyCryptoHQ → Eth Scan

MyCryptoHQ / Eth Scan

An efficient Ether and token balance scanner library

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Eth Scan

Web3 By Example
Node.js with Web3 javascript examples for getting basic information (transactions, balances, network stats, and tokens) from the Ethereum blockchain.
Stars: ✭ 156 (+345.71%)
Mutual labels:  ethereum, web3, tokens
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (+1100%)
Mutual labels:  ethereum, web3
React Ethereum Dapp Example
A starter boilerplate for an Ethereum dapp using web3.js v1.0, truffle, react, and parity
Stars: ✭ 384 (+997.14%)
Mutual labels:  ethereum, web3
Web3.php
A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
Stars: ✭ 507 (+1348.57%)
Mutual labels:  ethereum, web3
Ethereum Php
PHP interface to Ethereum JSON-RPC API. Fully typed Web3 for PHP 7.X
Stars: ✭ 343 (+880%)
Mutual labels:  ethereum, web3
3box
The easiest way for Ethereum apps to manage user data.
Stars: ✭ 348 (+894.29%)
Mutual labels:  ethereum, web3
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions on Ethereum network.
Stars: ✭ 462 (+1220%)
Mutual labels:  ethereum, web3
Ethereum Erc721
Non-fungible token implementation for Ethereum-based blockchains.
Stars: ✭ 253 (+622.86%)
Mutual labels:  ethereum, tokens
Ethjs
A highly optimised, light-weight JS utility for Ethereum.
Stars: ✭ 574 (+1540%)
Mutual labels:  ethereum, web3
Typechain
🔌 TypeScript bindings for Ethereum smart contracts
Stars: ✭ 769 (+2097.14%)
Mutual labels:  ethereum, web3
Web3 React
🧰 A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
Stars: ✭ 788 (+2151.43%)
Mutual labels:  ethereum, web3
Alpha
Follow the white rabbit 🐇
Stars: ✭ 304 (+768.57%)
Mutual labels:  ethereum, web3
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (+742.86%)
Mutual labels:  ethereum, web3
Rimble Ui
React components that implement Rimble's Design System.
Stars: ✭ 357 (+920%)
Mutual labels:  ethereum, web3
Solidity Idiosyncrasies
Solidity gotchas, pitfalls, limitations, and idiosyncrasies.
Stars: ✭ 267 (+662.86%)
Mutual labels:  ethereum, web3
Eattheblocks
Source code for Eat The Blocks, a screencast for Ethereum Dapp Developers
Stars: ✭ 431 (+1131.43%)
Mutual labels:  ethereum, web3
Eth.social
An Ethereum dApp for posting social events.
Stars: ✭ 17 (-51.43%)
Mutual labels:  ethereum, web3
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions.
Stars: ✭ 237 (+577.14%)
Mutual labels:  ethereum, web3
Awesome Buggy Erc20 Tokens
A Collection of Vulnerabilities in ERC20 Smart Contracts With Tokens Affected
Stars: ✭ 251 (+617.14%)
Mutual labels:  ethereum, tokens
Etherchain Light
Lightweight Ethereum blockchain explorer
Stars: ✭ 550 (+1471.43%)
Mutual labels:  ethereum, web3

eth-scan

eth-scan is a library written in TypeScript, to help you fetch Ether or (ERC-20) token balances for multiple addresses in an efficient way. The library uses a smart contract to fetch the balances in a single call to a node. The contract is currently deployed at 0x571C62a1c863aEAD01c1d34D8cB3Ee2c6f938800 on the Ethereum mainnet, Goerli, Kovan, Rinkeby, Ropsten, and xDai.

It can use Web3.js, Ethers.js, JSON-RPC (HTTP), or an EIP-1193-compatible provider to get the balances. See Getting Started for more info.

Note: Even though eth_call doesn't use any gas, the block gas limit still applies, and the maximum number of addresses you can fetch in a single call is limited. By default this library batches calls per 1000 addresses.

Getting started

The library is published on npm. To install it, use npm or yarn:

yarn add @mycrypto/eth-scan

or

npm install @mycrypto/eth-scan

Example

import { getEtherBalances } from '@mycrypto/eth-scan';

getEtherBalances('http://127.0.0.1:8545', [
  '0x9a0decaffb07fb500ff7e5d253b16892dbec006a',
  '0xeb65f72a2f5464157288ac15f1bb56c56e6be375',
  '0x1b96c634f9e9fcfb76932e165984901701352ffd',
  '0x740539b55ee5dc58efffb88fea44a9008f8daa6f',
  '0x95d9e32dc03770699a6a5e5858165b174d500015'
]).then(console.log);

Results in:

{
  '0x9a0decaffb07fb500ff7e5d253b16892dbec006a': BigInt(1000000000000000000),
  '0xeb65f72a2f5464157288ac15f1bb56c56e6be375': BigInt(1000000000000000000),
  '0x1b96c634f9e9fcfb76932e165984901701352ffd': BigInt(1000000000000000000),
  '0x740539b55ee5dc58efffb88fea44a9008f8daa6f': BigInt(1000000000000000000),
  '0x95d9e32dc03770699a6a5e5858165b174d500015': BigInt(1000000000000000000)
}

API

getEtherBalances(provider, addresses, options)

Get Ether balances for addresses.

  • provider <Provider> - A Web3 instance, Ethers.js provider, JSONRPC endpoint, or EIP-1193 compatible provider

  • addresses <string[]> - An array of addresses as hexadecimal string.

  • options <EthScanOptions> (optional) - The options to use.

  • Returns: <Promise<BalanceMap>> - A promise with an object with the addresses and the balances.

getTokenBalances(provider, addresses, token, options)

Get ERC-20 token balances from token for addresses. This does not check if the address specified is a token and will throw an error if it isn't.

  • provider <Provider> - A Web3 instance, Ethers.js provider, JSONRPC endpoint, or EIP-1193 compatible provider

  • addresses <string[]> - An array of addresses as hexadecimal string.

  • token <string> - The address of the ERC-20 token.

  • options <EthScanOptions> (optional) - The options to use.

  • Returns: <Promise<BalanceMap>> - A promise with an object with the addresses and the balances.

getTokensBalance(provider, address, tokens, options)

Get ERC-20 token balances from tokens for address. If one of the token addresses specified is not a token, a balance of 0 will be used.

  • provider <Provider> - A Web3 instance, Ethers.js provider, JSONRPC endpoint, or EIP-1193 compatible provider

  • address <string> - The address to get token balances for.

  • tokens <string[]> - An array of ERC-20 token addresses.

  • options <EthScanOptions> (optional) - The options to use.

  • Returns: <Promise<BalanceMap>> - A promise with an object with the addresses and the balances.

getTokensBalances(provider, addresses, tokens, options)

  • provider <Provider> - A Web3 instance, Ethers.js provider, JSONRPC endpoint, or EIP-1193 compatible provider.

  • addresses <string[]> - An array of addresses as hexadecimal string.

  • tokens <string[]> - An array of ERC-20 token addresses.

  • options <EthScanOptions> (optional) - The options to use.

  • Returns: <Promise<BalanceMap<BalanceMap>>> - A promise with an object with the addresses and the balances.

EthScanOptions

  • contractAddress <string> (optional) - The address of the smart contract to use. Defaults to 0x86f25b64e1fe4c5162cdeed5245575d32ec549db.

  • batchSize <number> (optional) - The size of the call batches. Defaults to 1000.

BalanceMap

A BalanceMap is an object with an address as key and a bigint as value.

Providers

Currently, eth-scan has support for four different providers:

  • Ethers.js, by using an existing Ethers.js provider
  • Web3, by using an instance of the Web3 class
  • HTTP, by using a URL of a JSONRPC endpoint as string
  • EIP-1193 compatible provider, like window.ethereum

Compatiblity

eth-scan uses ES6+ functionality, which may not be supported on all platforms. If you need compatibility with older browsers or Node.js versions, you can use something like Babel.

There is an ES compatible version available, which should work with module bundlers like Webpack and Rollup.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].