@btc-vision/bitcoin 6.5.6 → 7.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOW_TO_WRITE_GOOD_CODE.md +2436 -0
- package/benchmark/psbt-2000-inputs.bench.ts +178 -0
- package/benchmark/signing.bench.ts +147 -0
- package/browser/address.d.ts +57 -10
- package/browser/address.d.ts.map +1 -0
- package/browser/bech32utils.d.ts +9 -1
- package/browser/bech32utils.d.ts.map +1 -0
- package/browser/bip66.d.ts +11 -6
- package/browser/bip66.d.ts.map +1 -0
- package/browser/block.d.ts +117 -11
- package/browser/block.d.ts.map +1 -0
- package/browser/branded.d.ts +20 -0
- package/browser/branded.d.ts.map +1 -0
- package/browser/crypto/crypto.d.ts +1 -0
- package/browser/crypto/crypto.d.ts.map +1 -0
- package/browser/crypto.d.ts +46 -7
- package/browser/crypto.d.ts.map +1 -0
- package/browser/ecc/context.d.ts +129 -0
- package/browser/ecc/context.d.ts.map +1 -0
- package/browser/ecc/index.d.ts +11 -0
- package/browser/ecc/index.d.ts.map +1 -0
- package/browser/ecc/types.d.ts +128 -0
- package/browser/ecc/types.d.ts.map +1 -0
- package/browser/ecpair.d.ts +99 -0
- package/browser/errors.d.ts +124 -0
- package/browser/errors.d.ts.map +1 -0
- package/browser/index.d.ts +32 -5
- package/browser/index.d.ts.map +1 -0
- package/browser/index.js +12477 -101
- package/browser/io/BinaryReader.d.ts +276 -0
- package/browser/io/BinaryReader.d.ts.map +1 -0
- package/browser/io/BinaryWriter.d.ts +391 -0
- package/browser/io/BinaryWriter.d.ts.map +1 -0
- package/browser/io/MemoryPool.d.ts +220 -0
- package/browser/io/MemoryPool.d.ts.map +1 -0
- package/browser/io/base64.d.ts +13 -0
- package/browser/io/base64.d.ts.map +1 -0
- package/browser/io/hex.d.ts +67 -0
- package/browser/io/hex.d.ts.map +1 -0
- package/browser/io/index.d.ts +17 -0
- package/browser/io/index.d.ts.map +1 -0
- package/browser/io/utils.d.ts +199 -0
- package/browser/io/utils.d.ts.map +1 -0
- package/browser/merkle.d.ts +10 -1
- package/browser/merkle.d.ts.map +1 -0
- package/browser/networks.d.ts +70 -9
- package/browser/networks.d.ts.map +1 -0
- package/browser/opcodes.d.ts +1 -0
- package/browser/opcodes.d.ts.map +1 -0
- package/browser/payments/bip341.d.ts +35 -9
- package/browser/payments/bip341.d.ts.map +1 -0
- package/browser/payments/embed.d.ts +112 -1
- package/browser/payments/embed.d.ts.map +1 -0
- package/browser/payments/index.d.ts +17 -10
- package/browser/payments/index.d.ts.map +1 -0
- package/browser/payments/p2ms.d.ts +150 -0
- package/browser/payments/p2ms.d.ts.map +1 -0
- package/browser/payments/p2op.d.ts +150 -24
- package/browser/payments/p2op.d.ts.map +1 -0
- package/browser/payments/p2pk.d.ts +154 -1
- package/browser/payments/p2pk.d.ts.map +1 -0
- package/browser/payments/p2pkh.d.ts +176 -1
- package/browser/payments/p2pkh.d.ts.map +1 -0
- package/browser/payments/p2sh.d.ts +150 -1
- package/browser/payments/p2sh.d.ts.map +1 -0
- package/browser/payments/p2tr.d.ts +185 -1
- package/browser/payments/p2tr.d.ts.map +1 -0
- package/browser/payments/p2wpkh.d.ts +161 -1
- package/browser/payments/p2wpkh.d.ts.map +1 -0
- package/browser/payments/p2wsh.d.ts +146 -1
- package/browser/payments/p2wsh.d.ts.map +1 -0
- package/browser/payments/types.d.ts +94 -64
- package/browser/payments/types.d.ts.map +1 -0
- package/browser/psbt/bip371.d.ts +34 -8
- package/browser/psbt/bip371.d.ts.map +1 -0
- package/browser/psbt/psbtutils.d.ts +56 -16
- package/browser/psbt/psbtutils.d.ts.map +1 -0
- package/browser/psbt/types.d.ts +245 -0
- package/browser/psbt/types.d.ts.map +1 -0
- package/browser/psbt/utils.d.ts +64 -0
- package/browser/psbt/utils.d.ts.map +1 -0
- package/browser/psbt/validation.d.ts +84 -0
- package/browser/psbt/validation.d.ts.map +1 -0
- package/browser/psbt.d.ts +82 -118
- package/browser/psbt.d.ts.map +1 -0
- package/browser/pubkey.d.ts +27 -6
- package/browser/pubkey.d.ts.map +1 -0
- package/browser/push_data.d.ts +24 -2
- package/browser/push_data.d.ts.map +1 -0
- package/browser/script.d.ts +33 -8
- package/browser/script.d.ts.map +1 -0
- package/browser/script_number.d.ts +17 -0
- package/browser/script_number.d.ts.map +1 -0
- package/browser/script_signature.d.ts +23 -5
- package/browser/script_signature.d.ts.map +1 -0
- package/browser/transaction.d.ts +160 -18
- package/browser/transaction.d.ts.map +1 -0
- package/browser/types.d.ts +36 -38
- package/browser/types.d.ts.map +1 -0
- package/browser/workers/WorkerSigningPool.d.ts +143 -0
- package/browser/workers/WorkerSigningPool.d.ts.map +1 -0
- package/browser/workers/WorkerSigningPool.node.d.ts +116 -0
- package/browser/workers/WorkerSigningPool.node.d.ts.map +1 -0
- package/browser/workers/ecc-bundle.d.ts +25 -0
- package/browser/workers/ecc-bundle.d.ts.map +1 -0
- package/browser/workers/index.d.ts +91 -0
- package/browser/workers/index.d.ts.map +1 -0
- package/browser/workers/psbt-parallel.d.ts +88 -0
- package/browser/workers/psbt-parallel.d.ts.map +1 -0
- package/browser/workers/signing-worker.d.ts +37 -0
- package/browser/workers/signing-worker.d.ts.map +1 -0
- package/browser/workers/types.d.ts +365 -0
- package/browser/workers/types.d.ts.map +1 -0
- package/build/address.d.ts +58 -11
- package/build/address.d.ts.map +1 -0
- package/build/address.js +82 -25
- package/build/address.js.map +1 -0
- package/build/bech32utils.d.ts +9 -1
- package/build/bech32utils.d.ts.map +1 -0
- package/build/bech32utils.js +10 -2
- package/build/bech32utils.js.map +1 -0
- package/build/bip66.d.ts +11 -6
- package/build/bip66.d.ts.map +1 -0
- package/build/bip66.js +32 -3
- package/build/bip66.js.map +1 -0
- package/build/block.d.ts +117 -11
- package/build/block.d.ts.map +1 -0
- package/build/block.js +202 -72
- package/build/block.js.map +1 -0
- package/build/branded.d.ts +20 -0
- package/build/branded.d.ts.map +1 -0
- package/build/branded.js +7 -0
- package/build/branded.js.map +1 -0
- package/build/crypto/crypto.d.ts +1 -0
- package/build/crypto/crypto.d.ts.map +1 -0
- package/build/crypto/crypto.js +1 -0
- package/build/crypto/crypto.js.map +1 -0
- package/build/crypto.d.ts +46 -7
- package/build/crypto.d.ts.map +1 -0
- package/build/crypto.js +65 -20
- package/build/crypto.js.map +1 -0
- package/build/ecc/context.d.ts +135 -0
- package/build/ecc/context.d.ts.map +1 -0
- package/build/ecc/context.js +232 -0
- package/build/ecc/context.js.map +1 -0
- package/build/ecc/index.d.ts +11 -0
- package/build/ecc/index.d.ts.map +1 -0
- package/build/ecc/index.js +11 -0
- package/build/ecc/index.js.map +1 -0
- package/build/ecc/types.d.ts +134 -0
- package/build/ecc/types.d.ts.map +1 -0
- package/build/ecc/types.js +8 -0
- package/build/ecc/types.js.map +1 -0
- package/build/errors.d.ts +124 -0
- package/build/errors.d.ts.map +1 -0
- package/build/errors.js +155 -0
- package/build/errors.js.map +1 -0
- package/build/index.d.ts +32 -5
- package/build/index.d.ts.map +1 -0
- package/build/index.js +26 -3
- package/build/index.js.map +1 -0
- package/build/io/BinaryReader.d.ts +276 -0
- package/build/io/BinaryReader.d.ts.map +1 -0
- package/build/io/BinaryReader.js +425 -0
- package/build/io/BinaryReader.js.map +1 -0
- package/build/io/BinaryWriter.d.ts +391 -0
- package/build/io/BinaryWriter.d.ts.map +1 -0
- package/build/io/BinaryWriter.js +611 -0
- package/build/io/BinaryWriter.js.map +1 -0
- package/build/io/MemoryPool.d.ts +220 -0
- package/build/io/MemoryPool.d.ts.map +1 -0
- package/build/io/MemoryPool.js +309 -0
- package/build/io/MemoryPool.js.map +1 -0
- package/build/io/base64.d.ts +13 -0
- package/build/io/base64.d.ts.map +1 -0
- package/build/io/base64.js +20 -0
- package/build/io/base64.js.map +1 -0
- package/build/io/hex.d.ts +67 -0
- package/build/io/hex.d.ts.map +1 -0
- package/build/io/hex.js +138 -0
- package/build/io/hex.js.map +1 -0
- package/build/io/index.d.ts +17 -0
- package/build/io/index.d.ts.map +1 -0
- package/build/io/index.js +23 -0
- package/build/io/index.js.map +1 -0
- package/build/io/utils.d.ts +199 -0
- package/build/io/utils.d.ts.map +1 -0
- package/build/io/utils.js +271 -0
- package/build/io/utils.js.map +1 -0
- package/build/merkle.d.ts +10 -1
- package/build/merkle.d.ts.map +1 -0
- package/build/merkle.js +12 -1
- package/build/merkle.js.map +1 -0
- package/build/networks.d.ts +70 -9
- package/build/networks.d.ts.map +1 -0
- package/build/networks.js +90 -4
- package/build/networks.js.map +1 -0
- package/build/opcodes.d.ts +1 -0
- package/build/opcodes.d.ts.map +1 -0
- package/build/opcodes.js +1 -0
- package/build/opcodes.js.map +1 -0
- package/build/payments/bip341.d.ts +35 -9
- package/build/payments/bip341.d.ts.map +1 -0
- package/build/payments/bip341.js +34 -15
- package/build/payments/bip341.js.map +1 -0
- package/build/payments/embed.d.ts +120 -1
- package/build/payments/embed.d.ts.map +1 -0
- package/build/payments/embed.js +215 -34
- package/build/payments/embed.js.map +1 -0
- package/build/payments/index.d.ts +17 -10
- package/build/payments/index.d.ts.map +1 -0
- package/build/payments/index.js +20 -10
- package/build/payments/index.js.map +1 -0
- package/build/payments/p2ms.d.ts +159 -1
- package/build/payments/p2ms.d.ts.map +1 -0
- package/build/payments/p2ms.js +427 -108
- package/build/payments/p2ms.js.map +1 -0
- package/build/payments/p2op.d.ts +158 -24
- package/build/payments/p2op.d.ts.map +1 -0
- package/build/payments/p2op.js +379 -93
- package/build/payments/p2op.js.map +1 -0
- package/build/payments/p2pk.d.ts +162 -1
- package/build/payments/p2pk.d.ts.map +1 -0
- package/build/payments/p2pk.js +327 -58
- package/build/payments/p2pk.js.map +1 -0
- package/build/payments/p2pkh.d.ts +185 -1
- package/build/payments/p2pkh.d.ts.map +1 -0
- package/build/payments/p2pkh.js +467 -114
- package/build/payments/p2pkh.js.map +1 -0
- package/build/payments/p2sh.d.ts +159 -1
- package/build/payments/p2sh.d.ts.map +1 -0
- package/build/payments/p2sh.js +500 -150
- package/build/payments/p2sh.js.map +1 -0
- package/build/payments/p2tr.d.ts +193 -1
- package/build/payments/p2tr.d.ts.map +1 -0
- package/build/payments/p2tr.js +592 -174
- package/build/payments/p2tr.js.map +1 -0
- package/build/payments/p2wpkh.d.ts +170 -1
- package/build/payments/p2wpkh.d.ts.map +1 -0
- package/build/payments/p2wpkh.js +428 -103
- package/build/payments/p2wpkh.js.map +1 -0
- package/build/payments/p2wsh.d.ts +155 -1
- package/build/payments/p2wsh.d.ts.map +1 -0
- package/build/payments/p2wsh.js +465 -143
- package/build/payments/p2wsh.js.map +1 -0
- package/build/payments/types.d.ts +98 -64
- package/build/payments/types.d.ts.map +1 -0
- package/build/payments/types.js +17 -13
- package/build/payments/types.js.map +1 -0
- package/build/psbt/bip371.d.ts +35 -9
- package/build/psbt/bip371.d.ts.map +1 -0
- package/build/psbt/bip371.js +117 -28
- package/build/psbt/bip371.js.map +1 -0
- package/build/psbt/psbtutils.d.ts +56 -16
- package/build/psbt/psbtutils.d.ts.map +1 -0
- package/build/psbt/psbtutils.js +71 -16
- package/build/psbt/psbtutils.js.map +1 -0
- package/build/psbt/types.d.ts +249 -0
- package/build/psbt/types.d.ts.map +1 -0
- package/build/psbt/types.js +6 -0
- package/build/psbt/types.js.map +1 -0
- package/build/psbt/utils.d.ts +68 -0
- package/build/psbt/utils.d.ts.map +1 -0
- package/build/psbt/utils.js +171 -0
- package/build/psbt/utils.js.map +1 -0
- package/build/psbt/validation.d.ts +88 -0
- package/build/psbt/validation.d.ts.map +1 -0
- package/build/psbt/validation.js +149 -0
- package/build/psbt/validation.js.map +1 -0
- package/build/psbt.d.ts +84 -120
- package/build/psbt.d.ts.map +1 -0
- package/build/psbt.js +406 -413
- package/build/psbt.js.map +1 -0
- package/build/pubkey.d.ts +27 -6
- package/build/pubkey.d.ts.map +1 -0
- package/build/pubkey.js +36 -12
- package/build/pubkey.js.map +1 -0
- package/build/push_data.d.ts +24 -2
- package/build/push_data.d.ts.map +1 -0
- package/build/push_data.js +44 -12
- package/build/push_data.js.map +1 -0
- package/build/script.d.ts +33 -8
- package/build/script.d.ts.map +1 -0
- package/build/script.js +101 -37
- package/build/script.js.map +1 -0
- package/build/script_number.d.ts +17 -0
- package/build/script_number.d.ts.map +1 -0
- package/build/script_number.js +19 -0
- package/build/script_number.js.map +1 -0
- package/build/script_signature.d.ts +23 -5
- package/build/script_signature.d.ts.map +1 -0
- package/build/script_signature.js +48 -15
- package/build/script_signature.js.map +1 -0
- package/build/transaction.d.ts +160 -18
- package/build/transaction.d.ts.map +1 -0
- package/build/transaction.js +443 -176
- package/build/transaction.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/build/types.d.ts +36 -38
- package/build/types.d.ts.map +1 -0
- package/build/types.js +169 -57
- package/build/types.js.map +1 -0
- package/build/workers/WorkerSigningPool.d.ts +174 -0
- package/build/workers/WorkerSigningPool.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.js +553 -0
- package/build/workers/WorkerSigningPool.js.map +1 -0
- package/build/workers/WorkerSigningPool.node.d.ts +124 -0
- package/build/workers/WorkerSigningPool.node.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.node.js +753 -0
- package/build/workers/WorkerSigningPool.node.js.map +1 -0
- package/build/workers/ecc-bundle.d.ts +25 -0
- package/build/workers/ecc-bundle.d.ts.map +1 -0
- package/build/workers/ecc-bundle.js +25 -0
- package/build/workers/ecc-bundle.js.map +1 -0
- package/build/workers/index.d.ts +91 -0
- package/build/workers/index.d.ts.map +1 -0
- package/build/workers/index.js +114 -0
- package/build/workers/index.js.map +1 -0
- package/build/workers/psbt-parallel.d.ts +117 -0
- package/build/workers/psbt-parallel.d.ts.map +1 -0
- package/build/workers/psbt-parallel.js +233 -0
- package/build/workers/psbt-parallel.js.map +1 -0
- package/build/workers/signing-worker.d.ts +37 -0
- package/build/workers/signing-worker.d.ts.map +1 -0
- package/build/workers/signing-worker.js +350 -0
- package/build/workers/signing-worker.js.map +1 -0
- package/build/workers/types.d.ts +365 -0
- package/build/workers/types.d.ts.map +1 -0
- package/build/workers/types.js +60 -0
- package/build/workers/types.js.map +1 -0
- package/package.json +68 -9
- package/scripts/bundle-ecc.ts +111 -0
- package/src/address.ts +91 -45
- package/src/bech32utils.ts +3 -3
- package/src/bip66.ts +34 -24
- package/src/block.ts +205 -86
- package/src/branded.ts +18 -0
- package/src/crypto.ts +64 -26
- package/src/ecc/context.ts +280 -0
- package/src/ecc/index.ts +14 -0
- package/src/ecc/types.ts +147 -0
- package/src/ecpair.d.ts +99 -0
- package/src/errors.ts +163 -0
- package/src/index.ts +112 -9
- package/src/io/BinaryReader.ts +461 -0
- package/src/io/BinaryWriter.ts +696 -0
- package/src/io/MemoryPool.ts +343 -0
- package/src/io/base64.ts +20 -0
- package/src/io/hex.ts +155 -0
- package/src/io/index.ts +41 -0
- package/src/io/utils.ts +283 -0
- package/src/merkle.ts +14 -9
- package/src/networks.ts +9 -9
- package/src/payments/bip341.ts +32 -33
- package/src/payments/embed.ts +244 -41
- package/src/payments/index.ts +12 -10
- package/src/payments/p2ms.ts +497 -118
- package/src/payments/p2op.ts +432 -134
- package/src/payments/p2pk.ts +370 -72
- package/src/payments/p2pkh.ts +524 -130
- package/src/payments/p2sh.ts +572 -169
- package/src/payments/p2tr.ts +686 -194
- package/src/payments/p2wpkh.ts +482 -105
- package/src/payments/p2wsh.ts +524 -162
- package/src/payments/types.ts +80 -66
- package/src/psbt/bip371.ts +72 -51
- package/src/psbt/psbtutils.ts +39 -40
- package/src/psbt/types.ts +324 -0
- package/src/psbt/utils.ts +188 -0
- package/src/psbt/validation.ts +185 -0
- package/src/psbt.ts +608 -827
- package/src/pubkey.ts +22 -23
- package/src/push_data.ts +18 -16
- package/src/script.ts +81 -66
- package/src/script_number.ts +6 -6
- package/src/script_signature.ts +33 -36
- package/src/transaction.ts +462 -239
- package/src/types.ts +229 -100
- package/src/workers/WorkerSigningPool.node.ts +887 -0
- package/src/workers/WorkerSigningPool.ts +666 -0
- package/src/workers/ecc-bundle.ts +26 -0
- package/src/workers/index.ts +165 -0
- package/src/workers/psbt-parallel.ts +327 -0
- package/src/workers/signing-worker.ts +353 -0
- package/src/workers/types.ts +417 -0
- package/test/address.spec.ts +9 -6
- package/test/bitcoin.core.spec.ts +16 -17
- package/test/block.spec.ts +8 -7
- package/test/bufferutils.spec.ts +228 -214
- package/test/crypto.spec.ts +19 -11
- package/test/fixtures/p2pk.json +0 -8
- package/test/fixtures/p2pkh.json +1 -1
- package/test/fixtures/p2sh.json +1 -1
- package/test/fixtures/script.json +1 -1
- package/test/fixtures/transaction.json +2 -2
- package/test/integration/_regtest.ts +25 -0
- package/test/integration/addresses.spec.ts +4 -3
- package/test/integration/bip32.spec.ts +2 -1
- package/test/integration/blocks.spec.ts +1 -1
- package/test/integration/cltv.spec.ts +18 -16
- package/test/integration/csv.spec.ts +37 -64
- package/test/integration/payments.spec.ts +5 -3
- package/test/integration/taproot.spec.ts +76 -83
- package/test/integration/transactions.spec.ts +38 -35
- package/test/payments.spec.ts +35 -13
- package/test/payments.utils.ts +17 -16
- package/test/psbt.spec.ts +111 -100
- package/test/script.spec.ts +11 -10
- package/test/script_signature.spec.ts +9 -11
- package/test/taproot-cache.spec.ts +694 -0
- package/test/transaction.spec.ts +32 -40
- package/test/types.spec.ts +74 -29
- package/test/workers-pool.spec.ts +963 -0
- package/test/workers-signing.spec.ts +635 -0
- package/test/workers.spec.ts +1390 -0
- package/tsconfig.base.json +34 -18
- package/tsconfig.browser.json +15 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +5 -14
- package/typedoc.json +29 -0
- package/vite.config.browser.ts +3 -42
- package/vitest.config.integration.ts +2 -0
- package/browser/bufferutils.d.ts +0 -34
- package/browser/chunks/crypto-BhCpKpek.js +0 -2033
- package/browser/chunks/payments-B1wlSccx.js +0 -1089
- package/browser/chunks/psbt-BCNk7JUx.js +0 -4055
- package/browser/chunks/script-DyPItFEl.js +0 -318
- package/browser/chunks/transaction-C_UbhMGn.js +0 -432
- package/browser/chunks/utils-DNZi-T5W.js +0 -761
- package/browser/ecc_lib.d.ts +0 -3
- package/browser/hooks/AdvancedSignatureManager.d.ts +0 -16
- package/browser/hooks/HookedSigner.d.ts +0 -4
- package/browser/hooks/SignatureManager.d.ts +0 -13
- package/browser/payments/lazy.d.ts +0 -2
- package/browser/typeforce.d.ts +0 -38
- package/build/bufferutils.d.ts +0 -34
- package/build/bufferutils.js +0 -141
- package/build/ecc_lib.d.ts +0 -3
- package/build/ecc_lib.js +0 -61
- package/build/hooks/AdvancedSignatureManager.d.ts +0 -16
- package/build/hooks/AdvancedSignatureManager.js +0 -52
- package/build/hooks/HookedSigner.d.ts +0 -4
- package/build/hooks/HookedSigner.js +0 -64
- package/build/hooks/SignatureManager.d.ts +0 -13
- package/build/hooks/SignatureManager.js +0 -45
- package/build/payments/lazy.d.ts +0 -2
- package/build/payments/lazy.js +0 -28
- package/build/tsconfig.tsbuildinfo +0 -1
- package/src/bufferutils.ts +0 -188
- package/src/ecc_lib.ts +0 -94
- package/src/hooks/AdvancedSignatureManager.ts +0 -104
- package/src/hooks/HookedSigner.ts +0 -108
- package/src/hooks/SignatureManager.ts +0 -84
- package/src/payments/lazy.ts +0 -28
- package/src/typeforce.d.ts +0 -38
- package/tsconfig.webpack.json +0 -18
package/build/block.js
CHANGED
|
@@ -1,99 +1,188 @@
|
|
|
1
|
-
import { BufferReader, BufferWriter, reverseBuffer, varuint } from './bufferutils.js';
|
|
2
1
|
import * as bcrypto from './crypto.js';
|
|
2
|
+
import { alloc, BinaryReader, BinaryWriter, compare, equals, fromHex, reverse, toHex, varuint, } from './io/index.js';
|
|
3
3
|
import { fastMerkleRoot } from './merkle.js';
|
|
4
4
|
import { Transaction } from './transaction.js';
|
|
5
|
-
import * as types from './types.js';
|
|
6
|
-
const { typeforce } = types;
|
|
7
5
|
const errorMerkleNoTxes = new TypeError('Cannot compute merkle root for zero transactions');
|
|
8
6
|
const errorWitnessNotSegwit = new TypeError('Cannot compute witness commit for non-segwit block');
|
|
7
|
+
const WITNESS_COMMIT_PREFIX = fromHex('6a24aa21a9ed');
|
|
8
|
+
/**
|
|
9
|
+
* Represents a Bitcoin block with header fields and optional transactions.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { Block, fromHex } from '@btc-vision/bitcoin';
|
|
14
|
+
*
|
|
15
|
+
* // Parse a block from hex
|
|
16
|
+
* const block = Block.fromHex('0100000000000000...');
|
|
17
|
+
*
|
|
18
|
+
* // Access block properties
|
|
19
|
+
* console.log(block.version);
|
|
20
|
+
* console.log(block.getId());
|
|
21
|
+
* console.log(block.timestamp);
|
|
22
|
+
*
|
|
23
|
+
* // Check proof of work
|
|
24
|
+
* if (block.checkProofOfWork()) {
|
|
25
|
+
* console.log('Valid PoW');
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
9
29
|
export class Block {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
/** Block version number */
|
|
31
|
+
version = 1;
|
|
32
|
+
/** Hash of the previous block (32 bytes) */
|
|
33
|
+
prevHash = undefined;
|
|
34
|
+
/** Merkle root of the transactions (32 bytes) */
|
|
35
|
+
merkleRoot = undefined;
|
|
36
|
+
/** Block timestamp (Unix time) */
|
|
37
|
+
timestamp = 0;
|
|
38
|
+
/** Witness commitment for SegWit blocks (32 bytes) */
|
|
39
|
+
witnessCommit = undefined;
|
|
40
|
+
/** Compact representation of the target threshold */
|
|
41
|
+
bits = 0;
|
|
42
|
+
/** Nonce used for proof of work */
|
|
43
|
+
nonce = 0;
|
|
44
|
+
/** Array of transactions included in the block */
|
|
45
|
+
transactions = undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Parses a Block from a Uint8Array.
|
|
48
|
+
* @param buffer - The raw block data (minimum 80 bytes for header only)
|
|
49
|
+
* @returns Parsed Block instance
|
|
50
|
+
* @throws Error if buffer is too small
|
|
51
|
+
*/
|
|
20
52
|
static fromBuffer(buffer) {
|
|
21
53
|
if (buffer.length < 80)
|
|
22
54
|
throw new Error('Buffer too small (< 80 bytes)');
|
|
23
|
-
const
|
|
55
|
+
const reader = new BinaryReader(buffer);
|
|
24
56
|
const block = new Block();
|
|
25
|
-
block.version =
|
|
26
|
-
block.prevHash =
|
|
27
|
-
block.merkleRoot =
|
|
28
|
-
block.timestamp =
|
|
29
|
-
block.bits =
|
|
30
|
-
block.nonce =
|
|
57
|
+
block.version = reader.readInt32LE();
|
|
58
|
+
block.prevHash = reader.readBytes(32);
|
|
59
|
+
block.merkleRoot = reader.readBytes(32);
|
|
60
|
+
block.timestamp = reader.readUInt32LE();
|
|
61
|
+
block.bits = reader.readUInt32LE();
|
|
62
|
+
block.nonce = reader.readUInt32LE();
|
|
31
63
|
if (buffer.length === 80)
|
|
32
64
|
return block;
|
|
33
65
|
const readTransaction = () => {
|
|
34
|
-
const tx = Transaction.fromBuffer(
|
|
35
|
-
|
|
66
|
+
const tx = Transaction.fromBuffer(reader.data.subarray(reader.offset), true);
|
|
67
|
+
reader.offset += tx.byteLength();
|
|
36
68
|
return tx;
|
|
37
69
|
};
|
|
38
|
-
const nTransactions =
|
|
70
|
+
const nTransactions = reader.readVarInt();
|
|
39
71
|
block.transactions = [];
|
|
40
72
|
for (let i = 0; i < nTransactions; ++i) {
|
|
41
73
|
const tx = readTransaction();
|
|
42
74
|
block.transactions.push(tx);
|
|
43
75
|
}
|
|
44
76
|
const witnessCommit = block.getWitnessCommit();
|
|
77
|
+
// This Block contains a witness commit
|
|
45
78
|
if (witnessCommit)
|
|
46
79
|
block.witnessCommit = witnessCommit;
|
|
47
80
|
return block;
|
|
48
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Parses a Block from a hex string.
|
|
84
|
+
* @param hex - Hexadecimal representation of the block
|
|
85
|
+
* @returns Parsed Block instance
|
|
86
|
+
*/
|
|
49
87
|
static fromHex(hex) {
|
|
50
|
-
return Block.fromBuffer(
|
|
88
|
+
return Block.fromBuffer(fromHex(hex));
|
|
51
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Calculates the target threshold from the compact bits representation.
|
|
92
|
+
* @param bits - Compact bits value from block header
|
|
93
|
+
* @returns 32-byte target threshold
|
|
94
|
+
*/
|
|
52
95
|
static calculateTarget(bits) {
|
|
53
96
|
const exponent = ((bits & 0xff000000) >> 24) - 3;
|
|
54
97
|
const mantissa = bits & 0x007fffff;
|
|
55
|
-
const target =
|
|
56
|
-
|
|
98
|
+
const target = alloc(32);
|
|
99
|
+
// Write mantissa as big-endian at the computed offset
|
|
100
|
+
const offset = 29 - exponent;
|
|
101
|
+
target[offset] = (mantissa >> 16) & 0xff;
|
|
102
|
+
target[offset + 1] = (mantissa >> 8) & 0xff;
|
|
103
|
+
target[offset + 2] = mantissa & 0xff;
|
|
57
104
|
return target;
|
|
58
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Calculates the merkle root for a list of transactions.
|
|
108
|
+
* @param transactions - Array of transactions
|
|
109
|
+
* @param forWitness - If true, calculate witness merkle root (for SegWit)
|
|
110
|
+
* @returns 32-byte merkle root hash
|
|
111
|
+
* @throws TypeError if transactions is empty or not an array
|
|
112
|
+
*/
|
|
59
113
|
static calculateMerkleRoot(transactions, forWitness) {
|
|
60
|
-
|
|
114
|
+
if (!Array.isArray(transactions)) {
|
|
115
|
+
throw new TypeError('Expected an array of transactions');
|
|
116
|
+
}
|
|
61
117
|
if (transactions.length === 0)
|
|
62
118
|
throw errorMerkleNoTxes;
|
|
63
119
|
if (forWitness && !txesHaveWitnessCommit(transactions))
|
|
64
120
|
throw errorWitnessNotSegwit;
|
|
65
121
|
const hashes = transactions.map((transaction) => transaction.getHash(forWitness));
|
|
66
122
|
const rootHash = fastMerkleRoot(hashes, bcrypto.hash256);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
123
|
+
if (forWitness) {
|
|
124
|
+
const witness = transactions[0].ins[0].witness[0];
|
|
125
|
+
const combined = new Uint8Array(rootHash.length + witness.length);
|
|
126
|
+
combined.set(rootHash);
|
|
127
|
+
combined.set(witness, rootHash.length);
|
|
128
|
+
return bcrypto.hash256(combined);
|
|
129
|
+
}
|
|
130
|
+
return rootHash;
|
|
70
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Extracts the witness commitment from the coinbase transaction.
|
|
134
|
+
* @returns 32-byte witness commitment or null if not found
|
|
135
|
+
*/
|
|
71
136
|
getWitnessCommit() {
|
|
72
|
-
if (!txesHaveWitnessCommit(this.transactions))
|
|
137
|
+
if (!this.transactions || !txesHaveWitnessCommit(this.transactions))
|
|
73
138
|
return null;
|
|
74
|
-
|
|
139
|
+
// The merkle root for the witness data is in an OP_RETURN output.
|
|
140
|
+
// There is no rule for the index of the output, so use filter to find it.
|
|
141
|
+
// The root is prepended with 0xaa21a9ed so check for 0x6a24aa21a9ed
|
|
142
|
+
// If multiple commits are found, the output with highest index is assumed.
|
|
143
|
+
const witnessCommits = this.transactions[0].outs.filter((out) => equals(out.script.subarray(0, 6), WITNESS_COMMIT_PREFIX)).map((out) => out.script.subarray(6, 38));
|
|
75
144
|
if (witnessCommits.length === 0)
|
|
76
145
|
return null;
|
|
146
|
+
// Use the commit with the highest output (should only be one though)
|
|
77
147
|
const result = witnessCommits[witnessCommits.length - 1];
|
|
78
|
-
if (!(result instanceof
|
|
148
|
+
if (!(result instanceof Uint8Array && result.length === 32))
|
|
79
149
|
return null;
|
|
80
150
|
return result;
|
|
81
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Checks if this block has a witness commitment.
|
|
154
|
+
* @returns True if the block has a witness commitment
|
|
155
|
+
*/
|
|
82
156
|
hasWitnessCommit() {
|
|
83
|
-
if (this.witnessCommit instanceof
|
|
157
|
+
if (this.witnessCommit instanceof Uint8Array && this.witnessCommit.length === 32)
|
|
84
158
|
return true;
|
|
85
159
|
if (this.getWitnessCommit() !== null)
|
|
86
160
|
return true;
|
|
87
161
|
return false;
|
|
88
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Checks if any transaction in this block has witness data.
|
|
165
|
+
* @returns True if any transaction has witness data
|
|
166
|
+
*/
|
|
89
167
|
hasWitness() {
|
|
90
|
-
return anyTxHasWitness(this.transactions);
|
|
168
|
+
return this.transactions ? anyTxHasWitness(this.transactions) : false;
|
|
91
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Calculates the weight of this block.
|
|
172
|
+
* Weight = (base size * 3) + total size
|
|
173
|
+
* @returns Block weight in weight units
|
|
174
|
+
*/
|
|
92
175
|
weight() {
|
|
93
176
|
const base = this.byteLength(false, false);
|
|
94
177
|
const total = this.byteLength(false, true);
|
|
95
178
|
return base * 3 + total;
|
|
96
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Calculates the serialized byte length of this block.
|
|
182
|
+
* @param headersOnly - If true, return only header size (80 bytes)
|
|
183
|
+
* @param allowWitness - If true, include witness data in calculation
|
|
184
|
+
* @returns Byte length of the serialized block
|
|
185
|
+
*/
|
|
97
186
|
byteLength(headersOnly, allowWitness = true) {
|
|
98
187
|
if (headersOnly || !this.transactions)
|
|
99
188
|
return 80;
|
|
@@ -101,81 +190,122 @@ export class Block {
|
|
|
101
190
|
varuint.encodingLength(this.transactions.length) +
|
|
102
191
|
this.transactions.reduce((a, x) => a + x.byteLength(allowWitness), 0));
|
|
103
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Computes the double-SHA256 hash of the block header.
|
|
195
|
+
* @returns 32-byte block hash
|
|
196
|
+
*/
|
|
104
197
|
getHash() {
|
|
105
198
|
return bcrypto.hash256(this.toBuffer(true));
|
|
106
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Returns the block ID (hash in reversed hex format, as displayed in block explorers).
|
|
202
|
+
* @returns Block ID as hex string
|
|
203
|
+
*/
|
|
107
204
|
getId() {
|
|
108
|
-
return
|
|
205
|
+
return toHex(reverse(this.getHash()));
|
|
109
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Converts the block timestamp to a Date object.
|
|
209
|
+
* @returns UTC date of the block
|
|
210
|
+
*/
|
|
110
211
|
getUTCDate() {
|
|
111
|
-
const date = new Date(0);
|
|
212
|
+
const date = new Date(0); // epoch
|
|
112
213
|
date.setUTCSeconds(this.timestamp);
|
|
113
214
|
return date;
|
|
114
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Serializes the block to a Uint8Array.
|
|
218
|
+
* @param headersOnly - If true, only serialize the 80-byte header
|
|
219
|
+
* @returns Serialized block data
|
|
220
|
+
*/
|
|
115
221
|
toBuffer(headersOnly) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
222
|
+
if (!this.prevHash)
|
|
223
|
+
throw new TypeError('Block prevHash is required');
|
|
224
|
+
if (!this.merkleRoot)
|
|
225
|
+
throw new TypeError('Block merkleRoot is required');
|
|
226
|
+
const buffer = new Uint8Array(this.byteLength(headersOnly));
|
|
227
|
+
const writer = new BinaryWriter(buffer);
|
|
228
|
+
writer.writeInt32LE(this.version);
|
|
229
|
+
writer.writeBytes(this.prevHash);
|
|
230
|
+
writer.writeBytes(this.merkleRoot);
|
|
231
|
+
writer.writeUInt32LE(this.timestamp);
|
|
232
|
+
writer.writeUInt32LE(this.bits);
|
|
233
|
+
writer.writeUInt32LE(this.nonce);
|
|
124
234
|
if (headersOnly || !this.transactions)
|
|
125
235
|
return buffer;
|
|
126
|
-
|
|
127
|
-
bufferWriter.offset += encoded.bytes;
|
|
236
|
+
writer.writeVarInt(this.transactions.length);
|
|
128
237
|
this.transactions.forEach((tx) => {
|
|
129
|
-
const txSize = tx.byteLength();
|
|
130
|
-
tx.toBuffer(buffer
|
|
131
|
-
|
|
238
|
+
const txSize = tx.byteLength(); // TODO: extract from toBuffer?
|
|
239
|
+
tx.toBuffer(buffer.subarray(writer.offset));
|
|
240
|
+
writer.offset += txSize;
|
|
132
241
|
});
|
|
133
242
|
return buffer;
|
|
134
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Serializes the block to a hex string.
|
|
246
|
+
* @param headersOnly - If true, only serialize the 80-byte header
|
|
247
|
+
* @returns Hex string representation of the block
|
|
248
|
+
*/
|
|
135
249
|
toHex(headersOnly) {
|
|
136
|
-
return this.toBuffer(headersOnly)
|
|
250
|
+
return toHex(this.toBuffer(headersOnly));
|
|
137
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Validates the merkle root and witness commitment (if present).
|
|
254
|
+
* @returns True if the transaction roots are valid
|
|
255
|
+
*/
|
|
138
256
|
checkTxRoots() {
|
|
257
|
+
// If the Block has segwit transactions but no witness commit,
|
|
258
|
+
// there's no way it can be valid, so fail the check.
|
|
139
259
|
const hasWitnessCommit = this.hasWitnessCommit();
|
|
140
260
|
if (!hasWitnessCommit && this.hasWitness())
|
|
141
261
|
return false;
|
|
142
|
-
return this
|
|
262
|
+
return this.#checkMerkleRoot() && (hasWitnessCommit ? this.#checkWitnessCommit() : true);
|
|
143
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Validates that the block hash meets the target threshold (proof of work).
|
|
266
|
+
* @returns True if the block's proof of work is valid
|
|
267
|
+
*/
|
|
144
268
|
checkProofOfWork() {
|
|
145
|
-
const hash =
|
|
269
|
+
const hash = reverse(this.getHash());
|
|
146
270
|
const target = Block.calculateTarget(this.bits);
|
|
147
|
-
return
|
|
271
|
+
return compare(hash, target) <= 0;
|
|
148
272
|
}
|
|
149
|
-
|
|
273
|
+
#checkMerkleRoot() {
|
|
150
274
|
if (!this.transactions)
|
|
151
275
|
throw errorMerkleNoTxes;
|
|
276
|
+
if (!this.merkleRoot)
|
|
277
|
+
throw new TypeError('Block merkleRoot is required');
|
|
152
278
|
const actualMerkleRoot = Block.calculateMerkleRoot(this.transactions);
|
|
153
|
-
return this.merkleRoot
|
|
279
|
+
return compare(this.merkleRoot, actualMerkleRoot) === 0;
|
|
154
280
|
}
|
|
155
|
-
|
|
281
|
+
#checkWitnessCommit() {
|
|
156
282
|
if (!this.transactions)
|
|
157
283
|
throw errorMerkleNoTxes;
|
|
158
284
|
if (!this.hasWitnessCommit())
|
|
159
285
|
throw errorWitnessNotSegwit;
|
|
286
|
+
if (!this.witnessCommit)
|
|
287
|
+
throw errorWitnessNotSegwit;
|
|
160
288
|
const actualWitnessCommit = Block.calculateMerkleRoot(this.transactions, true);
|
|
161
|
-
return this.witnessCommit
|
|
289
|
+
return compare(this.witnessCommit, actualWitnessCommit) === 0;
|
|
162
290
|
}
|
|
163
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Checks if the coinbase transaction has witness data (required for witness commitment).
|
|
294
|
+
* @param transactions - Array of transactions
|
|
295
|
+
* @returns True if coinbase has witness data
|
|
296
|
+
*/
|
|
164
297
|
function txesHaveWitnessCommit(transactions) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
transactions[0].ins[0] &&
|
|
170
|
-
transactions[0].ins[0].witness &&
|
|
171
|
-
transactions[0].ins[0].witness instanceof Array &&
|
|
172
|
-
transactions[0].ins[0].witness.length > 0);
|
|
298
|
+
const coinbase = transactions[0];
|
|
299
|
+
if (!coinbase?.ins?.[0]?.witness)
|
|
300
|
+
return false;
|
|
301
|
+
return coinbase.ins[0].witness.length > 0;
|
|
173
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Checks if any transaction in the array has witness data.
|
|
305
|
+
* @param transactions - Array of transactions
|
|
306
|
+
* @returns True if any transaction has witness data
|
|
307
|
+
*/
|
|
174
308
|
function anyTxHasWitness(transactions) {
|
|
175
|
-
return (
|
|
176
|
-
transactions.some((tx) => typeof tx === 'object' &&
|
|
177
|
-
tx.ins instanceof Array &&
|
|
178
|
-
tx.ins.some((input) => typeof input === 'object' &&
|
|
179
|
-
input.witness instanceof Array &&
|
|
180
|
-
input.witness.length > 0)));
|
|
309
|
+
return transactions.some((tx) => tx.ins?.some((input) => input.witness && input.witness.length > 0));
|
|
181
310
|
}
|
|
311
|
+
//# sourceMappingURL=block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["../src/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,aAAa,CAAC;AACvC,OAAO,EACH,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,KAAK,EACL,OAAO,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,MAAM,iBAAiB,GAAG,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAC;AAC5F,MAAM,qBAAqB,GAAG,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC;AAElG,MAAM,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,KAAK;IACd,2BAA2B;IAC3B,OAAO,GAAW,CAAC,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,GAAa,SAAS,CAAC;IAC/B,iDAAiD;IACjD,UAAU,GAAa,SAAS,CAAC;IACjC,kCAAkC;IAClC,SAAS,GAAW,CAAC,CAAC;IACtB,sDAAsD;IACtD,aAAa,GAAa,SAAS,CAAC;IACpC,qDAAqD;IACrD,IAAI,GAAW,CAAC,CAAC;IACjB,mCAAmC;IACnC,KAAK,GAAW,CAAC,CAAC;IAClB,kDAAkD;IAClD,YAAY,GAAmB,SAAS,CAAC;IAEzC;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAkB;QAChC,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEzE,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GAAG,CAAC,CAAC,CACrE,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded type definitions for type-safe primitives.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
declare const __brand: unique symbol;
|
|
7
|
+
type Brand<T, B extends string> = T & {
|
|
8
|
+
readonly [__brand]: B;
|
|
9
|
+
};
|
|
10
|
+
export type Bytes32 = Brand<Uint8Array, 'Bytes32'>;
|
|
11
|
+
export type Bytes20 = Brand<Uint8Array, 'Bytes20'>;
|
|
12
|
+
export type PublicKey = Brand<Uint8Array, 'PublicKey'>;
|
|
13
|
+
export type XOnlyPublicKey = Brand<Uint8Array, 'XOnlyPublicKey'>;
|
|
14
|
+
export type Satoshi = Brand<bigint, 'Satoshi'>;
|
|
15
|
+
export type PrivateKey = Brand<Uint8Array, 'PrivateKey'>;
|
|
16
|
+
export type Signature = Brand<Uint8Array, 'Signature'>;
|
|
17
|
+
export type SchnorrSignature = Brand<Uint8Array, 'SchnorrSignature'>;
|
|
18
|
+
export type Script = Brand<Uint8Array, 'Script'>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=branded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branded.d.ts","sourceRoot":"","sources":["../src/branded.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC/C,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AACzD,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;AACrE,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC"}
|
package/build/branded.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branded.js","sourceRoot":"","sources":["../src/branded.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/build/crypto/crypto.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/crypto/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
package/build/crypto/crypto.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/crypto/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
package/build/crypto.d.ts
CHANGED
|
@@ -1,13 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { Bytes20, Bytes32 } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Computes RIPEMD-160 hash of the input.
|
|
4
|
+
* @param data - Input data
|
|
5
|
+
* @returns 20-byte hash (Bytes20)
|
|
6
|
+
*/
|
|
7
|
+
export declare function ripemd160(data: Uint8Array): Bytes20;
|
|
8
|
+
/**
|
|
9
|
+
* Computes SHA-1 hash of the input.
|
|
10
|
+
* @param data - Input data
|
|
11
|
+
* @returns 20-byte hash (Bytes20)
|
|
12
|
+
*/
|
|
13
|
+
export declare function sha1(data: Uint8Array): Bytes20;
|
|
14
|
+
/**
|
|
15
|
+
* Computes SHA-256 hash of the input.
|
|
16
|
+
* @param data - Input data
|
|
17
|
+
* @returns 32-byte hash (Bytes32)
|
|
18
|
+
*/
|
|
19
|
+
export declare function sha256(data: Uint8Array): Bytes32;
|
|
20
|
+
/**
|
|
21
|
+
* Computes HASH160 (RIPEMD160(SHA256(data))) of the input.
|
|
22
|
+
* @param data - Input data
|
|
23
|
+
* @returns 20-byte hash (Bytes20)
|
|
24
|
+
*/
|
|
25
|
+
export declare function hash160(data: Uint8Array): Bytes20;
|
|
26
|
+
/**
|
|
27
|
+
* Computes double SHA-256 hash of the input.
|
|
28
|
+
* @param data - Input data
|
|
29
|
+
* @returns 32-byte hash (Bytes32)
|
|
30
|
+
*/
|
|
31
|
+
export declare function hash256(data: Uint8Array): Bytes32;
|
|
32
|
+
/**
|
|
33
|
+
* BIP340/Taproot tag names for tagged hashing.
|
|
34
|
+
*/
|
|
6
35
|
export declare const TAGS: readonly ["BIP0340/challenge", "BIP0340/aux", "BIP0340/nonce", "TapLeaf", "TapBranch", "TapSighash", "TapTweak", "KeyAgg list", "KeyAgg coefficient"];
|
|
7
36
|
export type TaggedHashPrefix = (typeof TAGS)[number];
|
|
8
37
|
type TaggedHashPrefixes = {
|
|
9
|
-
[key in TaggedHashPrefix]:
|
|
38
|
+
[key in TaggedHashPrefix]: Uint8Array;
|
|
10
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Precomputed tagged hash prefixes: SHA256(tag) || SHA256(tag)
|
|
42
|
+
*/
|
|
11
43
|
export declare const TAGGED_HASH_PREFIXES: TaggedHashPrefixes;
|
|
12
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Computes a BIP340-style tagged hash.
|
|
46
|
+
* @param prefix - The tag name
|
|
47
|
+
* @param data - Input data
|
|
48
|
+
* @returns 32-byte hash (Bytes32)
|
|
49
|
+
*/
|
|
50
|
+
export declare function taggedHash(prefix: TaggedHashPrefix, data: Uint8Array): Bytes32;
|
|
13
51
|
export {};
|
|
52
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,uJAUP,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,KAAK,kBAAkB,GAAG;KACrB,GAAG,IAAI,gBAAgB,GAAG,UAAU;CACxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAsDlC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAE9E"}
|