Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
eth-balance-checker
Advanced tools
Ethereum smart contract and library for efficient ERC20 and Ether balance checks.
A smart contract and library pair that allows you to check for multiple ERC20 and Ether balances across multiple addresses in a single RPC call.
You can find a demo over here: https://wbobeirne.github.io/eth-balance-checker-demo
The source for that demo is available here: https://github.com/wbobeirne/eth-balance-checker-demo
npm install --save eth-balance-checker
# OR
yarn add eth-balance-checker
The main contract is in contracts/BalanceChecker.sol
. Its associated ABI is in abis/BalanceChecker.abi.json
. Both of these are included in the NPM package if you want to compile them yourself, or extend them with another
contract.
0xb1f8e55c7f64d203c1400b9d8555d050f94adf39
0x8D9708f3F514206486D7E988533f770a16d074a7
0x3183B673f4816C94BeF53958BaF93C671B7F8Cf2
0x55ABBa8d669D60A10c104CC493ec5ef389EC92bb
0x2352c63A83f9Fd126af8676146721Fa00924d7e4
0x2352c63A83f9Fd126af8676146721Fa00924d7e4
0x2352c63A83f9Fd126af8676146721Fa00924d7e4
0x2352c63A83f9Fd126af8676146721Fa00924d7e4
0xB1c568e9C3E6bdaf755A60c7418C269eb11524FC
0xB1c568e9C3E6bdaf755A60c7418C269eb11524FC
There are separate libraries for web3.js
and ethers.js, both with identical
APIs. Just import the functions from either eth-balance-checker/lib/web3
or
eth-balance-checker/lib/ethers
. For all functions, pass "0x0"
as the "token"
address to get the ether balance of an address.
All functions also take in an optional 4th options parameter, those options are as follows:
interface Options {
// Choose a custom contract address. Must be provided to run the
// code on non-mainnet network.
contractAddress?: string;
}
provider: Web3 | Ethers.Provider
- The provider to use for the contract call.address: string
- The address to lookup balances fortokens: string[]
- Array of token contract addresses. Only supports ERC20 tokens.options?: Options
- Options for the contract, see above for options.Promise<{
// Ether balance
"0x0": "100",
// Token balances
"0x123...": "500",
"0x456...": "100000",
...
}>
import Web3 from 'web3';
import { getAddressBalances } from 'eth-balance-checker/lib/web3';
const web3 = new Web3(...);
const address = '0x123...';
const tokens = ['0x0', '0x456...'];
getAddressBalances(web3, address, tokens).then(balances => {
console.log(balances); // { "0x0": "100", "0x456...": "200" }
});
provider: Web3 | Ethers.Provider
- The provider to use for the contract call.addresses: string[]
- Array of addresses to lookup balances for.tokens: string[]
- Array of token contract addresses. Only supports ERC20 tokens.options?: Options
- Options for the contract, see above for options.Promise<{
// Address as the key
"0x123...": {
// Ether balance
"0x0": "100",
// Token balances
"0x456...": "500",
"0x789...": "10000",
...
},
...
}>
import * as Ethers from 'ethers';
import { getAddressesBalances } from 'eth-balance-checker/lib/ethers';
const ethers = Ethers.getDefaultProvider();
const addresses = ['0x123...', '0x456...'];
const tokens = ['0x0', '0x789...'];
getAddressBalances(ethers, addresses, tokens).then(balances => {
console.log(balances); // { "0x123...": { "0x0": "100", ... }, ... }
});
Requires node 8+. Just install packages, then use commands as needed:
npm install
# OR
yarn
build:contract
- Runs truffle compile
on the contract, and extracts ABI.build:lib
- Runs tsc
and outputs js and typedefs to lib/
build
- Runs build:contract
then build:lib
test:contract
- Runs truffle test
test:lib
- No tests implemented yettest
- Runs tst:contract
and test:lib
FAQs
Ethereum smart contract and library for efficient ERC20 and Ether balance checks.
The npm package eth-balance-checker receives a total of 711 weekly downloads. As such, eth-balance-checker popularity was classified as not popular.
We found that eth-balance-checker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.