New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

litecore-lib

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

litecore-lib - npm Package Compare versions

Comparing version 0.13.19 to 0.13.20

3

lib/block/blockheader.js

@@ -274,3 +274,4 @@ 'use strict';

BlockHeader.prototype.validProofOfWork = function validProofOfWork() {
var pow = new BN(this.id, 'hex');
// For Litecoin, we use the scrypt hash to calculate proof of work
var pow = new BN(Hash.scrypt(this.toBuffer()));
var target = this.getTargetDifficulty();

@@ -277,0 +278,0 @@

@@ -5,2 +5,3 @@ 'use strict';

var BufferUtil = require('../util/buffer');
var Scrypt = require('scryptsy')
var $ = require('../util/preconditions');

@@ -87,1 +88,7 @@

};
// Litecoin Scrypt hashing
Hash.scrypt = function(buf) {
$.checkArgument(BufferUtil.isBuffer(buf));
return Scrypt(buf, buf, 1024, 1, 1, 32).reverse();
};

@@ -72,3 +72,3 @@ 'use strict';

// max amount of satoshis in circulation
Transaction.MAX_MONEY = 21000000 * 1e8;
Transaction.MAX_MONEY = 84000000 * 1e8; // Litecoin has 84M coins

@@ -82,3 +82,3 @@ // nlocktime limit to be considered block height rather than a timestamp

// Value used for fee estimation (satoshis per kilobyte)
Transaction.FEE_PER_KB = 10000;
Transaction.FEE_PER_KB = 100000; // Litecoin default fees is 0.001 LTC

@@ -85,0 +85,0 @@ // Safe upper bound for change address script size in bytes

{
"name": "bitcore",
"version": "0.13.19",
"name": "litecore",
"version": "0.13.20",
"dependencies": {

@@ -5,0 +5,0 @@ "bn.js": {

{
"name": "litecore-lib",
"version": "0.13.19",
"version": "0.13.20",
"description": "A pure and powerful JavaScript Litecoin library.",

@@ -93,3 +93,4 @@ "author": "BitPay <dev@bitpay.com>",

"inherits": "=2.0.1",
"lodash": "=3.10.1"
"lodash": "=3.10.1",
"scryptsy": "=2.0.0"
},

@@ -96,0 +97,0 @@ "devDependencies": {

@@ -139,2 +139,17 @@ 'use strict';

describe('#scrypt', function() {
// See: https://github.com/litecoin-project/litecoin/blob/master-0.10/src/test/scrypt_tests.cpp
it('calculates scrypt hash correctly', function() {
var headers = [ "020000004c1271c211717198227392b029a64a7971931d351b387bb80db027f270411e398a07046f7d4a08dd815412a8712f874a7ebf0507e3878bd24e20a3b73fd750a667d2f451eac7471b00de6659", "0200000011503ee6a855e900c00cfdd98f5f55fffeaee9b6bf55bea9b852d9de2ce35828e204eef76acfd36949ae56d1fbe81c1ac9c0209e6331ad56414f9072506a77f8c6faf551eac7471b00389d01", "02000000a72c8a177f523946f42f22c3e86b8023221b4105e8007e59e81f6beb013e29aaf635295cb9ac966213fb56e046dc71df5b3f7f67ceaeab24038e743f883aff1aaafaf551eac7471b0166249b", "010000007824bc3a8a1b4628485eee3024abd8626721f7f870f8ad4d2f33a27155167f6a4009d1285049603888fe85a84b6c803a53305a8d497965a5e896e1a00568359589faf551eac7471b0065434e", "0200000050bfd4e4a307a8cb6ef4aef69abc5c0f2d579648bd80d7733e1ccc3fbc90ed664a7f74006cb11bde87785f229ecd366c2d4e44432832580e0608c579e4cb76f383f7f551eac7471b00c36982" ];
var hashes = [ "00000000002bef4107f882f6115e0b01f348d21195dacd3582aa2dabd7985806" , "00000000003a0d11bdd5eb634e08b7feddcfbbf228ed35d250daf19f1c88fc94", "00000000000b40f895f288e13244728a6c2d9d59d8aff29c65f8dd5114a8ca81", "00000000003007005891cd4923031e99d8e8d72f6e8e7edc6a86181897e105fe", "000000000018f0b426a4afc7130ccb47fa02af730d345b4fe7c7724d3800ec8c" ];
headers.forEach(function(header, i) {
var data = new Buffer(header, 'hex');
Hash.scrypt(data).toString('hex').should.equal(hashes[i]);
});
});
});
});

@@ -8,3 +8,3 @@ [

"script": "OP_DUP OP_HASH160 20 0x88d9931ea73d60eaf7e5671efc0552b912911f2a OP_EQUALVERIFY OP_CHECKSIG",
"satoshis": 1020000
"satoshis": 1110000
}],

@@ -21,3 +21,3 @@ "to", ["mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc", 1010000],

"scriptPubKey": "76a914073b7eae2823efa349e3b9155b8a735526463a0f88ac",
"amount": 0.01080000
"amount": 0.01170000
}],

@@ -45,3 +45,3 @@ "to", ["mn9new5vPYWuVN5m3gUBujfKh1uPQvR9mf", 500000],

"scriptPubKey": "76a914aab76ba4877d696590d94ea3e02948b55294815188ac",
"amount": 0.00570000,
"amount": 0.00660000,
"confirmations": 0

