litecore-archive / litecore-lib

A pure and powerful JavaScript Litecoin library
https://litecore.io/
Other
72 stars 85 forks source link

Can not convert private key to address #17

Open elvis-hp opened 5 years ago

elvis-hp commented 5 years ago

Hi, pls see the photo, I can not convert Private key to address. I'm using: "litecore-lib": "^0.13.22",

And my codes: var privateKey = "***" var litecore = require('litecore-lib'); var address = new litecore.PrivateKey(privateKey).toAddress(); pls help me, thank you so much!

screen shot 2018-10-30 at 5 55 02 pm

ultragtx commented 5 years ago

Hi @0xngoubou, this issue may be caused by bad npm modules, if you are using yarn, try npm instead.

I've tested on my OSX machine with node 10.8.0, created a new project, npm i litecore-lib, and it works with no issue.

Here's the package-lock.json if you need: package-lock.json.txt

elvis-hp commented 5 years ago

Hi, @ultragtx, thank you for helping me. But it does not work for. I try: npm i litecore-lib But it still bugs in bitcore-lib (not litecore-lib) Before that, I installed and used bitcore-lib. My project supports both BTC and BCH. Now need to add LiteCoin.

screen shot 2018-10-31 at 11 48 18 am

elvis-hp commented 5 years ago

new error:

var privateKey = new litecore.PrivateKey(); console.log("privateKey", privateKey); var address = privateKey.toAddress(); console.log("new address", address);

screen shot 2018-11-05 at 1 38 42 pm