This is a support component of Octopus Network.
With this pallet, a chain built from substrate can join octopus network as an appchain.
An appchain can rent security from motherchain on demand.
This pallet depend on CreateSignedTransaction
.
This pallet depend on pallet_session.
Cargo.toml
To add this pallet to your runtime, simply include the following to your runtime's Cargo.toml
file:
TOML
[dependencies]
pallet-session = { default-features = false, version = '3.0.0' }
pallet-octopus-appchain = { default-features = false, git = 'https://github.com/octopus-network/pallet-octopus-appchain.git' }
and update your runtime's std
feature to include this pallet:
TOML
std = [
# --snip--
'pallet-session/std',
'pallet-octopus-appchain/std',
]
lib.rs
You should implement it's trait like so:
```rust parametertypes! { pub const AppchainId: palletoctopusappchain::ChainId = 0; pub const Motherchain: palletoctopusappchain::MotherchainType = palletoctopus_appchain::MotherchainType::NEAR; pub const GracePeriod: u32 = 5; pub const UnsignedPriority: u64 = 1 << 20; }
impl palletoctopusappchain::Config for Runtime { type Event = Event; type AuthorityId = palletoctopusappchain::crypto::OctopusAuthId; type Call = Call; type AppchainId = AppchainId; type Motherchain = Motherchain; const RELAYCONTRACTNAME: &'static [u8] = b"dev-1616239154529-4812993"; type GracePeriod = GracePeriod; type UnsignedPriority = UnsignedPriority; } ```
and include it in your construct_runtime!
macro:
rust
OctopusAppchain: pallet_octopus_appchain::{Module, Call, Storage, Config<T>, Event<T>, ValidateUnsigned},
See this commit of Barnacle for genesis configuration and other settings.
We will explain these configurations in detail later.
You can view the reference docs for this pallet by running:
cargo doc --open