Skip to main content

Crate bitcoin_primitives

Crate bitcoin_primitives 

Source
Expand description

Rust Bitcoin - primitive types

Primitive data types that are used throughout the rust-bitcoin ecosystem.

If you are using rust-bitcoin then you do not need to access this crate directly. Everything here is re-exported in rust-bitcoin at the same path.

This crate can be used in a no-std environment but a lot of the functionality requires an allocator i.e., requires the alloc feature to be enabled.

Re-exports§

pub extern crate hex_stable as hex;

Modules§

absolute
Provides type LockTime that implements the logic around nLockTime/OP_CHECKLOCKTIMEVERIFY.
amount
Bitcoin amounts.
block
Bitcoin blocks.
fee_rate
Implements FeeRate and associated features.
locktime
Provides absolute and relative locktimes.
merkle_tree
Bitcoin Merkle tree functions.
parse_int
Parsing utilities.
pow
Proof-of-work related integer types.
relative
Provides type LockTime that implements the logic around nSequence/OP_CHECKSEQUENCEVERIFY.
result
Provides a monadic type returned by mathematical operations (core::ops).
script
Bitcoin scripts.
sequence
Bitcoin transaction input sequence number.
time
A UNIX timestamp used as the Bitcoin block time.
transaction
Bitcoin transactions.
weight
Implements Weight and associated features.
witness
A witness.

Structs§

Amount
An amount.
Block
Bitcoin block.
BlockHash
A bitcoin block hash.
BlockHeader
Bitcoin block header.
BlockHeight
A block height. Zero denotes the genesis block.
BlockHeightInterval
An unsigned block interval.
BlockMtp
The median timestamp of 11 consecutive blocks.
BlockMtpInterval
An unsigned difference between two BlockMtps.
BlockTime
A Bitcoin block timestamp.
BlockVersion
Bitcoin block version number.
CompactTarget
Encoding of 256-bit target as 32-bit float.
FeeRate
Fee rate.
Ntxid
A “normalized TXID”.
OutPoint
A reference to a transaction output.
Sequence
Bitcoin transaction input sequence number.
SignedAmount
A signed amount.
Transaction
Bitcoin transaction.
TransactionVersion
The transaction version.
TxIn
Bitcoin transaction input.
TxMerkleNode
A hash of the Merkle tree branch or root for transactions.
TxOut
Bitcoin transaction output.
Txid
A bitcoin transaction hash/transaction ID.
Weight
The weight of a transaction or block.
Witness
The Witness is the data used to unlock bitcoin since the SegWit upgrade.
WitnessCommitment
A hash corresponding to the witness structure commitment in the coinbase transaction.
WitnessMerkleNode
A hash corresponding to the Merkle tree root for witness data.
Wtxid
A bitcoin witness transaction ID.

Enums§

BlockChecked
Marker that the block’s merkle root has been successfully validated.
BlockUnchecked
Marker that the block’s merkle root has not been validated.
NumOpResult
Result of a mathematical operation on two numeric types.

Traits§

BlockValidation
Marker for whether or not a block has been validated.

Type Aliases§

RedeemScript
A reference to a P2SH redeem script.
RedeemScriptBuf
A P2SH redeem script.
ScriptPubKey
A reference to a scriptPubKey (locking script).
ScriptPubKeyBuf
A scriptPubKey (locking script).
ScriptSig
A reference to a script signature (scriptSig).
ScriptSigBuf
A script signature (scriptSig).
TapScript
A reference to a Segwit v1 Taproot script.
TapScriptBuf
A Segwit v1 Taproot script.
WitnessScript
A reference to a Segwit v0 witness script.
WitnessScriptBuf
A Segwit v0 witness script.