The Thesis
You executed a contract. You saw a delay. And then it confirmed.
That delay is not network congestion. It’s not validator latency. It’s the cost of proving correctness before the network ever sees your transaction.
Midnight doesn’t trust execution, it verifies it.
This article breaks down that gap, step by step, from local execution to on-chain finality.
Technical Architecture
Midnight is built on a modified Substrate-based stack (from the Polkadot SDK), but its execution model diverges at a critical point:
Transactions are not just signed. They are proven.
Instead of relying purely on signature validation like most L1s, Midnight introduces a proof-based transaction model, where every state transition must be accompanied by a zero-knowledge proof (ZK-SNARK).
This creates a hybrid pipeline:
Execution → Local (client-side)
Verification → Network (on-chain)
And between those two stages sits the most important component:
The proof server
The “Why” (Market Fit)
Traditional blockchains expose everything:
Inputs
State transitions
Account balances
Midnight removes that visibility without sacrificing correctness.
It solves a real constraint:
How do you validate computation without revealing the data used to compute it?
The answer:
Execute privately (locally)
Prove correctness (cryptographically)
Verify publicly (on-chain)
No data leakage. No blind trust.
What Actually Happens After You Click “Submit”
You already know how to deploy a contract from the previous guide:
https://eightblock.dev/articles/building-and-deploying-your-first-smart-contract-on-midnight-network
Now let’s zoom into what happens after that moment.
Step 1: Execution Happens Locally
You call:
contract.callTx.storeMessage("Hello")That code doesn’t go to the network.
It runs on your machine.
The circuit executes:
Applies logic
Determines the new state
Produces an unproven transaction
At this point:
The transaction is valid in logic, but not yet acceptable to the network.
Step 2: Transaction Balancing
Before proving, the system ensures:
Inputs ≥ Outputs + Fees
This includes:
Selecting DUST inputs
Constructing outputs
Maintaining ledger consistency
This is handled across multiple wallet layers:
Shielded wallet
Unshielded wallet
Fee (DUST) wallet
You don’t see this, but it always happens.
Step 3: Proof Generation (The 20–60 Second Gap)
Now the heavy part.
The SDK sends your transaction to:
http://localhost:6300This is your proof server.
It:
Loads circuit constraints
Applies proving keys
Executes cryptographic computations
What it produces:
A ZK-SNARK proof attached to your transaction
Why it’s slow:
Polynomial computations
Constraint system solving
Elliptic curve operations
This is CPU-bound work. Not network-bound.
Why the Proof Server Runs Locally
This is not optional. It’s a deliberate design choice.
Because the inputs include:
Private state
Ownership data
Witness values
If this ran remotely:
Your privacy would be compromised.
Instead:
No outbound connections
No data leakage
No third-party trust
It listens. Computes. Returns.
Nothing more.
Step 4: Transaction Submission
Once proven, the transaction is sent to:
https://rpc.preprod.midnight.networkThe node:
Checks structure (not full validity)
Adds it to the transaction pool
This step is fast.
Step 5: Block Inclusion & Verification
A block producer:
Picks your transaction
Includes it in a block
Now the real validation happens:
The network uses the verifying key
Checks the ZK proof
If valid:
The state transition is accepted without ever seeing the private data
This is the core property:
Correctness is verified
Inputs remain hidden
Step 6: Indexer → Your App
Once confirmed:
The indexer tracks the new state
Your app receives updates via WebSocket
The promise resolves
You see:
Transaction confirmedBut under the hood:
A full proof-verification lifecycle just completed
Reading Is Different
When you query state:
queryContractState(contractAddress)No proof.
No transaction.
No fees.
Just:
A GraphQL query to the indexer
A direct state response
That’s why reads are instant.
Economic Framework (DUST)
Midnight doesn’t use gas like Ethereum.
It uses:
DUST
DUST:
Is not tradable
Is not speculative
Exists only for fees
It is generated from holding the native token (NIGHT), and:
Accumulates over time
Is consumed when transactions execute
Every state change:
Burns DUST
Proves fee correctness (privately)
Even fees are privacy-preserving.
What Compilation Actually Produces
When you ran:
npm run compileYou generated four key components:
contract/ → callable APIs
keys/ → proving & verifying keys
zkir/ → circuit representations
compiler/ → build artifacts
These feed directly into:
Proof generation
On-chain verification
Without them:
No transaction could ever be proven
Contextual Insight: This Is Not Ethereum
On Ethereum:
Execution happens on-chain
Everyone replays your computation
On Midnight:
Execution happens locally
The network verifies a proof
That difference:
Reduces data exposure
Changes performance characteristics
Shifts computation to the edge (your machine)
Roadmap & Hurdles
Midnight’s model introduces clear trade-offs:
Strengths
Strong privacy guarantees
Deterministic correctness
Reduced on-chain computation
Constraints
Proof generation latency (20–60 seconds)
High local compute requirements
Developer learning curve (ZK concepts)
The biggest barrier is not infrastructure.
It’s mental models.
Developers must stop thinking in “transactions” and start thinking in “provable execution.”
Final Take
That delay you noticed?
It’s not inefficiency.
It’s the cost of:
Privacy
Verifiability
Sovereign computation
Every time you hit “submit,” you’re not just sending a transaction.
You’re proving that it deserves to exist.

Discussion
Join the conversation
Connect your wallet to share your thoughts and engage with the community
No comments yet
Connect your wallet to be the first to comment!