Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Project is in active development and has been moved to the EthereumJS monorepo.

License

NotificationsYou must be signed in to change notification settings

ethereumjs/ethereumjs-util

Repository files navigation

SYNOPSIS

NPM StatusActions StatusCoverage StatusDiscord

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

INSTALL

npm install ethereumjs-util

USAGE

importassertfrom'assert'import{isValidChecksumAddress,unpadBuffer,BN}from'ethereumjs-util'constaddress='0x2F015C60E0be116B1f0CD534704Db9c92118FB6A'assert.ok(isValidChecksumAddress(address))assert.equal(unpadBuffer(Buffer.from('000000006600','hex')),Buffer.from('6600','hex'))assert.equal(newBN('dead',16).add(newBN('101010',2)),57047)

API

Documentation

Modules

  • account
    • Account class
    • Private/public key and address-related functionality (creation, validation, conversion)
  • address
    • Address class and type
  • bytes
    • Byte-related helper and conversion functions
  • constants
    • Exposed constants
      • e.g. KECCAK256_NULL_S for string representation of Keccak-256 hash of null
  • hash
    • Hash functions
  • object
    • Helper function for creating a binary object (DEPRECATED)
  • signature
    • Signing, signature validation, conversion, recovery
  • types
    • Helpful TypeScript types
  • externals
    • Helper methods fromethjs-util
    • Re-exports ofBN,rlp

ethjs-util methods

The following methods are available provided byethjs-util:

  • arrayContainsArray
  • toBuffer
  • getBinarySize
  • stripHexPrefix
  • isHexPrefixed
  • isHexString
  • padToEven
  • intToHex
  • fromAscii
  • fromUtf8
  • toUtf8
  • toAscii
  • getKeys

They can be imported by name:

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

Re-Exports

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

EthereumJS

See our organizationaldocumentation for an introduction toEthereumJS 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 ourcontribution guidelines.

LICENSE

MPL-2.0


[8]ページ先頭

©2009-2025 Movatter.jp