Crate fedimint_core
source ·Re-exports
pub use module::ServerModule;
pub use tiered::Tiered;
pub use crate::core::server;
pub use tiered_multi::*;
Modules
- Fedimint Core API (common) module interface
- Core Fedimint database traits and types
- This module defines a binary encoding interface which is more suitable for consensus critical encoding than e.g.
bincode
. Over time all structs that need to be encoded to binary will be migrated to this interface. - Atomic BFT unit containing consensus items
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” - Wraps a type into an enum with a default variant, this allows to add new versions of the type in the future. Depending on context unknown versions may be ignored or lead to errors. E.g. the client might just ignore an unknown input version since it cannot originate from itself while the server would reject it for not being able to validate its correctness.
- 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
, which is a snowflake that requires: Serialize
and conditional implementation forDynUnknown
. The macro is getting gnarly, so seems easier to copy-paste-modify, than pile up conditional argument. - 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 inside the system. The base denomination is milli satoshi for now, this is also why the amount type from rust-bitcoin isn’t used instead.
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.
- for consensus-related calculations given the number of peers
Functions
- 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).