/penny.js

A JavaScript library for interacting with the Bitcoin protocol.

Primary LanguageJavaScriptMIT LicenseMIT

Penny.js

Penny.js is a library for interacting with the Bitcoin protocol. It is heavily inspired by bitcoin-ruby.

Installation

Bower

$ bower install penny.js

Examples

There are different aspects to the library which can be used separately or in combination. Below are some examples of what Penny can do.

Keys & addresses

Generate a key:

var key = new Penny.Key();
key.priv // => <priv key>
key.pub // => <pub key>

Get Bitcoin address from a public key:

Penny.pubkeyToAddress(pub) // => <bitcoin address>

Transaction parsing

Parse a transaction from JSON:

var tx = Penny.Transaction.fromJSON(json);

Parse a transaction from hex:

var tx = new Penny.Transaction(hex);

And then you can interact with the transaction:

tx.hash // => 6e9dd16625b62cfcd4bf02edb89ca1f5a8c30c4b1601507090fb28e59f2d02b4
tx.in.length // => 1
tx.out.lenght // => 2

License

MIT.