Docs.rs
  • fedimint-core-0.4.2
    • fedimint-core 0.4.2
    • Docs.rs crate page
    • MIT
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • dpc
    • elsirion
    • bradleystachurski
    • Dependencies
      • anyhow ^1.0.86 normal
      • async-recursion ^1.1.1 normal
      • async-trait ^0.1.80 normal
      • backon =0.4.4 normal
      • backtrace ^0.3.73 normal
      • base64-url ^3.0.0 normal
      • bech32 ^0.11.0 normal
      • bincode ^1.3.3 normal
      • bitcoin ^0.30.2 normal
      • bitcoin ^0.29.2 normal
      • bitcoin_hashes ^0.12.0 normal
      • bitvec ^1.0.1 normal
      • bls12_381 ^0.8.0 normal
      • erased-serde ^0.4 normal
      • fedimint-derive =0.4.2 normal
      • fedimint-logging =0.4.2 normal
      • futures ^0.3.30 normal
      • hex ^0.4.3 normal
      • imbl ^3.0.0 normal
      • itertools ^0.12.1 normal
      • jsonrpsee-core ^0.24.0 normal
      • lightning ^0.0.123 normal
      • lightning-invoice ^0.31.0 normal
      • macro_rules_attribute ^0.2.0 normal
      • miniscript ^10.0.0 normal
      • parity-scale-codec ^3.6.12 normal
      • rand ^0.8.5 normal
      • secp256k1 ^0.27.0 normal
      • secp256k1-zkp ^0.9.2 normal
      • serde ^1.0.203 normal
      • serde_json ^1.0.120 normal
      • serdect ^0.2.0 normal
      • strum ^0.26 normal
      • strum_macros ^0.26 normal
      • thiserror ^1.0.61 normal
      • fedimint-threshold-crypto ^0.2.1 normal
      • tracing ^0.1.40 normal
      • url ^2.5.2 normal
      • once_cell ^1.19.0 dev
      • test-log ^0.2 dev
      • tokio-test ^0.4.4 dev
      • tracing-subscriber ^0.3.18 dev
      • tokio ^1.38.0 normal
      • tokio-rustls ^0.24.1 normal
      • async-lock ^3.4 normal
      • futures-util ^0.3.30 normal
      • getrandom ^0.2.15 normal
      • gloo-timers ^0.3.0 normal
      • js-sys ^0.3.69 normal
      • jsonrpsee-wasm-client ^0.24.0 normal
      • tokio ^1.38.0 normal
      • wasm-bindgen-futures ^0.4.42 normal
    • Versions
    • 43.21% of the crate is documented
  • Go to latest version
  • Platform
    • i686-unknown-linux-gnu
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate fedimint_core

fedimint_core0.4.2

  • All Items

Sections

  • Wasm support

Crate Items

  • Re-exports
  • Modules
  • Macros
  • Structs
  • Enums
  • Constants
  • Traits
  • Functions
  • Attribute Macros

Crates

  • fedimint_core
?
Settings

Crate fedimint_core

source ·
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 control
  • fedimint_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 hex;
  • pub use secp256k1;
  • pub use tiered_multi::*;

Modules§

  • admin_client
    Admin (guardian) client types
  • backup
    Federation-stored client backups Federation-stored client backups
  • bitcoin_migration
    Gradual bitcoin dependency migration helpers
  • bls12_381_serde
    Legacy serde encoding for bls12_381
  • config
    Federation configuration
  • core
    Fundamental types Fedimint Core API (common) module interface
  • db
    Database handling Core Fedimint database traits and types
  • encoding
    Consensus encoding 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.
  • endpoint_constants
  • envs
    Common environment variables
  • epoch
  • fmt_utils
    Formatting helpers
  • invite_code
    Federation invite code
  • macros
    Common macros
  • module
    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.
  • net
    Peer networking
  • runtime
    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.
  • session_outcome
    Atomic BFT unit containing consensus items
  • task
    Task handling, including wasm safe logic
  • tiered
    Types handling per-denomination values
  • tiered_multi
    Types handling multiple per-denomination values
  • time
    Time handling, wasm safe functionality
  • timing
    Timing helpers
  • transaction
    Fedimint transaction (inpus + outputs + signature) types
  • txoproof
    Peg-in txo proofs
  • util
    General purpose utilities

