GithubHelp home page GithubHelp logo

k06a / ethereumjs-util Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ethereumjs/ethereumjs-util

1.0 1.0 1.0 755 KB

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

Home Page: https://github.com/ethereumjs/ethereumjs-monorepo

License: Mozilla Public License 2.0

JavaScript 0.90% TypeScript 99.10%

ethereumjs-util's Introduction

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

  • 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 from ethjs-util
    • Re-exports of BN, rlp

ethjs-util methods

The following methods are available provided by ethjs-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

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

ethereumjs-util's People

Contributors

alcuadrado avatar andy0130tw avatar asinyagin avatar axic avatar cgewecke avatar chikeichan avatar danjm avatar evertonfraga avatar fanatid avatar greenkeeper[bot] avatar greenkeeperio-bot avatar holgerd77 avatar jochem-brouwer avatar jwasinger avatar kumavis avatar mrchico avatar nebojsa94 avatar neurone avatar robiiinos avatar ryanio avatar s1na avatar serapath avatar silur avatar spalladino avatar subramanianv avatar tcoulter avatar tgerring avatar wanderer avatar whymarrh avatar zmanian avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

baron102

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.