Home

Awesome

<p align="center"> <a href="https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util"> <img src="https://user-images.githubusercontent.com/47108/78554503-42c47000-77d9-11ea-8935-2d93981d50df.png" width="309"> </a> </p>

SYNOPSIS

NPM Status Actions Status Coverage Status Discord

A collection of utility functions for Ethereum. It can be used in Node.js and in the browser with browserify.

INSTALL

npm install ethereumjs-util

USAGE

import assert from 'assert'
import { isValidChecksumAddress, unpadBuffer, BN } from 'ethereumjs-util'

const address = '0x2F015C60E0be116B1f0CD534704Db9c92118FB6A'
assert.ok(isValidChecksumAddress(address))

assert.equal(unpadBuffer(Buffer.from('000000006600', 'hex')), Buffer.from('6600', 'hex'))

assert.equal(new BN('dead', 16).add(new BN('101010', 2)), 57047)

API

Documentation

Modules

ethjs-util methods

The following methods are available provided by ethjs-util:

They can be imported by name:

import { intToHex, stripHexPrefix } from 'ethereumjs-util'

Re-Exports

Additionally ethereumjs-util re-exports a few commonly-used libraries. These include:

EthereumJS

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.

LICENSE

MPL-2.0