Perun Polkadot Node demonstrates how to integrate the Perun Pallet into a substrate chain.
It uses the Node template and Frontend template from substrate and configures them for Perun.
frontend/
based on frontend template- src/config/types.json holds some type definition for the frontend
node/
based on node template- pallets/perun contains the Perun Pallet
- runtime/Cargo.toml configures the Node
- runtime/src/lib.rs configures the Perun Pallet
You can use docker to start the node and the frontend to try out the Perun Pallet.
docker-compose build
docker-compose up
The frontend will be available at localhost:8000/substrate-front-end-template.
You can try out different Extrinsic calls in the Pallet Interactor.
This is currently not very practical since hashes and off-chain signatures are required, which are hard to enter manually. Using mocked hashes and sigs could be done here.
Instead of building the project yourself, you can use our images and start them individually:
docker run --rm -it -p9944:9944 ghcr.io/perun-network/polkadot-test-node
docker run --rm -it -p8000:8000 ghcr.io/perun-network/polkadot-test-frontend
The frontend will be available at localhost:8000/substrate-front-end-template.
Clone the repository with submodules.
git clone --recurse-submodules https://github.com/perun-network/perun-polkadot-node
cd perun-polkadot-node
Ensure that the Rust toolchain is installed. Then build the node.
cd node
cargo build --release
For testing, run the compiled node binary as follows.
cd node/target/release
./node-template --dev --ws-external --rpc-methods=Unsafe -lruntime=debug
You can start the frontend in a second terminal.
cd frontend
yarn install
yarn start
This should automatically open your browser with localhost:8000/substrate-front-end-template.
In the node, you can print log messages using frame_support::runtime_print
.
frame_support::runtime_print!("CustomValue: {:?}", val);
In order to see the log messages, make sure to run the node with -lruntime=debug
.
This node provides a runtime for benchmarking the Perun Pallet.
Enter the node/
directory and run the following command:
cargo run --release --features runtime-benchmarks benchmark --execution wasm --wasm-execution compiled --chain dev --pallet 'pallet_perun' --extrinsic '*' --steps 20 --repeat 10 --raw --output pallets/pallet-perun/src/weights.rs
This will write the updated weights into the weights.rs
file of the pallet.
More information can be found in the Substrate Benchmarking Doc.
Check out rust-land.org to install rustup
, then adjust your toolchain for this repo:
rustup default stable
rustup update nightly
rustup update stable
rustup target add wasm32-unknown-unknown --toolchain nightly
The development of this project is supported by the Web3 Foundation through the Open Grants Program.
The development of the go-perun library is supported by the German Ministry of Education and Science (BMBF) through a Startup Secure grant.
This software is still under development. The authors take no responsibility for any loss of digital assets or other damage caused by the use of it.
Copyright 2021 PolyCrypt GmbH.
Use of the source code is governed by the Apache 2.0 license that can be found in the LICENSE file.