Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 commitmentsVEILENC1 envelopes; window key revealed on RevealBatch
  • Proof-gated settlementClearBatch requires groth16 shielded-ledger-v1 (digest-bound public slots, not in-circuit matching)
  • Threshold tx gossip — VTG2 Shamir + X25519, fail-closed t>=2. Local 2-of-3. Shared AES is not a private mempool.
  • Native fee routing — 70/20/10 MSRB / COL / ops, plus native VAI and AMM (actions 7–14)

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

v1 is these 19 actions. IDs 19–41 in older ANIMA/handshake docs are spec-only and are not in this binary. Public copy must say 19, not 22/41/42. See veil-docs/architecture/VEIL_STACK.md.

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

Companion EVM is rails, not a second protocol. v1 rails: WVEIL, intent gateways, bridge minter, test faucet. Native VAI/AMM/COL live only as VeilVM actions. Local Teleporter is a mock. Olympus / Maker / meme contracts in veil-contracts are parked.

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

VeilVM — Avalanche HyperSDK L1 for privacy-preserving markets. 19 native actions (IDs 0–18). App id 22207. Not live on Fuji/mainnet.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages