Bitcoin Forum
May 21, 2024, 10:48:55 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Error Code: -5, Invalid private key encoding for Litecoin Private Key  (Read 98 times)
nitikeshd (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 1


View Profile WWW
December 18, 2017, 06:13:00 AM
 #1

I am using litecore-lib in nodejs.

Code:
Code: 
var pkey = new litecore.PrivateKey();
var address = pkey.toAddress();

spawn('litecoin-cli',['importprivkey',pkey]);

But it gives me Error Message:

error code: -5
error message:
Invalid private key encoding


Please Help!!?

Reference: https://github.com/litecoin-project/litecore-lib/blob/master/docs/examples.md#generate-a-random-address
achow101
Staff
Legendary
*
Offline Offline

Activity: 3402
Merit: 6641


Just writing some code


View Profile WWW
December 18, 2017, 03:20:01 PM
 #2

The private key is not a WIF string currently. You just have a PrivateKey object. You need to get the WIF string of the private key.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!