Reef chain is written in Rust. A basic familiarity with Rust tooling is required.
To learn more about Reef chain, please refer to Documentation.
To clone the repo with its submodules run:
git clone --recursive https://github.com/reef-defi/reef-chain
If you don’t have Rust already, you can install it with:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
You can install developer tools on Ubuntu 20.04 with:
sudo apt install make clang pkg-config libssl-dev build-essential
You can install the latest Rust toolchain with:
make init
The make run
command will launch a temporary node and its state will be discarded after you terminate the process.
make run
Use the following command to build the node without launching it:
make build
This command will start the single-node development chain with persistent state:
./target/release/reef-node --dev
Purge the development chain's state:
./target/release/reef-node purge-chain --dev
Start the development chain with detailed logging:
RUST_LOG=debug RUST_BACKTRACE=1 ./target/release/reef-node -lruntime=debug --dev
make test
Run runtime benchmark tests:
make bench
Run module benchmark tests:
cargo test -p module-poc --all-features
Run the module benchmarks and generate the weights file:
./target/release/reef-node benchmark \
--chain=dev \
--steps=50 \
--repeat=20 \
--pallet=module_poc \
--extrinsic='*' \
--execution=wasm \
--wasm-execution=compiled \
--heap-pages=4096 \
--output=./modules/poc/src/weights.rs
make debug
Once the project has been built, the following command can be used to explore all parameters and subcommands:
./target/release/reef-node -h
To list all available release builds run:
git tag
To create a corresponding production build, first checkout the tag:
git checkout testnet-1
Then run this command to install appropriate compiler version and produce a binary.
make release
Build the wasm runtime with:
make wasm
You can create a fork of a live chain (testnet / mainnet) for development purposes.
- Build binary and sync with target chain on localhost defaults. You will need to use unsafe rpc.
- Execute the
Make
command ensuring to specify chain name (testnet / mainnet).
make chain=testnet fork
- Now run a forked chain:
cd fork/data
./binary --chain fork.json --alice