GithubHelp home page GithubHelp logo

litecore-archive / litecore-lib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitpay/bitcore-lib

72.0 18.0 85.0 12.02 MB

A pure and powerful JavaScript Litecoin library

Home Page: https://litecore.io/

License: Other

JavaScript 99.98% HTML 0.02%

litecore-lib's Introduction

Litecore Library [DEPRECATED]

Important Notice: litecore-lib and the litecore stack are now deprecated. Please switch to alternative packages. libcore-lib should be considered unsafe for production use.

Alternatives include:

License

Code released under the MIT license.

Copyright 2013-2017 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc. Copyright 2016-2017 The Litecoin Core Developers

litecore-lib's People

Contributors

afk11 avatar bitjson avatar brandonrobertz avatar braydonf avatar chjj avatar devrandom avatar dskloet avatar dthorpe avatar eordano avatar ethers avatar fanatid avatar gabegattis avatar gasteve avatar himynameismartin avatar kyledrake avatar losh11 avatar manan19 avatar maraoz avatar marianorod avatar martindale avatar matiu avatar olalonde avatar pnagurny avatar rubensayshi avatar ryanxcharles avatar sagivo avatar throughnothing avatar trapp avatar trevinhofmann avatar yemel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

litecore-lib's Issues

xpub to get all address

Hi,
I need to get all the generated addresses for an xpub (or Ltub) extended public key. When I use the HDPublicKey.deriveChild(path, false), it is giving me this error:

message: 'Invalid argument: creating a hardened path requires an HDPrivateKey',
stack: 'Invalid argument: creating a hardened path requires an HDPrivateKey\n' +
'Error\n' +

Please help me to get the list of addresses from xpub or ltub extended public key.

Transaction example

Transactions can have multiple utxos? How would we add those in?

const transaction = new litecore.Transaction();
    .from(utxo)
    .to(targetAddress, target)
    .to(changeAddress, change)
    .sign(privateKey);

Could someone please provide an example of a transaction with multiple inputs?

Can not convert private key to address

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

use litecore-lib by python error!!!

This is my code:
`import execjs
import os

os.environ["NODE_PATH"] = r"C:\Users\PlanPoint\node_modules"
print(os.environ["NODE_PATH"])
print(execjs.get().name)
parser = execjs.compile("""
var liteCore = require('litecore-lib');
function parse(text) {
var privateKey = new liteCore.PrivateKey(text);
var publicKey = privateKey.toPublicKey();
var address = privateKey.toAddress();
var address2 = publicKey.toAddress(liteCore.Networks.testnet);
var toaddr = "n1F3e7b4C5VbaCBksoyBeLdJT2iB7TCAcr"
var utxos = '[{"address":"n4G7vt2ANN5rHz6c4V3dz7DyxG7qbwsi4r","txid":"e168527db3b34ca0f93c2dbbb08c9cdd09b150d333af30b18b54ac6442209789","vout":1,"scriptPubKey":"76a914f97cb24a04c278fb944cdefdec37c302838baca888ac","amount":1,"satoshis":100000000,"height":712547,"confirmations":11},{"address":"n4G7vt2ANN5rHz6c4V3dz7DyxG7qbwsi4r","txid":"8c3010b16f0b732f31cb76ab6f9d0b43b69f4ac6c5a3b54018ea28290cf80041","vout":0,"scriptPubKey":"76a914f97cb24a04c278fb944cdefdec37c302838baca888ac","amount":3,"satoshis":300000000,"height":712547,"confirmations":11}]'
var transaction = new liteCore.Transaction()
.from(utxos)
.to(toaddr, 200000000)
.change(address2)
.sign(privateKey)
.serialize();
return transaction;
}
""")
if name == "main":
obj = parser.call("parse", 'e735a14ef488a42d5621e8f75b53eddd3cbbb505557945cd07df65bb2dd78dd0')
print(obj)
and error message is:E:\zt_6.27\python\python.exe E:/zt_6.27/py2/testLTC2.py
C:\Users\PlanPoint\node_modules
Node.js (V8)
Traceback (most recent call last):
File "E:/zt_6.27/py2/testLTC2.py", line 26, in
obj = parser.call("parse", 'e735a14ef488a42d5621e8f75b53eddd3cbbb505557945cd07df65bb2dd78dd0')
File "E:\zt_6.27\python\lib\site-packages\execjs_abstract_runtime_context.py", line 37, in call
return self._call(name, *args)
File "E:\zt_6.27\python\lib\site-packages\execjs_external_runtime.py", line 92, in _call
return self.eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args))
File "E:\zt_6.27\python\lib\site-packages\execjs_external_runtime.py", line 78, in eval
return self.exec
(code)
File "E:\zt_6.27\python\lib\site-packages\execjs_abstract_runtime_context.py", line 18, in exec

return self.exec(source)
File "E:\zt_6.27\python\lib\site-packages\execjs_external_runtime.py", line 88, in exec
return self._extract_result(output)
File "E:\zt_6.27\python\lib\site-packages\execjs_external_runtime.py", line 167, in _extract_result
raise ProgramError(value)
execjs._exceptions.ProgramError: litecore.ErrorInvalidArgument: Invalid Argument: Must provide an object from where to extract data

Process finished with exit code 1`

What caused it? I wrote according to the guide.

No matching version found for bitcore-lib-ltc@^8.25.12

Hi,
I tried to install the dependency of the bitcore-node (npm install), and I've got this error:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for bitcore-lib-ltc@^8.25.12.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'crypto-wallet-core'
npm ERR! notarget

