JS Stellar Base
![Code Climate](https://codeclimate.com/github/stellar/js-stellar-base/badges/gpa.svg)
The stellar-base library is the lowest-level stellar helper library. It consists of classes
to read, write, hash, and sign the xdr structures that are used in stellar-core.
Installation
Using npm:
npm install --save stellar-base
Usage
Examples are here
In addition to the code generated from the XDR definition files (see js-xdr for example usage), this library also provides some stellar specific features. Let's look at some of them:
var StellarBase = require("stellar-base");
var signer = StellarBase.Keypair.fromSeed("s3tUdZbCmLoMdrZ6nhqztatMFaiD85P54oVj93g1NeSBwWQpTnE");
var verifier = StellarBase.Keypair.fromAddress("gsTe6bDX54bPwtUAm2TER4shBF8nQNVtEvB8fmRkRoWvq3Y8XmY")
var sig = signer.signDecorated("Hello world!")
console.log(sig.hint())
console.log(sig.signature())
This library also provides an impementation of base58 and base58check encoding, with support for the stellar alphabet:
var StellarBase = require("stellar-base");
var encoded = StellarBase.encodeBase58([0,0,0]);
StellarBase.decodeBase58(encoded)
StellarBase.encodeBase58Check("account_id", [0,0,0])
StellarBase.encodeBase58Check("seed", [0,0,0])
encoded = StellarBase.encodeBase58Check("account_id", [0,0,0])
StellarBase.decodeBase58Check("account_id", encoded)
StellarBase.decodeBase58Check("seed", encoded) # => throws Error: invalid version byte. expected 0, got 33
Contributing
Please see CONTRIBUTING.md for details.