Global

Methods

(private) bindExit()

Cleanup all child processes.

Source:

checksig(msg, sig, key) → {Boolean}

Verify a signature, taking into account sighash type.

Parameters:
Name Type Description
msg Buffer

Signature hash.

sig Buffer
key Buffer
Source:
Returns:
Type
Boolean

decode(str, exp) → {Number}

Parse a fixed number string and multiply by a power of ten (uses no floating point arithmetic).

Parameters:
Name Type Description
str String
exp Number

Number of decimal places.

Source:
Returns:

Integer.

Type
Number

encode(num, exp) → {String}

Convert int to fixed number string and reduce by a power of ten (uses no floating point arithmetic).

Parameters:
Name Type Description
num Number
exp Number

Number of decimal places.

Source:
Returns:

Fixed number string.

Type
String

fromFloat(num, exp) → {Number}

Parse a double float number and multiply by a power of ten (uses no floating point arithmetic).

Parameters:
Name Type Description
num Number
exp Number

Number of decimal places.

Source:
Returns:

Integer.

Type
Number

insert(items, item, compare) → {Number}

Perform a binary insert on a sorted array.

Parameters:
Name Type Description
items Array
item Object
compare function
Source:
Returns:

index

Type
Number

(private) listenExit(handler)

Listen for exit.

Parameters:
Name Type Description
handler function
Source:

remove(items, item, compare) → {Boolean}

Perform a binary removal on a sorted array.

Parameters:
Name Type Description
items Array
item Object
compare function
Source:
Returns:
Type
Boolean

Perform a binary search on a sorted array.

Parameters:
Name Type Attributes Description
items Array
key Object
compare function
insert Boolean <nullable>
Source:
Returns:

Index.

Type
Number

toFloat(num, exp) → {Number}

Convert int to float and reduce by a power of ten (uses no floating point arithmetic).

Parameters:
Name Type Description
num Number
exp Number

Number of decimal places.

Source:
Returns:

Double float.

Type
Number

validateKey(key, flagsnullable) → {Boolean}

Test whether the data element is a valid key if VERIFY_STRICTENC is enabled.

Parameters:
Name Type Attributes Description
key Buffer
flags VerifyFlags <nullable>
Source:
Throws:
ScriptError
Returns:
Type
Boolean

validateSignature(sig, flagsnullable) → {Boolean}

Test whether the data element is a valid signature based on the encoding, S value, and sighash type. Requires VERIFY_DERSIG|VERIFY_LOW_S|VERIFY_STRICTENC, VERIFY_LOW_S and VERIFY_STRING_ENC to be enabled respectively. Note that this will allow zero-length signatures.

Parameters:
Name Type Attributes Description
sig Buffer
flags VerifyFlags <nullable>
Source:
Throws:
ScriptError
Returns:
Type
Boolean

Type Definitions

AddressString

Serialized address.

Type:
Source:

AddressType

A subset of ScriptType, including pubkeyhash, scripthash, witnesspubkeyhash, and witnessscripthash. This value specifically refers to the address prefix. It is a network-agnostic way of representing prefixes. May sometimes be a string if specified.

Type:
  • Number | String
Source:

Amount

A satoshi amount. This is technically a JS double float, but it is regularly enforced to be less than 53 bits and less than MAX_MONEY in various functions.

Type:
  • Number
Source:

Base58String

Base58 string.

Type:
  • String
Source:

Bech32String

Bech32 string.

Type:
  • String
Source:

BN

A big number (bn.js)

Type:
  • Object
Source:

Hash

Buffer or hex-string hash.

Type:
  • Buffer | String
Source:

InvType

One of module:constants.inv.

Type:
  • Number | String
Source:

LockFlags

A bitfield containing locktime flags.

Type:
  • Number
Source:

NetworkType

One of main, testnet, regtest, segnet3, segnet4.

Type:
  • String
Source:
See:
  • {module:network.types}

Rate

Rate of satoshis per kB.

Type:
Source:

ScriptType

An output script type.

Type:
  • Number | String
Source:
See:
  • {module:constants.scriptTypes} May sometimes be a string if specified.

SighashType

Signature hash type. One of all, single, none, or one of constants.hashType.

Type:
  • String | Number
Source:

VerifyFlags

A bitfield containing script verify flags.

Type:
  • Number
Source: