Expand description
Core module defines core strict interfaces from informational LNPBP standards specifying secure and robust practices for function calls used in main bitcoin protocols:
- consensus-level primitives;
- deterministic bitcoin commitments;
- single-use-seals.
The goal of this module is to maximally reduce the probability of errors and mistakes within particular implementations of this paradigms by standardizing typical workflow processes in a form of interfaces that will be nearly impossible to use in the wrong form.
Re-exports§
Modules§
- bc
stl
- opcodes
- secp256k1
- Rust bindings for Pieter Wuille’s secp256k1 library, which is used for fast and accurate manipulation of ECDSA and Schnorr signatures on the secp256k1 curve. Such signatures are used extensively by the Bitcoin network and its derivatives.
- stl
stl
- Strict types library generator methods.
Structs§
- Annex
- The
Annex
struct enforces first byte to be0x50
. - Bip340
Sig - Block
Hash - Block
Header - Block
Merkle Root - ByteStr
- Compressed
Pk - Control
Block - Future
Leaf Ver - Inner type representing future (non-tapscript) leaf versions. See
LeafVer::Future
. - Internal
Keypair - Internal taproot public key, which can be present only in key fragment inside taproot descriptors.
- Internal
Pk - Internal taproot public key, which can be present only in key fragment inside taproot descriptors.
- Invalid
Leaf Ver - invalid taproot leaf version {0}.
- Invalid
Parity Value - invalid parity value {0} - must be 0 or 1
- Invalid
Timelock - Error constructing timelock from the provided value.
- Leaf
Script - Legacy
Pk - Legacy
Sig - Lock
Height - Value for a transaction
nTimeLock
field which is guaranteed to represent a block height number which is always less than 500000000. - Lock
Time - Lock
Timestamp - Value for a transaction
nTimeLock
field which is guaranteed to represent a UNIX timestamp which is always either 0 or a greater than or equal to 500000000. - NonStandard
Value - the provided value {value} for {matter} is non-standard; while it is accepted by the bitcoin consensus rules, the software prohibits from using it.
- Outpoint
- Output
Pk - Output taproot key - an
InternalPk
tweaked with merkle root of the script tree - or its own hash. Used only inside addresses and raw taproot descriptors. - Prevout
Mismatch - Pubkey
Hash - Redeem
Script - Sats
- Script
Bytes - Script
Code - Type used for generating sighash in SegWit signing
- Script
Hash - Script
Pubkey - SeqNo
- SigScript
- Sighash
- Sighash
Cache - Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
- Sighash
Type - TapBranch
Hash - TapLeaf
Hash - TapMerkle
Path - TapNode
Hash - TapScript
- TapSighash
- Tx
- TxIn
- TxOut
- TxVer
- Txid
- Uncompressed
Pk - VBytes
- VarInt
- A variable-length unsigned integer.
- Vout
- WPubkey
Hash - WScript
Hash - Weight
Units - Witness
- Witness
Program - Witness program as defined in BIP141.
- Witness
Script - Wtxid
- XOnlyPk
- Generic taproot x-only (BIP-340) public key - a wrapper around
XOnlyPublicKey
providing APIs compatible with the rest of the library. Should be used everywhere whenInternalPk
andOutputPk
do not apply: as an output of BIP32 key derivation functions, inside tapscripts/ leafscripts etc.
Enums§
- Annex
Error - Block
Data Parse Error - Bp
- Enumeration over types related to bitcoin protocol-compatible chains.
- Consensus
Data Error - Consensus
Decode Error - Invalid
Pubkey - LeafVer
- The leaf version for tapleafs.
- OpCode
- Outpoint
Parse Error - Parity
- Represents the parity passed between FFI function calls.
- Pubkey
Parse Error - Segwit
Error - SigError
- An ECDSA signature-related error.
- Sighash
Error - Sighash
Flag - TapCode
- Timelock
Parse Error - Witness
Ver - Version of the witness program.
Constants§
- LIB_
NAME_ BITCOIN - LOCKTIME_
THRESHOLD - The Threshold for deciding whether a lock time value is a height or a time (see Bitcoin Core).
- MIDSTATE_
TAPSIGHASH - The SHA-256 midstate value for the TapSig hash.
- SEQ_
NO_ CSV_ DISABLE_ MASK - SEQ_
NO_ CSV_ TYPE_ MASK - TAPROOT_
ANNEX_ PREFIX - Taproot annex prefix.
- TAPROOT_
LEAF_ MASK - Tapleaf mask for getting the leaf version from first byte of control block.
- TAPROOT_
LEAF_ TAPSCRIPT - Tapscript leaf version.
Traits§
Type Aliases§
- VarInt
Array - Bitcoin consensus allows arrays which length is encoded as VarInt to grow up to 64-bit values. However, at the same time no consensus rule allows any block data structure to exceed 2^32 bytes (4GB), and any change to that rule will be a hardfork. So for practical reasons we are safe to restrict the maximum size here with just 32 bits.
- VarInt
Bytes