bitcoinjs-lib
- Version 7.0.0
- Published
- 528 kB
- 7 dependencies
- MIT license
Install
npm i bitcoinjs-lib
yarn add bitcoinjs-lib
pnpm add bitcoinjs-lib
Overview
Client-side Bitcoin JavaScript library
Index
Functions
Classes
Psbt
- addInput()
- addInputs()
- addOutput()
- addOutputs()
- addUnknownKeyValToGlobal()
- addUnknownKeyValToInput()
- addUnknownKeyValToOutput()
- clearFinalizedInput()
- clone()
- combine()
- data
- extractTransaction()
- finalizeAllInputs()
- finalizeInput()
- finalizeTaprootInput()
- fromBase64()
- fromBuffer()
- fromHex()
- getFee()
- getFeeRate()
- getInputType()
- inputCount
- inputHasHDKey()
- inputHasPubkey()
- locktime
- outputHasHDKey()
- outputHasPubkey()
- setInputSequence()
- setLocktime()
- setMaximumFeeRate()
- setVersion()
- signAllInputs()
- signAllInputsAsync()
- signAllInputsHD()
- signAllInputsHDAsync()
- signInput()
- signInputAsync()
- signInputHD()
- signInputHDAsync()
- signTaprootInput()
- signTaprootInputAsync()
- toBase64()
- toBuffer()
- toHex()
- txInputs
- txOutputs
- updateGlobal()
- updateInput()
- updateOutput()
- validateSignaturesOfAllInputs()
- validateSignaturesOfInput()
- version
Transaction
- addInput()
- addOutput()
- ADVANCED_TRANSACTION_FLAG
- ADVANCED_TRANSACTION_MARKER
- byteLength()
- clone()
- DEFAULT_SEQUENCE
- fromBuffer()
- fromHex()
- getHash()
- getId()
- hashForSignature()
- hashForWitnessV0()
- hashForWitnessV1()
- hasWitnesses()
- ins
- isCoinbase()
- isCoinbaseHash()
- locktime
- outs
- setInputScript()
- setWitness()
- SIGHASH_ALL
- SIGHASH_ANYONECANPAY
- SIGHASH_DEFAULT
- SIGHASH_INPUT_MASK
- SIGHASH_NONE
- SIGHASH_OUTPUT_MASK
- SIGHASH_SINGLE
- stripWitnesses()
- toBuffer()
- toHex()
- version
- virtualSize()
- weight()
Interfaces
Enums
opcodes
- OP_0
- OP_0NOTEQUAL
- OP_1
- OP_10
- OP_11
- OP_12
- OP_13
- OP_14
- OP_15
- OP_16
- OP_1ADD
- OP_1NEGATE
- OP_1SUB
- OP_2
- OP_2DIV
- OP_2DROP
- OP_2DUP
- OP_2MUL
- OP_2OVER
- OP_2ROT
- OP_2SWAP
- OP_3
- OP_3DUP
- OP_4
- OP_5
- OP_6
- OP_7
- OP_8
- OP_9
- OP_ABS
- OP_ADD
- OP_AND
- OP_BOOLAND
- OP_BOOLOR
- OP_CAT
- OP_CHECKLOCKTIMEVERIFY
- OP_CHECKMULTISIG
- OP_CHECKMULTISIGVERIFY
- OP_CHECKSEQUENCEVERIFY
- OP_CHECKSIG
- OP_CHECKSIGADD
- OP_CHECKSIGVERIFY
- OP_CODESEPARATOR
- OP_DEPTH
- OP_DIV
- OP_DROP
- OP_DUP
- OP_ELSE
- OP_ENDIF
- OP_EQUAL
- OP_EQUALVERIFY
- OP_FALSE
- OP_FROMALTSTACK
- OP_GREATERTHAN
- OP_GREATERTHANOREQUAL
- OP_HASH160
- OP_HASH256
- OP_IF
- OP_IFDUP
- OP_INVALIDOPCODE
- OP_INVERT
- OP_LEFT
- OP_LESSTHAN
- OP_LESSTHANOREQUAL
- OP_LSHIFT
- OP_MAX
- OP_MIN
- OP_MOD
- OP_MUL
- OP_NEGATE
- OP_NIP
- OP_NOP
- OP_NOP1
- OP_NOP10
- OP_NOP2
- OP_NOP3
- OP_NOP4
- OP_NOP5
- OP_NOP6
- OP_NOP7
- OP_NOP8
- OP_NOP9
- OP_NOT
- OP_NOTIF
- OP_NUMEQUAL
- OP_NUMEQUALVERIFY
- OP_NUMNOTEQUAL
- OP_OR
- OP_OVER
- OP_PICK
- OP_PUBKEY
- OP_PUBKEYHASH
- OP_PUSHDATA1
- OP_PUSHDATA2
- OP_PUSHDATA4
- OP_RESERVED
- OP_RESERVED1
- OP_RESERVED2
- OP_RETURN
- OP_RIGHT
- OP_RIPEMD160
- OP_ROLL
- OP_ROT
- OP_RSHIFT
- OP_SHA1
- OP_SHA256
- OP_SIZE
- OP_SUB
- OP_SUBSTR
- OP_SWAP
- OP_TOALTSTACK
- OP_TRUE
- OP_TUCK
- OP_VER
- OP_VERIF
- OP_VERIFY
- OP_VERNOTIF
- OP_WITHIN
- OP_XOR
Type Aliases
Namespaces
Functions
function initEccLib
initEccLib: ( eccLib: TinySecp256k1Interface | undefined, opts?: { DANGER_DO_NOT_VERIFY_ECCLIB: boolean }) => void;
Initializes the ECC library with the provided instance. If
eccLib
isundefined
, the library will be cleared. IfeccLib
is a new instance, it will be verified before setting it as the active library.Parameter eccLib
The instance of the ECC library to initialize.
Parameter opts
Extra initialization options. Use {DANGER_DO_NOT_VERIFY_ECCLIB:true} if ecc verification should not be executed. Not recommended!
function toXOnly
toXOnly: (pubKey: Uint8Array) => Uint8Array;
Converts a public key to an X-only public key.
Parameter pubKey
The public key to convert.
Returns
The X-only public key.
Classes
class Block
class Block {}
property bits
bits: number;
property merkleRoot
merkleRoot?: Uint8Array;
property nonce
nonce: number;
property prevHash
prevHash?: Uint8Array;
property timestamp
timestamp: number;
property transactions
transactions?: Transaction[];
property version
version: number;
property witnessCommit
witnessCommit?: Uint8Array;
method byteLength
byteLength: (headersOnly?: boolean, allowWitness?: boolean) => number;
method calculateMerkleRoot
static calculateMerkleRoot: ( transactions: Transaction[], forWitness?: boolean) => Uint8Array;
method calculateTarget
static calculateTarget: (bits: number) => Uint8Array;
method checkProofOfWork
checkProofOfWork: () => boolean;
method checkTxRoots
checkTxRoots: () => boolean;
method fromBuffer
static fromBuffer: (buffer: Uint8Array) => Block;
method fromHex
static fromHex: (hex: string) => Block;
method getHash
getHash: () => Uint8Array;
method getId
getId: () => string;
method getUTCDate
getUTCDate: () => Date;
method getWitnessCommit
getWitnessCommit: () => Uint8Array | null;
method hasWitness
hasWitness: () => boolean;
method hasWitnessCommit
hasWitnessCommit: () => boolean;
method toBuffer
toBuffer: (headersOnly?: boolean) => Uint8Array;
method toHex
toHex: (headersOnly?: boolean) => string;
method weight
weight: () => number;
class Psbt
class Psbt {}
Psbt class can parse and generate a PSBT binary based off of the BIP174. There are 6 roles that this class fulfills. (Explained in BIP174)
Creator: This can be done with
new Psbt()
Updater: This can be done with
psbt.addInput(input)
,psbt.addInputs(inputs)
,psbt.addOutput(output)
,psbt.addOutputs(outputs)
when you are looking to add new inputs and outputs to the PSBT, andpsbt.updateGlobal(itemObject)
,psbt.updateInput(itemObject)
,psbt.updateOutput(itemObject)
addInput requires hash: Buffer | string; and index: number; as attributes and can also include any attributes that are used in updateInput method. addOutput requires script: Buffer; and value: number; and likewise can include data for updateOutput. For a list of what attributes should be what types. Check the bip174 library. Also, check the integration tests for some examples of usage.Signer: There are a few methods. signAllInputs and signAllInputsAsync, which will search all input information for your pubkey or pubkeyhash, and only sign inputs where it finds your info. Or you can explicitly sign a specific input with signInput and signInputAsync. For the async methods you can create a SignerAsync object and use something like a hardware wallet to sign with. (You must implement this)
Combiner: psbts can be combined easily with
psbt.combine(psbt2, psbt3, psbt4 ...)
the psbt calling combine will always have precedence when a conflict occurs. Combine checks if the internal bitcoin transaction is the same, so be sure that all sequences, version, locktime, etc. are the same before combining.Input Finalizer: This role is fairly important. Not only does it need to construct the input scriptSigs and witnesses, but it SHOULD verify the signatures etc. Before running
psbt.finalizeAllInputs()
please runpsbt.validateSignaturesOfAllInputs()
Running any finalize method will delete any data in the input(s) that are no longer needed due to the finalized scripts containing the information.Transaction Extractor: This role will perform some checks before returning a Transaction object. Such as fee rate not being larger than maximumFeeRate etc.
constructor
constructor(opts?: PsbtOptsOptional, data?: PsbtBase);
property data
readonly data: PsbtBase;
property inputCount
readonly inputCount: number;
property locktime
locktime: number;
property txInputs
readonly txInputs: PsbtTxInput[];
property txOutputs
readonly txOutputs: PsbtTxOutput[];
property version
version: number;
method addInput
addInput: (inputData: PsbtInputExtended) => this;
method addInputs
addInputs: (inputDatas: PsbtInputExtended[]) => this;
method addOutput
addOutput: (outputData: PsbtOutputExtended) => this;
method addOutputs
addOutputs: (outputDatas: PsbtOutputExtended[]) => this;
method addUnknownKeyValToGlobal
addUnknownKeyValToGlobal: (keyVal: KeyValue) => this;
method addUnknownKeyValToInput
addUnknownKeyValToInput: (inputIndex: number, keyVal: KeyValue) => this;
method addUnknownKeyValToOutput
addUnknownKeyValToOutput: (outputIndex: number, keyVal: KeyValue) => this;
method clearFinalizedInput
clearFinalizedInput: (inputIndex: number) => this;
method clone
clone: () => Psbt;
method combine
combine: (...those: Psbt[]) => this;
method extractTransaction
extractTransaction: (disableFeeCheck?: boolean) => Transaction;
method finalizeAllInputs
finalizeAllInputs: () => this;
method finalizeInput
finalizeInput: ( inputIndex: number, finalScriptsFunc?: FinalScriptsFunc | FinalTaprootScriptsFunc) => this;
method finalizeTaprootInput
finalizeTaprootInput: ( inputIndex: number, tapLeafHashToFinalize?: Uint8Array, finalScriptsFunc?: FinalTaprootScriptsFunc) => this;
method fromBase64
static fromBase64: (data: string, opts?: PsbtOptsOptional) => Psbt;
method fromBuffer
static fromBuffer: (buffer: Uint8Array, opts?: PsbtOptsOptional) => Psbt;
method fromHex
static fromHex: (data: string, opts?: PsbtOptsOptional) => Psbt;
method getFee
getFee: () => bigint;
method getFeeRate
getFeeRate: () => number;
method getInputType
getInputType: (inputIndex: number) => AllScriptType;
method inputHasHDKey
inputHasHDKey: (inputIndex: number, root: HDSigner) => boolean;
method inputHasPubkey
inputHasPubkey: (inputIndex: number, pubkey: Uint8Array) => boolean;
method outputHasHDKey
outputHasHDKey: (outputIndex: number, root: HDSigner) => boolean;
method outputHasPubkey
outputHasPubkey: (outputIndex: number, pubkey: Uint8Array) => boolean;
method setInputSequence
setInputSequence: (inputIndex: number, sequence: number) => this;
method setLocktime
setLocktime: (locktime: number) => this;
method setMaximumFeeRate
setMaximumFeeRate: (satoshiPerByte: number) => void;
method setVersion
setVersion: (version: number) => this;
method signAllInputs
signAllInputs: (keyPair: Signer, sighashTypes?: number[]) => this;
method signAllInputsAsync
signAllInputsAsync: ( keyPair: Signer | SignerAsync, sighashTypes?: number[]) => Promise<void>;
method signAllInputsHD
signAllInputsHD: (hdKeyPair: HDSigner, sighashTypes?: number[]) => this;
method signAllInputsHDAsync
signAllInputsHDAsync: ( hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]) => Promise<void>;
method signInput
signInput: ( inputIndex: number, keyPair: Signer, sighashTypes?: number[]) => this;
method signInputAsync
signInputAsync: ( inputIndex: number, keyPair: Signer | SignerAsync, sighashTypes?: number[]) => Promise<void>;
method signInputHD
signInputHD: ( inputIndex: number, hdKeyPair: HDSigner, sighashTypes?: number[]) => this;
method signInputHDAsync
signInputHDAsync: ( inputIndex: number, hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]) => Promise<void>;
method signTaprootInput
signTaprootInput: ( inputIndex: number, keyPair: Signer, tapLeafHashToSign?: Uint8Array, sighashTypes?: number[]) => this;
method signTaprootInputAsync
signTaprootInputAsync: ( inputIndex: number, keyPair: Signer | SignerAsync, tapLeafHash?: Uint8Array, sighashTypes?: number[]) => Promise<void>;
method toBase64
toBase64: () => string;
method toBuffer
toBuffer: () => Uint8Array;
method toHex
toHex: () => string;
method updateGlobal
updateGlobal: (updateData: PsbtGlobalUpdate) => this;
method updateInput
updateInput: (inputIndex: number, updateData: PsbtInputUpdate) => this;
method updateOutput
updateOutput: (outputIndex: number, updateData: PsbtOutputUpdate) => this;
method validateSignaturesOfAllInputs
validateSignaturesOfAllInputs: (validator: ValidateSigFunction) => boolean;
method validateSignaturesOfInput
validateSignaturesOfInput: ( inputIndex: number, validator: ValidateSigFunction, pubkey?: Uint8Array) => boolean;
class Transaction
class Transaction {}
Represents a Bitcoin transaction.
property ADVANCED_TRANSACTION_FLAG
static readonly ADVANCED_TRANSACTION_FLAG: number;
property ADVANCED_TRANSACTION_MARKER
static readonly ADVANCED_TRANSACTION_MARKER: number;
property DEFAULT_SEQUENCE
static readonly DEFAULT_SEQUENCE: number;
property ins
ins: Input[];
property locktime
locktime: number;
property outs
outs: Output[];
property SIGHASH_ALL
static readonly SIGHASH_ALL: number;
property SIGHASH_ANYONECANPAY
static readonly SIGHASH_ANYONECANPAY: number;
property SIGHASH_DEFAULT
static readonly SIGHASH_DEFAULT: number;
property SIGHASH_INPUT_MASK
static readonly SIGHASH_INPUT_MASK: number;
property SIGHASH_NONE
static readonly SIGHASH_NONE: number;
property SIGHASH_OUTPUT_MASK
static readonly SIGHASH_OUTPUT_MASK: number;
property SIGHASH_SINGLE
static readonly SIGHASH_SINGLE: number;
property version
version: number;
method addInput
addInput: ( hash: Uint8Array, index: number, sequence?: number, scriptSig?: Uint8Array) => number;
method addOutput
addOutput: (scriptPubKey: Uint8Array, value: bigint) => number;
method byteLength
byteLength: (_ALLOW_WITNESS?: boolean) => number;
method clone
clone: () => Transaction;
method fromBuffer
static fromBuffer: (buffer: Uint8Array, _NO_STRICT?: boolean) => Transaction;
method fromHex
static fromHex: (hex: string) => Transaction;
method getHash
getHash: (forWitness?: boolean) => Uint8Array;
method getId
getId: () => string;
method hashForSignature
hashForSignature: ( inIndex: number, prevOutScript: Uint8Array, hashType: number) => Uint8Array;
Hash transaction for signing a specific input.
Bitcoin uses a different hash for each signed transaction input. This method copies the transaction, makes the necessary changes based on the hashType, and then hashes the result. This hash can then be used to sign the provided transaction input.
method hashForWitnessV0
hashForWitnessV0: ( inIndex: number, prevOutScript: Uint8Array, value: bigint, hashType: number) => Uint8Array;
method hashForWitnessV1
hashForWitnessV1: ( inIndex: number, prevOutScripts: Uint8Array[], values: bigint[], hashType: number, leafHash?: Uint8Array, annex?: Uint8Array) => Uint8Array;
method hasWitnesses
hasWitnesses: () => boolean;
method isCoinbase
isCoinbase: () => boolean;
method isCoinbaseHash
static isCoinbaseHash: (buffer: Uint8Array) => boolean;
method setInputScript
setInputScript: (index: number, scriptSig: Uint8Array) => void;
method setWitness
setWitness: (index: number, witness: Uint8Array[]) => void;
method stripWitnesses
stripWitnesses: () => void;
method toBuffer
toBuffer: (buffer?: Uint8Array, initialOffset?: number) => Uint8Array;
method toHex
toHex: () => string;
method virtualSize
virtualSize: () => number;
method weight
weight: () => number;
Interfaces
interface HDSigner
interface HDSigner extends HDSignerBase {}
method derivePath
derivePath: (path: string) => HDSigner;
The path string must match /^m(/\d+'?)+$/ ex. m/44'/0'/0'/1/23 levels with ' must be hard derivations
method sign
sign: (hash: Uint8Array) => Uint8Array;
Input hash (the "message digest") for the signature algorithm Return a 64 byte signature (32 byte r and 32 byte s in that order)
interface HDSignerAsync
interface HDSignerAsync extends HDSignerBase {}
Same as above but with async sign method
method derivePath
derivePath: (path: string) => HDSignerAsync;
method sign
sign: (hash: Uint8Array) => Promise<Uint8Array>;
interface Network
interface Network {}
property bech32
bech32: string;
property bip32
bip32: Bip32;
property messagePrefix
messagePrefix: string;
property pubKeyHash
pubKeyHash: number;
property scriptHash
scriptHash: number;
property wif
wif: number;
interface Payment
interface Payment {}
property address
address?: string;
property data
data?: Uint8Array[];
property hash
hash?: Uint8Array;
property input
input?: Uint8Array;
property internalPubkey
internalPubkey?: Uint8Array;
property m
m?: number;
property n
n?: number;
property name
name?: string;
property network
network?: Network;
property output
output?: Uint8Array;
property pubkey
pubkey?: Uint8Array;
property pubkeys
pubkeys?: Uint8Array[];
property redeem
redeem?: Payment;
property redeemVersion
redeemVersion?: number;
property scriptTree
scriptTree?: Taptree;
property signature
signature?: Uint8Array;
property signatures
signatures?: Uint8Array[];
property witness
witness?: Uint8Array[];
interface PaymentOpts
interface PaymentOpts {}
property allowIncomplete
allowIncomplete?: boolean;
property validate
validate?: boolean;
interface PsbtTxInput
interface PsbtTxInput extends TransactionInput {}
property hash
hash: Uint8Array;
interface PsbtTxOutput
interface PsbtTxOutput extends TransactionOutput {}
property address
address: string | undefined;
interface Signer
interface Signer {}
property network
network?: any;
property publicKey
publicKey: Uint8Array;
method getPublicKey
getPublicKey: () => Uint8Array;
method sign
sign: (hash: Uint8Array, lowR?: boolean) => Uint8Array;
method signSchnorr
signSchnorr: (hash: Uint8Array) => Uint8Array;
interface SignerAsync
interface SignerAsync {}
property network
network?: any;
property publicKey
publicKey: Uint8Array;
method getPublicKey
getPublicKey: () => Uint8Array;
method sign
sign: (hash: Uint8Array, lowR?: boolean) => Promise<Uint8Array>;
method signSchnorr
signSchnorr: (hash: Uint8Array) => Promise<Uint8Array>;
interface TxInput
interface Input {}
Enums
enum opcodes
enum opcodes { OP_FALSE = 0, OP_0 = 0, OP_PUSHDATA1 = 76, OP_PUSHDATA2 = 77, OP_PUSHDATA4 = 78, OP_1NEGATE = 79, OP_RESERVED = 80, OP_TRUE = 81, OP_1 = 81, OP_2 = 82, OP_3 = 83, OP_4 = 84, OP_5 = 85, OP_6 = 86, OP_7 = 87, OP_8 = 88, OP_9 = 89, OP_10 = 90, OP_11 = 91, OP_12 = 92, OP_13 = 93, OP_14 = 94, OP_15 = 95, OP_16 = 96, OP_NOP = 97, OP_VER = 98, OP_IF = 99, OP_NOTIF = 100, OP_VERIF = 101, OP_VERNOTIF = 102, OP_ELSE = 103, OP_ENDIF = 104, OP_VERIFY = 105, OP_RETURN = 106, OP_TOALTSTACK = 107, OP_FROMALTSTACK = 108, OP_2DROP = 109, OP_2DUP = 110, OP_3DUP = 111, OP_2OVER = 112, OP_2ROT = 113, OP_2SWAP = 114, OP_IFDUP = 115, OP_DEPTH = 116, OP_DROP = 117, OP_DUP = 118, OP_NIP = 119, OP_OVER = 120, OP_PICK = 121, OP_ROLL = 122, OP_ROT = 123, OP_SWAP = 124, OP_TUCK = 125, OP_CAT = 126, OP_SUBSTR = 127, OP_LEFT = 128, OP_RIGHT = 129, OP_SIZE = 130, OP_INVERT = 131, OP_AND = 132, OP_OR = 133, OP_XOR = 134, OP_EQUAL = 135, OP_EQUALVERIFY = 136, OP_RESERVED1 = 137, OP_RESERVED2 = 138, OP_1ADD = 139, OP_1SUB = 140, OP_2MUL = 141, OP_2DIV = 142, OP_NEGATE = 143, OP_ABS = 144, OP_NOT = 145, OP_0NOTEQUAL = 146, OP_ADD = 147, OP_SUB = 148, OP_MUL = 149, OP_DIV = 150, OP_MOD = 151, OP_LSHIFT = 152, OP_RSHIFT = 153, OP_BOOLAND = 154, OP_BOOLOR = 155, OP_NUMEQUAL = 156, OP_NUMEQUALVERIFY = 157, OP_NUMNOTEQUAL = 158, OP_LESSTHAN = 159, OP_GREATERTHAN = 160, OP_LESSTHANOREQUAL = 161, OP_GREATERTHANOREQUAL = 162, OP_MIN = 163, OP_MAX = 164, OP_WITHIN = 165, OP_RIPEMD160 = 166, OP_SHA1 = 167, OP_SHA256 = 168, OP_HASH160 = 169, OP_HASH256 = 170, OP_CODESEPARATOR = 171, OP_CHECKSIG = 172, OP_CHECKSIGVERIFY = 173, OP_CHECKMULTISIG = 174, OP_CHECKMULTISIGVERIFY = 175, OP_NOP1 = 176, OP_CHECKLOCKTIMEVERIFY = 177, OP_NOP2 = 177, OP_CHECKSEQUENCEVERIFY = 178, OP_NOP3 = 178, OP_NOP4 = 179, OP_NOP5 = 180, OP_NOP6 = 181, OP_NOP7 = 182, OP_NOP8 = 183, OP_NOP9 = 184, OP_NOP10 = 185, OP_CHECKSIGADD = 186, OP_PUBKEYHASH = 253, OP_PUBKEY = 254, OP_INVALIDOPCODE = 255,}
member OP_0
OP_0 = 0
member OP_0NOTEQUAL
OP_0NOTEQUAL = 146
member OP_1
OP_1 = 81
member OP_10
OP_10 = 90
member OP_11
OP_11 = 91
member OP_12
OP_12 = 92
member OP_13
OP_13 = 93
member OP_14
OP_14 = 94
member OP_15
OP_15 = 95
member OP_16
OP_16 = 96
member OP_1ADD
OP_1ADD = 139
member OP_1NEGATE
OP_1NEGATE = 79
member OP_1SUB
OP_1SUB = 140
member OP_2
OP_2 = 82
member OP_2DIV
OP_2DIV = 142
member OP_2DROP
OP_2DROP = 109
member OP_2DUP
OP_2DUP = 110
member OP_2MUL
OP_2MUL = 141
member OP_2OVER
OP_2OVER = 112
member OP_2ROT
OP_2ROT = 113
member OP_2SWAP
OP_2SWAP = 114
member OP_3
OP_3 = 83
member OP_3DUP
OP_3DUP = 111
member OP_4
OP_4 = 84
member OP_5
OP_5 = 85
member OP_6
OP_6 = 86
member OP_7
OP_7 = 87
member OP_8
OP_8 = 88
member OP_9
OP_9 = 89
member OP_ABS
OP_ABS = 144
member OP_ADD
OP_ADD = 147
member OP_AND
OP_AND = 132
member OP_BOOLAND
OP_BOOLAND = 154
member OP_BOOLOR
OP_BOOLOR = 155
member OP_CAT
OP_CAT = 126
member OP_CHECKLOCKTIMEVERIFY
OP_CHECKLOCKTIMEVERIFY = 177
member OP_CHECKMULTISIG
OP_CHECKMULTISIG = 174
member OP_CHECKMULTISIGVERIFY
OP_CHECKMULTISIGVERIFY = 175
member OP_CHECKSEQUENCEVERIFY
OP_CHECKSEQUENCEVERIFY = 178
member OP_CHECKSIG
OP_CHECKSIG = 172
member OP_CHECKSIGADD
OP_CHECKSIGADD = 186
member OP_CHECKSIGVERIFY
OP_CHECKSIGVERIFY = 173
member OP_CODESEPARATOR
OP_CODESEPARATOR = 171
member OP_DEPTH
OP_DEPTH = 116
member OP_DIV
OP_DIV = 150
member OP_DROP
OP_DROP = 117
member OP_DUP
OP_DUP = 118
member OP_ELSE
OP_ELSE = 103
member OP_ENDIF
OP_ENDIF = 104
member OP_EQUAL
OP_EQUAL = 135
member OP_EQUALVERIFY
OP_EQUALVERIFY = 136
member OP_FALSE
OP_FALSE = 0
member OP_FROMALTSTACK
OP_FROMALTSTACK = 108
member OP_GREATERTHAN
OP_GREATERTHAN = 160
member OP_GREATERTHANOREQUAL
OP_GREATERTHANOREQUAL = 162
member OP_HASH160
OP_HASH160 = 169
member OP_HASH256
OP_HASH256 = 170
member OP_IF
OP_IF = 99
member OP_IFDUP
OP_IFDUP = 115
member OP_INVALIDOPCODE
OP_INVALIDOPCODE = 255
member OP_INVERT
OP_INVERT = 131
member OP_LEFT
OP_LEFT = 128
member OP_LESSTHAN
OP_LESSTHAN = 159
member OP_LESSTHANOREQUAL
OP_LESSTHANOREQUAL = 161
member OP_LSHIFT
OP_LSHIFT = 152
member OP_MAX
OP_MAX = 164
member OP_MIN
OP_MIN = 163
member OP_MOD
OP_MOD = 151
member OP_MUL
OP_MUL = 149
member OP_NEGATE
OP_NEGATE = 143
member OP_NIP
OP_NIP = 119
member OP_NOP
OP_NOP = 97
member OP_NOP1
OP_NOP1 = 176
member OP_NOP10
OP_NOP10 = 185
member OP_NOP2
OP_NOP2 = 177
member OP_NOP3
OP_NOP3 = 178
member OP_NOP4
OP_NOP4 = 179
member OP_NOP5
OP_NOP5 = 180
member OP_NOP6
OP_NOP6 = 181
member OP_NOP7
OP_NOP7 = 182
member OP_NOP8
OP_NOP8 = 183
member OP_NOP9
OP_NOP9 = 184
member OP_NOT
OP_NOT = 145
member OP_NOTIF
OP_NOTIF = 100
member OP_NUMEQUAL
OP_NUMEQUAL = 156
member OP_NUMEQUALVERIFY
OP_NUMEQUALVERIFY = 157
member OP_NUMNOTEQUAL
OP_NUMNOTEQUAL = 158
member OP_OR
OP_OR = 133
member OP_OVER
OP_OVER = 120
member OP_PICK
OP_PICK = 121
member OP_PUBKEY
OP_PUBKEY = 254
member OP_PUBKEYHASH
OP_PUBKEYHASH = 253
member OP_PUSHDATA1
OP_PUSHDATA1 = 76
member OP_PUSHDATA2
OP_PUSHDATA2 = 77
member OP_PUSHDATA4
OP_PUSHDATA4 = 78
member OP_RESERVED
OP_RESERVED = 80
member OP_RESERVED1
OP_RESERVED1 = 137
member OP_RESERVED2
OP_RESERVED2 = 138
member OP_RETURN
OP_RETURN = 106
member OP_RIGHT
OP_RIGHT = 129
member OP_RIPEMD160
OP_RIPEMD160 = 166
member OP_ROLL
OP_ROLL = 122
member OP_ROT
OP_ROT = 123
member OP_RSHIFT
OP_RSHIFT = 153
member OP_SHA1
OP_SHA1 = 167
member OP_SHA256
OP_SHA256 = 168
member OP_SIZE
OP_SIZE = 130
member OP_SUB
OP_SUB = 148
member OP_SUBSTR
OP_SUBSTR = 127
member OP_SWAP
OP_SWAP = 124
member OP_TOALTSTACK
OP_TOALTSTACK = 107
member OP_TRUE
OP_TRUE = 81
member OP_TUCK
OP_TUCK = 125
member OP_VER
OP_VER = 98
member OP_VERIF
OP_VERIF = 101
member OP_VERIFY
OP_VERIFY = 105
member OP_VERNOTIF
OP_VERNOTIF = 102
member OP_WITHIN
OP_WITHIN = 165
member OP_XOR
OP_XOR = 134
Type Aliases
type PaymentCreator
type PaymentCreator = (a: Payment, opts?: PaymentOpts) => Payment;
type Stack
type Stack = StackElement[];
type StackElement
type StackElement = Uint8Array | number;
type TaggedHashPrefix
type TaggedHashPrefix = (typeof TAGS)[number];
Namespaces
namespace address
module 'src/cjs/address.d.ts' {}
bitcoin address decode and encode tools, include base58、bech32 and output script
networks support bitcoin、bitcoin testnet and bitcoin regtest
addresses support P2PKH、P2SH、P2WPKH、P2WSH、P2TR and so on
function fromBase58Check
fromBase58Check: (address: string) => Base58CheckResult;
Decodes a base58check encoded Bitcoin address and returns the version and hash.
Parameter address
The base58check encoded Bitcoin address to decode.
Returns
An object containing the version and hash of the decoded address.
Throws
{TypeError} If the address is too short or too long.
function fromBech32
fromBech32: (address: string) => Bech32Result;
Converts a Bech32 or Bech32m encoded address to its corresponding data representation.
Parameter address
The Bech32 or Bech32m encoded address.
Returns
An object containing the version, prefix, and data of the address.
Throws
{TypeError} If the address uses the wrong encoding.
function fromOutputScript
fromOutputScript: (output: Uint8Array, network?: Network) => string;
Converts an output script to a Bitcoin address.
Parameter output
The output script as a Buffer.
Parameter network
The Bitcoin network (optional).
Returns
The Bitcoin address corresponding to the output script.
Throws
If the output script has no matching address.
function toBase58Check
toBase58Check: (hash: Uint8Array, version: number) => string;
Converts a hash to a Base58Check-encoded string.
Parameter hash
The hash to be encoded.
Parameter version
The version byte to be prepended to the encoded string.
Returns
The Base58Check-encoded string.
function toBech32
toBech32: (data: Uint8Array, version: number, prefix: string) => string;
Converts a buffer to a Bech32 or Bech32m encoded string.
Parameter data
The buffer to be encoded.
Parameter version
The version number to be used in the encoding.
Parameter prefix
The prefix string to be used in the encoding.
Returns
The Bech32 or Bech32m encoded string.
function toOutputScript
toOutputScript: (address: string, network?: Network) => Uint8Array;
Converts a Bitcoin address to its corresponding output script.
Parameter address
The Bitcoin address to convert.
Parameter network
The Bitcoin network to use. Defaults to the Bitcoin network.
Returns
The corresponding output script as a Buffer.
Throws
If the address has an invalid prefix or no matching script.
interface Base58CheckResult
interface Base58CheckResult {}
base58check decode result
interface Bech32Result
interface Bech32Result {}
bech32 decode result
namespace crypto
module 'src/cjs/crypto.d.ts' {}
Computes the HASH160 (RIPEMD-160 after SHA-256) of the given buffer.
Parameter buffer
The input data to be hashed.
Returns
The HASH160 of the input buffer.
variable TAGGED_HASH_PREFIXES
const TAGGED_HASH_PREFIXES: TaggedHashPrefixes;
A collection of tagged hash prefixes used in various BIP (Bitcoin Improvement Proposals) and Taproot-related operations. Each prefix is represented as a
Uint8Array
.{TaggedHashPrefixes}
{'BIP0340/challenge'} - Prefix for BIP0340 challenge. {'BIP0340/aux'} - Prefix for BIP0340 auxiliary data. {'BIP0340/nonce'} - Prefix for BIP0340 nonce. {TapLeaf} - Prefix for Taproot leaf. {TapBranch} - Prefix for Taproot branch. {TapSighash} - Prefix for Taproot sighash. {TapTweak} - Prefix for Taproot tweak. {'KeyAgg list'} - Prefix for key aggregation list. {'KeyAgg coefficient'} - Prefix for key aggregation coefficient.
variable TAGS
const TAGS: readonly [ 'BIP0340/challenge', 'BIP0340/aux', 'BIP0340/nonce', 'TapLeaf', 'TapBranch', 'TapSighash', 'TapTweak', 'KeyAgg list', 'KeyAgg coefficient'];
function hash160
hash160: (buffer: Uint8Array) => Uint8Array;
Computes the HASH160 (RIPEMD-160 after SHA-256) of the given buffer.
Parameter buffer
The input data to be hashed.
Returns
The HASH160 of the input buffer.
function hash256
hash256: (buffer: Uint8Array) => Uint8Array;
Computes the double SHA-256 hash of the given buffer.
Parameter buffer
The input data to be hashed.
Returns
The double SHA-256 hash of the input buffer.
function taggedHash
taggedHash: (prefix: TaggedHashPrefix, data: Uint8Array) => Uint8Array;
Computes a tagged hash using the specified prefix and data.
Parameter prefix
The prefix to use for the tagged hash. This should be one of the values from the
TaggedHashPrefix
enum.Parameter data
The data to hash, provided as a
Uint8Array
.Returns
The resulting tagged hash as a
Uint8Array
.
type TaggedHashPrefix
type TaggedHashPrefix = (typeof TAGS)[number];
namespace networks
module 'src/cjs/networks.d.ts' {}
This module defines the network configurations for Bitcoin and its variants, including message prefixes, Bech32 address format, BIP32 key derivation prefixes, and other address-related configurations. It supports Bitcoin, Bitcoin testnet, and Bitcoin regtest networks.
Additional information on address prefixes can be found here: - https://en.bitcoin.it/wiki/List_of_address_prefixes
variable bitcoin
const bitcoin: Network;
Represents the Bitcoin network configuration.
variable regtest
const regtest: Network;
Represents the regtest network configuration.
variable testnet
const testnet: Network;
Represents the testnet network configuration.
interface Network
interface Network {}
property bech32
bech32: string;
property bip32
bip32: Bip32;
property messagePrefix
messagePrefix: string;
property pubKeyHash
pubKeyHash: number;
property scriptHash
scriptHash: number;
property wif
wif: number;
namespace payments
module 'src/cjs/payments/index.d.ts' {}
Provides functionality for creating and managing Bitcoin payment objects.
This module supports multiple Bitcoin address types for payments, including: - P2PKH (Pay-to-PubKey-Hash) - P2SH (Pay-to-Script-Hash) - P2WPKH (Pay-to-Witness-PubKey-Hash) - P2WSH (Pay-to-Witness-Script-Hash) - P2TR (Taproot)
The
Payment
interface defines the structure of a payment object used for constructing various payment types, with fields for signatures, public keys, redeem scripts, and more.
function embed
embed: (a: Payment, opts?: PaymentOpts) => Payment;
Embeds data in a Bitcoin payment.
Parameter a
The payment object.
Parameter opts
Optional payment options.
Returns
The modified payment object.
Throws
{TypeError} If there is not enough data or if the output is invalid.
function p2ms
p2ms: (a: Payment, opts?: PaymentOpts) => Payment;
Represents a function that creates a Pay-to-Multisig (P2MS) payment object.
Parameter a
The payment object.
Parameter opts
Optional payment options.
Returns
The created payment object.
Throws
{TypeError} If the provided data is not valid.
function p2pk
p2pk: (a: Payment, opts?: PaymentOpts) => Payment;
Creates a pay-to-public-key (P2PK) payment object.
Parameter a
The payment object containing the necessary data.
Parameter opts
Optional payment options.
Returns
The P2PK payment object.
Throws
{TypeError} If the required data is not provided or if the data is invalid.
function p2pkh
p2pkh: (a: Payment, opts?: PaymentOpts) => Payment;
Creates a Pay-to-Public-Key-Hash (P2PKH) payment object.
Parameter a
The payment object containing the necessary data.
Parameter opts
Optional payment options.
Returns
The P2PKH payment object.
Throws
{TypeError} If the required data is not provided or if the data is invalid.
function p2sh
p2sh: (a: Payment, opts?: PaymentOpts) => Payment;
Creates a Pay-to-Script-Hash (P2SH) payment object.
Parameter a
The payment object containing the necessary data.
Parameter opts
Optional payment options.
Returns
The P2SH payment object.
Throws
{TypeError} If the required data is not provided or if the data is invalid.
function p2tr
p2tr: (a: Payment, opts?: PaymentOpts) => Payment;
Creates a Pay-to-Taproot (P2TR) payment object.
Parameter a
The payment object containing the necessary data for P2TR.
Parameter opts
Optional payment options.
Returns
The P2TR payment object.
Throws
{TypeError} If the provided data is invalid or insufficient.
function p2wpkh
p2wpkh: (a: Payment, opts?: PaymentOpts) => Payment;
Creates a pay-to-witness-public-key-hash (p2wpkh) payment object.
Parameter a
The payment object containing the necessary data.
Parameter opts
Optional payment options.
Returns
The p2wpkh payment object.
Throws
{TypeError} If the required data is missing or invalid.
function p2wsh
p2wsh: (a: Payment, opts?: PaymentOpts) => Payment;
Creates a Pay-to-Witness-Script-Hash (P2WSH) payment object.
Parameter a
The payment object containing the necessary data.
Parameter opts
Optional payment options.
Returns
The P2WSH payment object.
Throws
{TypeError} If the required data is missing or invalid.
interface Payment
interface Payment {}
property address
address?: string;
property data
data?: Uint8Array[];
property hash
hash?: Uint8Array;
property input
input?: Uint8Array;
property internalPubkey
internalPubkey?: Uint8Array;
property m
m?: number;
property n
n?: number;
property name
name?: string;
property network
network?: Network;
property output
output?: Uint8Array;
property pubkey
pubkey?: Uint8Array;
property pubkeys
pubkeys?: Uint8Array[];
property redeem
redeem?: Payment;
property redeemVersion
redeemVersion?: number;
property scriptTree
scriptTree?: Taptree;
property signature
signature?: Uint8Array;
property signatures
signatures?: Uint8Array[];
property witness
witness?: Uint8Array[];
interface PaymentOpts
interface PaymentOpts {}
property allowIncomplete
allowIncomplete?: boolean;
property validate
validate?: boolean;
type PaymentCreator
type PaymentCreator = (a: Payment, opts?: PaymentOpts) => Payment;
type PaymentFunction
type PaymentFunction = () => Payment;
type Stack
type Stack = StackElement[];
type StackElement
type StackElement = Uint8Array | number;
type StackFunction
type StackFunction = () => Stack;
namespace script
module 'src/cjs/script.d.ts' {}
Script tools module for working with Bitcoin scripts. Provides utilities such as decompiling, compiling, converting to/from ASM, stack manipulation, and script validation functions.
variable number
const number: typeof scriptNumber;
variable signature
const signature: typeof scriptSignature;
function compile
compile: (chunks: Uint8Array | Stack) => Uint8Array;
Compiles an array of script chunks into a Uint8Array.
Parameter chunks
The chunks to compile.
Returns
The compiled script as a Uint8Array.
Throws
Error if compilation fails.
function countNonPushOnlyOPs
countNonPushOnlyOPs: (value: Stack) => number;
Counts the number of non-push-only opcodes in a stack.
Parameter value
The stack to analyze.
Returns
The count of non-push-only opcodes.
function decompile
decompile: ( buffer: Uint8Array | Array<number | Uint8Array>) => Array<number | Uint8Array> | null;
Decompiles a script buffer into an array of chunks.
Parameter buffer
The script buffer to decompile.
Returns
The decompiled chunks or null if decompilation fails.
function fromASM
fromASM: (asm: string) => Uint8Array;
Converts an ASM string to a Buffer.
Parameter asm
The ASM string to convert.
Returns
The converted Buffer.
function isCanonicalPubKey
isCanonicalPubKey: (buffer: Uint8Array) => boolean;
Checks if the provided buffer is a canonical public key.
Parameter buffer
The buffer to check, expected to be a Uint8Array.
Returns
A boolean indicating whether the buffer is a canonical public key.
function isCanonicalScriptSignature
isCanonicalScriptSignature: (buffer: Uint8Array) => boolean;
Checks if the provided buffer is a canonical script signature.
A canonical script signature is a valid DER-encoded signature followed by a valid hash type byte.
Parameter buffer
The buffer to check.
Returns
true
if the buffer is a canonical script signature,false
otherwise.
function isDefinedHashType
isDefinedHashType: (hashType: number) => boolean;
Checks if the provided hash type is defined.
A hash type is considered defined if its modified value (after masking with ~0x80) is greater than 0x00 and less than 0x04.
Parameter hashType
The hash type to check.
Returns
True if the hash type is defined, false otherwise.
function isPushOnly
isPushOnly: (value: Stack) => boolean;
Determines if a stack consists of only push operations.
Parameter value
The stack to check.
Returns
True if all elements in the stack are push-only, false otherwise.
function toASM
toASM: (chunks: Uint8Array | Array<number | Uint8Array>) => string;
Converts the given chunks into an ASM (Assembly) string representation. If the chunks parameter is a Buffer, it will be decompiled into a Stack before conversion.
Parameter chunks
The chunks to convert into ASM.
Returns
The ASM string representation of the chunks.
function toStack
toStack: (chunks: Uint8Array | Array<number | Uint8Array>) => Uint8Array[];
Converts the given chunks into a stack of buffers.
Parameter chunks
The chunks to convert.
Returns
The stack of buffers.
enum OPS
enum OPS { OP_FALSE = 0, OP_0 = 0, OP_PUSHDATA1 = 76, OP_PUSHDATA2 = 77, OP_PUSHDATA4 = 78, OP_1NEGATE = 79, OP_RESERVED = 80, OP_TRUE = 81, OP_1 = 81, OP_2 = 82, OP_3 = 83, OP_4 = 84, OP_5 = 85, OP_6 = 86, OP_7 = 87, OP_8 = 88, OP_9 = 89, OP_10 = 90, OP_11 = 91, OP_12 = 92, OP_13 = 93, OP_14 = 94, OP_15 = 95, OP_16 = 96, OP_NOP = 97, OP_VER = 98, OP_IF = 99, OP_NOTIF = 100, OP_VERIF = 101, OP_VERNOTIF = 102, OP_ELSE = 103, OP_ENDIF = 104, OP_VERIFY = 105, OP_RETURN = 106, OP_TOALTSTACK = 107, OP_FROMALTSTACK = 108, OP_2DROP = 109, OP_2DUP = 110, OP_3DUP = 111, OP_2OVER = 112, OP_2ROT = 113, OP_2SWAP = 114, OP_IFDUP = 115, OP_DEPTH = 116, OP_DROP = 117, OP_DUP = 118, OP_NIP = 119, OP_OVER = 120, OP_PICK = 121, OP_ROLL = 122, OP_ROT = 123, OP_SWAP = 124, OP_TUCK = 125, OP_CAT = 126, OP_SUBSTR = 127, OP_LEFT = 128, OP_RIGHT = 129, OP_SIZE = 130, OP_INVERT = 131, OP_AND = 132, OP_OR = 133, OP_XOR = 134, OP_EQUAL = 135, OP_EQUALVERIFY = 136, OP_RESERVED1 = 137, OP_RESERVED2 = 138, OP_1ADD = 139, OP_1SUB = 140, OP_2MUL = 141, OP_2DIV = 142, OP_NEGATE = 143, OP_ABS = 144, OP_NOT = 145, OP_0NOTEQUAL = 146, OP_ADD = 147, OP_SUB = 148, OP_MUL = 149, OP_DIV = 150, OP_MOD = 151, OP_LSHIFT = 152, OP_RSHIFT = 153, OP_BOOLAND = 154, OP_BOOLOR = 155, OP_NUMEQUAL = 156, OP_NUMEQUALVERIFY = 157, OP_NUMNOTEQUAL = 158, OP_LESSTHAN = 159, OP_GREATERTHAN = 160, OP_LESSTHANOREQUAL = 161, OP_GREATERTHANOREQUAL = 162, OP_MIN = 163, OP_MAX = 164, OP_WITHIN = 165, OP_RIPEMD160 = 166, OP_SHA1 = 167, OP_SHA256 = 168, OP_HASH160 = 169, OP_HASH256 = 170, OP_CODESEPARATOR = 171, OP_CHECKSIG = 172, OP_CHECKSIGVERIFY = 173, OP_CHECKMULTISIG = 174, OP_CHECKMULTISIGVERIFY = 175, OP_NOP1 = 176, OP_CHECKLOCKTIMEVERIFY = 177, OP_NOP2 = 177, OP_CHECKSEQUENCEVERIFY = 178, OP_NOP3 = 178, OP_NOP4 = 179, OP_NOP5 = 180, OP_NOP6 = 181, OP_NOP7 = 182, OP_NOP8 = 183, OP_NOP9 = 184, OP_NOP10 = 185, OP_CHECKSIGADD = 186, OP_PUBKEYHASH = 253, OP_PUBKEY = 254, OP_INVALIDOPCODE = 255,}
member OP_0
OP_0 = 0
member OP_0NOTEQUAL
OP_0NOTEQUAL = 146
member OP_1
OP_1 = 81
member OP_10
OP_10 = 90
member OP_11
OP_11 = 91
member OP_12
OP_12 = 92
member OP_13
OP_13 = 93
member OP_14
OP_14 = 94
member OP_15
OP_15 = 95
member OP_16
OP_16 = 96
member OP_1ADD
OP_1ADD = 139
member OP_1NEGATE
OP_1NEGATE = 79
member OP_1SUB
OP_1SUB = 140
member OP_2
OP_2 = 82
member OP_2DIV
OP_2DIV = 142
member OP_2DROP
OP_2DROP = 109
member OP_2DUP
OP_2DUP = 110
member OP_2MUL
OP_2MUL = 141
member OP_2OVER
OP_2OVER = 112
member OP_2ROT
OP_2ROT = 113
member OP_2SWAP
OP_2SWAP = 114
member OP_3
OP_3 = 83
member OP_3DUP
OP_3DUP = 111
member OP_4
OP_4 = 84
member OP_5
OP_5 = 85
member OP_6
OP_6 = 86
member OP_7
OP_7 = 87
member OP_8
OP_8 = 88
member OP_9
OP_9 = 89
member OP_ABS
OP_ABS = 144
member OP_ADD
OP_ADD = 147
member OP_AND
OP_AND = 132
member OP_BOOLAND
OP_BOOLAND = 154
member OP_BOOLOR
OP_BOOLOR = 155
member OP_CAT
OP_CAT = 126
member OP_CHECKLOCKTIMEVERIFY
OP_CHECKLOCKTIMEVERIFY = 177
member OP_CHECKMULTISIG
OP_CHECKMULTISIG = 174
member OP_CHECKMULTISIGVERIFY
OP_CHECKMULTISIGVERIFY = 175
member OP_CHECKSEQUENCEVERIFY
OP_CHECKSEQUENCEVERIFY = 178
member OP_CHECKSIG
OP_CHECKSIG = 172
member OP_CHECKSIGADD
OP_CHECKSIGADD = 186
member OP_CHECKSIGVERIFY
OP_CHECKSIGVERIFY = 173
member OP_CODESEPARATOR
OP_CODESEPARATOR = 171
member OP_DEPTH
OP_DEPTH = 116
member OP_DIV
OP_DIV = 150
member OP_DROP
OP_DROP = 117
member OP_DUP
OP_DUP = 118
member OP_ELSE
OP_ELSE = 103
member OP_ENDIF
OP_ENDIF = 104
member OP_EQUAL
OP_EQUAL = 135
member OP_EQUALVERIFY
OP_EQUALVERIFY = 136
member OP_FALSE
OP_FALSE = 0
member OP_FROMALTSTACK
OP_FROMALTSTACK = 108
member OP_GREATERTHAN
OP_GREATERTHAN = 160
member OP_GREATERTHANOREQUAL
OP_GREATERTHANOREQUAL = 162
member OP_HASH160
OP_HASH160 = 169
member OP_HASH256
OP_HASH256 = 170
member OP_IF
OP_IF = 99
member OP_IFDUP
OP_IFDUP = 115
member OP_INVALIDOPCODE
OP_INVALIDOPCODE = 255
member OP_INVERT
OP_INVERT = 131
member OP_LEFT
OP_LEFT = 128
member OP_LESSTHAN
OP_LESSTHAN = 159
member OP_LESSTHANOREQUAL
OP_LESSTHANOREQUAL = 161
member OP_LSHIFT
OP_LSHIFT = 152
member OP_MAX
OP_MAX = 164
member OP_MIN
OP_MIN = 163
member OP_MOD
OP_MOD = 151
member OP_MUL
OP_MUL = 149
member OP_NEGATE
OP_NEGATE = 143
member OP_NIP
OP_NIP = 119
member OP_NOP
OP_NOP = 97
member OP_NOP1
OP_NOP1 = 176
member OP_NOP10
OP_NOP10 = 185
member OP_NOP2
OP_NOP2 = 177
member OP_NOP3
OP_NOP3 = 178
member OP_NOP4
OP_NOP4 = 179
member OP_NOP5
OP_NOP5 = 180
member OP_NOP6
OP_NOP6 = 181
member OP_NOP7
OP_NOP7 = 182
member OP_NOP8
OP_NOP8 = 183
member OP_NOP9
OP_NOP9 = 184
member OP_NOT
OP_NOT = 145
member OP_NOTIF
OP_NOTIF = 100
member OP_NUMEQUAL
OP_NUMEQUAL = 156
member OP_NUMEQUALVERIFY
OP_NUMEQUALVERIFY = 157
member OP_NUMNOTEQUAL
OP_NUMNOTEQUAL = 158
member OP_OR
OP_OR = 133
member OP_OVER
OP_OVER = 120
member OP_PICK
OP_PICK = 121
member OP_PUBKEY
OP_PUBKEY = 254
member OP_PUBKEYHASH
OP_PUBKEYHASH = 253
member OP_PUSHDATA1
OP_PUSHDATA1 = 76
member OP_PUSHDATA2
OP_PUSHDATA2 = 77
member OP_PUSHDATA4
OP_PUSHDATA4 = 78
member OP_RESERVED
OP_RESERVED = 80
member OP_RESERVED1
OP_RESERVED1 = 137
member OP_RESERVED2
OP_RESERVED2 = 138
member OP_RETURN
OP_RETURN = 106
member OP_RIGHT
OP_RIGHT = 129
member OP_RIPEMD160
OP_RIPEMD160 = 166
member OP_ROLL
OP_ROLL = 122
member OP_ROT
OP_ROT = 123
member OP_RSHIFT
OP_RSHIFT = 153
member OP_SHA1
OP_SHA1 = 167
member OP_SHA256
OP_SHA256 = 168
member OP_SIZE
OP_SIZE = 130
member OP_SUB
OP_SUB = 148
member OP_SUBSTR
OP_SUBSTR = 127
member OP_SWAP
OP_SWAP = 124
member OP_TOALTSTACK
OP_TOALTSTACK = 107
member OP_TRUE
OP_TRUE = 81
member OP_TUCK
OP_TUCK = 125
member OP_VER
OP_VER = 98
member OP_VERIF
OP_VERIF = 101
member OP_VERIFY
OP_VERIFY = 105
member OP_VERNOTIF
OP_VERNOTIF = 102
member OP_WITHIN
OP_WITHIN = 165
member OP_XOR
OP_XOR = 134
Package Files (20)
- src/cjs/address.d.ts
- src/cjs/block.d.ts
- src/cjs/crypto.d.ts
- src/cjs/ecc_lib.d.ts
- src/cjs/index.d.ts
- src/cjs/networks.d.ts
- src/cjs/ops.d.ts
- src/cjs/payments/embed.d.ts
- src/cjs/payments/index.d.ts
- src/cjs/payments/p2ms.d.ts
- src/cjs/payments/p2pk.d.ts
- src/cjs/payments/p2pkh.d.ts
- src/cjs/payments/p2sh.d.ts
- src/cjs/payments/p2tr.d.ts
- src/cjs/payments/p2wpkh.d.ts
- src/cjs/payments/p2wsh.d.ts
- src/cjs/psbt.d.ts
- src/cjs/psbt/bip371.d.ts
- src/cjs/script.d.ts
- src/cjs/transaction.d.ts
Dependencies (7)
Dev Dependencies (36)
- @eslint/eslintrc
- @eslint/js
- @types/bs58
- @types/bs58check
- @types/mocha
- @types/node
- @types/proxyquire
- @types/randombytes
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- better-npm-audit
- bip32
- bip39
- bip65
- bip68
- bitcoinjs-lib
- bs58
- c8
- dhttp
- ecpair
- eslint
- eslint-config-prettier
- eslint-plugin-prettier
- globals
- hoodwink
- minimaldata
- mocha
- prettier
- proxyquire
- randombytes
- regtest-client
- rimraf
- tiny-secp256k1
- tsx
- typedoc
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/bitcoinjs-lib
.
- Markdown[](https://www.jsdocs.io/package/bitcoinjs-lib)
- HTML<a href="https://www.jsdocs.io/package/bitcoinjs-lib"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7292 ms. - Missing or incorrect documentation? Open an issue for this package.