rn-bitcoinjs-message

0.0.1 • Public • Published

bitcoinjs-message

NPM Package Build Status Dependency status

js-standard-style

Examples

var bitcoin = require('bitcoinjs-lib') // v3.x.x
var bitcoinMessage = require('bitcoinjs-message')

sign(message, privateKey, compressed[, network.messagePrefix])

Sign a Bitcoin message

var keyPair = bitcoin.ECPair.fromWIF('5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss')
var privateKey = keyPair.privateKey
var message = 'This is an example of a signed message.'
 
var signature = bitcoinMessage.sign(message, privateKey, keyPair.compressed)
console.log(signature.toString('base64'))
// => 'G9L5yLFjti0QTHhPyFrZCT1V/MMnBtXKmoiKDZ78NDBjERki6ZTQZdSMCtkgoNmp17By9ItJr8o7ChX0XxY91nk='

verify(message, address, signature[, network.messagePrefix])

Verify a Bitcoin message

var address = '1HZwkjkeaoZfTSaJxDw6aKkxp45agDiEzN'
 
console.log(bitcoinMessage.verify(message, address, signature))
// => true

LICENSE MIT

Package Sidebar

Install

npm i rn-bitcoinjs-message

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

6.11 kB

Total Files

5

Last publish

Collaborators

  • vanclief