Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.32 KB

File metadata and controls

39 lines (29 loc) · 1.32 KB

Message Verification and Signing

Bitcore implementation of bitcoin message signing and verification. This is used to cryptographically prove that a certain message was signed by the holder of an address private key.

For more information refer to the bitcore-message github repo.

Installation

Message Verification and Signing is implemented as a separate module and you must add it to your dependencies:

For node projects:

npm install bitcore-lib --save
npm install bitcore-message --save

For client-side projects:

bower install bitcore-lib --save
bower install bitcore-message --save

Example

To sign a message:

var bitcore = require('bitcore-lib');
var Message = require('bitcore-message');
var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
var signature = Message('hello, world').sign(privateKey);

To verify a message:

var address = 'n1ZCYg9YXtB5XCZazLxSmPDa8iwJRZHhGx';
var signature = 'H/DIn8uA1scAuKLlCx+/9LnAcJtwQQ0PmcPrJUq90aboLv3fH5fFvY+vmbfOSFEtGarznYli6ShPr9RXwY9UrIY=';
var verified = Message('hello, world').verify(address, signature);