Macros§

  • __api_endpoint
    Example
  • _dyn_newtype_define_inner
  • _dyn_newtype_define_with_instance_id_inner
  • _dyn_newtype_impl_deref_mut
  • async_trait_maybe_send
    async trait that use MaybeSend
  • deserialize_as_encodable_hex
  • dyn_newtype_define
    Define “dyn newtype” (a newtype over dyn Trait)
  • dyn_newtype_display_passthrough
    Implements the Display trait for dyn newtypes whose traits implement Display
  • dyn_newtype_impl_dyn_clone_passthrough
    Implement Clone on a “dyn newtype”
  • erased_eq_no_instance_id
  • extensible_associated_module_type
    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.
  • fedimint_build_code_version_env
    Get value of FEDIMINT_BUILD_CODE_VERSION_ENV at compile time
  • impl_db_lookup
  • impl_db_record
    This is a helper macro that generates the implementations of DatabaseRecord necessary for reading/writing to the database and fetching by prefix.
  • maybe_add_send
    MaybeSync can not be used in dyn $Trait + MaybeSend
  • maybe_add_send_sync
    See maybe_add_send
  • module_plugin_dyn_newtype_clone_passthrough
  • module_plugin_dyn_newtype_define
    Define a “module plugin dyn-newtype” which is like a standard “dyn newtype”, but with associated “module_instance_id”.
  • module_plugin_dyn_newtype_display_passthrough
  • module_plugin_dyn_newtype_encode_decode
    Implement Encodable and Decodable for a “module dyn newtype”
  • module_plugin_dyn_newtype_eq_passthrough
  • module_plugin_static_trait_define
    Define a “plugin” trait
  • module_plugin_static_trait_define_config
    A copy of module_lugin_static_trait_define but for ClientConfig, which is a snowflake that requires : Serialize and conditional implementation for DynUnknown. The macro is getting gnarly, so seems easier to copy-paste-modify, than pile up conditional argument.
  • plugin_types_trait_impl_common
    Implements the necessary traits for all associated types of a FederationServer module.
  • plugin_types_trait_impl_config
    Implements the necessary traits for all configuration related types of a FederationServer module.
  • push_db_key_items
  • push_db_pair_items
  • push_db_pair_items_no_serde
  • serde_as_encodable_hex
  • serialize_as_encodable_hex

Structs§

  • Amount
    Represents an amount of BTC. The base denomination is millisatoshis, which is why the Amount type from rust-bitcoin isn’t used instead.
  • Feerate
  • NumPeers
    The number of guardians in a federation.
  • OutPoint
    OutPoint represents a globally unique output in a transaction
  • PeerId
  • TransactionId
    A transaction id for peg-ins, peg-outs and reissuances

Enums§

  • BitcoinAmountOrAll
    Amount of bitcoin to send, or All to send all available funds
  • CoreError
  • ParseAmountError

Constants§

  • SATS_PER_BITCOIN

Traits§

  • BitcoinHash
    Trait which applies to hashes of all types.
  • NumPeersExt
    Types that can be easily converted to NumPeers

Functions§

  • msats
    Shorthand for Amount::from_msats
  • sats
    Shorthand for Amount::from_sats
  • weight_to_vbytes
    Converts weight to virtual bytes, defined in BIP-141 as weight / 4 (rounded up to the next integer).

Attribute Macros§

  • apply

Results

re-export
fedimint_core::ServerModule
trait
fedimint_core::module::ServerModuleInit
Module Generation trait with associated types
struct
fedimint_core::config::ServerModuleConfig
Config for the server-side of a particular Federation …
struct
fedimint_core::module::ServerModuleInitArgs
type alias
fedimint_core::module::registry::ServerModuleRegistry
Collection of server modules
type alias
fedimint_core::config::ServerModuleInitRegistry
struct
fedimint_core::config::ServerModuleConsensusConfig
type alias
fedimint_core::config::ServerModuleConfigGenParamsRegistry
Registry that contains the config gen params for all …
trait
fedimint_core::core::server::IServerModule
Backend side module interface
trait
fedimint_core::module::IServerModuleInit
Interface for Module Generation
struct
fedimint_core::core::server::DynServerModule
struct
fedimint_core::module::DynServerModuleInit
trait
fedimint_core::config::TypedServerModuleConfig
Module (server side) config, typed
trait
fedimint_core::config::TypedServerModuleConsensusConfig
Consensus-critical part of a server side module config
trait method
fedimint_core::module::ServerModule::api_endpoints
Returns a list of custom API endpoints defined by the …
trait method
fedimint_core::module::ServerModule::process_input
Try to spend a transaction input. On success all necessary …
trait method
fedimint_core::module::ServerModule::consensus_proposal
This module’s contribution to the next consensus …
trait method
fedimint_core::module::ServerModule::output_status
Retrieve the current status of the output. Depending on …
trait method
fedimint_core::module::ServerModule::process_output
Try to create an output (e.g. issue notes, peg-out BTC, …
trait method
fedimint_core::module::ServerModule::process_consensus_item
This function is called once for every consensus item. The …
trait method
fedimint_core::module::ServerModule::audit
Queries the database and returns all assets and …
trait method
fedimint_core::module::ServerModule::api_endpoints
Returns a list of custom API endpoints defined by the …