Bitcoin Wallet Import Format JS encoding/decoding module
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test enforce private key length Nov 17, 2017
.gitignore add nyc to gitignore Oct 27, 2016
.travis.yml Update travis Nov 15, 2017
LICENSE Initial commit Aug 20, 2015
README.md README: add error example Dec 4, 2017
index.js enforce private key length Nov 17, 2017
package.json Use safe-buffer Nov 15, 2017

README.md

WIF

TRAVIS NPM

js-standard-style

Bitcoin Wallet Import Format encoding/decoding module.

Example

var wif = require('wif')
var privateKey = new Buffer('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
var key = wif.encode(128, privateKey, true)
// => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

var obj = wif.decode(key)
// => {
//	version: 128,
//	privateKey: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01>,
//	compressed: true
//}

wif.decode(key, 0x09)
// => Error: Invalid network version

// alternative syntax
wif.encode(obj)
// => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

LICENSE MIT