We should still figure out what to do before publishing darkfi-sdk to
crates.io since it probably can't reference a git version.
This might imply publishing our halo2 fork as well, probably under
halo2-darkfi namespace.
- replace log crate with tracing,
- replace simple-log crate with tracing-subscriber and tracing-appender
- add nu-ansi-term crate as a dependency which is itself tracing-subscriber's dependency,
inorder to write colored outputs to the terminal since we override formatting provided
by tracing-subscriber
- The node ID is not stored on the disk anymore, it's generated when fud starts.
- PoW uses Equi-X (https://spec.torproject.org/hspow-spec/v1-equix.html), the challenge contains a recent BTC block hash because it's 1) unpredictable 2) known by all fud nodes 3) periodically updated 4) stable. Once the block you chose for your node ID is too old, you will generate another one with another keypair and block hash (or other nodes will exclude you from their DHT).
- BTC block hashes are fetched from the Electrum nodes defined in the config file (you can use tor/i2p nodes if you want).
- Equi-X challenge is `(public_key || btc_block_hash || nonce)`, a node ID is `Hash(equix_challenge || equix_solution)`. You must evaluate the PoW to get a valid node ID.
- The keypair is random and regenerated when you create a new node ID, it's only there so that you can sign messages.
- `Dht` and `DhtHandler` now have a generic parameter which is any struct implementing the `DhtNode` trait. It was not needed before because fud did not use any fud-specific fields for its node struct. All the PoW stuff is in `fud` and NOT in `dht`.
- `fud/src/equix.rs` does not depend on fud, we can move it elsewhere if we want to use Equi-X in another bin.
- `FudPingRequest` now includes a random u64, the other node must provide a signature of that u64 (along with other data, including the data making up its node ID) in its `FudPingReply`.
This is a Sparse Merkle Tree used for contract state proofs.
We only support in-memory storage and BLAKE3 as the hasher.
Implementation is taken and stripped down from the repository located at
<https://github.com/thyeem/monotree/> and is licensed under the MIT License.