blockchainkit.constants#

Every consensus-relevant constant: hash domain tags, encoding bounds, and the default chain ID. Changing any of them changes hashes, signatures, or validation; see Exact conventions and model boundaries.

Consensus-relevant constants shared across blockchainkit.

Every hash domain tag, encoding bound, and default identifier lives here, so a change to one of them is visible as a change to the protocol. Changing any value changes hashes, signatures, or validation: update docs/source/protocol.rst, the tests, the examples, and CHANGELOG.md together.

>>> from blockchainkit import constants
>>> constants.UINT64_LIMIT == 2**64
True
blockchainkit.constants.UINT64_LIMIT = 18446744073709551616#

Exclusive upper bound of the unsigned 64-bit fields (nonces, amounts, heights).

Type:

int

blockchainkit.constants.WORD_MODULUS = 115792089237316195423570985008687907853269984665640564039457584007913129639936#

The virtual machine’s word size; arithmetic wraps modulo this value.

Type:

int

blockchainkit.constants.DEFAULT_CHAIN_ID = 'blockchainkit-demo'#

Network identifier signed into every transaction to prevent cross-chain replay.

Type:

str

blockchainkit.constants.COMMIT_DOMAIN = b'blockchainkit:commit:v1\x00'#

Domain tag prefixed to hash commitments.

Type:

bytes

blockchainkit.constants.SCHNORR_DOMAIN = 'blockchainkit:schnorr:v1'#

Domain tag prefixed, with the curve parameters, to Schnorr challenges.

Type:

str

blockchainkit.constants.MERKLE_LEAF_PREFIX = b'\x00'#

Prefix for hashing a Merkle leaf payload.

Type:

bytes

blockchainkit.constants.MERKLE_NODE_PREFIX = b'\x01'#

Prefix for hashing two child digests into a Merkle node.

Type:

bytes

blockchainkit.constants.MERKLE_ROOT_PREFIX = b'\x02'#

Prefix for binding the leaf count to the top Merkle digest.

Type:

bytes

blockchainkit.constants.PUZZLE_DOMAIN = b'blockchainkit:puzzle:v1'#

Domain tag for the keystream that encrypts a Merkle puzzle.

Type:

bytes

blockchainkit.constants.PUZZLE_MAGIC = b'MERKLE78'#

Known plaintext prefix that tells a solver a puzzle has opened.

Type:

bytes

blockchainkit.constants.LAMPORT_DOMAIN = b'blockchainkit:lamport:v1'#

Domain tag for deriving Lamport private preimages from a seed.

Type:

bytes

blockchainkit.constants.PEDERSEN_DOMAIN = b'blockchainkit:pedersen:v1'#

Domain tag for deriving the second Pedersen generator.

Type:

bytes

blockchainkit.constants.MUSIG_DOMAIN = b'blockchainkit:musig:v1'#

Domain tag for MuSig key-aggregation coefficients.

Type:

bytes

blockchainkit.constants.MMR_ROOT_PREFIX = b'\x03'#

Prefix for bagging Merkle-mountain-range peaks into one root.

Type:

bytes

blockchainkit.constants.BLOOM_DOMAIN = b'blockchainkit:bloom:v1'#

Domain tag for deriving Bloom-filter bit positions.

Type:

bytes

blockchainkit.constants.UTXO_DOMAIN = 'blockchainkit:utxo:v1'#

Domain tag signed into every UTXO transaction.

Type:

str

blockchainkit.constants.SORTITION_DOMAIN = b'blockchainkit:sortition:v1'#

Domain tag for the hash that stands in for a VRF in cryptographic sortition.

Type:

bytes

blockchainkit.constants.COMPACT_BLOCK_DOMAIN = b'blockchainkit:compact-block:v1'#

Domain tag for the salted short transaction IDs of compact blocks.

Type:

bytes

blockchainkit.constants.CREATE_DOMAIN = b'blockchainkit:create:v1'#

Domain tag for contract addresses derived from the deployer and its nonce.

Type:

bytes

blockchainkit.constants.CREATE2_DOMAIN = b'blockchainkit:create2:v1'#

Domain tag for contract addresses derived from the deployer, a salt and the code.

Type:

bytes

blockchainkit.constants.BLOCKHASH_DOMAIN = b'blockchainkit:blockhash:v1'#

Domain tag for the block hashes of the contract world model.

Type:

bytes

blockchainkit.constants.RICARDIAN_DOMAIN = b'blockchainkit:ricardian:v1'#

Domain tag for the identifier of a Ricardian contract.

Type:

bytes

blockchainkit.constants.CONTRACT_COMMIT_DOMAIN = b'blockchainkit:contract-commit:v1'#

Domain tag for the commitments of the commit-reveal lottery.

Type:

bytes

blockchainkit.constants.WALLET_DOMAIN = b'blockchainkit:wallet:v1'#

Domain tag for the messages that multisig wallet owners sign.

Type:

bytes

