Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var imports = require('soop').imports();
var util = imports.util || require('../util');
var Debug1 = imports.Debug1 || function() {};
var Script = imports.Script || require('./Script');
var Bignum = imports.Bignum || require('./Bignum');
var Binary = imports.Binary || require('binary');
var Step = imports.Step || require('step');
var buffertools = imports.buffertools || require('buffertools');
var Transaction = imports.Transaction || require('./Transaction');
var TransactionIn = Transaction.In;
var TransactionOut = Transaction.Out;
var COINBASE_OP = Transaction.COINBASE_OP;
var VerificationError = imports.VerificationError || require('../util/error').VerificationError;
var BlockRules = {
maxTimeOffset: 2 * 60 * 60, // How far block timestamps can be into the future
largestHash: Bignum(2).pow(256)
'use strict';
var imports = require('soop').imports();
var TIMESTAMP_PREFIX = 'bts-'; // bts- =>
var PREV_PREFIX = 'bpr-'; // bpr- =>
var NEXT_PREFIX = 'bne-'; // bne- =>
var MAIN_PREFIX = 'bma-'; // bma- => (0 is unconnected)
var TIP = 'bti-'; // bti = : last block on the chain
var LAST_FILE_INDEX = 'file-'; // last processed file index
// txid - blockhash mapping (only for confirmed txs, ONLY FOR BEST BRANCH CHAIN)
var IN_BLK_PREFIX = 'btx-'; //btx- =
var MAX_OPEN_FILES = 500;
var CONCURRENCY = 5;
var DFLT_REQUIRED_CONFIRMATIONS = 1;
/**
'use strict';
var imports = require('soop').imports();
// to show tx outs
var OUTS_PREFIX = 'txo-'; //txo-- => [addr, btc_sat]
var SPENT_PREFIX = 'txs-'; //txs---- = ts
// to sum up addr balance (only outs, spents are gotten later)
var ADDR_PREFIX = 'txa2-'; //txa----
// tsr = 1e13-js_timestamp
// => + btc_sat [:isConfirmed:[scriptPubKey|isSpendConfirmed:SpentTxid:SpentVout:SpentTs]
// |balance:txApperances
// TODO: use bitcore networks module
var genesisTXID = '4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b';
'use strict';
var soop = require('soop');
var imports = soop.imports();
var levelup = require('levelup');
var config = require('../config/config');
var Rpc = imports.rpc || require('./Rpc');
var async = require('async');
var logger = require('./logger').logger;
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var microtime = require('microtime');
var bitcore = require('bitcore');
var AuthMessage = bitcore.AuthMessage;
var preconditions = require('preconditions').singleton();
var MESSAGE_PREFIX = 'msg-'; // msg-- =>
var MAX_OPEN_FILES = 500;
var CONCURRENCY = 5;
var imports = require('soop').imports();
var base58 = imports.base58 || require('./Base58').base58;
var coinUtil = imports.coinUtil || require('../util');
var Key = imports.Key || require('./Key');
var Point = imports.Point || require('./Point');
var SecureRandom = imports.SecureRandom || require('./SecureRandom');
var bignum = imports.bignum || require('bignum');
var crypto = require('crypto');
var networks = require('../networks');
var secp256k1_n = new bignum('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', 16);
var secp256k1_Gx = new bignum('79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798', 16);
/*
random new HierarchicalKey: new HierarchicalKey();
from extended public or private key: new HierarchicalKey(str);
new blank HierarchicalKey: new HierarchicalKey(null);
var imports = require('soop').imports();
var base58 = imports.base58 || require('./Base58').base58;
var coinUtil = imports.coinUtil || require('../util');
var Key = imports.Key || require('./Key');
var Point = imports.Point || require('./Point');
var SecureRandom = imports.SecureRandom || require('./SecureRandom');
var bignum = imports.bignum || require('bignum');
var networks = require('../networks');
var secp256k1_n = new bignum('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', 16);
var secp256k1_Gx = new bignum('79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798', 16);
/*
random new HierarchicalKey: new HierarchicalKey();
from extended public or private key: new HierarchicalKey(str);
new blank HierarchicalKey: new HierarchicalKey(null);
*/
'use strict';
var imports = require('soop').imports();
var coinUtil = imports.coinUtil || require('../util');
var parent = imports.parent || require('../util/VersionedData');
var networks = imports.networks || require('../networks');
var Script = imports.Script || require('./Script');
function Address() {
Address.super(this, arguments);
}
Address.parent = parent;
parent.applyEncodingsTo(Address);
//create a pubKeyHash address
Address.fromPubKey = function(pubKey, network) {
if (!network)
network = 'livenet';
"use strict";
var imports = require('soop').imports();
var bignum = imports.bignum || require('../Bignum');
var CPPKey = imports.CPPKey || require('bindings')('KeyModule').Key;
var assert = require('assert');
//a point on the secp256k1 curve
//x and y are bignums
var Point = function(x, y) {
this.x = x;
this.y = y;
};
Point.add = function(p1, p2) {
var u1 = p1.toUncompressedPubKey();
var u2 = p2.toUncompressedPubKey();
var pubKey = CPPKey.addUncompressed(u1, u2);
return Point.fromUncompressedPubKey(pubKey);