Skip to main content

๐Ÿ” 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-commitment turns 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.