Options
All
  • Public
  • Public/Protected
  • All
Menu

bitcoin-ts

Index

Enumerations

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

AuthenticationInstruction

AuthenticationInstruction<Opcodes>: AuthenticationInstructionPush<Opcodes> | AuthenticationInstructionOperation<Opcodes>

A properly-formed instruction used by an AuthenticationVirtualMachine.

Type parameters

  • Opcodes

AuthenticationInstructions

AuthenticationInstructions<Opcodes>: AuthenticationInstruction<Opcodes>[]

Type parameters

  • Opcodes

AuthenticationTemplateVariable

AuthenticationTemplateVariable: HDKey | Key | WalletData | AddressData

AuthenticationVirtualMachineIdentifier

AuthenticationVirtualMachineIdentifier: "BCH_2020_05" | "BCH_2019_11" | "BCH_2019_05" | "BSV_2018_11" | "BTC_2017_08"

Allowable identifiers for Bitcoin virtual machine versions. Identifiers are based upon the month the VM version became active on the specified chain.

Base58AddressNetwork

Base58AddressNetwork: "mainnet" | "testnet" | "copay-bch"

The available networks for common Base58Address versions.

BytecodeGenerationResult

BytecodeGenerationResult: { bytecode: Uint8Array; success: true } | { errorType: string; errors: CompilationError[]; success: false }

CashAddressAvailableSizes

CashAddressAvailableSizes: keyof typeof cashAddressBitToSize

CashAddressAvailableSizesInBits

CashAddressAvailableSizesInBits: keyof typeof cashAddressSizeToBit

CashAddressAvailableTypes

CashAddressAvailableTypes: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15

CompilationResult

CompilationResult<ProgramState>: CompilationResultSuccess<ProgramState> | CompilationResultError<ProgramState>

Type parameters

  • ProgramState

CompilationResultError

CompilationResultError<ProgramState>: CompilationResultParseError | CompilationResultResolveError | CompilationResultReduceError<ProgramState>

Type parameters

  • ProgramState

CompilerOperation

CompilerOperation<CompilerOperationData, Checked>: (identifier: string, compilationData: Checked extends "Key" ? Required<Pick<CompilationData<CompilerOperationData>, "keys">> & CompilationData<CompilerOperationData> : Checked extends "HDKey" ? Required<Pick<CompilationData<CompilerOperationData>, "hdKeys">> & CompilationData<CompilerOperationData> : Checked extends "WalletData" ? Required<Pick<CompilationData<CompilerOperationData>, "walletData">> & CompilationData<CompilerOperationData> : Checked extends "AddressData" ? Required<Pick<CompilationData<CompilerOperationData>, "addressData">> & CompilationData<CompilerOperationData> : CompilationData<CompilerOperationData>, compilationEnvironment: CompilationEnvironment<CompilerOperationData>) => Uint8Array | string

Returns the bytecode result on success or an error message on failure.

Type parameters

Type declaration

    • (identifier: string, compilationData: Checked extends "Key" ? Required<Pick<CompilationData<CompilerOperationData>, "keys">> & CompilationData<CompilerOperationData> : Checked extends "HDKey" ? Required<Pick<CompilationData<CompilerOperationData>, "hdKeys">> & CompilationData<CompilerOperationData> : Checked extends "WalletData" ? Required<Pick<CompilationData<CompilerOperationData>, "walletData">> & CompilationData<CompilerOperationData> : Checked extends "AddressData" ? Required<Pick<CompilationData<CompilerOperationData>, "addressData">> & CompilationData<CompilerOperationData> : CompilationData<CompilerOperationData>, compilationEnvironment: CompilationEnvironment<CompilerOperationData>): Uint8Array | string
    • Parameters

      • identifier: string
      • compilationData: Checked extends "Key" ? Required<Pick<CompilationData<CompilerOperationData>, "keys">> & CompilationData<CompilerOperationData> : Checked extends "HDKey" ? Required<Pick<CompilationData<CompilerOperationData>, "hdKeys">> & CompilationData<CompilerOperationData> : Checked extends "WalletData" ? Required<Pick<CompilationData<CompilerOperationData>, "walletData">> & CompilationData<CompilerOperationData> : Checked extends "AddressData" ? Required<Pick<CompilationData<CompilerOperationData>, "addressData">> & CompilationData<CompilerOperationData> : CompilationData<CompilerOperationData>
      • compilationEnvironment: CompilationEnvironment<CompilerOperationData>

      Returns Uint8Array | string

CompilerOperationTypes

CompilerOperationTypes: AuthenticationTemplateVariable["type"] | "SigningSerialization"

CompilerOperationsBCH

CompilerOperationsKeyBCH

CompilerOperationsKeyBCH: "data_signature" | "public_key" | "schnorr_data_signature" | "schnorr_signature" | "signature"

CompilerOperationsMinimal

CompilerOperationsMinimal: "public_key" | "signature"

CompilerOperationsSigningSerializationBCH

CompilerOperationsSigningSerializationComponentBCH

CompilerOperationsSigningSerializationComponentBCH: "version" | "transaction_outpoints" | "transaction_outpoints_hash" | "transaction_sequence_numbers" | "transaction_sequence_numbers_hash" | "outpoint_transaction_hash" | "outpoint_index" | "covered_bytecode_length" | "covered_bytecode" | "output_value" | "sequence_number" | "corresponding_output" | "corresponding_output_hash" | "transaction_outputs" | "transaction_outputs_hash" | "locktime"

CompilerOperationsSigningSerializationFullBCH

CompilerOperationsSigningSerializationFullBCH: "full_all_outputs" | "full_all_outputs_single_input" | "full_corresponding_output" | "full_corresponding_output_single_input" | "full_no_outputs" | "full_no_outputs_single_input"

HdKeyNetwork

HdKeyNetwork: "mainnet" | "testnet"

The networks which can be referenced by an HD public or private key.

HdPrivateNode

A private node in a Hierarchical Deterministic (HD) key tree. To confirm the validity of this node, check the value of its valid property.

Note, HD nodes are network-independent. A network is required only when encoding the node as an HD key or using a derived public key in an address.

IdentifierResolutionFunction

IdentifierResolutionFunction: (identifier: string) => { bytecode: Uint8Array; status: true; type: opcode | variable } | { bytecode: Uint8Array; source: ResolvedScript; status: true; type: script } | { error: string; status: false }

Type declaration

    • (identifier: string): { bytecode: Uint8Array; status: true; type: opcode | variable } | { bytecode: Uint8Array; source: ResolvedScript; status: true; type: script } | { error: string; status: false }
    • Parameters

      • identifier: string

      Returns { bytecode: Uint8Array; status: true; type: opcode | variable } | { bytecode: Uint8Array; source: ResolvedScript; status: true; type: script } | { error: string; status: false }

Immutable

Immutable<T>:

A deep-readonly utility type. Can be removed when a built-in alternative is added to TypeScript. Derived from: https://github.com/microsoft/TypeScript/issues/13923#issuecomment-557509399

Type parameters

  • T

ImmutableArray

ImmutableArray<T>: keyof Immutable<T>[]

Type parameters

  • T

ImmutableMap

ImmutableMap<K, V>: ReadonlyMap<Immutable<K>, Immutable<V>>

Type parameters

  • K

  • V

ImmutableObject

ImmutableObject<T>: {}

Type parameters

  • T

Type declaration

ImmutablePrimitive

ImmutablePrimitive: undefined | null | boolean | string | number | Function

ImmutableSet

ImmutableSet<T>: ReadonlySet<Immutable<T>>

Type parameters

  • T

ImmutableUint8Array

ImmutableUint8Array: Readonly<ArrayLike<number>> & Iterable<number> & ImmutableObject<Uint8Array>

InstructionAggregationEvaluationResult

InstructionAggregationEvaluationResult<ProgramState>: InstructionAggregationEvaluationError<ProgramState> | InstructionAggregationEvaluationSuccess<ProgramState>

Type parameters

  • ProgramState

InstructionAggregationResult

InstructionAggregationResult<Opcodes>: InstructionAggregationSuccess<Opcodes> | InstructionAggregationError<Opcodes>

Type parameters

  • Opcodes

Operation

Operation<ProgramState>: (state: ProgramState) => ProgramState

Operations define the behavior of an opcode in an InstructionSet.

Operations should be written as efficiently as possible, and may safely mutate the ProgramState. If needed, the AuthenticationVirtualMachine will clone the ProgramState before providing it to an operation.

Type parameters

  • ProgramState

Type declaration

    • (state: ProgramState): ProgramState
    • Parameters

      • state: ProgramState

      Returns ProgramState

ParseResult

ParseResult: { expected: string[]; index: SourcePosition; status: false } | { status: true; value: BtlScriptSegment }

ParsedAuthenticationInstruction

ParsedAuthenticationInstruction<Opcodes>: AuthenticationInstruction<Opcodes> | ParsedAuthenticationInstructionMalformed<Opcodes>

A potentially-malformed AuthenticationInstruction. If malformed is true, this could be either ParsedAuthenticationInstructionPushMalformedLength or ParsedAuthenticationInstructionPushMalformedData

If the final instruction is a push operation which requires more bytes than are available in the remaining portion of a serialized script, that instruction will have a malformed property with a value of true. .

Type parameters

  • Opcodes

ParsedAuthenticationInstructionMalformed

ParsedAuthenticationInstructionMalformed<Opcodes>: ParsedAuthenticationInstructionPushMalformedLength<Opcodes> | ParsedAuthenticationInstructionPushMalformedData<Opcodes>

Type parameters

  • Opcodes

ParsedAuthenticationInstructions

An array of authentication instructions which may end with a malformed instruction.

Implementation note: this type can be improved by only marking the final element as potentially malformed. This is waiting on: https://github.com/Microsoft/TypeScript/issues/1360

The following type can be used when it doesn't produce the error, A rest element must be last in a tuple type. [1256]:

export type ParsedAuthenticationInstructions<Opcodes = number> = [
  ...AuthenticationInstruction<Opcodes>,
  ParsedAuthenticationInstruction<Opcodes>
];

Type parameters

  • Opcodes

PrivateResults

PrivateResults<NodeType>: NodeType extends HdPrivateNodeKnownParent ? HdPrivateNodeKnownParent : HdPrivateNodeValid | childIndexExceedsMaximum | nextChildIndexRequiresHardenedAlgorithm

Type parameters

  • NodeType

PublicResults

PublicResults<NodeType>: NodeType extends HdPublicNodeKnownParent ? HdPublicNodeKnownParent : HdPublicNode | hardenedDerivationRequiresPrivateNode | nextChildIndexRequiresHardenedAlgorithm

Type parameters

  • NodeType

RecoveryId

RecoveryId: 0 | 1 | 2 | 3

RecursiveSegmentType

RecursiveSegmentType: "Push" | "Evaluation"

ReductionResults

ReductionResults<NodeType>: NodeType extends HdPrivateNodeValid ? PrivateResults<NodeType> : PublicResults<NodeType>

This type is a little complex because resulting HD nodes may not have a known parent (defined parentIdentifier) if the provided node does not have a known parent and the path is either m or M (returning the provided node).

Type parameters

  • NodeType

ResolvedSegment

ResolvedSegmentBytecode

SampledEvaluationResult

SampledEvaluationResult<ProgramState>: SampledEvaluationSuccess<ProgramState> | SampledEvaluationError<ProgramState>

Type parameters

  • ProgramState

ScriptReductionTraceChildNode

ScriptReductionTraceChildNode<ProgramState>: ScriptReductionTraceNode | ScriptReductionTraceContainerNode<ProgramState> | ScriptReductionTraceErrorNode | ScriptReductionTraceEvaluationNode<ProgramState>

Type parameters

  • ProgramState

StringSegmentType

StringSegmentType: "Comment" | "Identifier" | "UTF8Literal" | "HexLiteral"

TestState

TestState<ProgramState>: (state: ProgramState) => boolean

Type parameters

  • ProgramState

Type declaration

    • (state: ProgramState): boolean
    • Parameters

      • state: ProgramState

      Returns boolean

WalletImportFormatType

WalletImportFormatType: "mainnet" | "testnet" | "mainnet-uncompressed" | "testnet-uncompressed"

The network and address format in which a WIF-encoded private key is expected to be used.

WIF-encoding is generally used to serialize private keys for Pay to Public Key (P2PKH) addresses – each WIF-encoded private key specifies the compression of the public key to use in the P2PKH address:

  • The values mainnet and testnet indicate that the address should use the compressed form of the derived public key (33 bytes, beginning with 0x02 or 0x03) on the respective network.
  • The less common mainnet-uncompressed and testnet-uncompressed values indicate that the address should use the uncompressed form of the public key (65 bytes beginning with 0x04) on the specified network.

Variables

Const EOF

EOF: "EOF" = "EOF"

The constant used by the parser to denote the end of the input

Const SECP256K1_CONTEXT_NONE

SECP256K1_CONTEXT_NONE: number = SECP256K1_FLAGS_TYPE_CONTEXT

Const SECP256K1_CONTEXT_SIGN

SECP256K1_CONTEXT_SIGN: number = SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN

Const SECP256K1_CONTEXT_VERIFY

SECP256K1_CONTEXT_VERIFY: number = SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY

Flags to pass to secp256k1_context_create.

Const SECP256K1_EC_COMPRESSED

SECP256K1_EC_COMPRESSED: number = SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION

Flag to pass to secp256k1_ec_pubkey_serialize and secp256k1_ec_privkey_export.

Const SECP256K1_EC_UNCOMPRESSED

SECP256K1_EC_UNCOMPRESSED: number = SECP256K1_FLAGS_TYPE_COMPRESSION

Const SECP256K1_FLAGS_BIT_COMPRESSION

SECP256K1_FLAGS_BIT_COMPRESSION: number = 1 << 8

Const SECP256K1_FLAGS_BIT_CONTEXT_SIGN

SECP256K1_FLAGS_BIT_CONTEXT_SIGN: number = 1 << 9

Const SECP256K1_FLAGS_BIT_CONTEXT_VERIFY

SECP256K1_FLAGS_BIT_CONTEXT_VERIFY: number = 1 << 8

The higher bits contain the actual data. Do not use directly.

Const SECP256K1_FLAGS_TYPE_COMPRESSION

SECP256K1_FLAGS_TYPE_COMPRESSION: number = 1 << 1

