Global Validator Replication
Smart contract state is duplicated across thousands of validator nodes. If a user loses hardware, entering their BIP-39 seed phrase on a fresh device immediately restores balances.
Native asset custodians (Fireblocks, BitGo, Dfns) secure the NIGHT token, but cannot protect arbitrary Compact contract witnesses—which have zero on-chain ciphertexts to custody. MidRelay provides the confidential state continuity and threshold custody engine required for production privacy dApps.
State Restored in 42ms
HistoricMerkleTree<8, Bytes<32>> root: 0x7f4a...92b1
XChaCha20-Poly1305 memo decrypted · Blake2b bound
2-of-3 threshold satisfied (London + Zürich shares)
proveHoldsState circuit verified · e(A, B) = e(α, β)
<50ms
State Verification Latency
18 / 18
Cryptographic Invariants Passing
GF(256)
2-of-3 Shamir Threshold Quorum
0-Byte
Plaintext Leakage (Ciphertext-Only)
01 / THE DUAL-LEDGER PROBLEM
On transparent chains, validator nodes replicate everything. On Midnight's Kachina dual-ledger, private state lives strictly on client hardware. This creates a silent existential vulnerability for serious dApps and regulated capital.
Smart contract state is duplicated across thousands of validator nodes. If a user loses hardware, entering their BIP-39 seed phrase on a fresh device immediately restores balances.
While native Zswap shielded tokens can be trial-decrypted from seed, custom Compact contracts record zero on-chain shadows for private witnesses. Application state (roles, identity credentials, private compliance notes) lives strictly in client LevelDB.
Comparing state persistence mechanisms across transparent, shielded, and custom Compact architectures.
| State Domain | Storage Location | Device Wipe Recovery | Confidentiality | Continuity Status |
|---|---|---|---|---|
Transparent Chains Ethereum, Cardano L1, Solana | Global Validator Ledger (Replicated) | Seed Phrase (BIP-39) restores all balances | Zero (Public Ledger Exposure) | Transparent |
Native Shielded Tokens Midnight Zswap (NIGHT / DUST) | On-chain encrypted note ciphertexts | Trial-decryption via viewing key rescan | Full ZK Confidentiality | Native Rescan |
Custom Compact Contracts Without MidRelay (Standard SDK) | Client LevelDB / IndexedDB strictly | PERMANENT LOSS · Zero on-chain preimage | Full ZK Confidentiality | Unrecoverable |
Compact + MidRelay Layer State Continuity & Custody Engine | Encrypted Memos on HistoricMerkleTree | Sub-50ms Deterministic Merkle Verification | 0-Byte Plaintext Leak · GF(256) Shamir | Guaranteed Continuity |
Existing custodians (Fireblocks, BitGo, Copper, Dfns) secure the native NIGHT token and transparent UTXOs—none address arbitrary Compact witness state, which has no on-chain ciphertext to custody in the first place. Asset custodians cannot protect or audit what never enters the public ledger. MidRelay complements native asset custodians by providing zero-knowledge state continuity and threshold viewing-key infrastructure for institutional assets like ShieldUSD, Fairway compliance rails, and private credit vaults.
02 / ARCHITECTURAL SCOPE
Relaying is not just cross-chain messaging. MidRelay defines relaying as the secure transport of private cryptographic state across three boundaries where confidential data is normally destroyed or compromised:
Relays private witnesses across machine death, browser wipes, and viewing-key rotations. Deterministic verification occurs in under 50ms — reconstructed state from encrypted memos is checked against on-chain Compact Merkle commitments.
Relays confidential state access between treasuries, auditors (FCA / SOC-2), and autonomous AI agents using 2-of-3 Shamir quorums over GF(256) without granting spending authority.
Relays verified Midnight zero-knowledge state tickets to Cardano Plutus (Aiken) and Base EVM (Solidity verifiers) for deterministic cross-chain settlement without wrapped synthetic tokens.
03 / INSTITUTIONAL ARCHITECTURE
MidRelay satisfies rigorous mathematical and regulatory criteria designed specifically for the constraints of zero-knowledge dual-ledger blockchains.
Reconstruct unspent notes and credentials from encrypted memos, verified against on-chain Compact Merkle roots using a single passphrase or a quorum of viewing keys.
k-of-n secret sharing across distributed guardians for FCA/tax compliance audits without exposing spending keys or private notes.
In-circuit assert(salt != 0) eliminates multi-transaction correlation attacks (termed 'DarkState' in our threat model), ensuring identical memos produce distinct commitments.
Lightweight TypeScript primitives for institutional key ceremonies, secret splitting, and automated state backups.
04 / REGULATED ENTERPRISE CUSTODY
As outlined in Monument Bank's roadmap for Midnight (tokenized deposits → whitelisted RWAs → private Lombard lending), institutions require continuous regulatory compliance (FCA / SOC-2) and auditability without revealing confidential client positions or balance sheets to the public ledger.
2-of-3 Shamir Quorum over GF(256)
Viewing authority is split across three distinct institutional guardians with no single point of compromise.
Scoped Time-Bounded Read-Only Audits
Auditors receive mathematically restricted viewing certificates that expire automatically and convey zero transaction-signing capabilities.
Zero Public Ledger Footprint
Validators verify the state proof in <5ms without learning balance amounts, counterparty identities, or historical ledger paths.
Keystore: 0x4a7f92...c8e1 · Derivation: Argon2id
KMS: arn:aws:kms:eu-central-1:vault-monument
Air-gapped Cold Storage · Primitive Polynomial: 0x11d
05 / DEVELOPER SPECIFICATION
The MidRelay SDK and Compact circuits keep trust boundaries explicit. Every cryptographic parameter is strongly typed and verifiable on-chain.
import { MidRelayClient, ShamirThreshold } from '@midrelay/sdk';
// 1. Split institutional viewing authority across 3 guardians (GF(256))
const shares = ShamirThreshold.split(masterViewingKey, { threshold: 2, total: 3 });
// 2. Commit encrypted state memo to Midnight Compact contract
const tx = await client.publishMemo({
statePayload: { balance: 50_000_000n, currency: 'USDM', vault: 'monument-uk' },
encryptionKey: shares.deriveEncryptionKey(),
salt: crypto.getRandomValues(new Uint8Array(32)) // Anti-correlation assertion
});
✓ Memo committed to Compact HistoricMerkleTree · Plaintext never leaves device06 / PHASED PROTOCOL ROADMAP
MidRelay begins where privacy blockchains are most vulnerable: the client-state lifecycle. In subsequent phases, MidRelay expands to multi-party custodians, AI autonomous agents, and cross-chain proof settlements.
Foundational private-witness survivability engine. Eliminates the #1 existential threat of local LevelDB erasure.
Multi-party viewing keys for regulated institutions and delegated time-bound capability mandates for autonomous AI agents.
Confidential institutional multi-sig vaults, dark solvency verification, and recursive state relays to Cardano and EVM.
Install the MidRelay Client SDK
Start building privacy-first state continuity in minutes.