utxo-lib 1.1.5 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of utxo-lib might be problematic. Click here for more details.
- package/index.js +47 -0
- package/package.json +6 -80
- package/LICENSE +0 -21
- package/README.md +0 -59
- package/dist/src/address.d.ts +0 -11
- package/dist/src/address.d.ts.map +0 -1
- package/dist/src/address.js +0 -37
- package/dist/src/addressFormat.d.ts +0 -53
- package/dist/src/addressFormat.d.ts.map +0 -1
- package/dist/src/addressFormat.js +0 -110
- package/dist/src/bitgo/Musig2.d.ts +0 -51
- package/dist/src/bitgo/Musig2.d.ts.map +0 -1
- package/dist/src/bitgo/Musig2.js +0 -175
- package/dist/src/bitgo/Unspent.d.ts +0 -95
- package/dist/src/bitgo/Unspent.d.ts.map +0 -1
- package/dist/src/bitgo/Unspent.js +0 -138
- package/dist/src/bitgo/UtxoPsbt.d.ts +0 -132
- package/dist/src/bitgo/UtxoPsbt.d.ts.map +0 -1
- package/dist/src/bitgo/UtxoPsbt.js +0 -469
- package/dist/src/bitgo/UtxoTransaction.d.ts +0 -22
- package/dist/src/bitgo/UtxoTransaction.d.ts.map +0 -1
- package/dist/src/bitgo/UtxoTransaction.js +0 -97
- package/dist/src/bitgo/UtxoTransactionBuilder.d.ts +0 -26
- package/dist/src/bitgo/UtxoTransactionBuilder.d.ts.map +0 -1
- package/dist/src/bitgo/UtxoTransactionBuilder.js +0 -67
- package/dist/src/bitgo/bbc/DashPsbt.d.ts +0 -12
- package/dist/src/bitgo/bbc/DashPsbt.d.ts.map +0 -1
- package/dist/src/bitgo/bbc/DashPsbt.js +0 -27
- package/dist/src/bitgo/bbc/DashTransaction.d.ts +0 -39
- package/dist/src/bitgo/bbc/DashTransaction.d.ts.map +0 -1
- package/dist/src/bitgo/bbc/DashTransaction.js +0 -109
- package/dist/src/bitgo/bbc/DashTransactionBuilder.d.ts +0 -14
- package/dist/src/bitgo/bbc/DashTransactionBuilder.d.ts.map +0 -1
- package/dist/src/bitgo/bbc/DashTransactionBuilder.js +0 -28
- package/dist/src/bitgo/bbc/index.d.ts +0 -4
- package/dist/src/bitgo/bbc/index.d.ts.map +0 -1
- package/dist/src/bitgo/bbc/index.js +0 -16
- package/dist/src/bitgo/bitcoincash/address.d.ts +0 -35
- package/dist/src/bitgo/bitcoincash/address.d.ts.map +0 -1
- package/dist/src/bitgo/bitcoincash/address.js +0 -151
- package/dist/src/bitgo/bitcoincash/index.d.ts +0 -2
- package/dist/src/bitgo/bitcoincash/index.d.ts.map +0 -1
- package/dist/src/bitgo/bitcoincash/index.js +0 -14
- package/dist/src/bitgo/dash/DashPsbt.d.ts +0 -12
- package/dist/src/bitgo/dash/DashPsbt.d.ts.map +0 -1
- package/dist/src/bitgo/dash/DashPsbt.js +0 -27
- package/dist/src/bitgo/dash/DashTransaction.d.ts +0 -39
- package/dist/src/bitgo/dash/DashTransaction.d.ts.map +0 -1
- package/dist/src/bitgo/dash/DashTransaction.js +0 -109
- package/dist/src/bitgo/dash/DashTransactionBuilder.d.ts +0 -14
- package/dist/src/bitgo/dash/DashTransactionBuilder.d.ts.map +0 -1
- package/dist/src/bitgo/dash/DashTransactionBuilder.js +0 -28
- package/dist/src/bitgo/dash/index.d.ts +0 -4
- package/dist/src/bitgo/dash/index.d.ts.map +0 -1
- package/dist/src/bitgo/dash/index.js +0 -16
- package/dist/src/bitgo/index.d.ts +0 -17
- package/dist/src/bitgo/index.d.ts.map +0 -1
- package/dist/src/bitgo/index.js +0 -30
- package/dist/src/bitgo/keyutil.d.ts +0 -17
- package/dist/src/bitgo/keyutil.d.ts.map +0 -1
- package/dist/src/bitgo/keyutil.js +0 -37
- package/dist/src/bitgo/nonStandardHalfSigned.d.ts +0 -7
- package/dist/src/bitgo/nonStandardHalfSigned.d.ts.map +0 -1
- package/dist/src/bitgo/nonStandardHalfSigned.js +0 -56
- package/dist/src/bitgo/outputScripts.d.ts +0 -84
- package/dist/src/bitgo/outputScripts.d.ts.map +0 -1
- package/dist/src/bitgo/outputScripts.js +0 -297
- package/dist/src/bitgo/parseInput.d.ts +0 -92
- package/dist/src/bitgo/parseInput.d.ts.map +0 -1
- package/dist/src/bitgo/parseInput.js +0 -344
- package/dist/src/bitgo/psbt/fromHalfSigned.d.ts +0 -24
- package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +0 -1
- package/dist/src/bitgo/psbt/fromHalfSigned.js +0 -91
- package/dist/src/bitgo/psbt/scriptTypes.d.ts +0 -6
- package/dist/src/bitgo/psbt/scriptTypes.d.ts.map +0 -1
- package/dist/src/bitgo/psbt/scriptTypes.js +0 -23
- package/dist/src/bitgo/signature.d.ts +0 -84
- package/dist/src/bitgo/signature.d.ts.map +0 -1
- package/dist/src/bitgo/signature.js +0 -222
- package/dist/src/bitgo/tnumber.d.ts +0 -9
- package/dist/src/bitgo/tnumber.d.ts.map +0 -1
- package/dist/src/bitgo/tnumber.js +0 -31
- package/dist/src/bitgo/transaction.d.ts +0 -29
- package/dist/src/bitgo/transaction.d.ts.map +0 -1
- package/dist/src/bitgo/transaction.js +0 -231
- package/dist/src/bitgo/types.d.ts +0 -5
- package/dist/src/bitgo/types.d.ts.map +0 -1
- package/dist/src/bitgo/types.js +0 -12
- package/dist/src/bitgo/wallet/Psbt.d.ts +0 -47
- package/dist/src/bitgo/wallet/Psbt.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/Psbt.js +0 -232
- package/dist/src/bitgo/wallet/Unspent.d.ts +0 -47
- package/dist/src/bitgo/wallet/Unspent.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/Unspent.js +0 -154
- package/dist/src/bitgo/wallet/WalletKeys.d.ts +0 -72
- package/dist/src/bitgo/wallet/WalletKeys.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/WalletKeys.js +0 -104
- package/dist/src/bitgo/wallet/WalletOutput.d.ts +0 -18
- package/dist/src/bitgo/wallet/WalletOutput.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/WalletOutput.js +0 -69
- package/dist/src/bitgo/wallet/WalletScripts.d.ts +0 -7
- package/dist/src/bitgo/wallet/WalletScripts.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/WalletScripts.js +0 -15
- package/dist/src/bitgo/wallet/WalletUnspentSigner.d.ts +0 -19
- package/dist/src/bitgo/wallet/WalletUnspentSigner.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/WalletUnspentSigner.js +0 -47
- package/dist/src/bitgo/wallet/chains.d.ts +0 -57
- package/dist/src/bitgo/wallet/chains.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/chains.js +0 -106
- package/dist/src/bitgo/wallet/index.d.ts +0 -8
- package/dist/src/bitgo/wallet/index.d.ts.map +0 -1
- package/dist/src/bitgo/wallet/index.js +0 -20
- package/dist/src/bitgo/zcash/ZcashBufferutils.d.ts +0 -26
- package/dist/src/bitgo/zcash/ZcashBufferutils.d.ts.map +0 -1
- package/dist/src/bitgo/zcash/ZcashBufferutils.js +0 -157
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts +0 -36
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +0 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.js +0 -146
- package/dist/src/bitgo/zcash/ZcashTransaction.d.ts +0 -61
- package/dist/src/bitgo/zcash/ZcashTransaction.d.ts.map +0 -1
- package/dist/src/bitgo/zcash/ZcashTransaction.js +0 -341
- package/dist/src/bitgo/zcash/ZcashTransactionBuilder.d.ts +0 -21
- package/dist/src/bitgo/zcash/ZcashTransactionBuilder.d.ts.map +0 -1
- package/dist/src/bitgo/zcash/ZcashTransactionBuilder.js +0 -105
- package/dist/src/bitgo/zcash/address.d.ts +0 -8
- package/dist/src/bitgo/zcash/address.d.ts.map +0 -1
- package/dist/src/bitgo/zcash/address.js +0 -57
- package/dist/src/bitgo/zcash/hashZip0244.d.ts +0 -27
- package/dist/src/bitgo/zcash/hashZip0244.d.ts.map +0 -1
- package/dist/src/bitgo/zcash/hashZip0244.js +0 -184
- package/dist/src/bitgo/zcash/index.d.ts +0 -4
- package/dist/src/bitgo/zcash/index.d.ts.map +0 -1
- package/dist/src/bitgo/zcash/index.js +0 -16
- package/dist/src/classify.d.ts +0 -19
- package/dist/src/classify.d.ts.map +0 -1
- package/dist/src/classify.js +0 -89
- package/dist/src/index.d.ts +0 -13
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -36
- package/dist/src/networks.d.ts +0 -115
- package/dist/src/networks.d.ts.map +0 -1
- package/dist/src/networks.js +0 -458
- package/dist/src/noble_ecc.d.ts +0 -28
- package/dist/src/noble_ecc.d.ts.map +0 -1
- package/dist/src/noble_ecc.js +0 -168
- package/dist/src/payments/index.d.ts +0 -4
- package/dist/src/payments/index.d.ts.map +0 -1
- package/dist/src/payments/index.js +0 -8
- package/dist/src/payments/p2tr.d.ts +0 -3
- package/dist/src/payments/p2tr.d.ts.map +0 -1
- package/dist/src/payments/p2tr.js +0 -348
- package/dist/src/payments/p2tr_ns.d.ts +0 -3
- package/dist/src/payments/p2tr_ns.d.ts.map +0 -1
- package/dist/src/payments/p2tr_ns.js +0 -134
- package/dist/src/taproot.d.ts +0 -141
- package/dist/src/taproot.d.ts.map +0 -1
- package/dist/src/taproot.js +0 -384
- package/dist/src/templates/multisig/index.d.ts +0 -4
- package/dist/src/templates/multisig/index.d.ts.map +0 -1
- package/dist/src/templates/multisig/index.js +0 -8
- package/dist/src/templates/multisig/input.d.ts +0 -7
- package/dist/src/templates/multisig/input.d.ts.map +0 -1
- package/dist/src/templates/multisig/input.js +0 -25
- package/dist/src/templates/multisig/output.d.ts +0 -7
- package/dist/src/templates/multisig/output.d.ts.map +0 -1
- package/dist/src/templates/multisig/output.js +0 -38
- package/dist/src/templates/nulldata.d.ts +0 -10
- package/dist/src/templates/nulldata.d.ts.map +0 -1
- package/dist/src/templates/nulldata.js +0 -17
- package/dist/src/templates/pubkey/index.d.ts +0 -4
- package/dist/src/templates/pubkey/index.d.ts.map +0 -1
- package/dist/src/templates/pubkey/index.js +0 -8
- package/dist/src/templates/pubkey/input.d.ts +0 -7
- package/dist/src/templates/pubkey/input.d.ts.map +0 -1
- package/dist/src/templates/pubkey/input.js +0 -14
- package/dist/src/templates/pubkey/output.d.ts +0 -7
- package/dist/src/templates/pubkey/output.d.ts.map +0 -1
- package/dist/src/templates/pubkey/output.js +0 -15
- package/dist/src/templates/pubkeyhash/index.d.ts +0 -4
- package/dist/src/templates/pubkeyhash/index.d.ts.map +0 -1
- package/dist/src/templates/pubkeyhash/index.js +0 -8
- package/dist/src/templates/pubkeyhash/input.d.ts +0 -7
- package/dist/src/templates/pubkeyhash/input.d.ts.map +0 -1
- package/dist/src/templates/pubkeyhash/input.js +0 -16
- package/dist/src/templates/pubkeyhash/output.d.ts +0 -6
- package/dist/src/templates/pubkeyhash/output.d.ts.map +0 -1
- package/dist/src/templates/pubkeyhash/output.js +0 -20
- package/dist/src/templates/scripthash/index.d.ts +0 -4
- package/dist/src/templates/scripthash/index.d.ts.map +0 -1
- package/dist/src/templates/scripthash/index.js +0 -8
- package/dist/src/templates/scripthash/input.d.ts +0 -6
- package/dist/src/templates/scripthash/input.d.ts.map +0 -1
- package/dist/src/templates/scripthash/input.js +0 -43
- package/dist/src/templates/scripthash/output.d.ts +0 -6
- package/dist/src/templates/scripthash/output.d.ts.map +0 -1
- package/dist/src/templates/scripthash/output.js +0 -15
- package/dist/src/templates/taproot/index.d.ts +0 -4
- package/dist/src/templates/taproot/index.d.ts.map +0 -1
- package/dist/src/templates/taproot/index.js +0 -8
- package/dist/src/templates/taproot/input.d.ts +0 -6
- package/dist/src/templates/taproot/input.d.ts.map +0 -1
- package/dist/src/templates/taproot/input.js +0 -23
- package/dist/src/templates/taproot/output.d.ts +0 -6
- package/dist/src/templates/taproot/output.d.ts.map +0 -1
- package/dist/src/templates/taproot/output.js +0 -15
- package/dist/src/templates/taprootnofn/index.d.ts +0 -4
- package/dist/src/templates/taprootnofn/index.d.ts.map +0 -1
- package/dist/src/templates/taprootnofn/index.js +0 -8
- package/dist/src/templates/taprootnofn/input.d.ts +0 -7
- package/dist/src/templates/taprootnofn/input.d.ts.map +0 -1
- package/dist/src/templates/taprootnofn/input.js +0 -24
- package/dist/src/templates/taprootnofn/output.d.ts +0 -7
- package/dist/src/templates/taprootnofn/output.d.ts.map +0 -1
- package/dist/src/templates/taprootnofn/output.js +0 -28
- package/dist/src/templates/witnesscommitment/index.d.ts +0 -3
- package/dist/src/templates/witnesscommitment/index.d.ts.map +0 -1
- package/dist/src/templates/witnesscommitment/index.js +0 -6
- package/dist/src/templates/witnesscommitment/output.d.ts +0 -8
- package/dist/src/templates/witnesscommitment/output.d.ts.map +0 -1
- package/dist/src/templates/witnesscommitment/output.js +0 -31
- package/dist/src/templates/witnesspubkeyhash/index.d.ts +0 -4
- package/dist/src/templates/witnesspubkeyhash/index.d.ts.map +0 -1
- package/dist/src/templates/witnesspubkeyhash/index.js +0 -8
- package/dist/src/templates/witnesspubkeyhash/input.d.ts +0 -7
- package/dist/src/templates/witnesspubkeyhash/input.d.ts.map +0 -1
- package/dist/src/templates/witnesspubkeyhash/input.js +0 -19
- package/dist/src/templates/witnesspubkeyhash/output.d.ts +0 -6
- package/dist/src/templates/witnesspubkeyhash/output.d.ts.map +0 -1
- package/dist/src/templates/witnesspubkeyhash/output.js +0 -15
- package/dist/src/templates/witnessscripthash/index.d.ts +0 -4
- package/dist/src/templates/witnessscripthash/index.d.ts.map +0 -1
- package/dist/src/templates/witnessscripthash/index.js +0 -8
- package/dist/src/templates/witnessscripthash/input.d.ts +0 -6
- package/dist/src/templates/witnessscripthash/input.d.ts.map +0 -1
- package/dist/src/templates/witnessscripthash/input.js +0 -35
- package/dist/src/templates/witnessscripthash/output.d.ts +0 -6
- package/dist/src/templates/witnessscripthash/output.d.ts.map +0 -1
- package/dist/src/templates/witnessscripthash/output.js +0 -15
- package/dist/src/testutil/index.d.ts +0 -3
- package/dist/src/testutil/index.d.ts.map +0 -1
- package/dist/src/testutil/index.js +0 -15
- package/dist/src/testutil/keys.d.ts +0 -10
- package/dist/src/testutil/keys.d.ts.map +0 -1
- package/dist/src/testutil/keys.js +0 -40
- package/dist/src/testutil/mock.d.ts +0 -21
- package/dist/src/testutil/mock.d.ts.map +0 -1
- package/dist/src/testutil/mock.js +0 -86
- package/dist/src/transaction_builder.d.ts +0 -47
- package/dist/src/transaction_builder.d.ts.map +0 -1
- package/dist/src/transaction_builder.js +0 -1084
package/dist/src/taproot.js
DELETED
@@ -1,384 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// Taproot-specific key aggregation and taptree logic as defined in:
|
3
|
-
// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
|
4
|
-
// https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getTweakedOutputKey = exports.getTaptreeRoot = exports.getTapleafHash = exports.parseControlBlock = exports.parseTaprootWitness = exports.getControlBlock = exports.getHuffmanTaptree = exports.getDepthFirstTaptree = exports.tapTweakPubkey = exports.tapTweakPrivkey = exports.hashTapBranch = exports.hashTapLeaf = exports.serializeScriptSize = exports.aggregateMuSigPubkeys = exports.INITIAL_TAPSCRIPT_VERSION = exports.EVEN_Y_COORD_PREFIX = void 0;
|
7
|
-
const assert = require("assert");
|
8
|
-
const FastPriorityQueue = require("fastpriorityqueue");
|
9
|
-
const bitcoinjs_lib_1 = require("bitcoinjs-lib");
|
10
|
-
const varuint = require('varuint-bitcoin');
|
11
|
-
/**
|
12
|
-
* The 0x02 prefix indicating an even Y coordinate which is implicitly assumed
|
13
|
-
* on all 32 byte x-only pub keys as defined in BIP340.
|
14
|
-
*/
|
15
|
-
exports.EVEN_Y_COORD_PREFIX = Buffer.of(0x02);
|
16
|
-
exports.INITIAL_TAPSCRIPT_VERSION = 0xc0;
|
17
|
-
/**
|
18
|
-
* Aggregates a list of public keys into a single MuSig2* public key
|
19
|
-
* according to the MuSig2 paper.
|
20
|
-
* @param ecc Elliptic curve implementation
|
21
|
-
* @param pubkeys The list of pub keys to aggregate
|
22
|
-
* @returns a 32 byte Buffer representing the aggregate key
|
23
|
-
*/
|
24
|
-
function aggregateMuSigPubkeys(ecc, pubkeys) {
|
25
|
-
// TODO: Consider enforcing key uniqueness.
|
26
|
-
assert(pubkeys.length > 1, 'at least two pubkeys are required for musig key aggregation');
|
27
|
-
// Sort the keys in ascending order
|
28
|
-
pubkeys.sort(Buffer.compare);
|
29
|
-
// In MuSig all signers contribute key material to a single signing key,
|
30
|
-
// using the equation
|
31
|
-
//
|
32
|
-
// P = sum_i µ_i * P_i
|
33
|
-
//
|
34
|
-
// where `P_i` is the public key of the `i`th signer and `µ_i` is a so-called
|
35
|
-
// _MuSig coefficient_ computed according to the following equation
|
36
|
-
//
|
37
|
-
// L = H(P_1 || P_2 || ... || P_n)
|
38
|
-
// µ_i = H(L || P_i)
|
39
|
-
const L = bitcoinjs_lib_1.crypto.taggedHash('KeyAgg list', Buffer.concat(pubkeys));
|
40
|
-
const secondUniquePubkey = pubkeys.find((pubkey) => !pubkeys[0].equals(pubkey));
|
41
|
-
const tweakedPubkeys = pubkeys.map((pubkey) => {
|
42
|
-
const xyPubkey = Buffer.concat([exports.EVEN_Y_COORD_PREFIX, pubkey]);
|
43
|
-
if (secondUniquePubkey !== undefined && secondUniquePubkey.equals(pubkey)) {
|
44
|
-
// The second unique key in the pubkey list given to ''KeyAgg'' (as well
|
45
|
-
// as any keys identical to this key) gets the constant KeyAgg
|
46
|
-
// coefficient 1 which saves an exponentiation (see the MuSig2* appendix
|
47
|
-
// in the MuSig2 paper).
|
48
|
-
return xyPubkey;
|
49
|
-
}
|
50
|
-
const c = bitcoinjs_lib_1.crypto.taggedHash('KeyAgg coefficient', Buffer.concat([L, pubkey]));
|
51
|
-
const tweakedPubkey = ecc.pointMultiply(xyPubkey, c);
|
52
|
-
if (!tweakedPubkey) {
|
53
|
-
throw new Error('Failed to multiply pubkey by coefficient');
|
54
|
-
}
|
55
|
-
return tweakedPubkey;
|
56
|
-
});
|
57
|
-
const aggregatePubkey = tweakedPubkeys.reduce((prev, curr) => {
|
58
|
-
const next = ecc.pointAdd(prev, curr);
|
59
|
-
if (!next)
|
60
|
-
throw new Error('Failed to sum pubkeys');
|
61
|
-
return next;
|
62
|
-
});
|
63
|
-
return aggregatePubkey.slice(1);
|
64
|
-
}
|
65
|
-
exports.aggregateMuSigPubkeys = aggregateMuSigPubkeys;
|
66
|
-
/**
|
67
|
-
* Encodes the length of a script as a bitcoin variable length integer.
|
68
|
-
* @param script
|
69
|
-
* @returns
|
70
|
-
*/
|
71
|
-
function serializeScriptSize(script) {
|
72
|
-
return varuint.encode(script.length);
|
73
|
-
}
|
74
|
-
exports.serializeScriptSize = serializeScriptSize;
|
75
|
-
/**
|
76
|
-
* Gets a tapleaf tagged hash from a script.
|
77
|
-
* @param script
|
78
|
-
* @returns
|
79
|
-
*/
|
80
|
-
function hashTapLeaf(script, leafVersion = exports.INITIAL_TAPSCRIPT_VERSION) {
|
81
|
-
const size = serializeScriptSize(script);
|
82
|
-
return bitcoinjs_lib_1.crypto.taggedHash('TapLeaf', Buffer.concat([Buffer.of(leafVersion), size, script]));
|
83
|
-
}
|
84
|
-
exports.hashTapLeaf = hashTapLeaf;
|
85
|
-
/**
|
86
|
-
* Creates a lexicographically sorted tapbranch from two child taptree nodes
|
87
|
-
* and returns its tagged hash.
|
88
|
-
* @param child1
|
89
|
-
* @param child2
|
90
|
-
* @returns the tagged tapbranch hash
|
91
|
-
*/
|
92
|
-
function hashTapBranch(child1, child2) {
|
93
|
-
// sort the children lexicographically
|
94
|
-
const sortedChildren = [child1, child2].sort(Buffer.compare);
|
95
|
-
return bitcoinjs_lib_1.crypto.taggedHash('TapBranch', Buffer.concat(sortedChildren));
|
96
|
-
}
|
97
|
-
exports.hashTapBranch = hashTapBranch;
|
98
|
-
function calculateTapTweak(pubkey, taptreeRoot) {
|
99
|
-
if (taptreeRoot) {
|
100
|
-
return bitcoinjs_lib_1.crypto.taggedHash('TapTweak', Buffer.concat([pubkey, taptreeRoot]));
|
101
|
-
}
|
102
|
-
// If the spending conditions do not require a script path, the output key should commit to an
|
103
|
-
// unspendable script path instead of having no script path.
|
104
|
-
// https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-22
|
105
|
-
return bitcoinjs_lib_1.crypto.taggedHash('TapTweak', Buffer.from(pubkey));
|
106
|
-
}
|
107
|
-
/**
|
108
|
-
* Tweaks a privkey, using the tagged hash of its pubkey, and (optionally) a taptree root
|
109
|
-
* @param ecc Elliptic curve implementation
|
110
|
-
* @param pubkey public key, used to calculate the tweak
|
111
|
-
* @param privkey the privkey to tweak
|
112
|
-
* @param taptreeRoot the taptree root tagged hash
|
113
|
-
* @returns {Buffer} the tweaked privkey
|
114
|
-
*/
|
115
|
-
function tapTweakPrivkey(ecc, pubkey, privkey, taptreeRoot) {
|
116
|
-
const tapTweak = calculateTapTweak(pubkey, taptreeRoot);
|
117
|
-
const point = ecc.pointFromScalar(privkey);
|
118
|
-
if (!point)
|
119
|
-
throw new Error('Invalid private key');
|
120
|
-
if (point[0] % 2 === 1)
|
121
|
-
privkey = ecc.privateNegate(privkey);
|
122
|
-
const result = ecc.privateAdd(privkey, tapTweak);
|
123
|
-
if (!result)
|
124
|
-
throw new Error('Invalid private key');
|
125
|
-
return result;
|
126
|
-
}
|
127
|
-
exports.tapTweakPrivkey = tapTweakPrivkey;
|
128
|
-
/**
|
129
|
-
* Tweaks an internal pubkey, using the tagged hash of itself, and (optionally) a taptree root
|
130
|
-
* @param ecc Elliptic curve implementation
|
131
|
-
* @param pubkey the internal pubkey to tweak
|
132
|
-
* @param taptreeRoot the taptree root tagged hash
|
133
|
-
* @returns {TweakedPubkey} the tweaked pubkey
|
134
|
-
*/
|
135
|
-
function tapTweakPubkey(ecc, pubkey, taptreeRoot) {
|
136
|
-
const tapTweak = calculateTapTweak(pubkey, taptreeRoot);
|
137
|
-
const result = ecc.xOnlyPointAddTweak(pubkey, tapTweak);
|
138
|
-
if (!result)
|
139
|
-
throw new Error('Invalid pubkey');
|
140
|
-
return result;
|
141
|
-
}
|
142
|
-
exports.tapTweakPubkey = tapTweakPubkey;
|
143
|
-
function recurseTaptree(leaves, targetDepth = 0) {
|
144
|
-
const { value, done } = leaves.next();
|
145
|
-
assert(!done, 'insufficient leaves to reconstruct tap tree');
|
146
|
-
const [index, leaf] = value;
|
147
|
-
const tree = {
|
148
|
-
root: hashTapLeaf(leaf.script, leaf.leafVersion),
|
149
|
-
paths: [],
|
150
|
-
};
|
151
|
-
tree.paths[index] = [];
|
152
|
-
for (let depth = leaf.depth; depth > targetDepth; depth--) {
|
153
|
-
const sibling = recurseTaptree(leaves, depth);
|
154
|
-
tree.paths.forEach((path) => path.push(sibling.root));
|
155
|
-
sibling.paths.forEach((path) => path.push(tree.root));
|
156
|
-
tree.root = hashTapBranch(tree.root, sibling.root);
|
157
|
-
// Merge disjoint sparse arrays of paths into tree.paths
|
158
|
-
Object.assign(tree.paths, sibling.paths);
|
159
|
-
}
|
160
|
-
return tree;
|
161
|
-
}
|
162
|
-
/**
|
163
|
-
* Gets the root hash and hash-paths of a taptree from the depth-first
|
164
|
-
* construction used in BIP-0371 PSBTs
|
165
|
-
* @param tree
|
166
|
-
* @returns {Taptree} the tree, represented by its root hash, and the paths to
|
167
|
-
* that root from each of the input scripts
|
168
|
-
*/
|
169
|
-
function getDepthFirstTaptree(tree) {
|
170
|
-
const iter = tree.leaves.entries();
|
171
|
-
const ret = recurseTaptree(iter);
|
172
|
-
assert(iter.next().done, 'invalid tap tree, no path to some leaves');
|
173
|
-
return ret;
|
174
|
-
}
|
175
|
-
exports.getDepthFirstTaptree = getDepthFirstTaptree;
|
176
|
-
/**
|
177
|
-
* Gets the root hash of a taptree using a weighted Huffman construction from a
|
178
|
-
* list of scripts and corresponding weights.
|
179
|
-
* @param scripts
|
180
|
-
* @param weights
|
181
|
-
* @returns {Taptree} the tree, represented by its root hash, and the paths to that root from each of the input scripts
|
182
|
-
*/
|
183
|
-
function getHuffmanTaptree(scripts, weights) {
|
184
|
-
assert(scripts.length > 0, 'at least one script is required to construct a tap tree');
|
185
|
-
// Create a queue/heap of the provided scripts prioritized according to their
|
186
|
-
// corresponding weights.
|
187
|
-
const queue = new FastPriorityQueue((a, b) => {
|
188
|
-
return a.weight < b.weight;
|
189
|
-
});
|
190
|
-
scripts.forEach((script, index) => {
|
191
|
-
const weight = weights[index] || 1;
|
192
|
-
assert(weight > 0, 'script weight must be a positive value');
|
193
|
-
queue.add({
|
194
|
-
weight,
|
195
|
-
taggedHash: hashTapLeaf(script),
|
196
|
-
paths: { [index]: [] },
|
197
|
-
});
|
198
|
-
});
|
199
|
-
// Now that we have a queue of weighted scripts, we begin a loop whereby we
|
200
|
-
// remove the two lowest weighted items from the queue. We create a tap branch
|
201
|
-
// node from the two items, and add the branch back to the queue with the
|
202
|
-
// combined weight of both its children. Each loop reduces the number of items
|
203
|
-
// in the queue by one, and we repeat until we are left with only one item -
|
204
|
-
// this becomes the tap tree root.
|
205
|
-
//
|
206
|
-
// For example, if we begin with scripts A, B, C, D with weights 6, 3, 1, 1
|
207
|
-
// After first loop: A(6), B(3), CD(1 + 1)
|
208
|
-
// After second loop: A(6), B[CD](3 + 2)
|
209
|
-
// Final loop: A[B[CD]](6+5)
|
210
|
-
// The final tree will look like:
|
211
|
-
//
|
212
|
-
// A[B[CD]]
|
213
|
-
// / \
|
214
|
-
// A B[CD]
|
215
|
-
// / \
|
216
|
-
// B [CD]
|
217
|
-
// / \
|
218
|
-
// C D
|
219
|
-
//
|
220
|
-
// This ensures that the spending conditions we believe to have the highest
|
221
|
-
// probability of being used are further up the tree than less likely scripts,
|
222
|
-
// thereby reducing the size of the merkle proofs for the more likely scripts.
|
223
|
-
while (queue.size > 1) {
|
224
|
-
// We can safely expect two polls to return non-null elements since we've
|
225
|
-
// checked that the queue has at least two elements before looping.
|
226
|
-
const child1 = queue.poll();
|
227
|
-
const child2 = queue.poll();
|
228
|
-
Object.values(child1.paths).forEach((path) => path.push(child2.taggedHash));
|
229
|
-
Object.values(child2.paths).forEach((path) => path.push(child1.taggedHash));
|
230
|
-
queue.add({
|
231
|
-
taggedHash: hashTapBranch(child1.taggedHash, child2.taggedHash),
|
232
|
-
weight: child1.weight + child2.weight,
|
233
|
-
paths: { ...child1.paths, ...child2.paths },
|
234
|
-
});
|
235
|
-
}
|
236
|
-
// After the while loop above completes we should have exactly one element
|
237
|
-
// remaining in the queue, which we can safely extract below.
|
238
|
-
const rootNode = queue.poll();
|
239
|
-
const paths = Object.entries(rootNode.paths).reduce((acc, [index, path]) => {
|
240
|
-
acc[Number(index)] = path; // TODO: Why doesn't TS know it's a number?
|
241
|
-
return acc;
|
242
|
-
}, Array(scripts.length));
|
243
|
-
return { root: rootNode.taggedHash, paths };
|
244
|
-
}
|
245
|
-
exports.getHuffmanTaptree = getHuffmanTaptree;
|
246
|
-
function getControlBlock(parity, pubkey, path, leafVersion = exports.INITIAL_TAPSCRIPT_VERSION) {
|
247
|
-
const parityVersion = leafVersion + parity;
|
248
|
-
return Buffer.concat([Buffer.of(parityVersion), pubkey, ...path]);
|
249
|
-
}
|
250
|
-
exports.getControlBlock = getControlBlock;
|
251
|
-
/**
|
252
|
-
* Parses a taproot witness stack and extracts key data elements.
|
253
|
-
* @param witnessStack
|
254
|
-
* @returns {ScriptPathWitness|KeyPathWitness} an object representing the
|
255
|
-
* parsed witness for a script path or key path spend.
|
256
|
-
* @throws {Error} if the witness stack does not conform to the BIP 341 script validation rules
|
257
|
-
*/
|
258
|
-
function parseTaprootWitness(witnessStack) {
|
259
|
-
let annex;
|
260
|
-
if (witnessStack.length >= 2 && witnessStack[witnessStack.length - 1][0] === 0x50) {
|
261
|
-
// If there are at least two witness elements, and the first byte of the last element is
|
262
|
-
// 0x50, this last element is called annex a and is removed from the witness stack
|
263
|
-
annex = witnessStack[witnessStack.length - 1];
|
264
|
-
witnessStack = witnessStack.slice(0, -1);
|
265
|
-
}
|
266
|
-
if (witnessStack.length < 1) {
|
267
|
-
throw new Error('witness stack must have at least one element');
|
268
|
-
}
|
269
|
-
else if (witnessStack.length === 1) {
|
270
|
-
// key path spend
|
271
|
-
const signature = witnessStack[0];
|
272
|
-
if (!bitcoinjs_lib_1.script.isCanonicalSchnorrSignature(signature)) {
|
273
|
-
throw new Error('invalid signature');
|
274
|
-
}
|
275
|
-
return { spendType: 'Key', signature, annex };
|
276
|
-
}
|
277
|
-
// script path spend
|
278
|
-
// second to last element is the tapscript
|
279
|
-
const tapscript = witnessStack[witnessStack.length - 2];
|
280
|
-
const tapscriptChunks = bitcoinjs_lib_1.script.decompile(tapscript);
|
281
|
-
if (!tapscriptChunks || tapscriptChunks.length === 0) {
|
282
|
-
throw new Error('tapscript is not a valid script');
|
283
|
-
}
|
284
|
-
// The last stack element is called the control block c, and must have length 33 + 32m,
|
285
|
-
// for a value of m that is an integer between 0 and 128, inclusive
|
286
|
-
const controlBlock = witnessStack[witnessStack.length - 1];
|
287
|
-
if (controlBlock.length < 33 || controlBlock.length > 33 + 32 * 128 || controlBlock.length % 32 !== 1) {
|
288
|
-
throw new Error('invalid control block length');
|
289
|
-
}
|
290
|
-
return {
|
291
|
-
spendType: 'Script',
|
292
|
-
scriptSig: witnessStack.slice(0, -2),
|
293
|
-
tapscript,
|
294
|
-
controlBlock,
|
295
|
-
annex,
|
296
|
-
};
|
297
|
-
}
|
298
|
-
exports.parseTaprootWitness = parseTaprootWitness;
|
299
|
-
/**
|
300
|
-
* Parses a taproot control block.
|
301
|
-
* @param ecc Elliptic curve implementation
|
302
|
-
* @param controlBlock the control block to parse
|
303
|
-
* @returns {ControlBlock} the parsed control block
|
304
|
-
* @throws {Error} if the witness stack does not conform to the BIP 341 script validation rules
|
305
|
-
*/
|
306
|
-
function parseControlBlock(ecc, controlBlock) {
|
307
|
-
if ((controlBlock.length - 1) % 32 !== 0) {
|
308
|
-
throw new TypeError('Invalid control block length');
|
309
|
-
}
|
310
|
-
const parity = controlBlock[0] & 0x01;
|
311
|
-
// Let p = c[1:33] and let P = lift_x(int(p)) where lift_x and [:] are defined as in BIP340.
|
312
|
-
// Fail if this point is not on the curve
|
313
|
-
const internalPubkey = controlBlock.slice(1, 33);
|
314
|
-
if (!ecc.isXOnlyPoint(internalPubkey)) {
|
315
|
-
throw new Error('internal pubkey is not an EC point');
|
316
|
-
}
|
317
|
-
// The leaf version cannot be 0x50 as that would result in ambiguity with the annex.
|
318
|
-
const leafVersion = controlBlock[0] & 0xfe;
|
319
|
-
if (leafVersion === 0x50) {
|
320
|
-
throw new Error('invalid leaf version');
|
321
|
-
}
|
322
|
-
const path = [];
|
323
|
-
for (let j = 33; j < controlBlock.length; j += 32) {
|
324
|
-
path.push(controlBlock.slice(j, j + 32));
|
325
|
-
}
|
326
|
-
return {
|
327
|
-
parity,
|
328
|
-
internalPubkey,
|
329
|
-
leafVersion,
|
330
|
-
path,
|
331
|
-
};
|
332
|
-
}
|
333
|
-
exports.parseControlBlock = parseControlBlock;
|
334
|
-
/**
|
335
|
-
* Calculates the tapleaf hash from a control block and script.
|
336
|
-
* @param ecc Elliptic curve implementation
|
337
|
-
* @param controlBlock the control block, either raw or parsed
|
338
|
-
* @param tapscript the leaf script corresdponding to the control block
|
339
|
-
* @returns {Buffer} the tapleaf hash
|
340
|
-
*/
|
341
|
-
function getTapleafHash(ecc, controlBlock, tapscript) {
|
342
|
-
if (Buffer.isBuffer(controlBlock)) {
|
343
|
-
controlBlock = parseControlBlock(ecc, controlBlock);
|
344
|
-
}
|
345
|
-
const { leafVersion } = controlBlock;
|
346
|
-
return bitcoinjs_lib_1.crypto.taggedHash('TapLeaf', Buffer.concat([Buffer.of(leafVersion), serializeScriptSize(tapscript), tapscript]));
|
347
|
-
}
|
348
|
-
exports.getTapleafHash = getTapleafHash;
|
349
|
-
/**
|
350
|
-
* Calculates the taptree root hash from a control block and script.
|
351
|
-
* @param ecc Elliptic curve implementation
|
352
|
-
* @param controlBlock the control block, either raw or parsed
|
353
|
-
* @param tapscript the leaf script corresdponding to the control block
|
354
|
-
* @param tapleafHash the leaf hash if already calculated
|
355
|
-
* @returns {Buffer} the taptree root hash
|
356
|
-
*/
|
357
|
-
function getTaptreeRoot(ecc, controlBlock, tapscript, tapleafHash) {
|
358
|
-
if (Buffer.isBuffer(controlBlock)) {
|
359
|
-
controlBlock = parseControlBlock(ecc, controlBlock);
|
360
|
-
}
|
361
|
-
const { path } = controlBlock;
|
362
|
-
tapleafHash = tapleafHash || getTapleafHash(ecc, controlBlock, tapscript);
|
363
|
-
// `taptreeMerkleHash` begins as our tapscript tapleaf hash and its value iterates
|
364
|
-
// through its parent tapbranch hashes until it ends up as the taptree root hash
|
365
|
-
let taptreeMerkleHash = tapleafHash;
|
366
|
-
for (const taptreeSiblingHash of path) {
|
367
|
-
taptreeMerkleHash =
|
368
|
-
Buffer.compare(taptreeMerkleHash, taptreeSiblingHash) === -1
|
369
|
-
? bitcoinjs_lib_1.crypto.taggedHash('TapBranch', Buffer.concat([taptreeMerkleHash, taptreeSiblingHash]))
|
370
|
-
: bitcoinjs_lib_1.crypto.taggedHash('TapBranch', Buffer.concat([taptreeSiblingHash, taptreeMerkleHash]));
|
371
|
-
}
|
372
|
-
return taptreeMerkleHash;
|
373
|
-
}
|
374
|
-
exports.getTaptreeRoot = getTaptreeRoot;
|
375
|
-
function getTweakedOutputKey(payment) {
|
376
|
-
var _a;
|
377
|
-
assert(payment.output);
|
378
|
-
if (payment.output.length === 34) {
|
379
|
-
return (_a = payment.output) === null || _a === void 0 ? void 0 : _a.subarray(2);
|
380
|
-
}
|
381
|
-
throw new Error(`invalid p2tr tweaked output key size ${payment.output.length}`);
|
382
|
-
}
|
383
|
-
exports.getTweakedOutputKey = getTweakedOutputKey;
|
384
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwcm9vdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YXByb290LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxvR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hcHRyZWVTaWJsaW5nSGFzaCwgdGFwdHJlZU1lcmtsZUhhc2hdKSk7XG4gIH1cblxuICByZXR1cm4gdGFwdHJlZU1lcmtsZUhhc2g7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRUd2Vha2VkT3V0cHV0S2V5KHBheW1lbnQ6IGJwYXltZW50cy5QYXltZW50KTogQnVmZmVyIHtcbiAgYXNzZXJ0KHBheW1lbnQub3V0cHV0KTtcbiAgaWYgKHBheW1lbnQub3V0cHV0Lmxlbmd0aCA9PT0gMzQpIHtcbiAgICByZXR1cm4gcGF5bWVudC5vdXRwdXQ/LnN1YmFycmF5KDIpO1xuICB9XG4gIHRocm93IG5ldyBFcnJvcihgaW52YWxpZCBwMnRyIHR3ZWFrZWQgb3V0cHV0IGtleSBzaXplICR7cGF5bWVudC5vdXRwdXQubGVuZ3RofWApO1xufVxuIl19
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/multisig/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.output = exports.input = void 0;
|
4
|
-
const input = require("./input");
|
5
|
-
exports.input = input;
|
6
|
-
const output = require("./output");
|
7
|
-
exports.output = output;
|
8
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvdGVtcGxhdGVzL211bHRpc2lnL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLGlDQUFpQztBQUd4QixzQkFBSztBQUZkLG1DQUFtQztBQUVuQix3QkFBTSIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGlucHV0IGZyb20gJy4vaW5wdXQnO1xuaW1wb3J0ICogYXMgb3V0cHV0IGZyb20gJy4vb3V0cHV0JztcblxuZXhwb3J0IHsgaW5wdXQsIG91dHB1dCB9O1xuIl19
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/templates/multisig/input.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAQ/B,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,CAUhF;yBAVe,KAAK"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// OP_0 [signatures ...]
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.check = void 0;
|
5
|
-
const __1 = require("../../");
|
6
|
-
const __2 = require("../../");
|
7
|
-
function partialSignature(value) {
|
8
|
-
return value === __2.opcodes.OP_0 || __1.script.isCanonicalScriptSignature(value);
|
9
|
-
}
|
10
|
-
function check(script, allowIncomplete) {
|
11
|
-
const chunks = __1.script.decompile(script);
|
12
|
-
if (chunks.length < 2)
|
13
|
-
return false;
|
14
|
-
if (chunks[0] !== __2.opcodes.OP_0)
|
15
|
-
return false;
|
16
|
-
if (allowIncomplete) {
|
17
|
-
return chunks.slice(1).every(partialSignature);
|
18
|
-
}
|
19
|
-
return chunks.slice(1).every(__1.script.isCanonicalScriptSignature);
|
20
|
-
}
|
21
|
-
exports.check = check;
|
22
|
-
check.toJSON = () => {
|
23
|
-
return 'multisig input';
|
24
|
-
};
|
25
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cm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gU3RhY2sgfSBmcm9tICcuLi8uLi8nO1xuaW1wb3J0IHsgc2NyaXB0IGFzIGJzY3JpcHQgfSBmcm9tICcuLi8uLi8nO1xuaW1wb3J0IHsgb3Bjb2RlcyB9IGZyb20gJy4uLy4uLyc7XG5cbmZ1bmN0aW9uIHBhcnRpYWxTaWduYXR1cmUodmFsdWU6IG51bWJlciB8IEJ1ZmZlcik6IGJvb2xlYW4ge1xuICByZXR1cm4gdmFsdWUgPT09IG9wY29kZXMuT1BfMCB8fCBic2NyaXB0LmlzQ2Fub25pY2FsU2NyaXB0U2lnbmF0dXJlKHZhbHVlIGFzIEJ1ZmZlcik7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBjaGVjayhzY3JpcHQ6IEJ1ZmZlciB8IFN0YWNrLCBhbGxvd0luY29tcGxldGU/OiBib29sZWFuKTogYm9vbGVhbiB7XG4gIGNvbnN0IGNodW5rcyA9IGJzY3JpcHQuZGVjb21waWxlKHNjcmlwdCkgYXMgU3RhY2s7XG4gIGlmIChjaHVua3MubGVuZ3RoIDwgMikgcmV0dXJuIGZhbHNlO1xuICBpZiAoY2h1bmtzWzBdICE9PSBvcGNvZGVzLk9QXzApIHJldHVybiBmYWxzZTtcblxuICBpZiAoYWxsb3dJbmNvbXBsZXRlKSB7XG4gICAgcmV0dXJuIGNodW5rcy5zbGljZSgxKS5ldmVyeShwYXJ0aWFsU2lnbmF0dXJlKTtcbiAgfVxuXG4gIHJldHVybiAoY2h1bmtzLnNsaWNlKDEpIGFzIEJ1ZmZlcltdKS5ldmVyeShic2NyaXB0LmlzQ2Fub25pY2FsU2NyaXB0U2lnbmF0dXJlKTtcbn1cbmNoZWNrLnRvSlNPTiA9ICgpOiBzdHJpbmcgPT4ge1xuICByZXR1cm4gJ211bHRpc2lnIGlucHV0Jztcbn07XG4iXX0=
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/templates/multisig/output.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAM/B,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,CAkBhF;yBAlBe,KAAK"}
|
@@ -1,38 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// m [pubKeys ...] n OP_CHECKMULTISIG
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.check = void 0;
|
5
|
-
const __1 = require("../../");
|
6
|
-
const __2 = require("../../");
|
7
|
-
const types = require("bitcoinjs-lib/src/types");
|
8
|
-
const OP_INT_BASE = __2.opcodes.OP_RESERVED; // OP_1 - 1
|
9
|
-
function check(script, allowIncomplete) {
|
10
|
-
const chunks = __1.script.decompile(script);
|
11
|
-
if (chunks.length < 4)
|
12
|
-
return false;
|
13
|
-
if (chunks[chunks.length - 1] !== __2.opcodes.OP_CHECKMULTISIG)
|
14
|
-
return false;
|
15
|
-
if (!types.Number(chunks[0]))
|
16
|
-
return false;
|
17
|
-
if (!types.Number(chunks[chunks.length - 2]))
|
18
|
-
return false;
|
19
|
-
const m = chunks[0] - OP_INT_BASE;
|
20
|
-
const n = chunks[chunks.length - 2] - OP_INT_BASE;
|
21
|
-
if (m <= 0)
|
22
|
-
return false;
|
23
|
-
if (n > 16)
|
24
|
-
return false;
|
25
|
-
if (m > n)
|
26
|
-
return false;
|
27
|
-
if (n !== chunks.length - 3)
|
28
|
-
return false;
|
29
|
-
if (allowIncomplete)
|
30
|
-
return true;
|
31
|
-
const keys = chunks.slice(1, -2);
|
32
|
-
return keys.every(__1.script.isCanonicalPubKey);
|
33
|
-
}
|
34
|
-
exports.check = check;
|
35
|
-
check.toJSON = () => {
|
36
|
-
return 'multi-sig output';
|
37
|
-
};
|
38
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0LmpzIiwic291cmNlUm9vd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bik6IGJvb2xlYW4ge1xuICBjb25zdCBjaHVua3MgPSBic2NyaXB0LmRlY29tcGlsZShzY3JpcHQpIGFzIFN0YWNrO1xuXG4gIGlmIChjaHVua3MubGVuZ3RoIDwgNCkgcmV0dXJuIGZhbHNlO1xuICBpZiAoY2h1bmtzW2NodW5rcy5sZW5ndGggLSAxXSAhPT0gb3Bjb2Rlcy5PUF9DSEVDS01VTFRJU0lHKSByZXR1cm4gZmFsc2U7XG4gIGlmICghdHlwZXMuTnVtYmVyKGNodW5rc1swXSkpIHJldHVybiBmYWxzZTtcbiAgaWYgKCF0eXBlcy5OdW1iZXIoY2h1bmtzW2NodW5rcy5sZW5ndGggLSAyXSkpIHJldHVybiBmYWxzZTtcbiAgY29uc3QgbSA9IChjaHVua3NbMF0gYXMgbnVtYmVyKSAtIE9QX0lOVF9CQVNFO1xuICBjb25zdCBuID0gKGNodW5rc1tjaHVua3MubGVuZ3RoIC0gMl0gYXMgbnVtYmVyKSAtIE9QX0lOVF9CQVNFO1xuXG4gIGlmIChtIDw9IDApIHJldHVybiBmYWxzZTtcbiAgaWYgKG4gPiAxNikgcmV0dXJuIGZhbHNlO1xuICBpZiAobSA+IG4pIHJldHVybiBmYWxzZTtcbiAgaWYgKG4gIT09IGNodW5rcy5sZW5ndGggLSAzKSByZXR1cm4gZmFsc2U7XG4gIGlmIChhbGxvd0luY29tcGxldGUpIHJldHVybiB0cnVlO1xuXG4gIGNvbnN0IGtleXMgPSBjaHVua3Muc2xpY2UoMSwgLTIpIGFzIEJ1ZmZlcltdO1xuICByZXR1cm4ga2V5cy5ldmVyeShic2NyaXB0LmlzQ2Fub25pY2FsUHViS2V5KTtcbn1cbmNoZWNrLnRvSlNPTiA9ICgpOiBzdHJpbmcgPT4ge1xuICByZXR1cm4gJ211bHRpLXNpZyBvdXRwdXQnO1xufTtcbiJdfQ==
|
@@ -1,10 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
export declare function check(script: Buffer | Array<number | Buffer>): boolean;
|
3
|
-
export declare namespace check {
|
4
|
-
var toJSON: () => string;
|
5
|
-
}
|
6
|
-
declare const output: {
|
7
|
-
check: typeof check;
|
8
|
-
};
|
9
|
-
export { output };
|
10
|
-
//# sourceMappingURL=nulldata.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"nulldata.d.ts","sourceRoot":"","sources":["../../../src/templates/nulldata.ts"],"names":[],"mappings":";AAIA,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,OAAO,CAItE;yBAJe,KAAK;;;AASrB,QAAA,MAAM,MAAM;;CAAY,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.output = exports.check = void 0;
|
4
|
-
// OP_RETURN {data}
|
5
|
-
const __1 = require("../");
|
6
|
-
const __2 = require("../");
|
7
|
-
function check(script) {
|
8
|
-
const buffer = __1.script.compile(script);
|
9
|
-
return buffer.length > 1 && buffer[0] === __2.opcodes.OP_RETURN;
|
10
|
-
}
|
11
|
-
exports.check = check;
|
12
|
-
check.toJSON = () => {
|
13
|
-
return 'null data output';
|
14
|
-
};
|
15
|
-
const output = { check };
|
16
|
-
exports.output = output;
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVsbGRhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGVtcGxhdGVzL251bGxkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLG1CQUFtQjtBQUNuQiwyQkFBd0M7QUFDeEMsMkJBQThCO0FBRTlCLFNBQWdCLEtBQUssQ0FBQyxNQUF1QztJQUMzRCxNQUFNLE1BQU0sR0FBRyxVQUFPLENB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AK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.output = exports.input = void 0;
|
4
|
-
const input = require("./input");
|
5
|
-
exports.input = input;
|
6
|
-
const output = require("./output");
|
7
|
-
exports.output = output;
|
8
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvdGVtcGxhdGVzL3B1YmtleS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpQ0FBaUM7QUFHeEIsc0JBQUs7QUFGZCxtQ0FBbUM7QUFFbkIsd0JBQU0iLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpbnB1dCBmcm9tICcuL2lucHV0JztcbmltcG9ydCAqIGFzIG91dHB1dCBmcm9tICcuL291dHB1dCc7XG5cbmV4cG9ydCB7IGlucHV0LCBvdXRwdXQgfTtcbiJdfQ==
|