Expand description
Fedimint Core library
fedimint-core
contains commonly used types, utilities and primitives,
shared between both client and server code.
Things that are server-side only typically live in fedimint-server
, and
client-side only in fedimint-client
.
§Wasm support
All code in fedimint-core
needs to compile on Wasm, and fedimint-core
includes helpers and wrappers around non-wasm-safe utitlies.
In particular:
fedimint_core::task
for task spawning and controlfedimint_core::time
for time-related operations
Re-exports§
pub use module::ServerModule;
pub use tiered::Tiered;
pub use crate::core::server;
pub use anyhow;
pub use bitcoin;
pub use hex;
pub use secp256k1;
pub use tiered_multi::*;
Modules§
- Admin (guardian) client types
- amount 🔒Bitcoin amount types
- Federation-stored client backups Federation-stored client backups
- Legacy serde encoding for
bls12_381
- Federation configuration
- Fundamental types Fedimint Core API (common) module interface
- Database handling Core Fedimint database traits and types
- Consensus encoding Binary encoding interface suitable for consensus critical encoding.
- Common environment variables
- Formatting helpers
- Federation invite code
- Common macros
- Extenable module sysystem Fedimint supports modules to allow extending it’s functionality. Some of the standard functionality is implemented in form of modules as well.
- Peer networking
- peer_id 🔒
PeerId
type - Runtime (wasm32 vs native) differences handling Copyright 2021 The Matrix.org Foundation C.I.C. Abstraction over an executor so we can spawn tasks under WASM the same way we do usually.
- Atomic BFT unit containing consensus items
- Task handling, including wasm safe logic
- Types handling per-denomination values
- Types handling multiple per-denomination values
- Time handling, wasm safe functionality
- Timing helpers
- Fedimint transaction (inpus + outputs + signature) types
- txid 🔒
- Peg-in txo proofs
- General purpose utilities
- Version
Macros§
- Example
- async trait that use MaybeSend
- Define “dyn newtype” (a newtype over
dyn Trait
) - Implements the
Display
trait for dyn newtypes whose traits implementDisplay
- Implement
Clone
on a “dyn newtype” - Macro for defining module associated types.
- Get value of
FEDIMINT_BUILD_CODE_VERSION
at compile time - This is a helper macro that generates the implementations of
DatabaseRecord
necessary for reading/writing to the database and fetching by prefix. - MaybeSync can not be used in
dyn $Trait + MaybeSend
- See
maybe_add_send
- Define a “module plugin dyn-newtype” which is like a standard “dyn newtype”, but with associated “module_instance_id”.
- Implement
Encodable
andDecodable
for a “module dyn newtype” - Define a “plugin” trait
- A copy of
module_lugin_static_trait_define
but forClientConfig
. - Implements the necessary traits for all associated types of a
FederationServer
module. - Implements the necessary traits for all configuration related types of a
FederationServer
module.
Structs§
- Represents an amount of BTC. The base denomination is millisatoshis, which is why the
Amount
type from rust-bitcoin isn’t used instead. - The number of guardians in a federation.
OutPoint
represents a globally unique output in a transaction- A transaction id for peg-ins, peg-outs and reissuances
Enums§
- Amount of bitcoin to send, or
All
to send all available funds
Constants§
Traits§
- Trait which applies to hashes of all types.
- Types that can be easily converted to
NumPeers
Functions§
- Outputs hex into an object implementing
fmt::Write
. - Gets the (approximate) network from a bitcoin address.
- Shorthand for
Amount::from_msats
- Shorthand for
Amount::from_sats
- Converts weight to virtual bytes, defined in BIP-141 as weight / 4 (rounded up to the next integer).