Quickstart
Integrate with Reclaim Pallet
Pre-requisite
You need to be familiar with Substrate Framework.
At this stage, we assume that you are familiar with the steps at ReactJs.
You can access the code of this walkthrough on Gitlab.
Integration with Reclaim Pallet using node template
Please note that pallet_integration_with_reclaim
pallet is an example pallet that represents your pallet which you want to intergrate Reclaim
with.
Clone the Substrate node with reclaim repo.
This Substrate node with reclaim serves as a node template which enables you to use ReclaimVerifier
trait in your pallets.
There are two pallets already configured:
pallet_reclaim
: contains the reclaim logic to verify proofs and implementsReclaimVerifier
.pallet_integration_with_reclaim
: Example pallet that aims to store if the account is verified and usesReclaimVerifier
as an associated type in your palletConfig
.
Code Discovery (pallet-reclaim/src/traits.rs
)
This file defines the ReclaimVerifier
trait which is an interface for verifying proofs in the Reclaim logic.
Code Discovery (pallet-reclaim/src/lib.rs
)
Examine the core logic of the Reclaim pallet in lib.rs. This includes the implementation of the Reclaim logic, storage items, and the public functions that interact with the blockchain.
- Implements
ReclaimVerifier
- Extrinsics for Reclaim Protocol
Code Discovery (pallet-integration-with-reclaim/src/lib.rs
)
This file illustrates how to use the ReclaimVerifier trait in another pallet, which stores verification status for accounts.
ReclaimVerifier
is added toConfig
- Storage to persist if an account is verified
- Extrinsic to Verify if user's proof is valid and store that user's account is verified
Code Discovery (pallet-integration-with-reclaim/src/mock.rs
)
In mock.rs, set up the testing environment for the integration pallet. This involves configuring mock traits and runtime for unit tests.
Code Discovery (runtime/src/lib.rs
)
In your runtime's lib.rs, integrate the pallets to the runtime configuration, ensuring they are included in the construct_runtime! macro.
- Implement Configs for Runtime
- Include the pallets in Runtime
- Add pallets to benches module