Skip to content

Latest commit

 

History

History
88 lines (47 loc) · 2.12 KB

constants.md

File metadata and controls

88 lines (47 loc) · 2.12 KB

Index

BTC Constants

These are defined in constants.rb.

Units

SATOSHI = 1

Satoshi is the smallest unit representable in Bitcoin transactions.

COIN = 100_000_000

One bitcoin equals 100 million satoshis.

BIT = 100

1 bit is 100 satoshis (1 millionth of a bitcoin).

Network Rules

Changing these will result in incompatibility with other nodes.

MAX_BLOCK_SIZE = 1_000_000

The maximum allowed size for a serialized block, in bytes.

MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50

The maximum allowed number of signature check operations in a block.

MAX_MONEY = 21_000_000 * COIN

No amount larger than this (in satoshis) is valid.

COINBASE_MATURITY = 100

Coinbase transaction outputs can only be spent after this number of new blocks.

LOCKTIME_THRESHOLD = 500_000_000

Threshold for BTC::Transaction#lock_time: below this value it is interpreted as a block number, otherwise as UNIX timestamp.

BIP16_TIMESTAMP = 1333238400

P2SH BIP16 didn't become active until April 1, 2012. All transactions before this timestamp should not be verified with P2SH rule.

MAX_SCRIPT_SIZE = 10000

Scripts longer than 10K bytes are invalid.

MAX_SCRIPT_ELEMENT_SIZE = 520

Maximum number of bytes per "pushdata" opcode.

MAX_KEYS_FOR_CHECKMULTISIG = 20

Number of public keys allowed for OP_CHECKMULTISIG.

MAX_OPS_PER_SCRIPT = 201

Maximum number of operations allowed per script (excluding pushdata operations and OP_N). Multisig operation additionally increases count by a number of pubkeys.

Soft Rules

Can bend these without becoming incompatible with everyone.

MAX_INV_SZ = 50000

The maximum number of entries in an 'inv' protocol message.

MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE / 2

The maximum size for mined blocks.

MAX_STANDARD_TX_SIZE = MAX_BLOCK_SIZE_GEN / 5

The maximum size for transactions we're willing to relay/mine.