Gadget is a comprehensive framework for building multi-party computation (MPC) and restaking service gadgets. It provides a standardized and flexible approach to implementing services that interact with job management systems, such as blockchains with on-chain job management logic, and communicate with other service providers using peer-to-peer or alternative networking stacks.
- Modular and extensible architecture
- Support for various MPC protocols and services:
- Integration with Substrate blockchain logic and networking
- Standardized job allocation, completion, and submission mechanisms
- Protocol-specific blockchain connections, networking layers, and application logic
- Comprehensive testing framework
- Rust 1.74.0 or higher
- Substrate blockchain with compatible job management and submission infrastructure
- Clone the repository:
git clone https://github.com/webb-tools/gadget/
cd gadget
- Build the project:
cargo build --release
The gadget shell is a standalone application that provides a command-line interface for interacting with the Gadget and the blockchain. To run the shell, use the following command:
./target/release/shell-manager --protocols-config ./global_protocols.toml --shell-config shell-configs/local-testnet-0.toml -vvv
Before running that command, make sure that a tangle node is running, otherwise, the shell will fail.
To create a new protocol using Gadget, clone the protocol-template and begin hacking!
For examples of protocols using this template, check out our protocol implementations
This repository contains unit tests and integration tests to validate the functionality of the Gadget framework and its interaction with the blockchain.
To run the tests, use the following command:
RUST_LOG=gadget=trace cargo nextest run
Integration testing involves a multi-step process that includes running a tangle node, running multiple gadget shells each with a separate config, and submitting jobs manually. To run the integration tests, make sure the aforementioned steps are followed for building the executables, then, follow these steps:
- Run a tangle node from the tangle repository
bash ./scripts/run-standalone-local.sh --clean
- Run Gadgets
bash ./scripts/run-gadget-local.sh
- Once the shells are running, open a separate terminal, navigate to the tangle directory, and run:
cd types && yarn && ts-node playground.ts
- View the progress by navigating in a web browser here
If you encounter linking errors related to libgmp (e.g., "could not find library -lgmp") when building on a Mac M1, follow these steps:
- Install GMP using Homebrew:
brew install gmp
- Set the LIBRARY_PATH and INCLUDE_PATH environment variables:
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib
export INCLUDE_PATH=$INCLUDE_PATH:/opt/homebrew/include
Note: You need to set these environment variables each time you start a new shell session or append them to your .zshrc file.
We welcome contributions to Gadget! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
Gadget is licensed under the MIT License
We would like to thank the following projects for their inspiration and contributions to this repository:
If you have any questions or need further information, please contact the developers here