It seems that the crypto-wallet-core included in the bitcore-node's package.json is not able to find this specific version of the bitcore-libt-ltc.

Receive UTXOS to generate new transaction

How can I receive UTXOS data for some address to generate new dependent transaction?

When I do this for BTC I use:

    var Insight = require("bitcore-explorers").Insight;
    var insight = new Insight(network);
    insight.getUnspentUtxos(sourceAddress, function (error, utxos) {
        // ...
    }

TypeError: Number must be less than N

Hi. I am trying to sign a transaction and I am getting the error mentioned in the title. This is my code:

const bitcore = require('litecore-lib');
const Mnemonic = require('litecore-mnemonic');

const words = 'something something ...';
const code = new Mnemonic(words);
const hdPrivateKey = code.toHDPrivateKey('password', "livenet");
const derivationPath = hdPrivateKey
  .derive(44, true)
  .derive(2, true)
  .derive(0, true)
  .derive(0);
const utxo = {
  ...
}
const originAddress = '..';
const destinationAddress = ',,';
const privateKey = derivationPath.derive(0).privateKey;

const tx = new bitcore.Transaction()
  .from(utxo)
  .to(destinationAddress, 0.001 * 100000000)
  .change(originAddress);

tx.sign(privateKey);

And the complete stack trace is:

TypeError: Number must be less than N
privatekey.js:55
    at new PrivateKey (/home/carlos/dev/xourse/testbn/node_modules/litecore-lib/lib/privatekey.js:55:11)
    at Transaction.getSignatures (/home/carlos/dev/xourse/testbn/node_modules/litecore-lib/lib/transaction/transaction.js:1141:13)
    at Transaction.sign (/home/carlos/dev/xourse/testbn/node_modules/litecore-lib/lib/transaction/transaction.js:1134:15)
    at Object.<anonymous> (/home/carlos/dev/xourse/testbn/ltc.js:81:12)
    at Module._compile (internal/modules/cjs/loader.js:651:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)

sign error

TypeError: r.gt is not a function at ECDSA.sigError (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/crypto/ecdsa.js:169:11) at ECDSA.verify (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/crypto/ecdsa.js:272:13) at Function.ECDSA.verify (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/crypto/ecdsa.js:294:6) at Object.verify (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/transaction/sighash.js:127:16) at PublicKeyHashInput.Input.isValidSignature (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/transaction/input/input.js:198:18) at PublicKeyHashInput.addSignature (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/transaction/input/publickeyhash.js:63:21) at Transaction.applySignature (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/transaction/transaction.js:1166:37) at /Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/lib/transaction/transaction.js:1135:10 at arrayEach (/Users/joy/Work/backend/withdraw_all/node_modules/litecore-lib/node_modules/lodash/index.js:1289:13) at Function.<anonymous>

my codes:
var privateKey = new litecore.PrivateKey('cUEHLwt7e7rXFoATPKyyWEGJv3BTznPSz79aFBWfyAHMzemCADCL'); var utxo = { "txId" : "ea81cfdaf1f467e8fc729913f5250ed6997841177f0e393789fcdd48c91f3896", "outputIndex" : 0, "address" : "mpcFhXGhao3J7xaP1eCTKZP8t5vzN5jwND", "script" : "76a91463b9bd92a3605869946677cf24f38f572fd6603788ac", "satoshis" : 10000000000 }; var transaction = new litecore.Transaction() .from(utxo) .to('n3chACpRvZHr5zvCLcxVPtguwGWSMHC4fk', 15000) .sign(privateKey)

please help

litecore-lib generating bitcoin address

here is my code

var litecore = require('litecore-lib');
var explorers = require('litecore-explorers');
var insight = new explorers.Insight('testnet');
var SenderPrivateKey = new litecore.PrivateKey('testnet');//"f5f6285f379080249da16eacf8dac4dd432f5c367bbe9476ccbb8526380ad1e5"
var SenderAddress = privateKey.toAddress();//mr1QRgBAshnYqLj1kk9TcnFumNo1ceApy6

"mr1QRgBAshnYqLj1kk9TcnFumNo1ceApy6"

Not able to receive litecoins with this address..

bower ENOTFOUND

When I try bower install litecore-lib, it replys below error.
bower ENOTFOUND Package litecore-lib not found

Is there litecore-lib for the browser? #

HDPrivateKey derivation: version argument is not a buffer

The following code fails:

const HDPrivateKey = require('litecore-lib').HDPrivateKey;
const privKey = 'xprv...';

var parent = new HDPrivateKey(privKey);
var child_0_1_2h = parent.derive(0).derive(1).derive(2, true);
var copy_of_child_0_1_2h = parent.derive("m/0/1/2'");
assert(child_0_1_2h.xprivkey === copy_of_child_0_1_2h);

Giving me this error:

AssertionError: version argument is not a buffer at checkBuffer (/home/burton/depositor/node_modules/litecore-lib/lib/hdprivatekey.js:523:5) at Function.HDPrivateKey._validateBufferArguments (/home/burton/depositor/node_modules/litecore-lib/lib/hdprivatekey.js:529:3) at HDPrivateKey._buildFromBuffers (/home/burton/depositor/node_modules/litecore-lib/lib/hdprivatekey.js:461:16) at HDPrivateKey._buildFromObject (/home/burton/depositor/node_modules/litecore-lib/lib/hdprivatekey.js:376:15) at new HDPrivateKey (/home/burton/depositor/node_modules/litecore-lib/lib/hdprivatekey.js:61:10) at Object.<anonymous> (/home/burton/depositor/index.js:5:14) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12)

Any work arounds for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.