fixed
- Fix sighash treatment when signing taproot script sign scripts using Psbt (#2104)
- Fix error for invalid scripts in toASM (#2097)
- Fix mutation of input to addOutput method on Psbt (#2091)
fixed
- Updated bip174 dependency to fix issue with unknownKeyVals. (#1979)
changed
- Changed internal usage of the Buffer API to match with newer broken bundlers that don't follow spec. The new usage is still compatible with older versions of Buffer, so there shouldn't be any breakage. The public API interface was not changed. (#1975)
fixed
- validateSignaturesOfInput for taproot inputs returned false for valid signatures in specific cases. (#1934)
fixed
- validateSignaturesOfInput for taproot inputs returned true for invalid signatures in specific cases. (#1932)
added
- add example using BIP86 vector to verify the sending to and from a BIP86 generated taproot address
fixed
- support for 65 byte taproot signature
- prevent the creation of unspendable scripts in bitcoinjs-lib by implementing checks for resource limitations
- use
Buffer.from()instead ofBuffer.of()
changed
- performance: precompute the taproot hashes
- performance: switch from
create-hashandripemd160to noble-hashes
removed
- types: removed unused methods
privateAddandprivateNegatefromTinySecp256k1Interface
added
- taproot support for payments (p2tr) and PSBT. See taproot.spec.ts integration test for examples. (#1742)
fixed
- p2sh payment now uses empty Buffer for redeem.output when redeemScript is OP_FALSE (#1802)
- Fix ripemd160 hashing fallback issue (#1812)
- No changes to public API
removed
- bip32: Removed the re-export. Please add as dependency to your app instead.
- ECPair: Please use bip32 moving forward. ecpair package was created for those who need it.
- TransactionBuilder: Any internal files used only in TB (classify, templates, etc.) were also removed.
added
- taproot segwit v1 address support (bech32m) via address module (#1676)
- hashForWitnessV1 method on Transaction class (#1745)
fixed
- Transaction version read/write differed. (#1717)
changed
- Updated PSBT to allow for witnessUtxo and nonWitnessUtxo simultaneously (Re: segwit psbt bug) (#1563)
added
- PSBT methods
getInputType,inputHasPubkey,inputHasHDKey,outputHasPubkey,outputHasHDKey(#1563)
fixed
- Fixed psbt.signInputAsync (and consequentially all Async signing methods) not handling rejection of keypair.sign properly (#1582)
fixed
- Fixed errors for psbt.txOutputs getter (#1578)
fixed
- Throw errors when p2wsh or p2wpkh contain uncompressed pubkeys (#1573)
added
- Add txInputs and txOutputs for Psbt (#1561)
changed
- (Not exposed) Added BufferWriter to help ease maintenance of certain forks of this library (#1533)
fixed
- Fixed Transaction class Output interface typing for TypeScript (#1506)
- Add
weight()to Block class, add optional includeWitness arg to Transaction byteLength method (#1515) - Match the old TransactionBuilder behavior of allowing for multiple instances of the same pubkey to be in a p2ms script for PSBT (#1519)
added
- Allow the API consumer to pass in the finalizer functions to allow for any type of transaction to be finalized. It places the most crucial part of transaction construction on the consumer, and should be used with caution. (#1491)
fixed
PsbtOutputExtendeddid not support using the address attribute properly. It is now fixed.
added
Psbtnow hasgetFee(): numberfor use when all inputs are finalized. It returns the satoshi fee of the transaction. Calling getFee, getFeeRate, or extractTransaction will cache these values so if you call one after the other, the second call will return immediately.
changed
Psbtinputs using segwit scripts can now work with nonWitnessUtxo as well as the original witnessUtxo. The reasoning for this is that nonWitnessUtxo has all the information contained in the witnessUtxo, so rejecting signing even though we have all the info we need is unnecessary. Trying to sign a non-segwit script with a witnessUtxo will still throw an Error as it should.
changed
- TypeScript types: Made Signer and SignerAsync use any for network since we only check for equivalence. (#1448)
- TypeScript types: Made the args for addInput and addOutput for Psbt actually accept updateInput and updateOutput parameters. (#1449)
added
ECPairandbip32objects now have a lowR boolean attribute defaulted to false. You may set it to true to ensure that the sign method uses low R values (#1442) (This is to enable low R usage in Psbt, since we decided not to give the low R flag to the Psbt class, since it makes more sense to be an attribute of the Signer interface)
changed
- Name inconsistencies for Psbt class. (Quick fix)
added
- A new
Psbtclass for creating, distributing, combining, signing, and compiling Transactions (#1425) - A
nameattribute to the Payment interface. P2SH and P2WSH are nested with'-'as separator, and p2ms is in the format of'p2ms(m of n)''all others are just hard coded. (#1433)
changed
TransactionBuilder: Migrate to stricter type checks during sign by switching to a single object parameter (#1416)tests: Use regtest-client as separate library (#1421)
added
- Added
ECPairInterfaceStackandStackElementinterfaces to the main index.ts export (TypeScript only affected)
added
- low R value support for ECPair, bip32, and TransactionBuilder (default off) via
txb.setLowR()(#1385)
fixed
- Fixed Various TypeScript types that have been pushed out since v5.0.0 (#1388)
added
- TypeScript support (#1319)
Block.prototype.checkTxRootswill check the merkleRoot and witnessCommit if it exists against the transactions array. (e52abec) (0426c66)
changed
Transaction.prototype.getHashnow hasforWitness?: booleanwhich when true returns the hash for wtxid (a652d04)Block.calculateMerkleRootnow hasforWitness?: booleanwhich when true returns the witness commit (a652d04)
removed
Block.prototype.checkMerkleRootwas removed, please usecheckTxRoots(0426c66)
fixed
- Fixed bug where Angular apps break due to lack of crypto at build time. Reverted #1373 and added (6bead5d).
fixed
- Fixed bug where Electron v4 breaks due to lack of
'rmd160'alias for ripemd160 hash. (#1373)
fixed
- Fixed
TransactionBuilderto require that the Transaction has outputs before signing (#1151) - Fixed
payments.p2sh, which now takes the network from the redeem attribute if one is not given in the object argument (#1232) - Fixed
Block.calculateTargetto allow for exponents up to 29 (#1285) - Fixed some low priority rarely occurring bugs with multisig payments and
TransactionBuildermultisig processing (#1307)
added
- Regtest network object to
networks(#1261)
fixed
- Fixed
TransactionBuildernot throwing when payment type validation should fail (#1195)
removed
- Removed rogue
package.jsonfromsrc/payments(#1216)
fixed
- Fixed
tiny-secp256k1dependency version (usedecurve) (#1139) - Fixed
TransactionBuilderthrowing when trying to signP2WSH(P2WPKH)(#1135)
added
- Added
bip32dependency as a primary export (#1073) - Added
ECPair.fromPrivateKey(#1070) - Added
paymentsexport, with support forp2pkh,p2pk,p2ms,p2sh,p2wpkh,p2wshandembedpayment types (#1096, #1119) - Added
script.signature.encode/decodefor script signatures (#459)
changed
ECPair.prototype.signnow returns a 64-byte signatureBuffer, not anECSignatureobject (#1084)ECPair(and all ECDSA code) now usestiny-secp256k1, which uses thelibsecp256k1library (#1070)TransactionBuilderinternal variables are now__prefixed to discourage public usage (#1038)TransactionBuildernow defaults to version 2 transaction versions (#1036)script.decompilenow returns[Buffer]ornull, if decompilation failed (#1039)
fixed
- Fixed
TransactionBuilderrejecting uncompressed public keys to comply with BIP143 (#987)
removed
- Removed Node 4/5 LTS support (#1080)
- Removed
ECPair.fromPublicKeyBuffer, useECPair.fromPublicKey(#1070) - Removed
ECPair.prototype.getAddress, usepayments.p2pkhinstead (#1085) - Removed
ECPair.prototype.getPrivateKey, useECPair.prototype.privateKeyproperty (#1070) - Removed
ECPair.prototype.getPublicKey, useECPair.prototype.publicKeyproperty (#1070) - Removed
ECPair.prototype.getNetwork, useECPair.prototype.networkproperty (#1070) - Removed
ECSignature, usescript.signature.encode/decodeinstead (#459) - Removed
HDNode, usebip32export instead (#1073) - Removed
bufferutils(#1035) - Removed
networks.litecoin, BYO non-Bitcoin networks instead (#1095) - Removed
script.isCanonicalSignature, usescript.isCanonicalScriptSignatureinstead (#1094) - Removed
script.*.input/output/checkfunctions (templates), usepayments.*instead (templatespreviously added in #681, #682) (#1119) - Removed dependency
bigi, usesbn.jsinternally now (viatiny-secp256k1) (#1070, #1112) - Removed public access to
ECPairconstructor, use exported functionsECPair.fromPrivateKey,ECPair.fromWIF,ECPair.makeRandom, orECPair.fromPublicKey(#1070)
fixed
- Fixed
decodeStackarbitrarily supporting non-Array arguments (#942)
changed
- Increased the
TransactionBuildermaximumFeeRatefrom 1000 to 2500 satoshis/byte. (#931)
added
- Added
ECSignature.prototype.toRSBuffer/ECSignature.fromRSBuffer(#915) - Added support to
TransactionBuilderfor 64-byte signatures via.sign(#915) - Added support to
TransactionBuilderfor the.publicKeystandard as an alternative to.getPublicKey()(#915)
fixed
- Fixed
script.scripthash.input.checkrecursion (#898) - Fixed
TransactionBuildersometimes ignoring witness value (#901) - Fixed
script.witnessScriptHash.inputimplementation (previously used the P2SH impl.) (#911)
added
- Added
address.fromBech32/toBech32(#846)
added
- Added
Transaction.prototype.virtualSize(#811) - Added
Transaction.prototype.weight(#811)
From this release users can expect out-of-the-box Segregated Witness support.
The majority of breaking changes have been in how script encoding/decoding occurs, with the introduction of witness stacks.
added
- Added
script.typesenums (#679) - Added
script.*.*.{check,encode,decode[,encodeStack,decodeStack]}functions (#681, #682) - Added minimal
TransactionBuilder.prototype.buildabsurd fee-safety (#696) - Added
script.(decompile/compile)PushOnlyandscript.toStackfunctions (#700) - Added
Transaction.prototype.toBufferSegregated Witness serialization support (#684, #701) - Added
Transaction.prototype.hasWitnesses(#718) - Added
script.witnessCommitment.*template - Added
TransactionBuilder.prototype.signnow has two additional parameters,witnessValue, andwitnessScript - Added
Transaction.hashForWitnessV0andTransaction.setWitness(5c2fdb60436714f18440dc709f0be065928c1e49)
fixed
- Fixed
scriptmust compile minimally (#638) - Fixed
TransactionandBlockversions should be Int32, signed integers (#662)
removed
- Removed
ecdsa.calcPubKeyRecoveryParam,ecdsa.recoverPubKey(#456) - Removed
buffer-equals/buffer-comparedependencies (#650) - Removed
HDNode.prototype.toString(#665) - Removed
dogecoinnetwork (#675) - Removed
messageexport, moved tobitcoinjs-message(#456)
renamed
- Removed
script.*functions in favour ofbitcoin.script.*.(input/output).(encode/decode/check)style (#682)
added
- Added
HDNode.prototype.isNeutered(#536) - Added
HDNode.prototype.derivePath(#538) - Added typeforce checking for
HDNode.prototype.derive*(#539) - Added
Transaction.prototype.isCoinbase(#578) - Added
Block.prototype.checkMerkleRoot(#580) - Added
Block.calculateMerkleRoot(#580) - Added
TransactionBuilder.prototype.setVersion(#599) - Added
script.isWitnessPubKeyHashOutput(#602) - Added
script.isWitnessScriptHashOutput(#602) - Added
script.witnessPubKeyHashOutput(#602) - Added
script.witnessScriptHashOutput(#602) - Added
script.witnessScriptHashInput(#602)
fixed
- Fixed "BIP32 is undefined" when network list given to
HDNodebut no compatible version found (#550) - Fixed
writePushDataIntoutput to adhere to minimal data push policy (#617)
added
- Added
Block.calculateTargetfor difficulty calculations (#509) - Added
Block.prototype.checkProofOfWork(#509) - Added
opcodes.OP_CHECKLOCKTIMEVERIFYalias forOP_NOP2(#511) - Added
script.number.[encode/decode]for CScriptNum-encodedBuffers (#516) - Added
TransactionBuilder.prototype.setLockTime(#507)
fixed
- Bumped
typeforceversion to fix erroneous error message fromtypes.Hash*bittypes (#534)
fixed
- script.isPubKeyHashOutput and script.isScriptHashOutput no longer allow for non-minimal data pushes (per bitcoin/bitcoin
IsStandardpolicy) (#499) - TransactionBuilder.addOutput now allows for SIGHASH_SINGLE, throwing if the contract is violated (#504)
- remove use of
const, use ES5 only (#502)
fixed
- Bumped typeforce to 1.5.5 (see #493)
fixed
- Add missing CHANGELOG entry for 2.1.1
changed
- removed use of
buffer-reverse, dependency only kept forbufferutils.reverse, to be deprecated (#478)
fixed
isMultisigOutputno longer allows data chunks form/n(#482)isMultisigOutput'snvalue must now match the number of public keys (as per bitcoin/bitcoin) (#484)
From this release users should use the HDNode directly (compared to accessing .keyPair) when performing ECDSA operations such as sign or verify.
Ideally you should not have to directly access HDNode internals for general usage, as it can often be confusing and error prone.
added
ECPair.prototype.getNetworkHDNode.prototype.getNetwork, wraps the underlying keyPair'sgetNetworkmethodHDNode.prototype.getPublicKeyBuffer, wraps the underlying keyPair'sgetPublicKeyBuffermethodHDNode.prototype.sign, wraps the underlying keyPair'ssignmethodHDNode.prototype.verify, wraps the underlying keyPair'sverifymethod
In this release we have strived to simplify the API, using native types wherever possible to encourage cross-compatibility with other open source community modules.
The ecdsa module has been removed in lieu of using a new ECDSA module (for performance and safety reasons) during the 2.x.y major release.
Several other cumbersome modules have been removed, with their new independent modules recommended for usage instead for greater modularity in your projects.
Backward incompatible changes:
added
- export
address, foraddressbased utility functions, most compatible, just withoutAddressinstantiation, see #401, #444 - export
script, forscriptbased utility functions, mostly compatible, just withoutScriptinstantiation, see #438, #444 - export
ECPair, a merged replacement forECKey/ECPubKey, invalid types will throw viatypeforce
changed
-
address.toOutputScript,ECPair.prototype.fromWIFandHDNode.prototype.fromBase58no longer automatically detect the network,networks.bitcoinis always assumed unless given. -
assertwas used for type checking, now replaced bytypeforce -
BIP66compliant strict DER signature validation was added toECSignature.fromDER, changing the exact exception messages slightly, see #448. -
new HDNode(d/Q, chainCode, network)->new HDNode(keyPair, chainCode), now usesECPair -
HDNode.prototype.toBase58(false)->HDNode.prototype.neutered().toBase58()for exporting an extended public key -
HDNode.prototype.toBase58(true)->HDNode.prototype.toBase58()for exporting an extended private key -
Transaction.prototype.hashForSignature(prevOutScript, inIndex, hashType)->Transaction.prototype.hashForSignature(inIndex, prevOutScript, hashType) -
Transaction.prototype.addInput(hash, ...):hashcould be a string, Transaction or Buffer ->hashcan now only be aBuffer. -
Transaction.prototype.addOutput(scriptPubKey, ...):scriptPubKeycould be a string,Addressor aBuffer->scriptPubKeycan now only be aBuffer. -
TransactionBuilderAPI unchanged.
removed
-
export
Address,stringsare now used, benchwith no performance loss for most use cases -
export
base58check, usebs58checkinstead -
export
ecdsa, useecurveinstead -
export
ECKey, use new exportECPairinstead -
export
ECPubKey, use new exportECPairinstead -
export
Wallet, see README.md#complementing-libraries instead -
export
Script, use new utility exportscriptinstead (#438 for more information) -
crypto.HmacSHA256, use node crypto instead -
crypto.HmacSHA512, use node crypto instead -
Transaction.prototype.sign, useTransactionBuilder.prototype.sign -
Transaction.prototype.signInput, useTransactionBuilder.prototype.sign -
Transaction.prototype.validateInput, useTransaction.prototype.hashForSignatureandECPair.verify -
HDNode.fromBuffer, useHDNode.fromBase58instead -
HDNode.fromHex, useHDNode.fromBase58instead -
HDNode.toBuffer, useHDNode.prototype.toBase58instead -
HDNode.toHex, useHDNode.prototype.toBase58instead -
networks.*.magic, see the comment here -
networks.[viacoin|viacointestnet|gamerscoin|jumbucks|zetacoin], import these yourself (see #383/a0e6ee7) -
networks.*.estimateFee, out-dated
renamed
Message->messagescripts->scriptscripts.dataOutput->script.nullDataOutput(per convention)