Const SECP256K1_FLAGS_TYPE_CONTEXT

SECP256K1_FLAGS_TYPE_CONTEXT: number = 1 << 0

All flags' lower 8 bits indicate what they're for. Do not use directly.

Const asciiCaseInsensitiveBits

asciiCaseInsensitiveBits: 31 = 31

In ASCII, each pair of upper and lower case characters share the same 5 least significant bits.

Const asciiLowerCaseStart

asciiLowerCaseStart: 96 = 96

Const authenticationScriptParser

authenticationScriptParser: Language = P.createLanguage({script: (r) =>P.seqMap(P.optWhitespace,r.expression.sepBy(P.optWhitespace).node('Script'),P.optWhitespace,(_, expressions) => expressions),expression: (r) =>P.alt(r.comment,r.push,r.evaluation,r.utf8,r.hex,r.bigint,r.identifier),comment: (r) =>P.alt(r.singleLineComment, r.multiLineComment).node('Comment'),singleLineComment: () =>P.seqMap(P.string('//').desc("the start of a single-line comment ('//')"),P.regexp(/[^\n]*/u),(__, comment) => comment.trim()),multiLineComment: () =>P.seqMap(P.string('/*').desc("the start of a multi-line comment ('/*')"),P.regexp(/[\s\S]*(?=\*\/)/u).desc("the end of this multi-line comment ('*/')"),P.string('*/'),(__, comment) => comment.trim()),push: (r) =>P.seqMap(P.string('<').desc("the start of a push statement ('<')"),r.script,P.string('>').desc("the end of this push statement ('>')"),(_, push) => push).node('Push'),evaluation: (r) =>P.seqMap(P.string('$').desc("the start of an evaluation ('$')"),P.string('(').desc("the opening parenthesis of this evaluation ('(')"),r.script,P.string(')').desc("the closing parenthesis of this evaluation (')')"),(_, __, evaluation) => evaluation).node('Evaluation'),identifier: () =>P.regexp(/[a-zA-Z_][.a-zA-Z0-9_-]*/u).desc('a valid identifier').node('Identifier'),utf8: () =>P.alt(P.seqMap(P.string('"').desc('a double quote (")'),P.regexp(/[^"]*/u),P.string('"').desc('a closing double quote (")'),(__, literal) => literal),P.seqMap(P.string("'").desc("a single quote (')"),P.regexp(/[^']*/u),P.string("'").desc("a closing single quote (')"),(__, literal) => literal)).node('UTF8Literal'),hex: () =>P.seqMap(P.string('0x').desc("a hex literal ('0x...')"),P.regexp(/(?:[0-9a-f]{2})+/iu).desc('a valid hexadecimal string'),(__, literal) => literal).node('HexLiteral'),bigint: () =>P.regexp(/-?[0-9]+/u).desc('an integer literal').map(BigInt).node('BigIntLiteral'),})

TODO: @types/parsimmon is not in use because of some early hacks. Ideally, this can be cleaned up by converting parsimmon.js to TypeScript, and trimming out the parts we don't need.

Const base256WordLength

base256WordLength: 8 = 8

Const base32WordLength

base32WordLength: 5 = 5

Const base58

base58: BaseConverter = createBaseConverter(bitcoinBase58Alphabet) as BaseConverter

Const base58ToBin

base58ToBin: (source: string) => Uint8Array | unknownCharacter = base58.decode

Convert a bitcoin-style base58-encoded string to a Uint8Array.

See createBaseConverter for format details.

param

a valid base58-encoded string to decode

Type declaration

Const base64GroupLength

base64GroupLength: 4 = 4

Const bech32CharacterSet

bech32CharacterSet: "qpzry9x8gf2tvdw0s3jn54khce6mua7l" = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"

The list of 32 symbols used in Bech32 encoding.

Const bech32CharacterSetIndex

bech32CharacterSetIndex: { 0: 15; 2: 10; 3: 17; 4: 21; 5: 20; 6: 26; 7: 30; 8: 7; 9: 5; a: 29; c: 24; d: 13; e: 25; f: 9; g: 8; h: 23; j: 18; k: 22; l: 31; m: 27; n: 19; p: 1; q: 0; r: 3; s: 16; t: 11; u: 28; v: 12; w: 14; x: 6; y: 4; z: 2 } = { q: 0, p: 1, z: 2, r: 3, y: 4, '9': 5, x: 6, '8': 7, g: 8, f: 9, '2': 10, t: 11, v: 12, d: 13, w: 14, '0': 15, s: 16, '3': 17, j: 18, n: 19, '5': 20, '4': 21, k: 22, h: 23, c: 24, e: 25, '6': 26, m: 27, u: 28, a: 29, '7': 30, l: 31 } as const

An object mapping each of the 32 symbols used in Bech32 encoding to their respective index in the character set.

Type declaration

  • 0: 15
  • 2: 10
  • 3: 17
  • 4: 21
  • 5: 20
  • 6: 26
  • 7: 30
  • 8: 7
  • 9: 5
  • a: 29
  • c: 24
  • d: 13
  • e: 25
  • f: 9
  • g: 8
  • h: 23
  • j: 18
  • k: 22
  • l: 31
  • m: 27
  • n: 19
  • p: 1
  • q: 0
  • r: 3
  • s: 16
  • t: 11
  • u: 28
  • v: 12
  • w: 14
  • x: 6
  • y: 4
  • z: 2

Const bech32GeneratorMostSignificantByte

bech32GeneratorMostSignificantByte: number[] = [0x98, 0x79, 0xf3, 0xae, 0x1e]

Const bech32GeneratorRemainingBytes

bech32GeneratorRemainingBytes: number[] = [0xf2bc8e61, 0xb76d99e2, 0x3e5fb3c4, 0x2eabe2a8, 0x4f43e470]

Const binToBase58

binToBase58: (input: Uint8Array) => string = base58.encode

Convert a Uint8Array to a bitcoin-style base58-encoded string.

See createBaseConverter for format details.

param

the Uint8Array to base58 encode

Type declaration

    • (input: Uint8Array): string
    • Parameters

      • input: Uint8Array

      Returns string

Const bip32HmacSha512Key

bip32HmacSha512Key: Uint8Array = utf8ToBin('Bitcoin seed')

Const bitcoinABCOpcodes

bitcoinABCOpcodes: {} = Object.entries(generateBytecodeMap(OpcodesBCH)).reduce<{readonly [opcode: string]: Uint8Array;}>((acc, cur) => ({ ...acc, [cur[0].slice('OP_'.length)]: cur[1] }), {PUSHDATA1: Uint8Array.of(OpcodesBCH.OP_PUSHDATA_1),PUSHDATA2: Uint8Array.of(OpcodesBCH.OP_PUSHDATA_2),PUSHDATA4: Uint8Array.of(OpcodesBCH.OP_PUSHDATA_4),})

Type declaration

  • [opcode: string]: Uint8Array

Const bitcoinBase58Alphabet

bitcoinBase58Alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

Const cashAddressBitToSize

cashAddressBitToSize: { 0: 160; 1: 192; 2: 224; 3: 256; 4: 320; 5: 384; 6: 448; 7: 512 } = {0: 160,1: 192,2: 224,3: 256,4: 320,5: 384,6: 448,7: 512,} as const

Type declaration

  • 0: 160
  • 1: 192
  • 2: 224
  • 3: 256
  • 4: 320
  • 5: 384
  • 6: 448
  • 7: 512

Const cashAddressReservedBitMask

cashAddressReservedBitMask: 128 = 128

Const cashAddressSizeBits

cashAddressSizeBits: 7 = 7

Const cashAddressSizeToBit

cashAddressSizeToBit: { 160: 0; 192: 1; 224: 2; 256: 3; 320: 4; 384: 5; 448: 6; 512: 7 } = {160: 0,192: 1,224: 2,256: 3,320: 4,384: 5,448: 6,512: 7,} as const

Type declaration

  • 160: 0
  • 192: 1
  • 224: 2
  • 256: 3
  • 320: 4
  • 384: 5
  • 448: 6
  • 512: 7

Const cashAddressTypeBitShift

cashAddressTypeBitShift: 3 = 3

Const cashAddressTypeBits

cashAddressTypeBits: 15 = 15

Const chars

chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Const defaultStringifySpacing

defaultStringifySpacing: 2 = 2

Const empty

empty: 0 = 0

Const finiteFieldOrder

finiteFieldOrder: 32 = 32

Const halfHmacSha512Length

halfHmacSha512Length: 32 = 32

Const hexByteLength

hexByteLength: 2 = 2

Const hexByteWidth

hexByteWidth: 2 = 2

Const hexadecimal

hexadecimal: 16 = 16

Const instructionSetBCHCurrentStrict

instructionSetBCHCurrentStrict: BCH_2019_05_STRICT = InstructionSetBCH.BCH_2019_05_STRICT

Const maximumLocktimeDate

maximumLocktimeDate: Date = new Date(Constants.maximumLocktime * Constants.msPerLocktimeSecond)

The maximum Date (inclusive) which can be encoded by a transaction's locktime.

Const minimumLocktimeDate

minimumLocktimeDate: Date = new Date(Constants.minimumTimestamp * Constants.msPerLocktimeSecond)

The minimum Date (inclusive) which can be encoded by a transaction's locktime.

Const nonBase64Chars

nonBase64Chars: RegExp = new RegExp(`[^${chars}=]`, 'u')

Const nonBech32Characters

nonBech32Characters: RegExp = new RegExp(`[^${bech32CharacterSet}]`, 'u')

Const normalMaximumScriptNumberByteLength

normalMaximumScriptNumberByteLength: 4 = 4

Const op1NegateValue

op1NegateValue: -1 = -1

Const payloadSeparator

payloadSeparator: 0 = 0

Const pushByteOpcodes

pushByteOpcodes: keyof OpcodesCommon[] = [OpcodesCommon.OP_PUSHBYTES_1,OpcodesCommon.OP_PUSHBYTES_2,OpcodesCommon.OP_PUSHBYTES_3,OpcodesCommon.OP_PUSHBYTES_4,OpcodesCommon.OP_PUSHBYTES_5,OpcodesCommon.OP_PUSHBYTES_6,OpcodesCommon.OP_PUSHBYTES_7,OpcodesCommon.OP_PUSHBYTES_8,OpcodesCommon.OP_PUSHBYTES_9,OpcodesCommon.OP_PUSHBYTES_10,OpcodesCommon.OP_PUSHBYTES_11,OpcodesCommon.OP_PUSHBYTES_12,OpcodesCommon.OP_PUSHBYTES_13,OpcodesCommon.OP_PUSHBYTES_14,OpcodesCommon.OP_PUSHBYTES_15,OpcodesCommon.OP_PUSHBYTES_16,OpcodesCommon.OP_PUSHBYTES_17,OpcodesCommon.OP_PUSHBYTES_18,OpcodesCommon.OP_PUSHBYTES_19,OpcodesCommon.OP_PUSHBYTES_20,OpcodesCommon.OP_PUSHBYTES_21,OpcodesCommon.OP_PUSHBYTES_22,OpcodesCommon.OP_PUSHBYTES_23,OpcodesCommon.OP_PUSHBYTES_24,OpcodesCommon.OP_PUSHBYTES_25,OpcodesCommon.OP_PUSHBYTES_26,OpcodesCommon.OP_PUSHBYTES_27,OpcodesCommon.OP_PUSHBYTES_28,OpcodesCommon.OP_PUSHBYTES_29,OpcodesCommon.OP_PUSHBYTES_30,OpcodesCommon.OP_PUSHBYTES_31,OpcodesCommon.OP_PUSHBYTES_32,OpcodesCommon.OP_PUSHBYTES_33,OpcodesCommon.OP_PUSHBYTES_34,OpcodesCommon.OP_PUSHBYTES_35,OpcodesCommon.OP_PUSHBYTES_36,OpcodesCommon.OP_PUSHBYTES_37,OpcodesCommon.OP_PUSHBYTES_38,OpcodesCommon.OP_PUSHBYTES_39,OpcodesCommon.OP_PUSHBYTES_40,OpcodesCommon.OP_PUSHBYTES_41,OpcodesCommon.OP_PUSHBYTES_42,OpcodesCommon.OP_PUSHBYTES_43,OpcodesCommon.OP_PUSHBYTES_44,OpcodesCommon.OP_PUSHBYTES_45,OpcodesCommon.OP_PUSHBYTES_46,OpcodesCommon.OP_PUSHBYTES_47,OpcodesCommon.OP_PUSHBYTES_48,OpcodesCommon.OP_PUSHBYTES_49,OpcodesCommon.OP_PUSHBYTES_50,OpcodesCommon.OP_PUSHBYTES_51,OpcodesCommon.OP_PUSHBYTES_52,OpcodesCommon.OP_PUSHBYTES_53,OpcodesCommon.OP_PUSHBYTES_54,OpcodesCommon.OP_PUSHBYTES_55,OpcodesCommon.OP_PUSHBYTES_56,OpcodesCommon.OP_PUSHBYTES_57,OpcodesCommon.OP_PUSHBYTES_58,OpcodesCommon.OP_PUSHBYTES_59,OpcodesCommon.OP_PUSHBYTES_60,OpcodesCommon.OP_PUSHBYTES_61,OpcodesCommon.OP_PUSHBYTES_62,OpcodesCommon.OP_PUSHBYTES_63,OpcodesCommon.OP_PUSHBYTES_64,OpcodesCommon.OP_PUSHBYTES_65,OpcodesCommon.OP_PUSHBYTES_66,OpcodesCommon.OP_PUSHBYTES_67,OpcodesCommon.OP_PUSHBYTES_68,OpcodesCommon.OP_PUSHBYTES_69,OpcodesCommon.OP_PUSHBYTES_70,OpcodesCommon.OP_PUSHBYTES_71,OpcodesCommon.OP_PUSHBYTES_72,OpcodesCommon.OP_PUSHBYTES_73,OpcodesCommon.OP_PUSHBYTES_74,OpcodesCommon.OP_PUSHBYTES_75,]

Const pushNumberOpcodes

pushNumberOpcodes: keyof OpcodesCommon[] = [OpcodesCommon.OP_1NEGATE,OpcodesCommon.OP_1,OpcodesCommon.OP_2,OpcodesCommon.OP_3,OpcodesCommon.OP_4,OpcodesCommon.OP_5,OpcodesCommon.OP_6,OpcodesCommon.OP_7,OpcodesCommon.OP_8,OpcodesCommon.OP_9,OpcodesCommon.OP_10,OpcodesCommon.OP_11,OpcodesCommon.OP_12,OpcodesCommon.OP_13,OpcodesCommon.OP_14,OpcodesCommon.OP_15,OpcodesCommon.OP_16,]

Const sha256BlockByteLength

sha256BlockByteLength: 64 = 64

Const sha512BlockByteLength

sha512BlockByteLength: 128 = 128

Const zero

zero: 0 = 0

Functions

Const aOrAnQuotedString

  • aOrAnQuotedString(word: string): string

Const addressContentsToLockingBytecode

  • addressContentsToLockingBytecode(addressContents: AddressContents): Uint8Array
  • Get the locking bytecode for a valid AddressContents object. See lockingBytecodeToAddressContents for details.

    For AddressContents of type AddressType.unknown, this method returns the payload without modification.

    Parameters

    Returns Uint8Array

Const aggregatedParseReductionTraceNodes

Const alignMemory

  • alignMemory(factor: number, size: number): number

Const applyError

Const areEqual

  • areEqual(a: Uint8Array, b: Uint8Array): boolean

Const arithmeticOperations

  • arithmeticOperations<Opcodes, State, Errors>(flags: { requireMinimalEncoding: boolean }): { __computed: (Anonymous function) }

Const articleAndVariableType

Const assembleBitcoinABCScript

  • assembleBitcoinABCScript(abcScript: string): Uint8Array
  • Convert a string from Bitcoin ABC's script_tests.json text-format to bytecode. The string must be valid – this method attempts to convert all unmatched tokens to BigInts.

    privateremarks

    This method doesn't use compileScript because of a slight incompatibility in the languages. In BTL, BigIntLiterals are a primitive type, and must be surrounded by a push statement (e.g. <100>) to push a number to the stack. In the script_tests.json text-format, numbers are assumed to be pushed. We could implement a transformation after the compiler's parse step, but because this format doesn't require any other features of the compiler, we opt to implement this as a simple method.

    Parameters

    • abcScript: string

      the script in Bitcoin ABC's script_tests.json text format

    Returns Uint8Array

Const attemptCashAddressFormatErrorCorrection

  • Attempt to correct up to 2 errors in a CashAddress. The CashAddress must be properly formed (include a prefix and only contain Bech32 characters).

    Improper use of this method carries the risk of lost funds.

    It is strongly advised that this method only be used under explicit user control. With enough errors, this method is likely to find a plausible correction for any address (but for which no private key exists). This is effectively equivalent to burning the funds.

    Only 2 substitution errors can be corrected (or a single swap) – deletions and insertions (errors which shift many other characters and change the length of the payload) can never be safely corrected and will produce an error.

    Errors can be corrected in both the prefix and the payload, but attempting to correct errors in the prefix prior to this method can improve results, e.g. for bchtest:qq2azmyyv6dtgczexyalqar70q036yund53jvfde0x, the string bchtest:qq2azmyyv6dtgczexyalqar70q036yund53jvfdecc can be corrected, while typo:qq2azmyyv6dtgczexyalqar70q036yund53jvfdecc can not.

    privateremarks

    Derived from: https://github.com/deadalnix/cashaddressed

    Parameters

    • address: string

      the CashAddress on which to attempt error correction

    Returns invalidFormat | malformedPayload | tooManyErrors | { address: string; corrections: number[] }

Const attemptCompilerOperation

  • attemptCompilerOperation<CompilerOperationData>(__namedParameters: { data: CompilationData<CompilerOperationData>; environment: CompilationEnvironment<CompilerOperationData, "signature" | "public_key">; identifier: string; operationId: string; variableType: "HDKey" | "Key" | "WalletData" | "AddressData" | "SigningSerialization" }): string | Uint8Array
  • Type parameters

    • CompilerOperationData

    Parameters

    • __namedParameters: { data: CompilationData<CompilerOperationData>; environment: CompilationEnvironment<CompilerOperationData, "signature" | "public_key">; identifier: string; operationId: string; variableType: "HDKey" | "Key" | "WalletData" | "AddressData" | "SigningSerialization" }
      • data: CompilationData<CompilerOperationData>
      • environment: CompilationEnvironment<CompilerOperationData, "signature" | "public_key">
      • identifier: string
      • operationId: string
      • variableType: "HDKey" | "Key" | "WalletData" | "AddressData" | "SigningSerialization"

    Returns string | Uint8Array

Const authenticationInstructionIsMalformed

  • authenticationInstructionIsMalformed<Opcodes>(instruction: ParsedAuthenticationInstruction<Opcodes>): instruction is ParsedAuthenticationInstructionMalformed<Opcodes>

Const authenticationInstructionsAreMalformed

  • authenticationInstructionsAreMalformed<Opcodes>(instructions: ParsedAuthenticationInstructions<Opcodes>): instructions is ParsedAuthenticationInstructionMalformed<Opcodes>[]

Const authenticationInstructionsAreNotMalformed

  • authenticationInstructionsAreNotMalformed<Opcodes>(instructions: ParsedAuthenticationInstructions<Opcodes>): instructions is AuthenticationInstruction<Opcodes>[]

Const base58AddressToLockingBytecode

Const base64ToBin

  • base64ToBin(validBase64: string): Uint8Array
  • Convert a base64-encoded string to a Uint8Array.

    Note, this method always completes. If validBase64 is not valid base64, an incorrect result will be returned. If validBase64 is potentially malformed, check it with isBase64 before calling this method.

    Parameters

    • validBase64: string

      a valid base64-encoded string to decode

    Returns Uint8Array

Const bech32PaddedToBin

  • Convert a padded bech32-encoded string (without checksum) to a Uint8Array, removing the padding. If the string is not valid Bech32, or if the array of 5-bit integers would require padding to be regrouped into 8-bit bytes, this method returns an error message.

    This method is the reverse of binToBech32Padded.

    Parameters

    • bech32Padded: string

      the padded bech32-encoded string to decode

    Returns Uint8Array | integerOutOfRange | hasDisallowedPadding | requiresDisallowedPadding | notBech32Padded

Const bigIntToBinUint256BEClamped

  • bigIntToBinUint256BEClamped(value: bigint): Uint8Array
  • Encode a positive BigInt into an unsigned 32-byte big-endian Uint8Array. This can be used to encoded numbers for cryptographic primitives like private keys, public keys, curve parameters, and signature points.

    Negative values will return the same result as 0, values higher than 2^256-1 will return the maximum expressible unsigned 256-bit value (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff).

    Parameters

    • value: bigint

      the BigInt to encode

    Returns Uint8Array

Const bigIntToBinUint64LE

  • bigIntToBinUint64LE(value: bigint): Uint8Array
  • Encode a positive BigInt as an 8-byte Uint64LE Uint8Array.

    This method will return an incorrect result for values outside of the range 0 to 0xffff_ffff_ffff_ffff.

    Parameters

    • value: bigint

      the number to encode

    Returns Uint8Array

Const bigIntToBinUint64LEClamped

  • bigIntToBinUint64LEClamped(value: bigint): Uint8Array
  • Encode a positive BigInt as an 8-byte Uint64LE Uint8Array, clamping the results. (Values exceeding 0xffff_ffff_ffff_ffff return the same result as 0xffff_ffff_ffff_ffff, negative values return the same result as 0.)

    Parameters

    • value: bigint

      the number to encode

    Returns Uint8Array

Const bigIntToBinUintLE

  • bigIntToBinUintLE(value: bigint): Uint8Array
  • Encode a positive BigInt as little-endian Uint8Array. Negative values will return the same result as 0.

    Parameters

    • value: bigint

      the number to encode

    Returns Uint8Array

Const bigIntToBitcoinVarInt

  • bigIntToBitcoinVarInt(value: bigint): Uint8Array
  • Encode a positive BigInt as a Bitcoin VarInt (Variable-length integer).

    Note: the maximum value of a Bitcoin VarInt is 0xffff_ffff_ffff_ffff. This method will return an incorrect result for values outside of the range 0 to 0xffff_ffff_ffff_ffff.

    Parameters

    • value: bigint

      the BigInt to encode (no larger than 0xffff_ffff_ffff_ffff)

    Returns Uint8Array

Const bigIntToScriptNumber

  • bigIntToScriptNumber(integer: bigint): Uint8Array
  • Convert a BigInt into the "Script Number" format. See parseBytesAsScriptNumber for more information.

    Parameters

    • integer: bigint

      the BigInt to encode as a Script Number

    Returns Uint8Array

Const binToBase64

  • binToBase64(bytes: Uint8Array): string
  • Convert a Uint8Array to a base64-encoded string.

    Parameters

    • bytes: Uint8Array

      the Uint8Array to base64 encode

    Returns string

Const binToBech32Padded

  • binToBech32Padded(bytes: Immutable<Uint8Array>): string
  • Convert a Uint8Array to a padded bech32-encoded string (without a checksum), adding padding bits as necessary to convert all bytes to 5-bit integers.

    This method is the reverse of bech32PaddedToBin.

    Parameters

    • bytes: Immutable<Uint8Array>

      the Uint8Array to bech32 encode

    Returns string

Const binToBigIntUint256BE

  • binToBigIntUint256BE(bin: Uint8Array): bigint
  • Decode an unsigned, 32-byte big-endian Uint8Array into a BigInt. This can be used to decode Uint8Array-encoded cryptographic primitives like private keys, public keys, curve parameters, and signature points.

    If starting from a hex value, consider using the BigInt constructor instead:

    BigInt(`0x${hex}`)

    Parameters

    • bin: Uint8Array

      the Uint8Array to decode

    Returns bigint

Const binToBigIntUint64LE

  • binToBigIntUint64LE(bin: Uint8Array): bigint
  • Decode an 8-byte Uint64LE Uint8Array into a BigInt.

    Throws if bin is shorter than 8 bytes.

    Parameters

    • bin: Uint8Array

      the Uint8Array to decode

    Returns bigint

Const binToBigIntUintBE

  • binToBigIntUintBE(bin: Uint8Array, bytes?: number): bigint
  • Decode a big-endian Uint8Array of any length into a BigInt. If starting from a hex value, consider using the BigInt constructor instead:

    BigInt(`0x${hex}`)

    The bytes parameter can be set to constrain the expected length (default: bin.length). This method throws if bin.length is not equal to bytes.

    Parameters

    • bin: Uint8Array

      the Uint8Array to decode

    • Default value bytes: number = bin.length

      the number of bytes to read (default: bin.length)

    Returns bigint

Const binToBigIntUintLE

  • binToBigIntUintLE(bin: Uint8Array, bytes?: number): bigint
  • Decode a little-endian Uint8Array of any length into a BigInt.

    The bytes parameter can be set to constrain the expected length (default: bin.length). This method throws if bin.length is not equal to bytes.

    Parameters

    • bin: Uint8Array

      the Uint8Array to decode

    • Default value bytes: number = bin.length

      the number of bytes to read (default: bin.length)

    Returns bigint

Const binToFixedLength

  • binToFixedLength(bin: Uint8Array, bytes: number): Uint8Array
  • Fill a new Uint8Array of a specific byte-length with the contents of a given Uint8Array, truncating or padding the Uint8Array with zeros.

    Parameters

    • bin: Uint8Array

      the Uint8Array to resize

    • bytes: number

      the desired byte-length

    Returns Uint8Array

Const binToHex

  • binToHex(bytes: Uint8Array): string
  • Encode a Uint8Array into a hexadecimal-encoded string.

    E.g.: binToHex(new Uint8Array([42, 100, 255]))'2a64ff'

    Parameters

    • bytes: Uint8Array

      a Uint8Array to encode

    Returns string

Const binToNumberUint16LE

  • binToNumberUint16LE(bin: Uint8Array): number
  • Decode a 2-byte Uint16LE Uint8Array into a number.

    Throws if bin is shorter than 2 bytes.

    Parameters

    • bin: Uint8Array

      the Uint8Array to decode

    Returns number

Const binToNumberUint32LE

  • binToNumberUint32LE(bin: Uint8Array): number
  • Decode a 4-byte Uint32LE Uint8Array into a number.

    Throws if bin is shorter than 4 bytes.

    Parameters

    • bin: Uint8Array

      the Uint8Array to decode

    Returns number

Const binToNumberUintLE

  • binToNumberUintLE(bin: Uint8Array, bytes?: number): number
  • Decode a little-endian Uint8Array of any length into a number. For numbers larger than Number.MAX_SAFE_INTEGER, use binToBigIntUintLE.

    The bytes parameter can be set to constrain the expected length (default: bin.length). This method throws if bin.length is not equal to bytes.

    privateremarks

    We avoid a bitwise strategy here because JavaScript uses 32-bit signed integers for bitwise math, so larger numbers are converted incorrectly. E.g. 2147483648 << 8 is 0, while 2147483648n << 8n is 549755813888n.

    Parameters

    • bin: Uint8Array

      the Uint8Array to decode

    • Default value bytes: number = bin.length

      the number of bytes to read (default: bin.length)

    Returns number

Const binToUtf8

  • binToUtf8(bytes: Uint8Array): string
  • Decode a Uint8Array as a UTF-8 string.

    Parameters

    • bytes: Uint8Array

      the Uint8Array to decode

    Returns string

Const bitcoinCashOperations

  • bitcoinCashOperations<Opcodes, State>(__namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }): { __computed: (Anonymous function) }
  • Type parameters

    Parameters

    • __namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }
        • requireBugValueZero: boolean
        • requireMinimalEncoding: boolean
        • requireNullSignatureFailures: boolean
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns { __computed: (Anonymous function) }

    • __computed: (Anonymous function)

Const bitwiseOperation

  • bitwiseOperation<State>(combine: (a: Uint8Array, b: Uint8Array) => Uint8Array): (Anonymous function)

Const bitwiseOperations

  • bitwiseOperations<Opcodes, State, Errors>(): { __computed: (state: ProgramState) => ProgramState }

Const booleanToScriptNumber

  • booleanToScriptNumber(value: boolean): Uint8Array
  • Convert a boolean into Script Number format (the type used to express boolean values emitted by several operations).

    Parameters

    • value: boolean

      the boolean value to convert

    Returns Uint8Array

Const cashAddressChecksumToUint5Array

  • cashAddressChecksumToUint5Array(checksum: number): number[]
  • Convert the checksum returned by cashAddressPolynomialModulo to an array of 5-bit positive integers which can be Base32 encoded.

    Parameters

    • checksum: number

      a 40 bit checksum returned by cashAddressPolynomialModulo

    Returns number[]

Const cashAddressPolynomialModulo

  • cashAddressPolynomialModulo(v: keyof number[]): number
  • Perform the CashAddress polynomial modulo operation, which is based on the Bech32 polynomial modulo operation, but the returned checksum is 40 bits, rather than 30.

    A.K.A. PolyMod

    remarks

    Notes from Bitcoin ABC: This function will compute what 8 5-bit values to XOR into the last 8 input values, in order to make the checksum 0. These 8 values are packed together in a single 40-bit integer. The higher bits correspond to earlier values.

    The input is interpreted as a list of coefficients of a polynomial over F = GF(32), with an implicit 1 in front. If the input is [v0,v1,v2,v3,v4], that polynomial is v(x) = 1x^5 + v0x^4 + v1x^3 + v2x^2 + v3*x + v4. The implicit 1 guarantees that [v0,v1,v2,...] has a distinct checksum from [0,v0,v1,v2,...].

    The output is a 40-bit integer whose 5-bit groups are the coefficients of the remainder of v(x) mod g(x), where g(x) is the cashaddr generator, x^8

    • [19]x^7 + [3]x^6 + [25]x^5 + [11]x^4 + [25]x^3 + [3]x^2 + [19]*x
    • [1]. g(x) is chosen in such a way that the resulting code is a BCH code, guaranteeing detection of up to 4 errors within a window of 1025 characters. Among the various possible BCH codes, one was selected to in fact guarantee detection of up to 5 errors within a window of 160 characters and 6 errors within a window of 126 characters. In addition, the code guarantee the detection of a burst of up to 8 errors.

    Note that the coefficients are elements of GF(32), here represented as decimal numbers between []. In this finite field, addition is just XOR of the corresponding numbers. For example, [27] + [13] = [27 ^ 13] = [22]. Multiplication is more complicated, and requires treating the bits of values themselves as coefficients of a polynomial over a smaller field, GF(2), and multiplying those polynomials mod a^5 + a^3 + 1. For example, [5] * [26] = (a^2 + 1) * (a^4 + a^3 + a) = (a^4 + a^3 + a) * a^2 + (a^4 + a^3 + a) = a^6 + a^5 + a^4 + a = a^3 + 1 (mod a^5 + a^3 + 1) = [9].

    During the course of the loop below, c contains the bit-packed coefficients of the polynomial constructed from just the values of v that were processed so far, mod g(x). In the above example, c initially corresponds to 1 mod (x), and after processing 2 inputs of v, it corresponds to x^2 + v0*x + v1 mod g(x). As 1 mod g(x) = 1, that is the starting value for c.

    privateremarks

    Derived from the bitcore-lib-cash implementation, which does not require BigInt: https://github.com/bitpay/bitcore

    Parameters

    • v: keyof number[]

      Array of 5-bit integers over which the checksum is to be computed

    Returns number

Const cashAddressPolynomialToCashAddress

  • cashAddressPolynomialToCashAddress(polynomial: keyof number[]): string
  • Convert a CashAddress polynomial to CashAddress string format.

    remarks

    CashAddress polynomials take the form:

    [lowest 5 bits of each prefix character] 0 [payload + checksum]

    This method remaps the 5-bit integers in the prefix location to the matching ASCII lowercase characters, replaces the separator with :, and then Bech32 encodes the remaining payload and checksum.

    Parameters

    • polynomial: keyof number[]

      an array of 5-bit integers representing the terms of a CashAddress polynomial

    Returns string

Const cashAddressToLockingBytecode

Const checkLimitsCommon

Const cloneAuthenticationProgramStateCommon

  • cloneAuthenticationProgramStateCommon<Opcodes, State, Errors>(state: State): { alternateStack: Uint8Array[]; correspondingOutput: undefined | Uint8Array; executionStack: boolean[]; instructions: (AuthenticationInstructionPush<Opcodes> | AuthenticationInstructionOperation<Opcodes>)[]; ip: number; lastCodeSeparator: number; locktime: number; operationCount: number; outpointIndex: number; outpointTransactionHash: Uint8Array; outputValue: number; sequenceNumber: number; signatureOperationsCount: number; stack: Uint8Array[]; transactionOutpoints: Uint8Array; transactionOutputs: Uint8Array; transactionSequenceNumbers: Uint8Array; version: number }
  • Type parameters

    Parameters

    • state: State

    Returns { alternateStack: Uint8Array[]; correspondingOutput: undefined | Uint8Array; executionStack: boolean[]; instructions: (AuthenticationInstructionPush<Opcodes> | AuthenticationInstructionOperation<Opcodes>)[]; ip: number; lastCodeSeparator: number; locktime: number; operationCount: number; outpointIndex: number; outpointTransactionHash: Uint8Array; outputValue: number; sequenceNumber: number; signatureOperationsCount: number; stack: Uint8Array[]; transactionOutpoints: Uint8Array; transactionOutputs: Uint8Array; transactionSequenceNumbers: Uint8Array; version: number }

    • alternateStack: Uint8Array[]
    • correspondingOutput: undefined | Uint8Array
    • executionStack: boolean[]
    • instructions: (AuthenticationInstructionPush<Opcodes> | AuthenticationInstructionOperation<Opcodes>)[]
    • ip: number
    • lastCodeSeparator: number
    • locktime: number
    • operationCount: number
    • outpointIndex: number
    • outpointTransactionHash: Uint8Array
    • outputValue: number
    • sequenceNumber: number
    • signatureOperationsCount: number
    • stack: Uint8Array[]
    • transactionOutpoints: Uint8Array
    • transactionOutputs: Uint8Array
    • transactionSequenceNumbers: Uint8Array
    • version: number

Const cloneStack

  • cloneStack(stack: keyof Readonly<Uint8Array>[]): Uint8Array[]

Const combineOperations

  • combineOperations<State>(firstOperation: Operation<State>, secondOperation: Operation<State>): (Anonymous function)

Const commonOperations

  • commonOperations<Opcodes, State, Errors>(__namedParameters: { flags: { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha1: { hash: Sha1["hash"] }; sha256: { hash: Sha256["hash"] } }): {}
  • Type parameters

    Parameters

    • __namedParameters: { flags: { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha1: { hash: Sha1["hash"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }
        • disallowUpgradableNops: boolean
        • requireBugValueZero: boolean
        • requireMinimalEncoding: boolean
        • requireNullSignatureFailures: boolean
      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha1: { hash: Sha1["hash"] }
        • hash: Sha1["hash"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns {}

Const compileScript

Const compileScriptText

  • compileScriptText<ProgramState, CompilerOperationData>(__namedParameters: { data: CompilationData<CompilerOperationData>; environment: CompilationEnvironment<CompilerOperationData, "signature" | "public_key">; script: string; scriptId: undefined | string }): CompilationResult<ProgramState>

Const compilerCreateStateCommon

Const compilerOperationBCHGenerateDataSignature

  • compilerOperationBCHGenerateDataSignature<OperationData>(name: "data_signature" | "schnorr_data_signature", signingAlgorithm: (secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }) => (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array): (Anonymous function)
  • Type parameters

    Parameters

    • name: "data_signature" | "schnorr_data_signature"
    • signingAlgorithm: (secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }) => (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array
        • (secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }): (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array
        • Parameters

          • secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }
            • signMessageHashDER: Secp256k1["signMessageHashDER"]
            • signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"]

          Returns (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array

            • (privateKey: Uint8Array, messageHash: Uint8Array): Uint8Array
            • Parameters

              • privateKey: Uint8Array
              • messageHash: Uint8Array

              Returns Uint8Array

    Returns (Anonymous function)

Const compilerOperationBCHGenerateSignature

  • compilerOperationBCHGenerateSignature<OperationData>(name: "signature" | "schnorr_signature", signingAlgorithm: (secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }) => (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array): (Anonymous function)
  • Type parameters

    Parameters

    • name: "signature" | "schnorr_signature"
    • signingAlgorithm: (secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }) => (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array
        • (secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }): (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array
        • Parameters

          • secp256k1: { signMessageHashDER: Secp256k1["signMessageHashDER"]; signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"] }
            • signMessageHashDER: Secp256k1["signMessageHashDER"]
            • signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"]

          Returns (privateKey: Uint8Array, messageHash: Uint8Array) => Uint8Array

            • (privateKey: Uint8Array, messageHash: Uint8Array): Uint8Array
            • Parameters

              • privateKey: Uint8Array
              • messageHash: Uint8Array

              Returns Uint8Array

    Returns (Anonymous function)

Const compilerOperationBCHGenerateSigningSerialization

  • compilerOperationBCHGenerateSigningSerialization<OperationData>(identifier: string, data: CompilationData<OperationData>, environment: CompilationEnvironment<OperationData>): string | Uint8Array

Const conditionalFlowControlOperations

  • conditionalFlowControlOperations<Opcodes, State, Errors>(): { __computed: (Anonymous function) }

Const conditionallyEvaluate

Const crackHdPrivateNodeFromHdPublicNodeAndChildPrivateNode

  • crackHdPrivateNodeFromHdPublicNodeAndChildPrivateNode<PublicNode>(crypto: { sha512: { hash: Sha512["hash"] } }, parentPublicNode: PublicNode, childPrivateNode: { childIndex: number; privateKey: Uint8Array }): cannotCrackHardenedDerivation | (PublicNode extends HdPublicNodeKnownParent ? HdPrivateNodeKnownParent : HdPrivateNodeValid)
  • Derive the HD private node from a HD public node, given any non-hardened child private node.

    remarks

    This exploits the "non-hardened" BIP32 derivation algorithm. Because non-hardened derivation only requires knowledge of the "chain code" (rather than requiring knowledge of the parent private key) it's possible to calculate the value by which the parent private key is "tweaked" to arrive at the child private key. Since we have the child private key, we simply subtract this "tweaked" amount to get back to the parent private key.

    The BIP32 "hardened" derivation algorithm is designed to address this weakness. Using hardened derivation, child private nodes can be shared without risk of leaking the parent private node, but this comes at the cost of public node derivation. Given only a parent public node, it is not possible to derive hardened child public keys, so applications must choose between support for HD public node derivation or support for sharing child private nodes.

    Type parameters

    Parameters

    • crypto: { sha512: { hash: Sha512["hash"] } }

      an implementation of sha512

      • sha512: { hash: Sha512["hash"] }
        • hash: Sha512["hash"]
    • parentPublicNode: PublicNode

      the parent HD public node for which to derive a private node

    • childPrivateNode: { childIndex: number; privateKey: Uint8Array }

      any non-hardened child private node of the parent node

      • childIndex: number
      • privateKey: Uint8Array

    Returns cannotCrackHardenedDerivation | (PublicNode extends HdPublicNodeKnownParent ? HdPrivateNodeKnownParent : HdPrivateNodeValid)

Const createAuthenticationProgramExternalStateCommon

Const createAuthenticationProgramExternalStateCommonEmpty

  • createAuthenticationProgramExternalStateCommonEmpty(): { correspondingOutput: Uint8Array; locktime: number; outpointIndex: number; outpointTransactionHash: Uint8Array; outputValue: number; sequenceNumber: number; transactionOutpoints: Uint8Array; transactionOutputs: Uint8Array; transactionSequenceNumbers: Uint8Array; version: number }
  • This is a meaningless but complete CommonExternalProgramState, useful for testing and debugging.

    Returns { correspondingOutput: Uint8Array; locktime: number; outpointIndex: number; outpointTransactionHash: Uint8Array; outputValue: number; sequenceNumber: number; transactionOutpoints: Uint8Array; transactionOutputs: Uint8Array; transactionSequenceNumbers: Uint8Array; version: number }

    • correspondingOutput: Uint8Array
    • locktime: number
    • outpointIndex: number
    • outpointTransactionHash: Uint8Array
    • outputValue: number
    • sequenceNumber: number
    • transactionOutpoints: Uint8Array
    • transactionOutputs: Uint8Array
    • transactionSequenceNumbers: Uint8Array
    • version: number

Const createAuthenticationProgramInternalStateCommon

Const createAuthenticationProgramStateCommon

Const createAuthenticationProgramStateCommonEmpty

Const createAuthenticationVirtualMachine

Const createBaseConverter

  • Create a BaseConverter, which exposes methods for encoding and decoding Uint8Arrays using bitcoin-style padding: each leading zero in the input is replaced with the zero-index character of the alphabet, then the remainder of the input is encoded as a large number in the specified alphabet.

    For example, using the alphabet 01, the input [0, 15] is encoded 01111 – a single 0 represents the leading padding, followed by the base2 encoded 0x1111 (15). With the same alphabet, the input [0, 0, 255] is encoded 0011111111 - only two 0 characters are required to represent both leading zeros, followed by the base2 encoded 0x11111111 (255).

    This is not compatible with RFC 3548's Base16, Base32, or Base64.

    If the alphabet is malformed, this method returns the error as a string.

    privateremarks

    Algorithm from the base-x implementation (which is derived from the original Satoshi implementation): https://github.com/cryptocoinjs/base-x

    Parameters

    • alphabet: string

      an ordered string which maps each index to a character, e.g. 0123456789.

    Returns BaseConversionError | BaseConverter

Const createCompiler

  • createCompiler<CompilerOperationData, ProgramState>(compilationEnvironment: CompilationEnvironment<CompilerOperationData>): Compiler<CompilerOperationData, ProgramState>
  • Create a Compiler from the provided compilation environment. This method requires a full CompilationEnvironment and does not instantiate any new crypto or VM implementations.

    Type parameters

    • CompilerOperationData

    • ProgramState

    Parameters

    • compilationEnvironment: CompilationEnvironment<CompilerOperationData>

      the environment from which to create the compiler

    Returns Compiler<CompilerOperationData, ProgramState>

Const createCompilerBCH

  • createCompilerBCH<CompilerOperationData, ProgramState>(overrides: CompilationEnvironment<CompilerOperationData>): Promise<Compiler<CompilerOperationData, ProgramState>>

Const createIdentifierResolver

  • Return an IdentifierResolutionFunction for use in resolveScriptSegment.

    Type parameters

    • CompilerOperationData

    Parameters

    • scriptId: string | undefined

      the id of the script for which the resulting IdentifierResolutionFunction will be used.

    • data: CompilationData<CompilerOperationData>

      the actual variable values (private keys, shared wallet data, shared address data, etc.) to use in resolving variables.

    • environment: CompilationEnvironment<CompilerOperationData>

      a snapshot of the context around scriptId. See CompilationEnvironment for details.

    Returns IdentifierResolutionFunction

Const createInstructionSetBCH

  • createInstructionSetBCH(__namedParameters: { flags: { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha1: { hash: Sha1["hash"] }; sha256: { hash: Sha256["hash"] } }): InstructionSet<AuthenticationProgramBCH, AuthenticationProgramStateBCH>
  • Initialize a new instruction set for the BCH virtual machine.

    Parameters

    • __namedParameters: { flags: { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha1: { hash: Sha1["hash"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }
        • disallowUpgradableNops: boolean
        • requireBugValueZero: boolean
        • requireMinimalEncoding: boolean
        • requireNullSignatureFailures: boolean
      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha1: { hash: Sha1["hash"] }
        • hash: Sha1["hash"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns InstructionSet<AuthenticationProgramBCH, AuthenticationProgramStateBCH>

Const createTestAuthenticationProgramBCH

  • createTestAuthenticationProgramBCH(__namedParameters: { lockingBytecode: Uint8Array; satoshis: number; sha256: { hash: Sha256["hash"] }; unlockingBytecode: Uint8Array }): { inputIndex: number; sourceOutput: Output<Uint8Array, number>; spendingTransaction: Transaction<Input<Uint8Array, Uint8Array>, Output<Uint8Array, number>> }
  • Parameters

    • __namedParameters: { lockingBytecode: Uint8Array; satoshis: number; sha256: { hash: Sha256["hash"] }; unlockingBytecode: Uint8Array }
      • lockingBytecode: Uint8Array
      • satoshis: number
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
      • unlockingBytecode: Uint8Array

    Returns { inputIndex: number; sourceOutput: Output<Uint8Array, number>; spendingTransaction: Transaction<Input<Uint8Array, Uint8Array>, Output<Uint8Array, number>> }

    • inputIndex: number
    • sourceOutput: Output<Uint8Array, number>
    • spendingTransaction: Transaction<Input<Uint8Array, Uint8Array>, Output<Uint8Array, number>>

Const cryptoOperations

  • cryptoOperations<Opcodes, State, Errors>(__namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha1: { hash: Sha1["hash"] }; sha256: { hash: Sha256["hash"] } }): { __computed: (state: ProgramState) => ProgramState }
  • Type parameters

    Parameters

    • __namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha1: { hash: Sha1["hash"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }
        • requireBugValueZero: boolean
        • requireMinimalEncoding: boolean
        • requireNullSignatureFailures: boolean
      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha1: { hash: Sha1["hash"] }
        • hash: Sha1["hash"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns { __computed: (state: ProgramState) => ProgramState }

    • __computed: (state: ProgramState) => ProgramState
        • (state: ProgramState): ProgramState
        • Parameters

          • state: ProgramState

          Returns ProgramState

Const dateToLocktime

  • dateToLocktime(date: Date): Uint8Array | outOfRange
  • Convert a Javascript Date object to its equivalent transaction locktime representation. The date is rounded to the nearest second (the precision of locktime Dates).

    Note: a block-based locktime can simply be encoded with numberToBinUint32LE (provided it is no larger than the maximum, 499999999).

    Parameters

    • date: Date

      the Date to convert to a locktime Uint8Array

    Returns Uint8Array | outOfRange

Const decodeBase58Address

  • Decode and validate a Base58Address, strictly checking the version and payload length.

    For other address-like standards which closely follow the Base58Address format (but have alternative version byte requirements), use decodeBase58AddressFormat.

    remarks

    Because the Wallet Import Format (WIF) private key serialization format uses the Base58Address format, some libraries allow WIF key decoding via the same method as base58 address decoding. This method strictly accepts only Base58Address types, but WIF keys can be decoded with decodePrivateKeyWif.

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256 (a universal implementation is available via instantiateSha256)

      • hash: Sha256["hash"]
    • address: string

      the string to decode as a base58 address

    Returns unknownCharacter | tooShort | invalidChecksum | unknownAddressVersion | incorrectLength | { payload: Uint8Array; version: number }

Const decodeBase58AddressFormat

  • Attempt to decode a Base58Address-formatted string. This is more lenient than decodeCashAddress, which also validates the address version.

    Returns the contents of the address or an error message as a string.

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256 (a universal implementation is available via instantiateSha256)

      • hash: Sha256["hash"]
    • address: string

      the string to decode as a base58 address

    Returns unknownCharacter | tooShort | invalidChecksum | { payload: Uint8Array; version: number }

Const decodeBech32

  • decodeBech32(validBech32: string): (0 | 2 | 16 | 1 | 4 | 3 | 8 | 6 | 18 | 12 | 31 | 7 | 10 | 15 | 9 | 5 | 11 | 13 | 14 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30)[]
  • Decode a Bech32-encoded string into an array of 5-bit integers.

    Note, this method always completes. If validBech32 is not valid bech32, an incorrect result will be returned. If validBech32 is potentially malformed, check it with isBech32 before calling this method.

    Parameters

    • validBech32: string

      the bech32-encoded string to decode

    Returns (0 | 2 | 16 | 1 | 4 | 3 | 8 | 6 | 18 | 12 | 31 | 7 | 10 | 15 | 9 | 5 | 11 | 13 | 14 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30)[]

Const decodeBitcoinSignature

  • decodeBitcoinSignature(encodedSignature: Uint8Array): { signature: Uint8Array; signingSerializationType: Uint8Array }
  • Split a bitcoin-encoded signature into a signature and signing serialization type.

    While a bitcoin-encoded signature only includes a single byte to encode the signing serialization type, a 3-byte forkId can be appended to the signing serialization to provide replay-protection between different forks. (See Bitcoin Cash's Replay Protected Sighash spec for details.)

    Parameters

    • encodedSignature: Uint8Array

    Returns { signature: Uint8Array; signingSerializationType: Uint8Array }

    • signature: Uint8Array
    • signingSerializationType: Uint8Array

Const decodeCashAddress

Const decodeCashAddressFormat

Const decodeCashAddressFormatWithoutPrefix

Const decodeCashAddressVersionByte

  • decodeCashAddressVersionByte(version: number): reservedBitSet | { bitLength: 192 | 224 | 160 | 256 | 320 | 384 | 448 | 512; type: number }

Const decodeHdKey

Const decodeHdPrivateKey

Const decodeHdPublicKey

Const decodePrivateKeyWif

  • decodePrivateKeyWif(sha256: { hash: Sha256["hash"] }, wifKey: string): unknownCharacter | tooShort | invalidChecksum | { privateKey: Uint8Array; type: "mainnet" | "testnet" | "mainnet-uncompressed" | "testnet-uncompressed" }
  • Decode a private key using Wallet Import Format (WIF). See encodePrivateKeyWif for details.

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256 (a universal implementation is available via instantiateSha256)

      • hash: Sha256["hash"]
    • wifKey: string

      the private key to decode (in Wallet Import Format)

    Returns unknownCharacter | tooShort | invalidChecksum | { privateKey: Uint8Array; type: "mainnet" | "testnet" | "mainnet-uncompressed" | "testnet-uncompressed" }

Const deriveHdPath

  • deriveHdPath<NodeType>(crypto: { ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { addTweakPrivateKey: Secp256k1["addTweakPrivateKey"]; addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"]; derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }; sha256: { hash: Sha256["hash"] }; sha512: { hash: Sha512["hash"] } }, node: NodeType, path: string): invalidDerivationPath | invalidPrivateDerivationPrefix | invalidPublicDerivationPrefix | ReductionResults<NodeType>
  • Derive a child HD node from a parent node given a derivation path. The resulting node is the same type as the parent node (private nodes return private nodes, public nodes return public nodes).

    remarks

    The derivation path uses the notation specified in BIP32:

    The first character must be either m for private derivation or M for public derivation, followed by sets of / and a number representing the child index used in the derivation at that depth. Hardened derivation is represented by a trailing ', and may only appear in private derivation paths (hardened derivation requires knowledge of the private key). Hardened child indexes are represented with the hardened index offset (2147483648) subtracted.

    For example, m/0/1'/2 uses private derivation (m), with child indexes in the following order:

    derivePrivate(derivePrivate(derivePrivate(node, 0), 2147483648 + 1), 2)

    Likewise, M/3/4/5 uses public derivation (M), with child indexes in the following order:

    derivePublic(derivePublic(derivePublic(node, 3), 4), 5)

    Because hardened derivation requires a private node, paths which specify public derivation (M) using hardened derivation (') will return an error. To derive the public node associated with a child private node which requires hardened derivation, begin with private derivation, then provide the result to deriveHdPublicNode.

    Type parameters

    Parameters

    • crypto: { ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { addTweakPrivateKey: Secp256k1["addTweakPrivateKey"]; addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"]; derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }; sha256: { hash: Sha256["hash"] }; sha512: { hash: Sha512["hash"] } }

      implementations of sha256, sha512, ripemd160, and secp256k1 derivation functions – these are available via instantiateBIP32Crypto

      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • secp256k1: { addTweakPrivateKey: Secp256k1["addTweakPrivateKey"]; addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"]; derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }
        • addTweakPrivateKey: Secp256k1["addTweakPrivateKey"]
        • addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"]
        • derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
      • sha512: { hash: Sha512["hash"] }
        • hash: Sha512["hash"]
    • node: NodeType

      the HD node from which to begin the derivation (for paths beginning with m, an HdPrivateNodeValid; for paths beginning with M, an HdPublicNode)

    • path: string

      the BIP32 derivation path, e.g. m/0/1'/2 or M/3/4/5

    Returns invalidDerivationPath | invalidPrivateDerivationPrefix | invalidPublicDerivationPrefix | ReductionResults<NodeType>

Const deriveHdPrivateNodeChild

  • Derive a child HD private node from an HD private node.

    To derive a child HD public node, use deriveHdPublicNode on the result of this method. If the child uses a non-hardened index, it's also possible to use deriveHdPublicNodeChild.

    privateremarks

    The Secp256k1.addTweakPrivateKey method throws if the tweak is out of range or if the resulting private key would be invalid. The procedure to handle this error is standardized by BIP32: return the HD node at the next child index. (Regardless, this scenario is incredibly unlikely without a weakness in HMAC-SHA512.)

    Parameters

    • crypto: { ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { addTweakPrivateKey: Secp256k1["addTweakPrivateKey"]; derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }; sha256: { hash: Sha256["hash"] }; sha512: { hash: Sha512["hash"] } }

      implementations of sha256, ripemd160, secp256k1 compressed public key derivation, and secp256k1 private key "tweak addition" (application of the EC group operation) – these are available via instantiateBIP32Crypto

      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • secp256k1: { addTweakPrivateKey: Secp256k1["addTweakPrivateKey"]; derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }
        • addTweakPrivateKey: Secp256k1["addTweakPrivateKey"]
        • derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
      • sha512: { hash: Sha512["hash"] }
        • hash: Sha512["hash"]
    • node: HdPrivateNodeValid

      the valid HD private node from which to derive the child node

    • index: number

      the index at which to derive the child node - indexes greater than or equal to the hardened index offset (0x80000000/2147483648) are derived using the "hardened" derivation algorithm

    Returns HdPrivateNodeKnownParent | childIndexExceedsMaximum | nextChildIndexRequiresHardenedAlgorithm

Const deriveHdPrivateNodeFromSeed

  • deriveHdPrivateNodeFromSeed<AssumedValidity>(crypto: { sha512: { hash: Sha512["hash"] } }, seed: Uint8Array, assumeValidity?: AssumedValidity)
  • Derive an HdPrivateNode from the provided seed following the BIP32 specification. A seed should include between 16 bytes and 64 bytes of entropy (recommended: 32 bytes).

    Type parameters

    • AssumedValidity: boolean | undefined

    Parameters

    • crypto: { sha512: { hash: Sha512["hash"] } }

      an implementation of sha512

      • sha512: { hash: Sha512["hash"] }
        • hash: Sha512["hash"]
    • seed: Uint8Array

      the entropy from which to derive the HdPrivateNode

    • Optional assumeValidity: AssumedValidity

      if set, the derived private key will not be checked for validity, and will be assumed valid if true or invalid if false (this is useful for testing)

Const deriveHdPrivateNodeIdentifier

  • deriveHdPrivateNodeIdentifier(crypto: { ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }; sha256: { hash: Sha256["hash"] } }, hdPrivateNode: HdPrivateNodeValid): Uint8Array
  • Derive the public identifier for a given HD private node. This is used to uniquely identify HD nodes in software. The first 4 bytes of this identifier are considered its "fingerprint".

    Parameters

    • crypto: { ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }; sha256: { hash: Sha256["hash"] } }

      implementations of sha256, ripemd160, and secp256k1 compressed public key derivation

      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • secp256k1: { derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }
        • derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
    • hdPrivateNode: HdPrivateNodeValid

      the HD private node from which to derive the public identifier (not require to be valid)

    Returns Uint8Array

Const deriveHdPublicNode

  • deriveHdPublicNode<PrivateNode>(crypto: { secp256k1: { derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] } }, node: PrivateNode): PrivateNode extends HdPrivateNodeKnownParent ? HdPublicNodeKnownParent : HdPublicNode
  • Derive the HD public node of an HD private node.

    Though private keys cannot be derived from HD public keys, sharing HD public keys still carries risk. Along with allowing an attacker to associate wallet addresses together (breaking privacy), should an attacker gain knowledge of a single child private key, it's possible to derive all parent HD private keys. See crackHdPrivateNodeFromHdPublicNodeAndChildPrivateNode for details.

    Type parameters

    Parameters

    • crypto: { secp256k1: { derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] } }

      an implementation of secp256k1 compressed public key derivation (e.g. instantiateSecp256k1)

      • secp256k1: { derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"] }
        • derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"]
    • node: PrivateNode

      a valid HD private node

    Returns PrivateNode extends HdPrivateNodeKnownParent ? HdPublicNodeKnownParent : HdPublicNode

Const deriveHdPublicNodeChild

  • Derive a non-hardened child HD public node from an HD public node.

    Because hardened derivation also requires knowledge of the parent private node, it's not possible to use an HD public node to derive a hardened child HD public node.

    Though private keys cannot be derived from HD public keys, sharing HD public keys still carries risk. Along with allowing an attacker to associate wallet addresses together (breaking privacy), should an attacker gain knowledge of a single child private key, it's possible to derive all parent HD private keys. See crackHdPrivateNodeFromHdPublicNodeAndChildPrivateNode for details.

    privateremarks

    The Secp256k1.addTweakPublicKeyCompressed method throws if the tweak is out of range or if the resulting public key would be invalid. The procedure to handle this error is standardized by BIP32: return the HD node at the next child index. (Regardless, this scenario is incredibly unlikely without a weakness in HMAC-SHA512.)

    Parameters

    • crypto: { ripemd160: { hash: Ripemd160["hash"] }; secp256k1: { addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"] }; sha256: { hash: Sha256["hash"] }; sha512: { hash: Sha512["hash"] } }

      implementations of sha256, sha512, ripemd160, and secp256k1 compressed public key "tweak addition" (application of the EC group operation) – these are available via instantiateBIP32Crypto

      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • secp256k1: { addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"] }
        • addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
      • sha512: { hash: Sha512["hash"] }
        • hash: Sha512["hash"]
    • node: HdPublicNode

      the HD public node from which to derive the child public node

    • index: number

      the index at which to derive the child node

    Returns HdPublicNodeKnownParent | hardenedDerivationRequiresPrivateNode | nextChildIndexRequiresHardenedAlgorithm

Const deriveHdPublicNodeIdentifier

  • deriveHdPublicNodeIdentifier(crypto: { ripemd160: { hash: Ripemd160["hash"] }; sha256: { hash: Sha256["hash"] } }, node: HdPublicNode): Uint8Array
  • Derive the public identifier for a given HdPublicNode. This is used to uniquely identify HD nodes in software. The first 4 bytes of this identifier are considered its fingerprint.

    Parameters

    • crypto: { ripemd160: { hash: Ripemd160["hash"] }; sha256: { hash: Sha256["hash"] } }

      implementations of sha256 and ripemd160

      • ripemd160: { hash: Ripemd160["hash"] }
        • hash: Ripemd160["hash"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
    • node: HdPublicNode

    Returns Uint8Array

Const describeExpectedInput

  • describeExpectedInput(expectedArray: string[]): string
  • A text-formatting method to pretty-print the list of expected inputs (Encountered unexpected input while parsing script. Expected ...). If present, the EOF expectation is always moved to the end of the list.

    Parameters

    • expectedArray: string[]

      the alphabetized list of expected inputs produced by parseScript

    Returns string

Const deserializeTransaction

  • TODO: document return type (note outpointTransactionHash is little-endian – most UIs display big-endian transaction hashes)

    Note: this method throws runtime errors when attempting to decode improperly encoded transactions.

    Parameters

    • bin: Uint8Array

      the raw transaction to decode

    Returns Transaction

Const disabledOperation

  • disabledOperation<State, Errors>(): (Anonymous function)

Const disabledOperations

  • disabledOperations<State, Errors>(): { __computed: (Anonymous function) }

Const disassembleAuthenticationInstruction

Const disassembleBytecode

  • disassembleBytecode<Opcode>(opcodes: {}, bytecode: Uint8Array): string
  • Disassemble authentication bytecode into a lossless ASM representation.

    TODO: a similar method which re-formats ASM strings, converting HexLiterals to Script Numbers or UTF8Literals.

    Type parameters

    • Opcode

    Parameters

    • opcodes: {}

      the set to use when determining the name of opcodes, e.g. OpcodesBCH

      • [opcode: number]: string
    • bytecode: Uint8Array

      the authentication bytecode to disassemble

    Returns string

Const disassembleBytecodeBCH

  • disassembleBytecodeBCH(bytecode: Uint8Array): string

Const disassembleBytecodeBTC

  • disassembleBytecodeBTC(bytecode: Uint8Array): string

Const disassembleParsedAuthenticationInstruction

Const disassembleParsedAuthenticationInstructionMalformed

Const disassembleParsedAuthenticationInstructions

Const emptyHash

  • emptyHash(): Uint8Array

Const emptyReductionTraceNode

  • emptyReductionTraceNode(range: Range): { bytecode: Uint8Array; range: Range }

Const encodeBase58Address

  • encodeBase58Address(sha256: { hash: Sha256["hash"] }, type: "p2pkh" | "p2sh" | "p2pkh-testnet" | "p2sh-testnet" | "p2pkh-copay-bch" | "p2sh-copay-bch", payload: Uint8Array): string
  • Encode a hash as a Base58Address.

    Note, this method does not enforce error handling via the type system. The returned string will not be a valid Base58Address if hash is not exactly 20 bytes. If needed, validate the length of hash before calling this method.

    For other standards which use the Base58Address format but have other version or length requirements, use encodeCashAddressFormat.

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256 (a universal implementation is available via instantiateSha256)

      • hash: Sha256["hash"]
    • type: "p2pkh" | "p2sh" | "p2pkh-testnet" | "p2sh-testnet" | "p2pkh-copay-bch" | "p2sh-copay-bch"

      the type of address to encode: p2pkh, p2sh, p2pkh-testnet, or p2sh-testnet

    • payload: Uint8Array

    Returns string

Const encodeBase58AddressFormat

  • encodeBase58AddressFormat<VersionType>(sha256: { hash: Sha256["hash"] }, version: VersionType, payload: Uint8Array): string
  • Encode a payload using the Base58Address format, the original address format used by the Satoshi implementation.

    Note, this method does not enforce error handling via the type system. The returned string will not be a valid Base58Address if hash is not exactly 20 bytes. If needed, validate the length of hash before calling this method.

    remarks

    A Base58Address includes a 1-byte prefix to indicate the address version, a variable-length payload, and a 4-byte checksum:

    [version: 1 byte] [payload: variable length] [checksum: 4 bytes]

    The checksum is the first 4 bytes of the double-SHA256 hash of the version byte followed by the payload.

    Type parameters

    • VersionType: number

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256 (a universal implementation is available via instantiateSha256)

      • hash: Sha256["hash"]
    • version: VersionType

      the address version byte (see Base58Version)

    • payload: Uint8Array

      the Uint8Array payload to encode

    Returns string

Const encodeBech32

  • encodeBech32(base32IntegerArray: keyof number[]): string
  • Encode an array of numbers as a base32 string using the Bech32 character set.

    Note, this method always completes. For a valid result, all items in base32IntegerArray must be between 0 and 32.

    Parameters

    • base32IntegerArray: keyof number[]

      the array of 5-bit integers to encode

    Returns string

Const encodeCashAddress

  • encodeCashAddress<Prefix, Type>(prefix: Prefix, type: Type, hash: Uint8Array): string
  • Encode a hash as a CashAddress.

    Note, this method does not enforce error handling via the type system. The returned string may be a CashAddressEncodingError.unsupportedHashLength if hash is not a valid length. Check the result if the input is potentially malformed.

    For other address standards which closely follow the CashAddress specification (but have alternative version byte requirements), use encodeCashAddressFormat.

    Type parameters

    Parameters

    • prefix: Prefix

      a valid prefix indicating the network for which to encode the address (usually a CashAddressNetworkPrefix) – must be only lowercase letters

    • type: Type

      the CashAddressType to encode in the version byte – usually a CashAddressType

    • hash: Uint8Array

      the hash to encode (for P2PKH, the public key hash; for P2SH, the redeeming bytecode hash)

    Returns string

Const encodeCashAddressFormat

  • encodeCashAddressFormat<Prefix, Version>(prefix: Prefix, version: Version, hash: Immutable<Uint8Array>): string
  • Encode a hash as a CashAddress-like string using the CashAddress format.

    To encode a standard CashAddress, use encodeCashAddress.

    Type parameters

    • Prefix: string

    • Version: number

    Parameters

    • prefix: Prefix

      a valid prefix indicating the network for which to encode the address – must be only lowercase letters

    • version: Version

      a single byte indicating the version of this address

    • hash: Immutable<Uint8Array>

      the hash to encode

    Returns string

Const encodeCashAddressVersionByte

  • Encode a CashAddress version byte for the given address type and hash length. See CashAddressVersionByte for more information.

    The type parameter must be a number between 0 and 15, and bitLength must be one of the standardized lengths. To use the contents of a variable, cast it to CashAddressType or CashAddressSize respectively, e.g.:

    const type = 3 as CashAddressType;
    const size = 160 as CashAddressSize;
    getCashAddressVersionByte(type, size);

    Parameters

    Returns number

Const encodeDataPush

  • encodeDataPush(data: Uint8Array): Uint8Array
  • Returns the minimal bytecode required to push the provided data to the stack.

    remarks

    This method conservatively encodes a Uint8Array as a data push. For Script Numbers which can be pushed using a single opcode (-1 through 16), the equivalent bytecode value is returned. Other data values will be prefixed with the proper opcode and push length bytes (if necessary) to create the minimal push instruction.

    Note, while some single-byte Script Number pushes will be minimally-encoded by this method, all larger inputs will be encoded as-is (it cannot be assumed that inputs are intended to be used as Script Numbers). To encode the push of a Script Number, minimally-encode the number before passing it to this method, e.g.: encodeDataPush(bigIntToScriptNumber(parseBytesAsScriptNumber(nonMinimalNumber))).

    The maximum bytecode length which can be encoded for a push in the Bitcoin system is 4294967295 (~4GB). This method assumes a smaller input – if bytecode has the potential to be longer, it should be checked (and the error handled) prior to calling this method.

    Parameters

    • data: Uint8Array

      the Uint8Array to push to the stack

    Returns Uint8Array

Const encodeHdPrivateKey

  • Encode an HD private key (as defined by BIP32) given an HD private node.

    Parameters

    • crypto: { sha256: { hash: Sha256["hash"] } }

      an implementation of sha256

      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
    • keyParameters: HdKeyParameters<HdPrivateNodeValid>

      a valid HD private node and the network for which to encode the key

    Returns string

Const encodeHdPublicKey

  • Encode an HD public key (as defined by BIP32) given an HD public node.

    Parameters

    • crypto: { sha256: { hash: Sha256["hash"] } }

      an implementation of sha256

      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]
    • keyParameters: HdKeyParameters<HdPublicNode>

      an HD public node and the network for which to encode the key

    Returns string

Const encodePrivateKeyWif

  • encodePrivateKeyWif(sha256: { hash: Sha256["hash"] }, privateKey: Uint8Array, type: WalletImportFormatType): string
  • Encode a private key using Wallet Import Format (WIF).

    WIF encodes the 32-byte private key, a 4-byte checksum, and a type indicating the intended usage for the private key. See WalletImportFormatType for details.

    remarks

    WIF-encoding uses the Base58Address format with version Base58AddressFormatVersion.wif (128/0x80) or Base58AddressFormatVersion.wifTestnet (239/0xef), respectively.

    To indicate that the private key is intended for use in a P2PKH address using the compressed form of its derived public key, a 0x01 is appended to the payload prior to encoding. For the uncompressed construction, the extra byte is omitted.

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256 (a universal implementation is available via instantiateSha256)

      • hash: Sha256["hash"]
    • privateKey: Uint8Array

      a 32-byte Secp256k1 ECDSA private key

    • type: WalletImportFormatType

      the intended usage of the private key (e.g. mainnet or testnet)

    Returns string

Const equals

Const evaluateInstructionAggregations

Const executionIsActive

  • executionIsActive<State>(state: State): boolean

Const flattenBinArray

  • flattenBinArray(array: keyof Uint8Array[]): Uint8Array
  • Reduce an array of Uint8Arrays into a single Uint8Array.

    Parameters

    • array: keyof Uint8Array[]

      the array of Uint8Arrays to flatten

    Returns Uint8Array

Const formatAsmPushHex

  • formatAsmPushHex(data: Uint8Array): string

Const formatMissingBytesAsm

  • formatMissingBytesAsm(missing: number): string

Const generateBytecodeMap

  • generateBytecodeMap(opcodes: object): {}

Const generatePrivateKey

  • generatePrivateKey(secureRandom: () => Uint8Array): Uint8Array
  • Securely generate a valid Secp256k1 private key given a secure source of randomness.

    Node.js Usage

    import { randomBytes } from 'crypto';
    import { generatePrivateKey } from 'bitcoin-ts';
    
    const key = generatePrivateKey(secp256k1, () => randomBytes(32));

    Browser Usage

    import { generatePrivateKey } from 'bitcoin-ts';
    
    const key = generatePrivateKey(secp256k1, () =>
      window.crypto.getRandomValues(new Uint8Array(32))
    );

    Parameters

    • secureRandom: () => Uint8Array

      a method which returns a securely-random 32-byte Uint8Array

        • (): Uint8Array
        • Returns Uint8Array

    Returns Uint8Array

Const generateSigningSerializationBCH

  • generateSigningSerializationBCH(__namedParameters: { correspondingOutput: undefined | Uint8Array; coveredBytecode: Uint8Array; forkId: Uint8Array; locktime: number; outpointIndex: number; outpointTransactionHash: Uint8Array; outputValue: number; sequenceNumber: number; sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionOutpoints: Uint8Array; transactionOutputs: Uint8Array; transactionSequenceNumbers: Uint8Array; version: number }): Uint8Array
  • Serialize the signature-protected properties of a transaction following the algorithm required by the signingSerializationType of a signature.

    Parameters

    • __namedParameters: { correspondingOutput: undefined | Uint8Array; coveredBytecode: Uint8Array; forkId: Uint8Array; locktime: number; outpointIndex: number; outpointTransactionHash: Uint8Array; outputValue: number; sequenceNumber: number; sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionOutpoints: Uint8Array; transactionOutputs: Uint8Array; transactionSequenceNumbers: Uint8Array; version: number }
      • correspondingOutput: undefined | Uint8Array
      • coveredBytecode: Uint8Array
      • forkId: Uint8Array
      • locktime: number
      • outpointIndex: number
      • outpointTransactionHash: Uint8Array
      • outputValue: number
      • sequenceNumber: number
      • sha256: { hash: (input: Uint8Array) => Uint8Array }
        • hash: (input: Uint8Array) => Uint8Array
            • (input: Uint8Array): Uint8Array
            • Parameters

              • input: Uint8Array

              Returns Uint8Array

      • signingSerializationType: Uint8Array
      • transactionOutpoints: Uint8Array
      • transactionOutputs: Uint8Array
      • transactionSequenceNumbers: Uint8Array
      • version: number

    Returns Uint8Array

Const getBitcoinIdentifier

  • getBitcoinIdentifier(data: Uint8Array, sha256: { hash: Sha256["hash"] }): Uint8Array
  • Derive a standard identifier from a serialized data structure.

    remarks

    By convention, Bitcoin transaction and block identifiers are derived by double-sha256 hashing their serialized form, and reversing the byte order. (The result of sha256 is defined by its specification as big-endian, and bitcoin displays hashes in little-endian format.)

    Parameters

    • data: Uint8Array

      the serialized raw data being identified

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256

      • hash: Sha256["hash"]

    Returns Uint8Array

    an identifier in little-endian byte order

Const getBitcoinTransactionId

  • getBitcoinTransactionId(transaction: Uint8Array, sha256: { hash: Sha256["hash"] }): string
  • Derive a standard transaction identifier from a serialized transaction.

    Parameters

    • transaction: Uint8Array

      the serialized transaction

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256

      • hash: Sha256["hash"]

    Returns string

    a Transaction ID in little-endian byte order

Const getCompilerOperationsBCH

  • getCompilerOperationsBCH(): CompilationEnvironment<CompilerOperationDataBCH, CompilerOperationsBCH>["operations"]

Const getEmbeddedRipemd160Binary

  • getEmbeddedRipemd160Binary(): ArrayBuffer | SharedArrayBuffer

Const getEmbeddedSecp256k1Binary

  • getEmbeddedSecp256k1Binary(): ArrayBuffer | SharedArrayBuffer

Const getEmbeddedSha1Binary

  • getEmbeddedSha1Binary(): ArrayBuffer

Const getEmbeddedSha256Binary

  • getEmbeddedSha256Binary(): ArrayBuffer | SharedArrayBuffer

Const getEmbeddedSha512Binary

  • getEmbeddedSha512Binary(): ArrayBuffer | SharedArrayBuffer

Const getFlagsForInstructionSetBCH

  • getFlagsForInstructionSetBCH(instructionSet: InstructionSetBCH): { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }
  • Parameters

    Returns { disallowUpgradableNops: boolean; requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }

    • disallowUpgradableNops: boolean
    • requireBugValueZero: boolean
    • requireMinimalEncoding: boolean
    • requireNullSignatureFailures: boolean

Const getInstructionLengthBytes

Const getResolutionErrors

Const getSigningSerializationType

  • getSigningSerializationType(algorithmIdentifier: string, prefix?: string): undefined | Uint8Array

Const hasMalformedLength

Const hasUnnecessaryPadding

  • hasUnnecessaryPadding(length: number, firstByte: number, secondByte: number): boolean

Const hashOutputs

  • hashOutputs(__namedParameters: { correspondingOutput: undefined | Uint8Array; sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionOutputs: Uint8Array }): Uint8Array
  • Return the proper hashOutputs value for a given a signing serialization type.

    Parameters

    • __namedParameters: { correspondingOutput: undefined | Uint8Array; sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionOutputs: Uint8Array }
      • correspondingOutput: undefined | Uint8Array
      • sha256: { hash: (input: Uint8Array) => Uint8Array }
        • hash: (input: Uint8Array) => Uint8Array
            • (input: Uint8Array): Uint8Array
            • Parameters

              • input: Uint8Array

              Returns Uint8Array

      • signingSerializationType: Uint8Array
      • transactionOutputs: Uint8Array

    Returns Uint8Array

Const hashPrevouts

  • hashPrevouts(__namedParameters: { sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionOutpoints: Uint8Array }): Uint8Array
  • Return the proper hashPrevouts value for a given a signing serialization type.

    Parameters

    • __namedParameters: { sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionOutpoints: Uint8Array }
      • sha256: { hash: (input: Uint8Array) => Uint8Array }
        • hash: (input: Uint8Array) => Uint8Array
            • (input: Uint8Array): Uint8Array
            • Parameters

              • input: Uint8Array

              Returns Uint8Array

      • signingSerializationType: Uint8Array
      • transactionOutpoints: Uint8Array

    Returns Uint8Array

Const hashSequence

  • hashSequence(__namedParameters: { sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionSequenceNumbers: Uint8Array }): Uint8Array
  • Return the proper hashSequence value for a given a signing serialization type.

    Parameters

    • __namedParameters: { sha256: { hash: (input: Uint8Array) => Uint8Array }; signingSerializationType: Uint8Array; transactionSequenceNumbers: Uint8Array }
      • sha256: { hash: (input: Uint8Array) => Uint8Array }
        • hash: (input: Uint8Array) => Uint8Array
            • (input: Uint8Array): Uint8Array
            • Parameters

              • input: Uint8Array

              Returns Uint8Array

      • signingSerializationType: Uint8Array
      • transactionSequenceNumbers: Uint8Array

    Returns Uint8Array

Const hexToBin

  • hexToBin(validHex: string): Uint8Array
  • Decode a hexadecimal-encoded string into a Uint8Array.

    E.g.: hexToBin('2a64ff')new Uint8Array([42, 100, 255])

    Note, this method always completes. If validHex is not divisible by 2, the final byte will be parsed as if it were prepended with a 0 (e.g. aaa is interpreted as aa0a). If validHex is potentially malformed, check it with isHex before calling this method.

    Parameters

    • validHex: string

      a string of valid, hexadecimal-encoded data

    Returns Uint8Array

Const hmacSha256

  • hmacSha256(sha256: { hash: Sha256["hash"] }, secret: Uint8Array, message: Uint8Array): Uint8Array
  • Create a hash-based message authentication code using HMAC-SHA256 as specified in RFC 4231. Returns a 32-byte Uint8Array.

    Secrets longer than the block byte-length (64 bytes) are hashed before use, shortening their length to the minimum recommended length (32 bytes). See RFC 2104 for details.

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of Sha256

      • hash: Sha256["hash"]
    • secret: Uint8Array

      the secret key (recommended length: 32-64 bytes)

    • message: Uint8Array

      the message to authenticate

    Returns Uint8Array

Const hmacSha512

  • hmacSha512(sha512: { hash: Sha512["hash"] }, secret: Uint8Array, message: Uint8Array): Uint8Array
  • Create a hash-based message authentication code using HMAC-SHA512 as specified in RFC 4231. Returns a 64-byte Uint8Array.

    Secrets longer than the block byte-length (128 bytes) are hashed before use, shortening their length to the minimum recommended length (64 bytes). See RFC 2104 for details.

    Parameters

    • sha512: { hash: Sha512["hash"] }

      an implementation of Sha512

      • hash: Sha512["hash"]
    • secret: Uint8Array

      the secret key (recommended length: 64-128 bytes)

    • message: Uint8Array

      the message to authenticate

    Returns Uint8Array

Const includesFlag

  • includesFlag(value: number, flag: number): boolean

Const incrementOperationCount

Const instantiateBIP32Crypto

  • Instantiate an object containing WASM implementations of each cryptographic algorithm required by BIP32 utilities in this library.

    These WASM implementations provide optimal performance across every JavaScript runtime, but depending on your application, you may prefer to instantiate native implementations such as those provided by Node.js or the crypto.subtle API (to reduce bundle size) or an external module (for synchronous instantiation).

    Returns Promise<{ ripemd160: Sha512; secp256k1: Secp256k1; sha256: Ripemd160; sha512: Ripemd160 }>

Const instantiateHmacFunction

  • instantiateHmacFunction(hashFunction: (input: Uint8Array) => Uint8Array, blockByteLength: number): (Anonymous function)
  • Instantiate a hash-based message authentication code (HMAC) function as specified by RFC 2104.

    Parameters

    • hashFunction: (input: Uint8Array) => Uint8Array

      a cryptographic hash function which iterates a basic compression function on blocks of data

        • (input: Uint8Array): Uint8Array
        • Parameters

          • input: Uint8Array

          Returns Uint8Array

    • blockByteLength: number

      the byte-length of blocks used in hashFunction

    Returns (Anonymous function)

Const instantiateRipemd160

  • An ultimately-portable (but slower) version of instantiateRipemd160Bytes which does not require the consumer to provide the ripemd160 binary buffer.

    Returns Promise<Ripemd160>

Const instantiateRipemd160Bytes

  • instantiateRipemd160Bytes(webassemblyBytes: ArrayBuffer): Promise<Ripemd160>
  • The most performant way to instantiate ripemd160 functionality. To avoid using Node.js or DOM-specific APIs, you can use instantiateRipemd160.

    Parameters

    • webassemblyBytes: ArrayBuffer

      A buffer containing the ripemd160 binary.

    Returns Promise<Ripemd160>

Const instantiateRustWasm

  • instantiateRustWasm(webassemblyBytes: ArrayBuffer, expectedImportModuleName: string, hashExportName: string, initExportName: string, updateExportName: string, finalExportName: string): Promise<HashFunction>
  • Note, most of this method is translated and boiled-down from the wasm-pack workflow. Significant changes to wasm-bindgen or wasm-pack build will likely require modifications to this method.

    Parameters

    • webassemblyBytes: ArrayBuffer
    • expectedImportModuleName: string
    • hashExportName: string
    • initExportName: string
    • updateExportName: string
    • finalExportName: string

    Returns Promise<HashFunction>

Const instantiateSecp256k1

  • instantiateSecp256k1(randomSeed?: Uint8Array): Promise<Secp256k1>
  • Create and wrap a Secp256k1 WebAssembly instance to expose a set of purely-functional Secp256k1 methods. For slightly faster initialization, use instantiateSecp256k1Bytes.

    TODO: cache resulting instance to return in all future calls

    Parameters

    • Optional randomSeed: Uint8Array

      a 32-byte random seed used to randomize the secp256k1 context after creation. See the description in instantiateSecp256k1Bytes for details.

    Returns Promise<Secp256k1>

Const instantiateSecp256k1Bytes

  • instantiateSecp256k1Bytes(webassemblyBytes: ArrayBuffer, randomSeed?: Uint8Array): Promise<Secp256k1>
  • This method is like instantiateSecp256k1, but requires the consumer to Window.fetch or fs.readFile the secp256k1.wasm binary and provide it to this method as webassemblyBytes. This skips a base64 decoding of an embedded binary.

    Randomizing the Context with randomSeed

    This method also accepts an optional, 32-byte randomSeed, which is passed to the contextRandomize method in the underlying WebAssembly.

    The value of this precaution is debatable, especially in the context of javascript and WebAssembly.

    In the secp256k1 C library, context randomization is an additional layer of security from side-channel attacks which attempt to extract private key information by analyzing things like a CPU's emitted radio frequencies or power usage.

    In this library, these attacks seem even less likely, since the "platform" on which this code will be executed (e.g. V8) is likely to obscure any such signals.

    Still, out of an abundance of caution (and because no one has produced a definitive proof indicating that this is not helpful), this library exposes the ability to randomize the context like the C library. Depending on the intended application, consumers can decide whether or not to randomize.

    Parameters

    • webassemblyBytes: ArrayBuffer

      an ArrayBuffer containing the bytes from bitcoin-ts' secp256k1.wasm binary. Providing this buffer manually may be faster than the internal base64 decode which happens in instantiateSecp256k1.

    • Optional randomSeed: Uint8Array

      a 32-byte random seed used to randomize the secp256k1 context after creation. See above for details.

    Returns Promise<Secp256k1>

Const instantiateSecp256k1Wasm

Const instantiateSecp256k1WasmBytes

  • instantiateSecp256k1WasmBytes(webassemblyBytes: ArrayBuffer): Promise<Secp256k1Wasm>
  • The most performant way to instantiate secp256k1 functionality. To avoid using Node.js or DOM-specific APIs, you can use instantiateSecp256k1.

    Note, most of this method is translated and boiled-down from Emscripten's preamble.js. Significant changes to the WASM build or breaking updates to Emscripten will likely require modifications to this method.

    Parameters

    • webassemblyBytes: ArrayBuffer

      A buffer containing the secp256k1 binary.

    Returns Promise<Secp256k1Wasm>

Const instantiateSha1

  • instantiateSha1(): Promise<Sha1>
  • An ultimately-portable (but slower) version of instantiateSha1Bytes which does not require the consumer to provide the sha1 binary buffer.

    Returns Promise<Sha1>

Const instantiateSha1Bytes

  • instantiateSha1Bytes(webassemblyBytes: ArrayBuffer): Promise<Sha1>
  • The most performant way to instantiate sha1 functionality. To avoid using Node.js or DOM-specific APIs, you can use instantiateSha1.

    Parameters

    • webassemblyBytes: ArrayBuffer

      A buffer containing the sha1 binary.

    Returns Promise<Sha1>

Const instantiateSha256

  • instantiateSha256(): Promise<Sha256>
  • An ultimately-portable (but possibly slower) version of instantiateSha256Bytes which does not require the consumer to provide the sha256 binary buffer.

    TODO: cache resulting instance to return in all future calls

    Returns Promise<Sha256>

Const instantiateSha256Bytes

  • instantiateSha256Bytes(webassemblyBytes: ArrayBuffer): Promise<Sha256>
  • The most performant way to instantiate sha256 functionality. To avoid using Node.js or DOM-specific APIs, you can use instantiateSha256.

    Parameters

    • webassemblyBytes: ArrayBuffer

      A buffer containing the sha256 binary.

    Returns Promise<Sha256>

Const instantiateSha512

  • instantiateSha512(): Promise<Sha512>
  • An ultimately-portable (but slower) version of instantiateSha512Bytes which does not require the consumer to provide the sha512 binary buffer.

    Returns Promise<Sha512>

Const instantiateSha512Bytes

  • instantiateSha512Bytes(webassemblyBytes: ArrayBuffer): Promise<Sha512>
  • The most performant way to instantiate sha512 functionality. To avoid using Node.js or DOM-specific APIs, you can use instantiateSha512.

    Parameters

    • webassemblyBytes: ArrayBuffer

      A buffer containing the sha512 binary.

    Returns Promise<Sha512>

Const instantiateVirtualMachineBCH

Const isBase64

  • isBase64(maybeBase64: string): boolean
  • For use before base64ToBin. Returns true if the provided string is valid base64 (length is divisible by 4, only uses base64 characters).

    Parameters

    • maybeBase64: string

    Returns boolean

Const isBech32

  • isBech32(maybeBech32: string): boolean
  • Validate that a string is bech32 encoded (without a checksum). The string must use only the bech32 character set, and it must be padded correctly, i.e. it must encode a multiple of 8 bits.

    Parameters

    • maybeBech32: string

      a string to test for valid Bech32 encoding

    Returns boolean

Const isDefinedSigningSerializationType

  • isDefinedSigningSerializationType(byte: number): boolean

Const isHex

  • isHex(maybeHex: string): boolean
  • For use before hexToBin. Returns true if the provided string is valid hexadecimal (length is divisible by 2, only uses hexadecimal characters).

    Parameters

    • maybeHex: string

      a string to test

    Returns boolean

Const isLegacySigningSerialization

  • isLegacySigningSerialization(signingSerializationType: number): boolean

Const isLittleEndian

  • isLittleEndian(buffer: ArrayBuffer): boolean

Const isMinimalDataPush

  • isMinimalDataPush(opcode: number, data: Uint8Array): boolean
  • Returns true if the provided data is minimally-encoded by the provided opcode.

    Parameters

    • opcode: number

      the opcode used to push data

    • data: Uint8Array

      the contents of the push

    Returns boolean

Const isMultiWordPush

  • isMultiWordPush(opcode: number): boolean

Const isNegative

  • isNegative(value: number): boolean

Const isPayToScriptHash

Const isPush

Const isPushData

  • isPushData(pushOpcode: number): boolean

Const isPushOperation

  • isPushOperation(opcode: number): boolean
  • From C++ implementation: Note that IsPushOnly() does consider OP_RESERVED to be a push-type opcode, however execution of OP_RESERVED fails, so it's not relevant to P2SH/BIP62 as the scriptSig would fail prior to the P2SH special validation code being executed.

    Parameters

    • opcode: number

    Returns boolean

Const isScriptNumberError

Const isValidBitLength

  • isValidBitLength(bitLength: number): bitLength is CashAddressAvailableSizesInBits

Const isValidCompressedPublicKeyEncoding

  • isValidCompressedPublicKeyEncoding(publicKey: Uint8Array): boolean

Const isValidInteger

  • isValidInteger(signature: Uint8Array, tagIndex: number, length: number, valueIndex: number): boolean

Const isValidPublicKeyEncoding

  • isValidPublicKeyEncoding(publicKey: Uint8Array): boolean

Const isValidSignatureEncodingBCHRaw

  • isValidSignatureEncodingBCHRaw(signature: Uint8Array): boolean

Const isValidSignatureEncodingBCHTransaction

  • isValidSignatureEncodingBCHTransaction(transactionSignature: Uint8Array): boolean
  • Validate the encoding of a transaction signature, including a signing serialization type byte (A.K.A. "sighash" byte).

    Parameters

    • transactionSignature: Uint8Array

      the full transaction signature

    Returns boolean

Const isValidSignatureEncodingDER

  • isValidSignatureEncodingDER(signature: Uint8Array): boolean
  • Validate a DER-encoded signature.

    remarks

    This function is consensus-critical since BIP66, but differs from the BIP66 specification in that it does not validate the existence of a signing serialization type byte at the end of the signature (to support OP_CHECKDATASIG). To validate a bitcoin-encoded signature (including null signatures), use isValidSignatureEncodingBCH.

    privateremarks

    From the Bitcoin ABC C++ implementation:

    Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] total-length: 1-byte length descriptor of everything that follows, excluding the sighash byte. R-length: 1-byte length descriptor of the R value that follows. R: arbitrary-length big-endian encoded R value. It must use the shortest possible encoding for a positive integers (which means no null bytes at the start, except a single one when the next byte has its highest bit set). S-length: 1-byte length descriptor of the S value that follows. S: arbitrary-length big-endian encoded S value. The same rules apply.

    Parameters

    • signature: Uint8Array

    Returns boolean

Const isValidUncompressedPublicKeyEncoding

  • isValidUncompressedPublicKeyEncoding(publicKey: Uint8Array): boolean

Const isWitnessProgram

  • isWitnessProgram(bytecode: Uint8Array): boolean

Const lengthBytesForPushOpcode

  • lengthBytesForPushOpcode(opcode: number): Bytes

Const lockingBytecodeToAddressContents

  • Attempt to match a lockingBytecode to a standard address type for use in address encoding. (See AddressType for details.)

    For a locking bytecode matching the Pay to Public Key Hash (P2PKH) pattern, the returned type is AddressType.p2pkh and payload is the HASH160 of the public key.

    For a locking bytecode matching the Pay to Script Hash (P2SH) pattern, the returned type is AddressType.p2sh and payload is the HASH160 of the redeeming bytecode, A.K.A. "redeem script hash".

    For a locking bytecode matching the Pay to Public Key (P2PK) pattern, the returned type is AddressType.p2pk and payload is the full public key.

    Any other locking bytecode will return a type of AddressType.unknown and a payload of the unmodified bytecode.

    Parameters

    • bytecode: Uint8Array

      the locking bytecode to match

    Returns AddressContents

Const lockingBytecodeToBase58Address

  • Encode a locking bytecode as a Base58Address for a given network.

    If bytecode matches either the P2PKH or P2SH pattern, it is encoded using the proper address type and returned as a valid Base58Address (string).

    If bytecode cannot be encoded as an address (i.e. because the pattern is not standard), the resulting AddressContents is returned.

    Parameters

    • sha256: { hash: Sha256["hash"] }

      an implementation of sha256 (a universal implementation is available via instantiateSha256)

      • hash: Sha256["hash"]
    • bytecode: Uint8Array

      the locking bytecode to encode

    • network: Base58AddressNetwork

      the network for which to encode the address (mainnet or testnet)

    Returns string | AddressContents

Const lockingBytecodeToCashAddress

  • lockingBytecodeToCashAddress<Prefix>(bytecode: Uint8Array, prefix: Prefix): string | AddressContents
  • Encode a locking bytecode as a CashAddress given a network prefix.

    If bytecode matches either the P2PKH or P2SH pattern, it is encoded using the proper address type and returned as a valid CashAddress (string).

    If bytecode cannot be encoded as an address (i.e. because the pattern is not standard), the resulting AddressContents is returned.

    Type parameters

    • Prefix: string

    Parameters

    • bytecode: Uint8Array

      the locking bytecode to encode

    • prefix: Prefix

      the network prefix to use, e.g. bitcoincash, bchtest, or bchreg

    Returns string | AddressContents

Const locktimeTypesAreCompatible

  • locktimeTypesAreCompatible(locktime: number, requiredLocktime: number): boolean

Const mapOverOperations

Const maskCashAddressPrefix

  • maskCashAddressPrefix(prefix: string): number[]
  • Convert a string into an array of 5-bit numbers, representing the characters in a case-insensitive way.

    Parameters

    • prefix: string

      the prefix to mask

    Returns number[]

Const match

Const mergeRanges

  • mergeRanges(ranges: Range[]): {}

Const nonOperations

  • nonOperations<State>(flags: { disallowUpgradableNops: boolean }): { __computed: (Anonymous function) }
  • Type parameters

    • State

    Parameters

    • flags: { disallowUpgradableNops: boolean }
      • disallowUpgradableNops: boolean

    Returns { __computed: (Anonymous function) }

    • __computed: (Anonymous function)

Const numberToBinInt32TwosCompliment

  • numberToBinInt32TwosCompliment(value: number): Uint8Array
  • Encode an integer as a 4-byte, little-endian Uint8Array using the number's two's compliment representation (the format used by JavaScript's bitwise operators).

    remarks

    The C++ bitcoin implementations sometimes represent short vectors using signed 32-bit integers (e.g. sighashType). This method can be used to test compatibility with those implementations.

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const numberToBinUint16BE

  • numberToBinUint16BE(value: number): Uint8Array
  • Encode a positive integer as a 2-byte Uint16LE Uint8Array.

    This method will return an incorrect result for values outside of the range 0 to 0xffff.

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const numberToBinUint16LE

  • numberToBinUint16LE(value: number): Uint8Array
  • Encode a positive integer as a 2-byte Uint16LE Uint8Array.

    This method will return an incorrect result for values outside of the range 0 to 0xffff.

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const numberToBinUint16LEClamped

  • numberToBinUint16LEClamped(value: number): Uint8Array
  • Encode a positive integer as a 2-byte Uint16LE Uint8Array, clamping the results. (Values exceeding 0xffff return the same result as 0xffff, negative values will return the same result as 0.)

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const numberToBinUint32BE

  • numberToBinUint32BE(value: number): Uint8Array
  • Encode a positive number as a 4-byte Uint32BE Uint8Array.

    This method will return an incorrect result for values outside of the range 0 to 0xffffffff.

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const numberToBinUint32LE

  • numberToBinUint32LE(value: number): Uint8Array
  • Encode a positive number as a 4-byte Uint32LE Uint8Array.

    This method will return an incorrect result for values outside of the range 0 to 0xffffffff.

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const numberToBinUint32LEClamped

  • numberToBinUint32LEClamped(value: number): Uint8Array
  • Encode a positive integer as a 4-byte Uint32LE Uint8Array, clamping the results. (Values exceeding 0xffffffff return the same result as 0xffffffff, negative values will return the same result as 0.)

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const numberToBinUintLE

  • numberToBinUintLE(value: number): Uint8Array
  • Encode a positive integer as a little-endian Uint8Array. For values exceeding Number.MAX_SAFE_INTEGER, use bigIntToBinUintLE. Negative values will return the same result as 0.

    Parameters

    • value: number

      the number to encode

    Returns Uint8Array

Const op0NotEqual

  • op0NotEqual<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const op1Add

  • op1Add<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const op1Sub

  • op1Sub<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const op2Drop

  • op2Drop<State>(): (Anonymous function)

Const op2Dup

  • op2Dup<State>(): (Anonymous function)

Const op2Over

  • op2Over<State>(): (Anonymous function)

Const op2Rot

  • op2Rot<State>(): (Anonymous function)

Const op2Swap

  • op2Swap<State>(): (Anonymous function)

Const op3Dup

  • op3Dup<State>(): (Anonymous function)

Const opAbs

  • opAbs<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opAdd

  • opAdd<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opAnd

  • opAnd<State>(): (Anonymous function)

Const opBin2Num

  • opBin2Num<State>(): (Anonymous function)

Const opBoolAnd

  • opBoolAnd<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opBoolOr

  • opBoolOr<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opCat

  • opCat<State>(): (Anonymous function)

Const opCheckDataSig

  • opCheckDataSig<State, Errors>(__namedParameters: { secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }): (Anonymous function)
  • Type parameters

    Parameters

    • __namedParameters: { secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns (Anonymous function)

Const opCheckDataSigVerify

  • opCheckDataSigVerify<State, Errors>(__namedParameters: { secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }): (Anonymous function)
  • Type parameters

    Parameters

    • __namedParameters: { secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns (Anonymous function)

Const opCheckLockTimeVerify

  • opCheckLockTimeVerify<State, Errors>(flags: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opCheckMultiSig

  • opCheckMultiSig<Opcodes, State, Errors>(__namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"] }; sha256: { hash: Sha256["hash"] } }): (Anonymous function)
  • Type parameters

    Parameters

    • __namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }
        • requireBugValueZero: boolean
        • requireMinimalEncoding: boolean
        • requireNullSignatureFailures: boolean
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns (Anonymous function)

Const opCheckMultiSigVerify

  • opCheckMultiSigVerify<Opcodes, State, Errors>(__namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"] }; sha256: { hash: Sha256["hash"] } }): Operation<State>
  • Type parameters

    Parameters

    • __namedParameters: { flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { requireBugValueZero: boolean; requireMinimalEncoding: boolean; requireNullSignatureFailures: boolean }
        • requireBugValueZero: boolean
        • requireMinimalEncoding: boolean
        • requireNullSignatureFailures: boolean
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns Operation<State>

Const opCheckSequenceVerify

  • opCheckSequenceVerify<State, Errors>(flags: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opCheckSig

  • opCheckSig<Opcodes, State, Errors>(__namedParameters: { flags: { requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }): Operation<State>
  • Type parameters

    Parameters

    • __namedParameters: { flags: { requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { requireNullSignatureFailures: boolean }
        • requireNullSignatureFailures: boolean
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns Operation<State>

Const opCheckSigVerify

  • opCheckSigVerify<Opcodes, State, Errors>(__namedParameters: { flags: { requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }): Operation<State>
  • Type parameters

    Parameters

    • __namedParameters: { flags: { requireNullSignatureFailures: boolean }; secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }; sha256: { hash: Sha256["hash"] } }
      • flags: { requireNullSignatureFailures: boolean }
        • requireNullSignatureFailures: boolean
      • secp256k1: { verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]; verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"] }
        • verifySignatureDERLowS: Secp256k1["verifySignatureDERLowS"]
        • verifySignatureSchnorr: Secp256k1["verifySignatureSchnorr"]
      • sha256: { hash: Sha256["hash"] }
        • hash: Sha256["hash"]

    Returns Operation<State>

Const opCodeSeparator

  • opCodeSeparator<Opcodes, State>(): Operation<State>

Const opDepth

  • opDepth<State>(): (Anonymous function)

Const opDiv

  • opDiv<State>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opDrop

  • opDrop<State>(): (Anonymous function)

Const opDup

  • opDup<State>(): (Anonymous function)

Const opElse

Const opEndIf

Const opEqual

Const opEqualVerify

  • opEqualVerify<State, Errors>(): Operation<State>

Const opFromAltStack

  • opFromAltStack<State, Errors>(): (Anonymous function)

Const opGreaterThan

  • opGreaterThan<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)

Const opGreaterThanOrEqual

  • opGreaterThanOrEqual<State, Errors>(__namedParameters: { requireMinimalEncoding: boolean }): (Anonymous function)