A collection of utility functions for Ethereum. It can be used in Node.js and in the browser with browserify.
npm install ethereumjs-util
import assert from 'assert'
import { isValidChecksumAddress, unpadBuffer, BN } from 'ethereumjs-util'
assert.ok(isValidChecksumAddress('0x2F015C60E0be116B1f0CD534704Db9c92118FB6A'))
assert.ok(unpadBuffer(Buffer.from('000000006600', 'hex')).equals(Buffer.from('6600', 'hex')))
assert.ok(new BN('dead', 16).add(new BN('101010', 2)).eqn(57047))
Read the API docs.
KECCAK256_NULL_S
for string representation of Keccak-256 hash of nullDEPRECATED
)BN
, rlp
The following methods are available by an internalized version of the ethjs-util package (MIT
license), see internal.ts. The original package is not maintained any more and the original functionality will be replaced by own implementations over time (starting with the v7.1.3
release, October 2021).
They can be imported by name:
import { stripHexPrefix } from 'ethereumjs-util'
ethereumjs-util
re-exports the following commonly-used libraries:
They can be imported by name:
import { BN, rlp } from 'ethereumjs-util'
See our organizational documentation for an introduction to EthereumJS
as well as information on current standards and best practices.
If you want to join for work or do improvements on the libraries have a look at our contribution guidelines.
MPL-2.0