BitcoinCashJS (bitcoincashjs-lib)
Fork of the amazing bitcoinjs-lib.
Client-side Bitcoin JavaScript library
Fork of the amazing bitcoinjs-lib.
added
address.fromBech32/toBech32
(#846)added
Transaction.prototype.virtualSize
(#811)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
script.types
enums (#679)script.*.*.{check,encode,decode[,encodeStack,decodeStack]}
functions (#681, #682)TransactionBuilder.prototype.build
absurd fee-safety (#696)script.(decompile/compile)PushOnly
and script.toStack
functions (#700)Transaction.prototype.toBuffer
Segregated Witness serialization support (#684, #701)Transaction.prototype.hasWitnesses
(#718)script.witnessCommitment.*
templateTransactionBuilder.prototype.sign
now has two additional parameters, witnessValue
, and witnessScript
Transaction.hashForWitnessV0
and Transaction.setWitness
(5c2fdb60436714f18440dc709f0be065928c1e49)fixed
script
must compile minimally (#638)Transaction
and Block
versions should be Int32, signed integers (#662)removed
ecdsa.calcPubKeyRecoveryParam
, ecdsa.recoverPubKey
(#456)buffer-equals
/buffer-compare
dependencies (#650)HDNode.prototype.toString
(#665)dogecoin
network (#675)message
export, moved to bitcoinjs-message
(#456)renamed
script.*
functions in favour of bitcoin.script.*.(input/output).(encode/decode/check)
style (#682)added
HDNode.prototype.isNeutered
(#536)HDNode.prototype.derivePath
(#538)HDNode.prototype.derive*
(#539)Transaction.prototype.isCoinbase
(#578)Block.prototype.checkMerkleRoot
(#580)Block.calculateMerkleRoot
(#580)TransactionBuilder.prototype.setVersion
(#599)script.isWitnessPubKeyHashOutput
(#602)script.isWitnessScriptHashOutput
(#602)script.witnessPubKeyHashOutput
(#602)script.witnessScriptHashOutput
(#602)script.witnessScriptHashInput
(#602)fixed
HDNode
but no compatible version found (#550)writePushDataInt
output to adhere to minimal data push policy (#617)added
Block.calculateTarget
for difficulty calculations (#509)Block.prototype.checkProofOfWork
(#509)opcodes.OP_CHECKLOCKTIMEVERIFY
alias for OP_NOP2
(#511)script.number.[encode/decode]
for CScriptNum-encoded Buffer
s (#516)TransactionBuilder.prototype.setLockTime
(#507)fixed
typeforce
version to fix erroneous error message from types.Hash*bit
types (#534)fixed
IsStandard
policy) (#499)const
, use ES5 only (#502)fixed
fixed
changed
buffer-reverse
, dependency only kept for bufferutils.reverse
, to be deprecated (#478)fixed
isMultisigOutput
no longer allows data chunks for m
/n
(#482)isMultisigOutput
's n
value 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 shoud not have to directly access HDNode
internals for general usage, as it can often be confusing and error prone.
added
ECPair.prototype.getNetwork
HDNode.prototype.getNetwork
, wraps the underyling keyPair's getNetwork
methodHDNode.prototype.getPublicKeyBuffer
, wraps the underyling keyPair's getPublicKeyBuffer
methodHDNode.prototype.sign
, wraps the underlying keyPair's sign
methodHDNode.prototype.verify
, wraps the underlying keyPair's verify
methodIn this release we have strived to simplify the API, using native types wherevever 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
address
, for address
based utility functions, most compatible, just without Address
instantiation, see #401, #444script
, for script
based utility functions, mostly compatible, just without Script
instantiation, see #438, #444ECPair
, a merged replacement for ECKey
/ECPubKey
, invalid types will throw via typeforce
changed
address.toOutputScript
, ECPair.prototype.fromWIF
and HDNode.prototype.fromBase58
no longer automatically detect the network, networks.bitcoin
is always assumed unless given.assert
was used for type checking, now replaced by typeforce
BIP66
compliant strict DER signature validation was added to ECSignature.fromDER
, changing the exact exception messages slightly, see #448.
new HDNode(d/Q, chainCode, network)
-> new HDNode(keyPair, chainCode)
, now uses ECPair
HDNode.prototype.toBase58(false)
-> HDNode.prototype.neutered().toBase58()
for exporting an extended public keyHDNode.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, ...)
: hash
could be a string, Transaction or Buffer -> hash
can now only be a Buffer
.Transaction.prototype.addOutput(scriptPubKey, ...)
: scriptPubKey
could be a string, Address
or a Buffer
-> scriptPubKey
can now only be a Buffer
.TransactionBuilder
API unchanged.removed
Address
, strings
are now used, benchwith no performance loss for most use casesbase58check
, use bs58check
insteadecdsa
, use ecurve
insteadECKey
, use new export ECPair
insteadECPubKey
, use new export ECPair
insteadWallet
, see README.md#complementing-libraries insteadexport Script
, use new utility export script
instead (#438 for more information)
crypto.HmacSHA256
, use node crypto instead
crypto.HmacSHA512
, use node crypto instead
Transaction.prototype.sign
, use TransactionBuilder.prototype.sign
Transaction.prototype.signInput
, use TransactionBuilder.prototype.sign
Transaction.prototype.validateInput
, use Transaction.prototype.hashForSignature
and ECPair.verify
HDNode.fromBuffer
, use HDNode.fromBase58
instead
HDNode.fromHex
, use HDNode.fromBase58
insteadHDNode.toBuffer
, use HDNode.prototype.toBase58
insteadHDNode.toHex
, use HDNode.prototype.toBase58
instead
networks.*.magic
, see the comment here
networks.[viacoin|viacointestnet|gamerscoin|jumbucks|zetacoin]
, import these yourself (see #383/a0e6ee7)networks.*.estimateFee
, out-datedrenamed
Message
-> message
scripts
-> script
scripts.dataOutput
-> script.nullDataOutput
(per convention)