๐ Pallet Commitment
a semantic asset commitment engine for Substrate runtimes.
This pallet extends traditional fungible balance locking by introducing structured commitments.
Instead of simply freezing fungible assets, balances are bonded to:
- ๐ฏ a purpose (Reason)
- ๐งพ a context (Digest)
- ๐ a model (Direct / Index / Pool)
- โ a semantic position (Variant)
This creates a reusable infrastructure layer for staking, governance, escrow, lending, and other financial systems.
pallet-commitmentturns traditional balance locks into programmable financial commitments.
๐ Why This Pallet Existsโ
Traditional locks are simple:
Lock 100 Tokens to Reason A
But real protocols need more.
For example:
- staking needs validator-linked commitments
- governance needs proposal-linked deposits
- escrow needs trade-linked guarantees
- lending needs collateral-linked positions
These are not just locks. They are commitments with meaning.
This pallet provides that abstraction.
๐ง Core Ideaโ
A commitment is:
Commitment = bond(asset) -> (reason, digest)
Where:
- Reason: why the asset is committed
- Digest: what the commitment belongs to
- Asset: how much value is committed
This turns balances into structured protocol state.
Instead of managing each lock separately, the runtime works through the shared digest.
This allows:
- ๐ฆ grouped updates across related commitments
- ๐ shared rewards and penalties
- โ๏ธ proportional redistribution
- ๐งพ simpler protocol-level accounting
Result:
- โ less fragmented balance management
- ๐ better scalability
- ๐งน cleaner support for complex financial logic
๐งฉ Commitment Models
The pallet supports multiple commitment models:
โ Direct Commitmentโ
Commit directly to a single digest.
Alice -> (STAKING, ValidatorDigest)
Best for simple staking, escrow, and deposits.
๐งบ Index Commitmentโ
Group multiple digests (entries) using weighted shares.
ALICE -> (ESCROW, BTC) -> 50%
(ESCROW, ETH) -> 30%
(ESCROW, DOT) -> 20%
Useful for grouped exposure and portfolio-style commitments.
๐ Pool Commitmentโ
Pools are manager-controlled commitments built on top of indexes.
Users commit into a pool, and the pool operator manages how value is allocated across slots.
Example:
Alice commits 100 DOT -> Validator Pool
The pool has dynamic slots (digests) like:
- Validator A -> 40%
- Validator B -> 35%
- Validator C -> 25%
The pool operator can only adjust these shares and validators over time.
Useful for managed vaults, delegated staking, and operator-controlled financial systems.
๐ท๏ธ Commit Variantsโ
Additionally, commitments can optionally carry semantic positions for models that require it, such as voting, prediction markets, or directional exposure.
Examples:
- long / short
- affirmative / contrary
- positive / negative
- yay / nay / abstain
This allows protocol-specific meaning without changing the underlying commitment engine.
๐ Lazy Balance Pluginโ
Instead of executing balance operations natively, this pallet uses a pluggable balance system based on virtual receipts.
Action -> Receipt Created -> Plugin resolves final balance
The commitment engine records what should happen, while the balance plugin decides how balances are finalized.
This allows flexible rules such as:
- โฐ deposits only during specific time windows
- ๐ minimum or maximum minting and withdrawals
- โ custom validation before settlement
Different protocols can apply different balance rules without changing the commitment engine itself.
This keeps the core simple while supporting advanced financial behavior beyond immediate balance updates.
๐งฑ Built for Other Palletsโ
This pallet is shared infrastructure, not standalone business logic.
Different pallets use commitments differently, e.g., staking, governance, lending, escrow, or managed pools, so this pallet avoids enforcing one fixed workflow.
Instead, it provides reusable building blocks.
Consumer pallets connect through traits like:
type CommitmentAdapter: Commitment<Self::AccountId>;
This lets each pallet define its own commitment logic while reusing the same underlying engine.
One system handles balance mechanics. Each protocol defines the meaning.
๐ Next Stepsโ
Not sure where to begin?
๐ Start with ๐งญ Start Here
It helps you choose the right path based on what you want to do.