compact-core:compact-transaction-model

Explain Midnight's three-stage execution mapping Compact circuits to on-chain transactions.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Clarifies how Midnight's three-stage transaction execution maps Compact circuits to on-chain results, helping developers design robust contracts that correctly employ well-formedness, guaranteed, and fallible phases, including checkpoint semantics and fee implications.

Core Features & Use Cases

  • Explain the three-stage lifecycle (well-formedness, guaranteed phase, fallible phase) and how kernel.checkpoint() defines phase boundaries.
  • Describe transaction composition, merging for atomic swaps, and contract deployments within the fallible phase.
  • Provide guidance on state conflicts, gas accounting, and Zswap transcript binding to ensure consistency.

Quick Start

Review the provided example circuits and implement a small sample with kernel.checkpoint() to observe guaranteed and fallible phase separation.

Frequently Asked Questions about compact-core:compact-transaction-model

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

FAQPage Schema
How do Midnight transaction phases map to Compact circuits?

Midnight transaction execution maps Compact circuits through three stages: well-formedness, guaranteed, and fallible phases. The kernel.checkpoint() function defines boundaries between these phases, ensuring proper state validation and ZK proof verification before on-chain commitment.

When should I use kernel.checkpoint() in a Compact contract?

Use kernel.checkpoint() in Compact contracts to separate the guaranteed phase from the fallible phase. This separation is critical when handling transaction composition, atomic swaps, and state-conflict scenarios where consistent phase boundaries must be maintained for ZK proof verification.

How does transaction composition work for atomic swaps in Midnight?

Transaction composition in Midnight merges multiple Compact circuits within the fallible phase to execute atomic swaps. The Zswap transcript binding ensures consistency across merged transactions, while gas-to-fee calculations determine the execution costs for the composed transaction.

What is the difference between guaranteed and fallible phases in Midnight?

The guaranteed phase executes operations that must succeed without consuming fees, while the fallible phase handles operations that may fail and incur gas costs. Kernel.checkpoint() defines this boundary, allowing developers to implement fee-aware contracts with proper state-conflict handling.

How are gas-to-fee calculations handled during Midnight contract deployment?

Gas-to-fee calculations in Midnight contract deployments occur during the fallible phase after kernel.checkpoint() separates it from the guaranteed phase. ZK proof verification and transcript binding ensure that fee accounting remains consistent across the deployed Compact circuits.

Why are ZK proof verifications required for Midnight transaction semantics?

ZK proof verifications are required in Midnight transaction semantics to validate that Compact circuits execute correctly across well-formedness, guaranteed, and fallible phases. They ensure state consistency during transaction composition and contract deployments while maintaining robust fee-aware guarantees.