Module: protocol/consensus

Members

(static, constant) BASE_REWARD :Amount

Base block subsidy (consensus). Note to shitcoin implementors: if you increase this to anything greater than 33 bits, getReward will have to be modified to handle the shifts.

Type:
Source:

(static, constant) BIP16_TIME :Number

The date bip16 (p2sh) was activated (consensus).

Type:
  • Number
Default Value:
  • 1333238400
Source:

(static, constant) COIN :Amount

One bitcoin in satoshis.

Type:
Default Value:
  • 100000000
Source:

(static, constant) COINBASE_MATURITY :Number

Number of blocks before a coinbase spend can occur (consensus).

Type:
  • Number
Default Value:
  • 100
Source:

(static, constant) HALF_REWARD :Amount

Half base block subsidy. Required to calculate the reward properly (with only 32 bit shifts available).

Type:
Source:

(static, constant) LOCKTIME_THRESHOLD :Number

nLockTime threshold for differentiating between height and time (consensus). Tue Nov 5 00:53:20 1985 UTC

Type:
  • Number
Default Value:
  • 500000000
Source:

(static, constant) MAX_BLOCK_SIGOPS :Number

Maximum block sigops (consensus).

Type:
  • Number
Source:

(static, constant) MAX_BLOCK_SIGOPS_COST :Number

Maximum block sigops cost (consensus).

Type:
  • Number
Default Value:
  • 80000
Source:

(static, constant) MAX_BLOCK_SIZE :Number

Maximum block base size (consensus).

Type:
  • Number
Default Value:
  • 1000000
Source:

(static, constant) MAX_BLOCK_WEIGHT :Number

Maximum block weight (consensus).

Type:
  • Number
Default Value:
  • 4000000
Source:

(static, constant) MAX_MONEY :Amount

Maximum amount of money in satoshis: 21million * 1btc (consensus).

Type:
Source:

(static, constant) MAX_MULTISIG_PUBKEYS :Number

Max n value for multisig (consensus).

Type:
  • Number
Default Value:
  • 20
Source:

(static, constant) MAX_RAW_BLOCK_SIZE :Number

Maximum block serialization size (protocol).

Type:
  • Number
Default Value:
  • 4000000
Source:

(static, constant) MAX_SCRIPT_OPS :Number

Max opcodes executed (consensus).

Type:
  • Number
Default Value:
  • 201
Source:

(static, constant) MAX_SCRIPT_PUSH :Number

Max script element size (consensus).

Type:
  • Number
Default Value:
  • 520
Source:

(static, constant) MAX_SCRIPT_SIZE :Number

Max serialized script size (consensus).

Type:
  • Number
Default Value:
  • 10000
Source:

(static, constant) MAX_SCRIPT_STACK :Number

Max stack size during execution (consensus).

Type:
  • Number
Default Value:
  • 1000
Source:

(static, constant) SEQUENCE_DISABLE_FLAG :Number

Highest nSequence bit -- disables sequence locktimes (consensus).

Type:
  • Number
Source:

(static, constant) SEQUENCE_GRANULARITY :Number

Sequence granularity for time (consensus).

Type:
  • Number
Default Value:
  • 9
Source:

(static, constant) SEQUENCE_MASK :Number

Sequence mask (consensus).

Type:
  • Number
Default Value:
  • 65535
Source:

(static, constant) SEQUENCE_TYPE_FLAG :Number

Sequence time: height or time (consensus).

Type:
  • Number
Source:

(static, constant) VERSION_TOP_BITS :Number

What bits to set in version for versionbits blocks.

Type:
  • Number
Default Value:
  • 536870912
Source:

(static, constant) VERSION_TOP_MASK :Number

What bitmask determines whether versionbits is in use.

Type:
  • Number
Default Value:
  • 3758096384
Source:

(static, constant) WITNESS_SCALE_FACTOR :Number

Amount to multiply base/non-witness sizes by.

Type:
  • Number
Default Value:
  • 4
Source:

Methods

(static) fromCompact(compact) → {BN}

Convert a compact number to a big number. Used for block.bits -> target conversion.

Parameters:
Name Type Description
compact Number
Source:
Returns:
Type
BN

(static) getReward(height) → {Amount}

Calculate block subsidy.

Parameters:
Name Type Description
height Number

Reward era by height.

Source:
Returns:
Type
Amount

(static) toCompact(num) → {Number}

Convert a big number to a compact number. Used for target -> block.bits conversion.

Parameters:
Name Type Description
num BN
Source:
Returns:
Type
Number

(static) verifyPOW(hash, bits) → {Boolean}

Verify proof-of-work.

Parameters:
Name Type Description
hash Hash
bits Number
Source:
Returns:
Type
Boolean