๐๏ธ Overview
pallet-xp is a modular, trait-driven system for managing XP identities, reputation, and execution.
It is not a balance pallet.
It is a runtime-native identity layer built around:
- XP identities (
XpId) - reputation-driven progression (Pulse)
- scoped execution through ownership
- programmable constraints (Lock / Reserve)
- interoperability through traits and adapters
The architecture is designed for extensibility, safety, and protocol-level composition.
What the Architecture Separatesโ
The pallet cleanly separates:
- state storage
- execution logic
- reputation mechanics
- ownership validation
- constraint handling
- external integration (traits + adapters)
This avoids monolithic design and makes each system independently composable.
1. XP Identity Layerโ
The identity layer is the foundation of the pallet.
Core Roleโ
XpId= primary runtime identity- execution subject
- storage key
- ownership target
An account does not "hold XP".
It owns one or more XP identities.
Why This Mattersโ
This allows:
- multiple independent identities per account
- XP-scoped execution
- isolated behavioral state
- protocol-native identity logic
XP becomes something the runtime acts through, not just something it stores.
2. Storage Layerโ
The storage layer holds all persistent XP state.
Every important system behavior is backed by explicit storage.
Core Storage Mapsโ
| Storage | Purpose |
|---|---|
๐งฉ XpOf | Main XP state (free, reserve, lock, pulse, timestamp) |
๐ค XpOwners | Ownership mapping |
๐ LockedXpOf | Lock records |
๐ฆ ReservedXpOf | Reserve records |
๐งน ReapedXp | Reaped / invalidated XP tracking |
Storage reflects both value and behavioral history.
3. Trait-Based Systemโ
The pallet is built using traits, not monolithic logic.
Each behavior is separated into a dedicated interface.
This makes the system reusable across runtimes and easier to integrate with other pallets.
Core Traitsโ
| Trait | Purpose |
|---|---|
XpSystem | Read/query XP |
XpOwner | Ownership management |
XpMutate | Create and earn XP |
XpReserve | Reserve XP |
XpLock | Lock XP |
XpReap | Remove inactive XP |
Traits define capability boundaries.
This is one of the strongest architectural decisions in the pallet.
4. Execution Flowโ
All runtime interaction follows a strict identity validation model.
origin: AccountId
input: XpId
ensure: owner(origin, XpId)
This guarantees that accounts authorize actions, but XP identities define execution scope.
Execution Pipelineโ
Execution is identity-scoped, not account-scoped.
5. Pulse Engineโ
Pulse is embedded inside mutation logic.
It is not a separate subsystem.
It is part of how XP is earned.
Placementโ
The pulse engine lives inside XpMutate.
This ensures reputation and XP growth cannot be separated.
Roleโ
Pulse:
- ๐ฆ controls when XP earning begins
- ๐ก๏ธ prevents same-block abuse
- ๐ scales rewards using reputation
- ๐ accelerates growth when XP is locked
It transforms XP from a balance system into a behavioral system.
6. Constraint Systemโ
Constraints are modular behavioral controls.
They do not transfer XP.
They define how XP may be used.
๐ Lockโ
Strict restriction.
Represents commitment.
๐ฆ Reserveโ
Soft allocation.
Represents intent.
Both are reason-based and runtime-controlled.
Placementโ
Constraints shape behavior, not ownership.
7. Event & Extension Layerโ
The pallet supports events and listener hooks for external integrations.
This creates extensibility without changing core logic.
Flowโ
Events are for observability.
Extensions are for protocol behavior.
Purposeโ
- ๐ External integrations
- ๐ง Custom runtime extensions
- ๐ Monitoring and analytics
- โ๏ธ Lifecycle hooks for other pallets
This makes XP usable across the wider runtime.
8. Fungible Adapter Layerโ
XP provides partial compatibility with fungible traits.
This exists for interoperability, not because XP is a true balance system.
Important Clarificationโ
- โ XP is not truly fungible
- โ There is no total issuance model
- โ XP is not a transferable asset
The adapter exists so other pallets can reuse balance-oriented logic safely.
Placementโ
This allows compatibility without compromising XP semantics.
Design Principlesโ
1. Separation of Concernsโ
Identity, logic, storage, and constraints are independent.
This improves maintainability and correctness.
2. Trait-Driven Architectureโ
Each responsibility is modular and composable.
Traits prevent tight coupling.
3. Identity-Centric Executionโ
All runtime logic operates on XpId, not directly on accounts.
This is the defining design principle of the pallet.
4. Extensibilityโ
Hooks, listeners, and adapters allow seamless integration with other pallets.
The system is built for protocol composition.
Final Insightโ
โ๏ธ
pallet-xpis not just storage. ๐ง It is an identity-driven execution layer with built-in reputation mechanics.
That is what makes the architecture fundamentally different from balance pallets.
๐ Next Stepsโ
To understand how state is stored in detail:
๐ Architecture -> Storage