Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

First argument should be an instance of PrivateKey #204

Open
5-digits opened this issue Feb 8, 2018 · 0 comments
Open

First argument should be an instance of PrivateKey #204

5-digits opened this issue Feb 8, 2018 · 0 comments

Comments

@5-digits
Copy link

5-digits commented Feb 8, 2018

After using the bitcore-lib and the bitcore-message

when sign a new message i get this error ::
C:\wamp64\www\Transactions\core\node_modules\bitcore-message\node_modules\bitcore-lib\lib\util\preconditions.js:14 throw new errors.InvalidArgument(argumentName, message, docsPath); ^ Invalid Argument: First argument should be an instance of PrivateKey Error at new NodeError (C:\wamp64\www\Transactions\core\node_modules\bitcore-message\node_modules\bitcore-lib\lib\errors\index.js:20:41) at Object.checkArgument (C:\wamp64\www\Transactions\core\node_modules\bitcore-message\node_modules\bitcore-lib\lib\util\preconditions.js:14:13) at Message._sign (C:\wamp64\www\Transactions\core\node_modules\bitcore-message\lib\message.js:43:5) at Message.sign (C:\wamp64\www\Transactions\core\node_modules\bitcore-message\lib\message.js:62:24)

my script code ::

var bitcore = require('bitcore-lib');

+delete global._bitcore;
var Message = require('bitcore-message');

var privateKey = new bitcore.PrivateKey('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
var message = new Message('This is an example of a signed message.');

 var signature = message.sign(privateKey); 
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@5-digits and others