Skip to content

kzero-xyz/kzero-template-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node template for kzero.

This is a template substrate node example to integrate kzero.

Integrate in runtime

Integrate kzero is simple. The only step you need to do is integrate a new pallet: pallet-zklogin from kzero.

Integrate pallet-zklogin

  1. in Cargo.toml

    pallet-zklogin = { git = "https://github.com/kzero-xyz/kzero", branch = "polkadot-stable2407", default-features = false }
  2. in runtime

    1. config pallet_zklogin

      parameter_types! {
          pub const MaxKeys: u32 = 3; // this can change to other value by yourself
      }
      impl pallet_zklogin::Config for Runtime {
          type AuthorityId = pallet_zklogin::crypto::ZkLoginAuthId;
          type MaxKeys = MaxKeys;
          type RuntimeEvent = RuntimeEvent;
          type Extrinsic = InnerUncheckedExtrinsic;
          type CheckedExtrinsic =
              <InnerUncheckedExtrinsic as sp_runtime::traits::Checkable<Self::Context>>::Checked;
          type UnsignedValidator = Runtime;
          type Context = frame_system::ChainContext<Runtime>;
          type Time = Timestamp;
          type WeightInfo = pallet_zklogin::weights::SubstrateWeight<Runtime>;
      }
    2. define the new type UncheckedExtrinsic which is used for pallet_zklogin. The core change is SignedExtra

      pub type InnerUncheckedExtrinsic = generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, InnerSignedExtra>;
      // for inner transaction, we use the innerSignedPayload(which use the innerSignedExtra)
      pub type InnerSignedPayload = generic::SignedPayload<RuntimeCall, InnerSignedExtra>;

Integrate via toolchain 1.81.0

Notice for now, the kzero is compiled in toolchain 1.81.0. You can try to test other toolchain, while if you are using 1.81.0, you need to downgrade some crates:

cargo update base64ct --precise=1.6.0
cargo update backtrace --precise=0.3.69
cargo update url --precise=2.5.0
cargo update static_init --precise=1.0.3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages