Socket
Socket
Sign inDemoInstall

ethereumjs-util

Package Overview
Dependencies
44
Maintainers
4
Versions
84
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ethereumjs-util

a collection of utility functions for Ethereum


Version published
Weekly downloads
1.2M
decreased by-9.45%
Maintainers
4
Install size
6.17 MB
Created
Weekly downloads
 

Package description

What is ethereumjs-util?

The ethereumjs-util package provides a set of utility functions for Ethereum. These utilities include functions for handling addresses, big numbers, hashing, and encoding/decoding data according to the Ethereum protocol standards. It is a foundational package that can be used to develop Ethereum-based applications, facilitating tasks such as transaction formatting, signature verification, and data conversion.

What are ethereumjs-util's main functionalities?

Address Formatting

Converts an Ethereum address to its checksummed version to prevent case sensitivity errors.

const { toChecksumAddress } = require('ethereumjs-util');
const checksumAddress = toChecksumAddress('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359');
console.log(checksumAddress);

Hashing

Generates a keccak256 hash of the input data, a common hashing function used in Ethereum.

const { keccak256 } = require('ethereumjs-util');
const hash = keccak256(Buffer.from('hello'));
console.log('Hash:', hash.toString('hex'));

Signature Verification

Signs a message hash with a private key and serializes the signature in a format compatible with RPC calls.

const { ecsign, toRpcSig } = require('ethereumjs-util');
const privateKey = Buffer.from('c87509a1c067bbde7aebb4d3c0a0b8ab8bd02b676c91662b5f41c4ec9863d8ee', 'hex');
const msgHash = keccak256(Buffer.from('hello'));
const sig = ecsign(msgHash, privateKey);
const serializedSig = toRpcSig(sig.v, sig.r, sig.s);
console.log('Signature:', serializedSig);

Other packages similar to ethereumjs-util

Readme

Source

SYNOPSIS

NPM Package Build Status Coverage Status Gitter or #ethereumjs on freenode

A collection of utility functions for ethereum. It can be used in node.js or can be in the browser with browserify.

API

./docs/

Most of the string manipulation methods are provided by ethjs-util


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

Keywords

FAQs

Last updated on 16 Jul 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc