Coder Social home page Coder Social logo

ethereumjs-util's Introduction

SYNOPSIS Build Status

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

API

properties

  • MAX_INTEGER - The max interger that the VM can handle
  • TWO_POW256 - 2^256
  • SHA3_NULL - SHA3-256 hash of null
  • SHA3_RLP_ARRAY - SHA3-256 of an rlp of an empty array
  • SHA3_RLP - SHA3-256 hash of the rlp of null
  • ETH_UNITS - an array of ethereum units

methods

zeros(number)

Returns buffer filled with 0's

  • number - the number bytes to to return

pad(val, length)

pads an array or buffer with leading zeros till it has length bytes

  • val - the value to pad
  • length - the of the resulting value

unpad(val)

Trims leading zeros from a buffer or an array

  • val - a buffer to unpad

intToHex(int)

Converts an Integer into a hex String

  • int

intToBuffer(int)

Converts an Integer to a Buffer

  • int

bufferToInt(buf)

converts a Buffer to an Interger

  • buf

fromSigned(buf)

interpets a Buffer as a signed Integer and returns a Bignum

  • buf

toUnsigned(num)

Converts a bignum to an unsigned interger and returns it as a buffer

  • num - a bignum

pubToAddress(pubKey)

Returns the ethereum address of a given public key

  • pubKey - the public key as a buffer

defineProperties(self, fields)

defines properties on a Object

  • self - the Object to define properties on
  • fields - an array fields to define

validate(fields, data)

Validate defined fields

  • fields
  • data

printBA(ba)

Print a Buffer Array

  • ba - an Array of Buffers

baToJSON(ba)

converts a buffer array to JSON

  • ba - an Array of Buffers

TESTING

Node.js Tests use Mocha. Test in the browser use Testling.

LICENSE

GPL

ethereumjs-util's People

Contributors

kumavis avatar wanderer avatar

Watchers

 avatar  avatar

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.