core-concepts:data-models

Compare UTXO and account token models for Midnight ledger design.

37|9|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/devrelaicom/midnight-expert --skill core-concepts-data-models
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: core-concepts:data-models
Source: https://github.com/devrelaicom/midnight-expert/tree/main/plugins/core-concepts/skills/data-models
Command: npx skills add https://github.com/devrelaicom/midnight-expert --skill core-concepts-data-models

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps developers and architects decide between UTXO (ledger tokens) and account-based (contract) token models on the Midnight ledger by explaining privacy trade-offs, concurrency implications, and ledger structure so they can pick the safest and most performant design for their application.

Core Features & Use Cases

  • Model comparison: Clear trade-offs between UTXO-based shieldable ledger tokens and account-based contract tokens for privacy, parallelism, and composability.
  • UTXO mechanics: Explanations of coin commitments, nullifier computation, shielded vs unshielded coins, and Merkle commitment tree membership proofs.
  • Ledger structure: Overview of Zswap state, historic Merkle roots, first-free index, nullifier set, and the contract map with verifier keys.
  • Practical guidance: When to mint native vs custom token types, how token types are derived, and integration patterns with Compact contracts.

Quick Start

Compare UTXO and account token models for a privacy-preserving fungible token that requires parallel processing and explain the implications for minting, nullifiers, and contract integration.

Frequently Asked Questions about core-concepts:data-models

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the difference between UTXO and account-based token models on the Midnight ledger?

The Midnight ledger supports UTXO-based shieldable tokens and account-based contract tokens, trading off privacy and parallelism against contract composability. UTXO tokens use coin commitments and nullifiers for shielded transfers, while account tokens manage balances directly in contract state.

How do nullifiers and Merkle commitment trees work for shielded Midnight tokens?

Nullifiers prevent double-spending by marking spent coins, while Merkle commitment trees provide cryptographic membership proofs for shielded coin validity. Historic Merkle roots anchor these proofs, allowing the Zswap state to verify shielded transactions without exposing underlying UTXO data.

When should I choose UTXO ledger tokens versus account-based contract tokens for DeFi or gaming?

Choose UTXO ledger tokens for privacy-preserving transfers and parallel transaction processing, or account-based contract tokens for DeFi composability and complex state logic. UTXO models handle shielded balances better, while account models simplify interactive gaming or governance contract state.

How are custom token types derived and minted on the Midnight ledger?

Midnight token types are derived from specific ledger parameters, allowing architects to mint native or custom tokens. The chosen model dictates integration patterns with Compact contracts, affecting how token types interact with the contract map and verifier keys.

Does the UTXO model support parallel transaction processing better than the account model?

Yes, the UTXO model supports parallel transaction processing better than the account model because independent coin spends do not conflict. Account-based contract tokens require sequential state updates to the contract map, creating contention and limiting concurrency for token transfers.

What are the limitations of using account-based contract tokens for shielded transfers?

Account-based contract tokens limit shielded transfer privacy because balances reside in public contract state rather than shielded coin commitments. They also restrict parallel processing concurrency, requiring sequential state updates that complicate nullifier computation and Zswap state interactions.