Skip to content

tangle-network/dkg-substrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8360611 · Aug 3, 2023
Sep 2, 2022
Jul 10, 2023
Apr 26, 2023
Jul 11, 2023
Aug 3, 2023
Jul 18, 2023
Jul 18, 2023
Jul 18, 2023
Aug 3, 2023
Aug 3, 2023
Jun 4, 2022
Aug 3, 2023
Jul 20, 2023
Jul 19, 2023
Aug 3, 2023
Aug 3, 2023
Jul 10, 2023
Oct 25, 2021
May 12, 2023
May 30, 2023
Jul 10, 2023
Aug 3, 2023
Aug 3, 2023
Oct 21, 2022
Jul 18, 2023
Oct 15, 2022
May 12, 2023
Jul 12, 2023
Aug 3, 2023
Jan 22, 2022
Jul 5, 2023

Repository files navigation

🚀 Threshold ECDSA Distributed Key Generation Protocol 🔑

GitHub Workflow Status Codecov License: GPL v3 Telegram Discord

📖 Table of Contents

Table of Contents

Getting Started 🎉

The DKG is a multi-party computation protocol that generates a group public and private key. We aim to use this group keypair to sign arbitrary messages that will govern protocols deployed around the blockchain ecosystem. One primary purpose for the DKG is to govern and facilitate operations of the private signature bridge/anchor system.

For additional information, please refer to the Webb DKG Rust Docs 📝. Have feedback on how to improve the dkg? Or have a specific question to ask? Checkout the DKG Feedback Discussion 💬.

Prerequisites

This guide uses https://rustup.rs installer and the rustup tool to manage the Rust toolchain.

First install and configure rustup:

# Install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Configure
source ~/.cargo/env

Configure the Rust toolchain to default to the latest stable version, add nightly and the nightly wasm target:

rustup default nightly
rustup update
rustup update nightly
rustup target add wasm32-unknown-unknown

Installation 💻

cargo build --release

NOTE: You must use the release builds! The optimizations here are required as in debug mode, it is expected that nodes are not able to run fast enough to produce blocks.

Installation Using Nix 💻

  1. Install Nix
  2. Enable Flakes
  3. If you have direnv installed, everything should work out of the box.
  4. Run nix develop in the root of this repo to get a shell with all the dependencies installed.

Usage

Standalone Local Testnet

./scripts/run-local-testnet.sh --clean

This should start the local testnet, you can view the logs in /tmp directory for all the authorities and use polkadotJS to view the running testnet.

Testing 🧪

The following instructions outline how to run dkg-substrate's base test suite and E2E test suite.

To run base tests

cargo test

To run the test orchestrator E2E tests (recommended)

# Build the dkg-standalone node
cargo build --release -p dkg-standalone-node --features=integration-tests,testing

# run the orchestrator, making sure to use the proper config
cargo run --package dkg-test-orchestrator --release --features=testing -- --config /path/to/orchestrator_config.toml

Setting up debugging logs

If you would like to run the dkg with verbose logs you may add the following arguments during initial setup. You may change the target to include debug | error | info| trace | warn. You may also want to review Substrate runtime debugging.

-ldkg=debug \
-ldkg_metadata=debug \
-lruntime::offchain=debug \
-ldkg_proposal_handler=debug \
-ldkg_proposals=debug

Contributing

Interested in contributing to the Webb Relayer Network? Thank you so much for your interest! We are always appreciative for contributions from the open-source community!

If you have a contribution in mind, please check out our Contribution Guide for information on how to do so. We are excited for your first contribution!

License

Licensed under GNU General Public License v3.0.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the GNU General Public License v3.0 license, shall be licensed as above, without any additional terms or conditions.

Troubleshooting

The linking phase may fail due to not finding libgmp (i.e., "could not find library -lgmp") when building on a mac M1. To fix this problem, run:

brew install gmp
# make sure to run the commands below each time when starting a new env, or, append them to .zshrc
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib
export INCLUDE_PATH=$INCLUDE_PATH:/opt/homebrew/include