Skip to main content

Crate bitcoin_units

Crate bitcoin_units 

Source
Expand description

Rust Bitcoin - unit types

This library provides basic types used by 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. Also the same re-exports exist in primitives if you are using that crate instead of bitcoin.

§Examples

// Exactly the same as `use bitcoin::{amount, Amount}`.
use bitcoin_units::{amount, Amount};

let _amount = Amount::from_sat(1_000)?;

Modules§

absolute
Provides type LockTime that implements the logic around nLockTime/OP_CHECKLOCKTIMEVERIFY.
amount
Bitcoin amounts.
block
Block height and interval types.
fee_rate
Implements FeeRate and associated features.
locktime
Provides absolute and relative locktimes.
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).
sequence
Bitcoin transaction input sequence number.
time
A UNIX timestamp used as the Bitcoin block time.
weight
Implements Weight and associated features.

Structs§

Amount
An amount.
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.
CompactTarget
Encoding of 256-bit target as 32-bit float.
FeeRate
Fee rate.
Sequence
Bitcoin transaction input sequence number.
SignedAmount
A signed amount.
Weight
The weight of a transaction or block.

Enums§

NumOpResult
Result of a mathematical operation on two numeric types.