Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitcoinjs/wif
Bitcoin Wallet Import Format JS encoding/decoding module
https://github.com/bitcoinjs/wif
bitcoin
Last synced: 5 days ago
JSON representation
Bitcoin Wallet Import Format JS encoding/decoding module
- Host: GitHub
- URL: https://github.com/bitcoinjs/wif
- Owner: bitcoinjs
- License: mit
- Created: 2015-08-20T09:56:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-06-25T11:45:22.000Z (6 months ago)
- Last Synced: 2024-11-30T18:50:24.680Z (12 days ago)
- Topics: bitcoin
- Language: JavaScript
- Homepage:
- Size: 417 KB
- Stars: 82
- Watchers: 10
- Forks: 42
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cryptocoinjs - bitcoin
README
# WIF
[![TRAVIS](https://secure.travis-ci.org/bitcoinjs/wif.png)](http://travis-ci.org/bitcoinjs/wif)
[![NPM](http://img.shields.io/npm/v/wif.svg)](https://www.npmjs.org/package/wif)[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
Bitcoin Wallet Import Format encoding/decoding module.
## Example
``` javascript
import * as wif from "wif"
var privateKey = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
var key = wif.encode({version: 128, privateKey, compressed: true}) // for the testnet use: wif.encode(239, ...
// => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWnvar obj = wif.decode(key)
// => {
// version: 128,
// privateKey: Uint8Array(32) [
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 1
// ],
// compressed: true
//}wif.decode(key, 0x09)
// => Error: Invalid network version// alternative syntax
wif.encode(obj)
// => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
```## LICENSE [MIT](LICENSE)