Technical Details
1. Core Smart Contract (ERC-0 Main Contract)
At the heart of ERC-0 is a smart contract deployed on the Ethereum mainnet. This contract:
- Allows users to lock ETH or tokens via
commit()
. - Finalizes off-chain transactions on Ethereum via
disperse()
. - Validates off-chain transaction correctness through ZK-proof verification.
Key Functions:
function commit() external payable; // Deposit ETH or tokens
function disperse(bytes calldata zkProof) external; // Finalize off-chain operations
function verifyProof(bytes calldata proof) internal view returns (bool); // ZK-proof verification
2. Off-Chain Execution (Gasless Transactions)
Once users deposit funds into the ERC-0 contract:
- They can sign off-chain operations (e.g., trades, transfers, launches).
- Operations are stored in a special mempool (UserOperation Mempool).
- No gas is paid per transaction—only the final
disperse()
call incurs a gas fee.
Example Flow:
- User performs a 1 ETH ↔ 3000 USDC swap off-chain via a DEX.
- The transaction is batched by validators and a ZK-proof is generated.
- When
disperse()
is called, the proof is submitted to Ethereum.
3. Zero-Knowledge Proof (ZK) Mechanism
ERC-0 uses ZK-SNARKs to mathematically prove the correctness of off-chain transactions.
ZK-Proof Process:
- Off-chain transactions are batched.
- Validators ensure:
- Valid signatures
- Sufficient balances
- Correct nonce ordering
- A ZK-proof is generated and submitted to Ethereum.
Advantages:
✔ Saves gas (only proof verification runs on Ethereum)
✔ Instant finality (no 7-day wait like Optimistic Rollups)
✔ Privacy (transactions are verified without revealing details)
4. Disperse and On-Chain Finalization
When a user calls disperse()
:
- Validators prove all operations since the last disperse using ZK.
- The proof is submitted to the ERC-0 contract.
- The contract verifies the proof and:
- Updates balances
- Stores transaction results immutably on Ethereum
Example Code:
function disperse(bytes calldata zkProof) external {
require(verifyProof(zkProof), "Invalid proof");
stateRoot = newStateRoot; // Update state
emit StateUpdated(newStateRoot); // Emit event
}
5. Security Mechanisms
ERC-0 ensures security through:
- Nonce Control: Each transaction includes a nonce (prevents replay attacks).
- All-or-Nothing Execution: A single invalid transaction invalidates the entire batch.
- Authorized Validators: Only whitelisted validators can submit proofs.