This is a template substrate node example to integrate kzero.
Integrate kzero is simple. The only step you need to do is integrate a new pallet: pallet-zklogin
from kzero.
-
in Cargo.toml
pallet-zklogin = { git = "https://github.com/kzero-xyz/kzero", branch = "polkadot-stable2407", default-features = false }
-
in runtime
-
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>; }
-
define the new type UncheckedExtrinsic which is used for
pallet_zklogin
. The core change isSignedExtra
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>;
-
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