blockchainkit.constants.EIP1967_IMPLEMENTATION_LABEL = b'eip1967.proxy.implementation'#

Label hashed to the storage slot of a proxy’s implementation address (EIP-1967).

Type:

bytes

blockchainkit.constants.EIP1967_ADMIN_LABEL = b'eip1967.proxy.admin'#

Label hashed to the storage slot of a proxy’s admin address (EIP-1967).

Type:

bytes

blockchainkit.constants.CHANNEL_DOMAIN = b'blockchainkit:channel:v1'#

Domain tag for the off-chain states, commitments and penalties channel parties sign.

Type:

bytes

blockchainkit.constants.PLASMA_DOMAIN = b'blockchainkit:plasma:v1'#

Domain tag for the coin transfers of the Plasma child chain.

Type:

bytes

blockchainkit.constants.ROLLUP_DOMAIN = b'blockchainkit:rollup:v1'#

Domain tag for the account leaves of a rollup’s state root.

Type:

bytes

blockchainkit.constants.BRIDGE_DOMAIN = b'blockchainkit:bridge:v1'#

Domain tag for the withdrawals and messages that bridge validators sign.

Type:

bytes

blockchainkit.constants.WATCHTOWER_DOMAIN = b'blockchainkit:watchtower:v1'#

Domain tag for watchtower blob encryption and appointment receipts.

Type:

bytes

blockchainkit.constants.TRANSCRIPT_DOMAIN = b'blockchainkit:transcript:v1'#

Domain tag for the Fiat-Shamir transcripts of the proof systems.

Type:

bytes

blockchainkit.constants.IPA_GENERATOR_DOMAIN = b'blockchainkit:ipa-generators:v1'#

Domain tag for deriving the independent generators of inner-product arguments.

Type:

bytes

blockchainkit.constants.MIMC_DOMAIN = b'blockchainkit:mimc:v1'#

Domain tag for deriving the round constants of the MiMC hash.

Type:

bytes

blockchainkit.constants.SUM_LEAF_DOMAIN = b'blockchainkit:sum-leaf:v1'#

Domain tag for hashing a customer’s balance into a Merkle-sum-tree leaf.

Type:

bytes

blockchainkit.constants.SUM_NODE_DOMAIN = b'blockchainkit:sum-node:v1'#

Domain tag for hashing two children and both their sums into a Merkle-sum-tree node.

Type:

bytes

blockchainkit.constants.SOLVENCY_DOMAIN = b'blockchainkit:solvency:v1'#

Domain tag for the Fiat-Shamir challenges of the proofs of solvency.

Type:

bytes

blockchainkit.constants.LOOKALIKE_DOMAIN = b'blockchainkit:lookalike:v1'#

Domain tag for the candidate addresses ground out by an address poisoner.

Type:

bytes

blockchainkit.constants.MIX_DOMAIN = b'blockchainkit:mix:v1'#

Domain tag for the keystream of each layer of a mix-net or onion-routing message.

Type:

bytes

blockchainkit.constants.RING_DOMAIN = b'blockchainkit:ring:v1'#

Domain tag for the chained challenges of ring signatures.

Type:

bytes

blockchainkit.constants.KEY_IMAGE_DOMAIN = b'blockchainkit:key-image:v1'#

Domain tag for hashing a public key into the group to form its key image.

Type:

bytes

blockchainkit.constants.STEALTH_DOMAIN = b'blockchainkit:stealth:v1'#

Domain tag for hashing a stealth payment’s shared secret to a scalar.

Type:

bytes

blockchainkit.constants.KERNEL_DOMAIN = b'blockchainkit:kernel:v1'#

Domain tag for the Schnorr challenges of Mimblewimble transaction kernels.

Type:

bytes

blockchainkit.constants.ACCUMULATOR_DOMAIN = b'blockchainkit:accumulator:v1'#

Domain tag for hashing a coin into a prime for the RSA accumulator.

Type:

bytes

blockchainkit.constants.TUMBLER_DOMAIN = b'blockchainkit:tumbler:v1'#

Domain tag for the key that a TumbleBit puzzle solution derives.

Type:

bytes

blockchainkit.constants.HARDENED_OFFSET = 2147483648#

The first hardened child index of BIP32 key derivation, written 0' or 0h.

Type:

int

blockchainkit.constants.BIP32_SEED_KEY = b'Bitcoin seed'#

The HMAC-SHA512 key that turns a seed into a BIP32 master key.

Type:

bytes

blockchainkit.constants.BIP39_SALT_PREFIX = 'mnemonic'#

Prefixed to the passphrase to salt BIP39’s seed derivation.

Type:

str

blockchainkit.constants.MAX_SCRIPT_ELEMENT_SIZE = 520#

The largest data push Script allows, and so the largest P2SH redeem script (bytes).

Type:

int

blockchainkit.constants.USER_OPERATION_DOMAIN = b'blockchainkit:user-operation:v1'#

Domain tag for the hash that an ERC-4337 account owner signs.

Type:

bytes