@@ -62,3 +62,3 @@ }]

"scriptPubKey": "76a914089acaba6af8b2b4fb4bed3b747ab1e4e60b496588ac",
"amount": 0.01
"amount": 0.0109
}],

@@ -71,3 +71,3 @@ "to", ["n3riXZowrjGnY74rx7Hdi9wCyvgyJC28zZ", 990000],

"from", [{
"address":"38nw4sTs3fCH1YiBjYeQAX1t9eWMxpek8Z","txid":"073281b2cc94e879aaf30ea2e92947d9827b270015849d3a5b96a89ee15bfa66","vout":0,"ts":1418877950,"scriptPubKey":"a9144de752833233fe69a20064f29b2ca0f6399c8af387","amount":0.00318512,"confirmationsFromCache":false
"address":"38nw4sTs3fCH1YiBjYeQAX1t9eWMxpek8Z","txid":"073281b2cc94e879aaf30ea2e92947d9827b270015849d3a5b96a89ee15bfa66","vout":0,"ts":1418877950,"scriptPubKey":"a9144de752833233fe69a20064f29b2ca0f6399c8af387","amount":0.00408512,"confirmationsFromCache":false
}, ["03411e021210a933c247ea9c8dad4bbead281597d508ad84e899de13e4ce98b4ba", "03bda2c3cc11a391b36e3d695b03ab42b96fe04086b2349056108d858983e60dab", "03c16e6ecf4e02bf9db23d3247ab92db8881f0866133ffb530c3470f6d8dea7330"], 2],

@@ -79,3 +79,3 @@ "to", ["3BazTqvkvEBcWk7J4sbgRnxUw6rjYrogf9", 300299],

[
"from", [{"address":"3BazTqvkvEBcWk7J4sbgRnxUw6rjYrogf9","txid":"afbf98ca4a43db8915d75184b5204fbe71d916482adfe85cb0ed3635764fc220","vout":0,"ts":1418878108,"scriptPubKey":"a9146c8d8b04c6a1e664b1ec20ec932760760c97688e87","amount":0.00318512,"confirmationsFromCache":false}, ["020483ebb834d91d494a3b649cf0e8f5c9c4fcec5f194ab94341cc99bb440007f2", "0271ebaeef1c2bf0c1a4772d1391eab03e4d96a6e9b48551ab4e4b0d2983eb452b", "03a659828aabe443e2dedabb1db5a22335c5ace5b5b7126998a288d63c99516dd8"], 2
"from", [{"address":"3BazTqvkvEBcWk7J4sbgRnxUw6rjYrogf9","txid":"afbf98ca4a43db8915d75184b5204fbe71d916482adfe85cb0ed3635764fc220","vout":0,"ts":1418878108,"scriptPubKey":"a9146c8d8b04c6a1e664b1ec20ec932760760c97688e87","amount":0.00408512,"confirmationsFromCache":false}, ["020483ebb834d91d494a3b649cf0e8f5c9c4fcec5f194ab94341cc99bb440007f2", "0271ebaeef1c2bf0c1a4772d1391eab03e4d96a6e9b48551ab4e4b0d2983eb452b", "03a659828aabe443e2dedabb1db5a22335c5ace5b5b7126998a288d63c99516dd8"], 2
],

@@ -82,0 +82,0 @@ "from", [

@@ -203,2 +203,9 @@ 'use strict';

};
var simpleUtxoWith1000000Satoshis = {
address: fromAddress,
txId: 'a477af6b2667c29670467e4e0728b685ee07b240235771862318e29ddbe58458',
outputIndex: 0,
script: Script.buildPublicKeyHashOut(fromAddress).toString(),
satoshis: 1000000
};
var anyoneCanSpendUTXO = JSON.parse(JSON.stringify(simpleUtxoWith100000Satoshis));

@@ -293,8 +300,8 @@ anyoneCanSpendUTXO.script = new Script().add('OP_TRUE');

var transaction = new Transaction()
.from(simpleUtxoWith100000Satoshis)
.to(toAddress, 50000)
.from(simpleUtxoWith1000000Satoshis)
.to(toAddress, 500000)
.change(changeAddress)
.sign(privateKey);
transaction.outputs.length.should.equal(2);
transaction.outputs[1].satoshis.should.equal(40000);
transaction.outputs[1].satoshis.should.equal(400000);
transaction.outputs[1].script.toString()

@@ -308,4 +315,4 @@ .should.equal(Script.fromAddress(changeAddress).toString());

var transaction = new Transaction()
.from(simpleUtxoWith100000Satoshis)
.to(toAddress, 50000)
.from(simpleUtxoWith1000000Satoshis)
.to(toAddress, 500000)
.change(changeAddressP2SH)

@@ -925,3 +932,3 @@ .sign(privateKey);

transaction.inputAmount.should.equal(100000000);
transaction.outputAmount.should.equal(99990000);
transaction.outputAmount.should.equal(99900000);
});

@@ -1018,3 +1025,3 @@ it('returns correct values for coinjoin transaction', function() {

tx.outputs[0].script.toAddress().toString().should.equal(toAddress);
tx.outputs[1].satoshis.should.equal(89990000);
tx.outputs[1].satoshis.should.equal(89900000);
tx.outputs[1].script.toAddress().toString().should.equal(changeAddress);

@@ -1021,0 +1028,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc