Skip to content

thesecretlab-dev/veilvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VeilVM

A custom Avalanche VM for privacy-preserving prediction markets, built on HyperSDK.

Not a fork of Subnet-EVM — a purpose-built execution environment with native ZK proof verification, commit-reveal batch auctions, and a shielded ledger.

ChainId 22207 · Built in Go · Avalanche L1

Why a Custom VM?

EVM-based chains leak information. Order flow is visible in the mempool, trade sizes are public, and market manipulation is trivial. VeilVM solves this at the execution layer:

  • Encrypted order commitments — Orders are committed as hashes, revealed only during batch clearing
  • Proof-gated settlement — Batches clear only when a valid ZK proof is submitted and verified at consensus
  • Shielded ledger — Balance and position privacy via ZK-SNARK proofs (Groth16/PLONK, BN254)
  • Native fee routing — Protocol fees split across market-specific buyback (MSRB), chain-owned liquidity (COL), and operations

Actions

ID Action Description
0 Transfer Transfer VEIL tokens
1 CreateMarket Create a prediction market
2 CommitOrder Submit encrypted order commitment
3 RevealBatch Submit decryption share for batch reveal
4 ClearBatch Clear batch auction (proof-gated)
5 ResolveMarket Resolve with oracle attestation
6 Dispute Dispute a market resolution
7 RouteFees Split fees across MSRB/COL/Ops
8 ReleaseCOLTranche Release treasury COL by epoch cap
9–10 MintVAI / BurnVAI VAI stablecoin operations
11–14 CreatePool / AddLiquidity / RemoveLiquidity / SwapExactIn Native UniV2-style DEX
15–16 UpdateReserveState / SetRiskParams Governance updates
17 SubmitBatchProof Submit ZK proof + Vellum proof blob
18 SetProofConfig Governance proof requirements

ZK Proof Pipeline

Prover                          VeilVM Consensus
  │                                    │
  ├─ Compute clearPrice, volume,       │
  │  fillsHash from revealed orders    │
  │                                    │
  ├─ Hash: sha256("VEIL_CLEAR_V1" ║    │
  │  marketID ║ windowID ║ clearPrice  │
  │  ║ totalVolume ║ fillsHash)        │
  │                                    │
  ├─ Generate Groth16 proof ──────────►│
  │  (SubmitBatchProof)                │── Verify proof (gnark BN254)
  │                                    │── Store in Vellum proof storage
  │                                    │── Mint Glyph inscription
  │                                    │── Update Bloodsworn profile
  │                                    │
  ├─ ClearBatch ──────────────────────►│
  │                                    │── Verify proof record exists
  │                                    │── Match public_inputs_hash
  │                                    │── Verify Vellum blob integrity
  │                                    │── Execute settlement (fail-closed)

Proof Envelopes: VZK1 (proof + witness) and VZK2 (+ circuit ID). Circuit identity enforced at consensus when VEIL_ZK_REQUIRED_CIRCUIT_ID is set.

Companion EVM

A parallel EVM chain hosts DeFi primitives that bridge to VeilVM:

  • WVEIL — Wrapped VEIL (ERC-20) via Teleporter bridge
  • wsVEIL — Rebase-wrapping staked VEIL (Olympus-style)
  • VAI — VEIL-native stablecoin
  • Bond Vaults — Discount VEIL acquisition via LP/DAI bonds
  • Intent Gateways — Cross-chain order and liquidity routing

See veil-contracts for the full Solidity suite.

Build & Run

# Build
go build ./...

# Run the VM
go run ./cmd/veilvm

# Generate ZK fixture keys
go run ./cmd/veilvm-zktool -out ./zk-fixture
go run ./cmd/veilvm-zktool -circuit shielded-ledger-v1 -out ./zk-fixture-shielded

# Run ZK benchmarks with real Groth16 proofs
PROOF_MODE=groth16 GROTH16_PK_PATH=./zk-fixture/groth16_clearhash_pk.bin \
  go run ./cmd/veilvm-zkbench

# Docker (local profile with strict verifier)
docker compose -f docker-compose.local.yml up -d --build

# Smoke test
node scripts/smoke-local.mjs --chain-id <CHAIN_ID>

RPC Extensions

Method Description
clearinputshash Compute canonical public-input hash
batchproof Get batch proof metadata
vellumproof Get stored proof blob
bloodsworn Read validator trust profile
glyph Read proof-derived inscription metadata

Ecosystem

Component Repo
Smart Contracts veil-contracts
Frontend veil-frontend
Identity (ZK) zeroid
Agent Runtime anima-runtime
Documentation veil-docs

Links


Markets that can't be front-run. Proofs that can't be faked.

About

L1 Chain — Custom Go VM on Avalanche HyperSDK. Purpose-built execution environment for privacy-preserving market operations. ChainId 22207.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages