sed -i 's/^var /const /'
This commit is contained in:
parent
93b1ae4303
commit
91b8823aa8
37 changed files with 197 additions and 197 deletions
|
@ -1,11 +1,11 @@
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var bech32 = require('bech32')
|
const bech32 = require('bech32')
|
||||||
var bs58check = require('bs58check')
|
const bs58check = require('bs58check')
|
||||||
var bscript = require('./script')
|
const bscript = require('./script')
|
||||||
var btemplates = require('./templates')
|
const btemplates = require('./templates')
|
||||||
var networks = require('./networks')
|
const networks = require('./networks')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var types = require('./types')
|
const types = require('./types')
|
||||||
|
|
||||||
function fromBase58Check (address) {
|
function fromBase58Check (address) {
|
||||||
var payload = bs58check.decode(address)
|
var payload = bs58check.decode(address)
|
||||||
|
|
14
src/block.js
14
src/block.js
|
@ -1,11 +1,11 @@
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var bcrypto = require('./crypto')
|
const bcrypto = require('./crypto')
|
||||||
var fastMerkleRoot = require('merkle-lib/fastRoot')
|
const fastMerkleRoot = require('merkle-lib/fastRoot')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var types = require('./types')
|
const types = require('./types')
|
||||||
var varuint = require('varuint-bitcoin')
|
const varuint = require('varuint-bitcoin')
|
||||||
|
|
||||||
var Transaction = require('./transaction')
|
const Transaction = require('./transaction')
|
||||||
|
|
||||||
function Block () {
|
function Block () {
|
||||||
this.version = 1
|
this.version = 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var createHash = require('create-hash')
|
const createHash = require('create-hash')
|
||||||
|
|
||||||
function ripemd160 (buffer) {
|
function ripemd160 (buffer) {
|
||||||
return createHash('rmd160').update(buffer).digest()
|
return createHash('rmd160').update(buffer).digest()
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var bip66 = require('bip66')
|
const bip66 = require('bip66')
|
||||||
const ecc = require('tiny-secp256k1')
|
const ecc = require('tiny-secp256k1')
|
||||||
var pushdata = require('pushdata-bitcoin')
|
const pushdata = require('pushdata-bitcoin')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var types = require('./types')
|
const types = require('./types')
|
||||||
var scriptNumber = require('./script_number')
|
const scriptNumber = require('./script_number')
|
||||||
|
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
var REVERSE_OPS = require('bitcoin-ops/map')
|
const REVERSE_OPS = require('bitcoin-ops/map')
|
||||||
var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
const OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
||||||
|
|
||||||
function isOPInt (value) {
|
function isOPInt (value) {
|
||||||
return types.Number(value) &&
|
return types.Number(value) &&
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
|
|
||||||
function decode (buffer, maxLength, minimal) {
|
function decode (buffer, maxLength, minimal) {
|
||||||
maxLength = maxLength || 4
|
maxLength = maxLength || 4
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
var decompile = require('../script').decompile
|
const decompile = require('../script').decompile
|
||||||
var multisig = require('./multisig')
|
const multisig = require('./multisig')
|
||||||
var nullData = require('./nulldata')
|
const nullData = require('./nulldata')
|
||||||
var pubKey = require('./pubkey')
|
const pubKey = require('./pubkey')
|
||||||
var pubKeyHash = require('./pubkeyhash')
|
const pubKeyHash = require('./pubkeyhash')
|
||||||
var scriptHash = require('./scripthash')
|
const scriptHash = require('./scripthash')
|
||||||
var witnessPubKeyHash = require('./witnesspubkeyhash')
|
const witnessPubKeyHash = require('./witnesspubkeyhash')
|
||||||
var witnessScriptHash = require('./witnessscripthash')
|
const witnessScriptHash = require('./witnessscripthash')
|
||||||
var witnessCommitment = require('./witnesscommitment')
|
const witnessCommitment = require('./witnesscommitment')
|
||||||
|
|
||||||
var types = {
|
const types = {
|
||||||
MULTISIG: 'multisig',
|
MULTISIG: 'multisig',
|
||||||
NONSTANDARD: 'nonstandard',
|
NONSTANDARD: 'nonstandard',
|
||||||
NULLDATA: 'nulldata',
|
NULLDATA: 'nulldata',
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// OP_0 [signatures ...]
|
// OP_0 [signatures ...]
|
||||||
|
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var p2mso = require('./output')
|
const p2mso = require('./output')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
function partialSignature (value) {
|
function partialSignature (value) {
|
||||||
return value === OPS.OP_0 || bscript.isCanonicalScriptSignature(value)
|
return value === OPS.OP_0 || bscript.isCanonicalScriptSignature(value)
|
||||||
|
@ -23,7 +23,7 @@ function check (script, allowIncomplete) {
|
||||||
}
|
}
|
||||||
check.toJSON = function () { return 'multisig input' }
|
check.toJSON = function () { return 'multisig input' }
|
||||||
|
|
||||||
var EMPTY_BUFFER = Buffer.allocUnsafe(0)
|
const EMPTY_BUFFER = Buffer.allocUnsafe(0)
|
||||||
|
|
||||||
function encodeStack (signatures, scriptPubKey) {
|
function encodeStack (signatures, scriptPubKey) {
|
||||||
typeforce([partialSignature], signatures)
|
typeforce([partialSignature], signatures)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// m [pubKeys ...] n OP_CHECKMULTISIG
|
// m [pubKeys ...] n OP_CHECKMULTISIG
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var types = require('../../types')
|
const types = require('../../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
const OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
||||||
|
|
||||||
function check (script, allowIncomplete) {
|
function check (script, allowIncomplete) {
|
||||||
var chunks = bscript.decompile(script)
|
var chunks = bscript.decompile(script)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// OP_RETURN {data}
|
// OP_RETURN {data}
|
||||||
|
|
||||||
var bscript = require('../script')
|
const bscript = require('../script')
|
||||||
var types = require('../types')
|
const types = require('../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var buffer = bscript.compile(script)
|
var buffer = bscript.compile(script)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// {signature}
|
// {signature}
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var chunks = bscript.decompile(script)
|
var chunks = bscript.decompile(script)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// {pubKey} OP_CHECKSIG
|
// {pubKey} OP_CHECKSIG
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var chunks = bscript.decompile(script)
|
var chunks = bscript.decompile(script)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// {signature} {pubKey}
|
// {signature} {pubKey}
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var chunks = bscript.decompile(script)
|
var chunks = bscript.decompile(script)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
|
// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var types = require('../../types')
|
const types = require('../../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var buffer = bscript.compile(script)
|
var buffer = bscript.compile(script)
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// <scriptSig> {serialized scriptPubKey script}
|
// <scriptSig> {serialized scriptPubKey script}
|
||||||
|
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
|
|
||||||
var p2ms = require('../multisig/')
|
const p2ms = require('../multisig/')
|
||||||
var p2pk = require('../pubkey/')
|
const p2pk = require('../pubkey/')
|
||||||
var p2pkh = require('../pubkeyhash/')
|
const p2pkh = require('../pubkeyhash/')
|
||||||
var p2wpkho = require('../witnesspubkeyhash/output')
|
const p2wpkho = require('../witnesspubkeyhash/output')
|
||||||
var p2wsho = require('../witnessscripthash/output')
|
const p2wsho = require('../witnessscripthash/output')
|
||||||
|
|
||||||
function check (script, allowIncomplete) {
|
function check (script, allowIncomplete) {
|
||||||
var chunks = bscript.decompile(script)
|
var chunks = bscript.decompile(script)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// OP_HASH160 {scriptHash} OP_EQUAL
|
// OP_HASH160 {scriptHash} OP_EQUAL
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var types = require('../../types')
|
const types = require('../../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var buffer = bscript.compile(script)
|
var buffer = bscript.compile(script)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// OP_RETURN {aa21a9ed} {commitment}
|
// OP_RETURN {aa21a9ed} {commitment}
|
||||||
|
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var types = require('../../types')
|
const types = require('../../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
var HEADER = Buffer.from('aa21a9ed', 'hex')
|
const HEADER = Buffer.from('aa21a9ed', 'hex')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var buffer = bscript.compile(script)
|
var buffer = bscript.compile(script)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// {signature} {pubKey}
|
// {signature} {pubKey}
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
|
|
||||||
function isCompressedCanonicalPubKey (pubKey) {
|
function isCompressedCanonicalPubKey (pubKey) {
|
||||||
return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33
|
return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// OP_0 {pubKeyHash}
|
// OP_0 {pubKeyHash}
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var types = require('../../types')
|
const types = require('../../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var buffer = bscript.compile(script)
|
var buffer = bscript.compile(script)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// <scriptSig> {serialized scriptPubKey script}
|
// <scriptSig> {serialized scriptPubKey script}
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var types = require('../../types')
|
const types = require('../../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
|
|
||||||
var p2ms = require('../multisig/')
|
const p2ms = require('../multisig/')
|
||||||
var p2pk = require('../pubkey/')
|
const p2pk = require('../pubkey/')
|
||||||
var p2pkh = require('../pubkeyhash/')
|
const p2pkh = require('../pubkeyhash/')
|
||||||
|
|
||||||
function check (chunks, allowIncomplete) {
|
function check (chunks, allowIncomplete) {
|
||||||
typeforce(types.Array, chunks)
|
typeforce(types.Array, chunks)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// OP_0 {scriptHash}
|
// OP_0 {scriptHash}
|
||||||
|
|
||||||
var bscript = require('../../script')
|
const bscript = require('../../script')
|
||||||
var types = require('../../types')
|
const types = require('../../types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var OPS = require('bitcoin-ops')
|
const OPS = require('bitcoin-ops')
|
||||||
|
|
||||||
function check (script) {
|
function check (script) {
|
||||||
var buffer = bscript.compile(script)
|
var buffer = bscript.compile(script)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var bcrypto = require('./crypto')
|
const bcrypto = require('./crypto')
|
||||||
var bscript = require('./script')
|
const bscript = require('./script')
|
||||||
var bufferutils = require('./bufferutils')
|
const bufferutils = require('./bufferutils')
|
||||||
var opcodes = require('bitcoin-ops')
|
const opcodes = require('bitcoin-ops')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var types = require('./types')
|
const types = require('./types')
|
||||||
var varuint = require('varuint-bitcoin')
|
const varuint = require('varuint-bitcoin')
|
||||||
|
|
||||||
function varSliceSize (someScript) {
|
function varSliceSize (someScript) {
|
||||||
var length = someScript.length
|
var length = someScript.length
|
||||||
|
@ -36,12 +36,12 @@ Transaction.SIGHASH_ANYONECANPAY = 0x80
|
||||||
Transaction.ADVANCED_TRANSACTION_MARKER = 0x00
|
Transaction.ADVANCED_TRANSACTION_MARKER = 0x00
|
||||||
Transaction.ADVANCED_TRANSACTION_FLAG = 0x01
|
Transaction.ADVANCED_TRANSACTION_FLAG = 0x01
|
||||||
|
|
||||||
var EMPTY_SCRIPT = Buffer.allocUnsafe(0)
|
const EMPTY_SCRIPT = Buffer.allocUnsafe(0)
|
||||||
var EMPTY_WITNESS = []
|
const EMPTY_WITNESS = []
|
||||||
var ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
|
const ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
|
||||||
var ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
|
const ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
|
||||||
var VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex')
|
const VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex')
|
||||||
var BLANK_OUTPUT = {
|
const BLANK_OUTPUT = {
|
||||||
script: EMPTY_SCRIPT,
|
script: EMPTY_SCRIPT,
|
||||||
valueBuffer: VALUE_UINT64_MAX
|
valueBuffer: VALUE_UINT64_MAX
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var baddress = require('./address')
|
const baddress = require('./address')
|
||||||
var bcrypto = require('./crypto')
|
const bcrypto = require('./crypto')
|
||||||
var bscript = require('./script')
|
const bscript = require('./script')
|
||||||
var btemplates = require('./templates')
|
const btemplates = require('./templates')
|
||||||
var networks = require('./networks')
|
const networks = require('./networks')
|
||||||
var ops = require('bitcoin-ops')
|
const ops = require('bitcoin-ops')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
var types = require('./types')
|
const types = require('./types')
|
||||||
var scriptTypes = btemplates.types
|
const scriptTypes = btemplates.types
|
||||||
var SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG]
|
const SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG]
|
||||||
var P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH])
|
const P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH])
|
||||||
|
|
||||||
var ECPair = require('./ecpair')
|
const ECPair = require('./ecpair')
|
||||||
var Transaction = require('./transaction')
|
const Transaction = require('./transaction')
|
||||||
|
|
||||||
function supportedType (type) {
|
function supportedType (type) {
|
||||||
return SIGNABLE.indexOf(type) !== -1
|
return SIGNABLE.indexOf(type) !== -1
|
||||||
|
|
12
src/types.js
12
src/types.js
|
@ -1,6 +1,6 @@
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
|
|
||||||
var UINT31_MAX = Math.pow(2, 31) - 1
|
const UINT31_MAX = Math.pow(2, 31) - 1
|
||||||
function UInt31 (value) {
|
function UInt31 (value) {
|
||||||
return typeforce.UInt32(value) && value <= UINT31_MAX
|
return typeforce.UInt32(value) && value <= UINT31_MAX
|
||||||
}
|
}
|
||||||
|
@ -10,16 +10,16 @@ function BIP32Path (value) {
|
||||||
}
|
}
|
||||||
BIP32Path.toJSON = function () { return 'BIP32 derivation path' }
|
BIP32Path.toJSON = function () { return 'BIP32 derivation path' }
|
||||||
|
|
||||||
var SATOSHI_MAX = 21 * 1e14
|
const SATOSHI_MAX = 21 * 1e14
|
||||||
function Satoshi (value) {
|
function Satoshi (value) {
|
||||||
return typeforce.UInt53(value) && value <= SATOSHI_MAX
|
return typeforce.UInt53(value) && value <= SATOSHI_MAX
|
||||||
}
|
}
|
||||||
|
|
||||||
// external dependent types
|
// external dependent types
|
||||||
var ECPoint = typeforce.quacksLike('Point')
|
const ECPoint = typeforce.quacksLike('Point')
|
||||||
|
|
||||||
// exposed, external API
|
// exposed, external API
|
||||||
var Network = typeforce.compile({
|
const Network = typeforce.compile({
|
||||||
messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String),
|
messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String),
|
||||||
bip32: {
|
bip32: {
|
||||||
public: typeforce.UInt32,
|
public: typeforce.UInt32,
|
||||||
|
@ -31,7 +31,7 @@ var Network = typeforce.compile({
|
||||||
})
|
})
|
||||||
|
|
||||||
// extend typeforce types with ours
|
// extend typeforce types with ours
|
||||||
var types = {
|
const types = {
|
||||||
BIP32Path: BIP32Path,
|
BIP32Path: BIP32Path,
|
||||||
Buffer256bit: typeforce.BufferN(32),
|
Buffer256bit: typeforce.BufferN(32),
|
||||||
ECPoint: ECPoint,
|
ECPoint: ECPoint,
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var base58 = require('bs58')
|
const base58 = require('bs58')
|
||||||
var bitcoin = require('../')
|
const bitcoin = require('../')
|
||||||
|
|
||||||
var base58EncodeDecode = require('./fixtures/core/base58_encode_decode.json')
|
const base58EncodeDecode = require('./fixtures/core/base58_encode_decode.json')
|
||||||
var base58KeysInvalid = require('./fixtures/core/base58_keys_invalid.json')
|
const base58KeysInvalid = require('./fixtures/core/base58_keys_invalid.json')
|
||||||
var base58KeysValid = require('./fixtures/core/base58_keys_valid.json')
|
const base58KeysValid = require('./fixtures/core/base58_keys_valid.json')
|
||||||
var blocksValid = require('./fixtures/core/blocks.json')
|
const blocksValid = require('./fixtures/core/blocks.json')
|
||||||
var sigCanonical = require('./fixtures/core/sig_canonical.json')
|
const sigCanonical = require('./fixtures/core/sig_canonical.json')
|
||||||
var sigHash = require('./fixtures/core/sighash.json')
|
const sigHash = require('./fixtures/core/sighash.json')
|
||||||
var sigNoncanonical = require('./fixtures/core/sig_noncanonical.json')
|
const sigNoncanonical = require('./fixtures/core/sig_noncanonical.json')
|
||||||
var txValid = require('./fixtures/core/tx_valid.json')
|
const txValid = require('./fixtures/core/tx_valid.json')
|
||||||
|
|
||||||
describe('Bitcoin-core', function () {
|
describe('Bitcoin-core', function () {
|
||||||
// base58EncodeDecode
|
// base58EncodeDecode
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* global describe, it, beforeEach */
|
/* global describe, it, beforeEach */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var Block = require('../src/block')
|
const Block = require('../src/block')
|
||||||
|
|
||||||
var fixtures = require('./fixtures/block')
|
const fixtures = require('./fixtures/block')
|
||||||
|
|
||||||
describe('Block', function () {
|
describe('Block', function () {
|
||||||
describe('version', function () {
|
describe('version', function () {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bufferutils = require('../src/bufferutils')
|
const bufferutils = require('../src/bufferutils')
|
||||||
|
|
||||||
var fixtures = require('./fixtures/bufferutils.json')
|
const fixtures = require('./fixtures/bufferutils.json')
|
||||||
|
|
||||||
describe('bufferutils', function () {
|
describe('bufferutils', function () {
|
||||||
describe('readUInt64LE', function () {
|
describe('readUInt64LE', function () {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bcrypto = require('../src/crypto')
|
const bcrypto = require('../src/crypto')
|
||||||
|
|
||||||
var fixtures = require('./fixtures/crypto')
|
const fixtures = require('./fixtures/crypto')
|
||||||
|
|
||||||
describe('crypto', function () {
|
describe('crypto', function () {
|
||||||
['hash160', 'hash256', 'ripemd160', 'sha1', 'sha256'].forEach(function (algorithm) {
|
['hash160', 'hash256', 'ripemd160', 'sha1', 'sha256'].forEach(function (algorithm) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bitcoin = require('../../')
|
const bitcoin = require('../../')
|
||||||
var dhttp = require('dhttp/200')
|
const dhttp = require('dhttp/200')
|
||||||
|
|
||||||
var APIPASS = process.env.APIPASS || 'satoshi'
|
const APIPASS = process.env.APIPASS || 'satoshi'
|
||||||
var APIURL = 'https://api.dcousens.cloud/1'
|
const APIURL = 'https://api.dcousens.cloud/1'
|
||||||
|
|
||||||
function broadcast (txHex, callback) {
|
function broadcast (txHex, callback) {
|
||||||
dhttp({
|
dhttp({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bitcoin = require('../../')
|
const bitcoin = require('../../')
|
||||||
|
|
||||||
describe('bitcoinjs-lib (blocks)', function () {
|
describe('bitcoinjs-lib (blocks)', function () {
|
||||||
it('can extract a height from a CoinBase transaction', function () {
|
it('can extract a height from a CoinBase transaction', function () {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/* global describe, it, before */
|
/* global describe, it, before */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bitcoin = require('../../')
|
const bitcoin = require('../../')
|
||||||
var regtestUtils = require('./_regtest')
|
const regtestUtils = require('./_regtest')
|
||||||
var regtest = regtestUtils.network
|
const regtest = regtestUtils.network
|
||||||
var bip65 = require('bip65')
|
const bip65 = require('bip65')
|
||||||
|
|
||||||
var alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest)
|
const alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest)
|
||||||
var bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest)
|
const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest)
|
||||||
|
|
||||||
describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
|
describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
|
||||||
// force update MTP
|
// force update MTP
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bigi = require('bigi')
|
const bigi = require('bigi')
|
||||||
var bitcoin = require('../../')
|
const bitcoin = require('../../')
|
||||||
var bip32 = require('bip32')
|
const bip32 = require('bip32')
|
||||||
var crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
var tinysecp = require('tiny-secp256k1')
|
const tinysecp = require('tiny-secp256k1')
|
||||||
|
|
||||||
var ecurve = require('ecurve')
|
const ecurve = require('ecurve')
|
||||||
var secp256k1 = ecurve.getCurveByName('secp256k1')
|
const secp256k1 = ecurve.getCurveByName('secp256k1')
|
||||||
|
|
||||||
describe('bitcoinjs-lib (crypto)', function () {
|
describe('bitcoinjs-lib (crypto)', function () {
|
||||||
it('can recover a private key from duplicate R values', function () {
|
it('can recover a private key from duplicate R values', function () {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bscript = require('../src/script')
|
const bscript = require('../src/script')
|
||||||
var minimalData = require('minimaldata')
|
const minimalData = require('minimaldata')
|
||||||
|
|
||||||
var fixtures = require('./fixtures/script.json')
|
const fixtures = require('./fixtures/script.json')
|
||||||
var fixtures2 = require('./fixtures/templates.json')
|
const fixtures2 = require('./fixtures/templates.json')
|
||||||
|
|
||||||
describe('script', function () {
|
describe('script', function () {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var scriptNumber = require('../src/script_number')
|
const scriptNumber = require('../src/script_number')
|
||||||
var fixtures = require('./fixtures/script_number.json')
|
const fixtures = require('./fixtures/script_number.json')
|
||||||
|
|
||||||
describe('script-number', function () {
|
describe('script-number', function () {
|
||||||
describe('decode', function () {
|
describe('decode', function () {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bscriptSig = require('../src/script').signature
|
const bscriptSig = require('../src/script').signature
|
||||||
var Buffer = require('safe-buffer').Buffer
|
const Buffer = require('safe-buffer').Buffer
|
||||||
var fixtures = require('./fixtures/signature.json')
|
const fixtures = require('./fixtures/signature.json')
|
||||||
|
|
||||||
describe('Script Signatures', function () {
|
describe('Script Signatures', function () {
|
||||||
function fromRaw (signature) {
|
function fromRaw (signature) {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bcrypto = require('../src/crypto')
|
const bcrypto = require('../src/crypto')
|
||||||
var bscript = require('../src/script')
|
const bscript = require('../src/script')
|
||||||
var btemplates = require('../src/templates')
|
const btemplates = require('../src/templates')
|
||||||
var ops = require('bitcoin-ops')
|
const ops = require('bitcoin-ops')
|
||||||
|
|
||||||
var fixtures = require('./fixtures/templates.json')
|
const fixtures = require('./fixtures/templates.json')
|
||||||
|
|
||||||
function fromHex (x) { return Buffer.from(x, 'hex') }
|
function fromHex (x) { return Buffer.from(x, 'hex') }
|
||||||
function toHex (x) { return x.toString('hex') }
|
function toHex (x) { return x.toString('hex') }
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* global describe, it, beforeEach */
|
/* global describe, it, beforeEach */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var bscript = require('../src/script')
|
const bscript = require('../src/script')
|
||||||
var fixtures = require('./fixtures/transaction')
|
const fixtures = require('./fixtures/transaction')
|
||||||
var Transaction = require('../src/transaction')
|
const Transaction = require('../src/transaction')
|
||||||
|
|
||||||
describe('Transaction', function () {
|
describe('Transaction', function () {
|
||||||
function fromRaw (raw, noWitness) {
|
function fromRaw (raw, noWitness) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* global describe, it */
|
/* global describe, it */
|
||||||
|
|
||||||
var assert = require('assert')
|
const assert = require('assert')
|
||||||
var types = require('../src/types')
|
const types = require('../src/types')
|
||||||
var typeforce = require('typeforce')
|
const typeforce = require('typeforce')
|
||||||
|
|
||||||
describe('types', function () {
|
describe('types', function () {
|
||||||
describe('Buffer Hash160/Hash256', function () {
|
describe('Buffer Hash160/Hash256', function () {
|
||||||
|
|
Loading…
Reference in a new issue