A collection of utility functions for ethereum. It can be used in node.js or can be in the browser with browserify.
MAX_INTEGER
- The max interger that the VM can handleTWO_POW256
- 2^256SHA3_NULL
- SHA3-256 hash ofnull
SHA3_RLP_ARRAY
- SHA3-256 of an rlp of an empty arraySHA3_RLP
- SHA3-256 hash of the rlp ofnull
ETH_UNITS
- an array of ethereum units
Returns buffer filled with 0's
number
- the number bytes to to return
pads an array
or buffer
with leading zeros till it has length
bytes
val
- the value to padlength
- the of the resulting value
Trims leading zeros from a buffer or an array
val
- abuffer
to unpad
Converts an Integer
into a hex String
int
Converts an Integer
to a Buffer
int
converts a Buffer
to an Interger
buf
interpets a Buffer
as a signed Integer
and returns a Bignum
buf
Converts a bignum
to an unsigned interger and returns it as a buffer
num
- abignum
Returns the ethereum address of a given public key
pubKey
- the public key as abuffer
defines properties on a Object
self
- theObject
to define properties onfields
- an array fields to define
Validate defined fields
fields
data
Print a Buffer Array
ba
- anArray
ofBuffers
converts a buffer array to JSON
ba
- anArray
ofBuffers
Node.js Tests use Mocha. Test in the browser use Testling.
GPL