Skip to content

MeridianAlgo/Interlink

Repository files navigation

InterLink

Overview

InterLink is a zero-knowledge interoperability protocol enabling mathematically guaranteed cross-chain state transitions. By utilizing zk-SNARKs (Halo2 with Groth16 on BN254) and a high-throughput Solana Coordination Hub, InterLink enables instant, permissionless cross-chain message passing and asset transfers with O(1) on-chain verification.

InterLink Architecture

The protocol follows a Hub-and-Spoke architecture where Solana acts as the central settlement and verification layer, while EVM chains (Ethereum, Optimism, Arbitrum, Base, Polygon), Cosmos IBC chains, and future networks serve as spoke gateways.

IMPORTANT – PROVER CONSISTENCY REQUIREMENT

The relayer's Halo2 prover MUST use the exact same interlink_v1_domain salt when generating proofs. This is strictly required to match the updated Solidity input binding logic in InterlinkGateway.sol:L175-180. Ensure the entire pipeline (prover -> relayer -> on-chain verification) uses consistent domain separation to prevent proof mismatches.


Why InterLink?

Feature Wormhole Stargate Across LiFi InterLink
Verification Guardian multisig (19) UltraLight Client Optimistic Oracle Aggregated ZK proofs (O(1))
Settlement 2-15 min 1-2 min 5-60 min Varies <30 seconds
Fees (Tier 1) $1-20 VAA $0.50-5 0.25-1% Varies 0% (zero-fee)
Proof model Trust 13/19 guardians Trust relayer Trust 5 signers Trust bridge Trustless math
Uptime SLA 99.95% (informal) None published None None 99.9% (enforced)
Governance Guardian multisig Snapshot (off-chain) UMA Oracle None On-chain DAO
Audit trail On-chain VAA log None None None SHA-256 hash-chain
Rate limiting None None None 50 req/min 100 req/min free
Bug bounty $50k-2M Varies Varies None $100-500k
LP incentives None STG emissions ACX rewards None Epoch-based + boost

Project Architecture

interlink/
├── circuits/                    # ZK circuit definitions
│   ├── src/
│   │   ├── merkle.rs           # Poseidon Merkle inclusion proofs
│   │   ├── consensus.rs        # Ethereum Sync Committee + Tendermint circuits
│   │   ├── folding.rs          # Recursive proof folding pipeline
│   │   └── config.rs           # Circuit configuration
│   └── Cargo.toml
├── contracts/
│   ├── evm/
│   │   ├── src/InterlinkGateway.sol    # EVM spoke gateway (Solidity 0.8.28)
│   │   ├── script/Deploy.s.sol         # Mainnet deployment
│   │   ├── script/DeployL2.s.sol       # L2 deployment (OP/Arb/Base/Polygon)
│   │   └── test/InterlinkGateway.t.sol # Foundry fuzz tests (23 tests)
│   ├── solana/interlink-hub/
│   │   ├── programs/interlink-hub/     # Anchor program (BN254 pairing)
│   │   └── tests/                      # Devnet integration tests
│   └── cosmos/interlink-gateway/       # CosmWasm gateway (IBC-ready)
├── relayer/
│   ├── src/
│   │   ├── main.rs             # Entry point, env config, task spawning
│   │   ├── lib.rs              # Module registry (33 modules)
│   │   └── [33 modules]       # See Module Reference below
│   ├── tests/
│   │   ├── security.rs         # 30 security-focused tests
│   │   └── integration.rs      # 18 end-to-end integration tests
│   └── bin/
│       ├── benchmark.rs        # Proof generation benchmarks
│       └── load_test.rs        # Concurrent transfer load testing
├── interlink-core/             # Core circuit engine + payload types
├── sdk/                        # @interlink/sdk TypeScript package
└── website/                    # Developer portal (React + Vite)

Relayer Module Reference (33 modules)

The relayer is the heart of InterLink — a standalone Rust service with 33 specialized modules organized by domain.

Core Bridge Pipeline

Module File Description
listener listener.rs WebSocket EVM event subscription with exponential backoff reconnection. Parses MessagePublished, SwapInitiated, NFTLocked events from gateway contracts.
events events.rs GatewayEvent enum with typed variants for Deposit, Swap, and NFTLock. ABI-compatible decoding from EVM log topics + data.
finality finality.rs Per-chain finality confirmation. Polls EVM HTTP RPC for block confirmations. Supports configurable confirmation counts per chain (Ethereum: 75 blocks, L2s: 1-2 blocks).
prover prover.rs Halo2 Groth16 proof generation on BN254. Domain-separated with interlink_v1_domain salt. Semaphore-bounded concurrent proving with spawn_blocking. Result-based error propagation (no panics in async runtime).
submitter submitter.rs Builds and submits raw Solana transactions with ZK proofs. Compact-u16 encoding, PDA derivation (state_registry, stake_account, vk), cached keypair loading.
batch batch.rs BatchCollector aggregates transfers into single settlement transactions every 5 seconds. Configurable batch size with flush-on-full.
nonce nonce.rs DurableNoncePool for parallel Solana settlement (10-100 concurrent nonces). Lock-free acquire/release with exhaustion alerting.

Economics & Fees

Module File Description
fee fee.rs Dynamic fee tier engine. Zero ($0-1k), Standard 0.05% ($1k-100k), Institutional 0.01% ($100k-10M), OTC 0% ($10M+). Beats Wormhole VAA fees and Across 0.25-1%.
gas gas.rs Cross-chain gas cost estimation with amortized proof generation overhead. CostComparison benchmarks against Wormhole/Stargate/Across fee models.
mev mev.rs MEV capture revenue modeling. Computes LP breakeven analysis — minimum daily volume for zero-fee Tier 1 sustainability.
amm amm.rs Constant-product AMM (x*y=k) for bridge vault liquidity. LP fee split: 0.25% to LPs + 0.05% protocol. 5% max price-impact guard. APY tracking with real-time yield computation.

Governance & Token Economics

Module File Description
governance governance.rs DAO governance: 1B $INTERLINK supply (40% community, 30% team, 30% treasury). Proposal creation (100k threshold), 7-day voting, 2-day timelock, treasury disbursement. 6 proposal types: UpdateFees, AddChain, UpdateValidatorSet, TreasuryAllocation, UpdateParameters, Text.
staking staking.rs $INTERLINK staking with Bronze/Silver/Gold/Platinum tiers (1k-1M token thresholds). 10-100% fee discounts, 20%→5% APY taper, validator eligibility, configurable slashing (5% downtime, 50% byzantine).
validator_rewards validator_rewards.rs 10% bridge fee distribution to validators, weighted by stake × uptime. Minimum 90% uptime requirement. 5% bonus for perfect uptime. Epoch-based heartbeat tracking.
vesting vesting.rs Token vesting schedules: team (4yr vest, 1yr cliff), advisors (2yr vest, 6mo cliff), treasury (3yr linear, no cliff). Per-beneficiary tracking with revocation support for departed team members.
liquidity_mining liquidity_mining.rs LP incentive program: 10M $INTERLINK over 26 epochs (6 months). Early-bird 2x boost (epochs 1-4), loyalty 1.5x boost (≥4 consecutive epochs), 25/75 immediate/vesting split, 24h anti-gaming minimum deposit.
bounty bounty.rs Bug bounty lifecycle: Critical $100k-$500k, High $10k-$100k, Medium $1k-$10k, Low $100-$1k. SLA response times: Critical 4h, High 24h, Medium 72h, Low 168h. Full submission→triage→confirm→pay pipeline.

Security & Resilience

Module File Description
multisig multisig.rs Threshold multi-signature (3-of-5 Ed25519). Validator bundle creation, signature aggregation, and verification. Upgradeable to 13-of-19 (Wormhole parity) via governance vote.
circuitbreaker circuitbreaker.rs Auto-pause on anomaly: ≥5 consecutive proof failures, ≥3 settlement failures, $1M TVL drain in 5min. Guardian emergency pause. Auto-recovery after 5min cooldown (non-guardian pauses only).
retry retry.rs Exponential backoff with jitter, per-chain retry policies (Ethereum: 2s base/8 retries, Solana: 200ms/4 retries, L2: 500ms/5 retries). Circuit-breaker-aware. Dead-letter queue (1k capacity) for manual replay of failed ops.
ratelimit ratelimit.rs Token-bucket rate limiting: Free 100 req/min, Pro 1000 req/min, Enterprise custom/unlimited. 2x burst allowance. Standard X-RateLimit-* response headers.

Routing & Simulation

Module File Description
intent intent.rs Intent-based routing: user specifies desired output ("1 ETH → ≥2900 USDC on Solana"), solver finds optimal path. Route types: DirectBridge, BridgeAndSwap, MultiHop, SameChainSwap. 2% max slippage, 3-hop max, 5-min expiry.
swap_routing swap_routing.rs Multi-DEX aggregation: Uniswap V3, 1inch, 0x, SushiSwap, Curve (EVM) and Jupiter, Raydium, Orca (Solana). Best-rate selection with fallback routing, slippage tracking, and per-source reliability analytics.
simulator simulator.rs Transfer dry-run with 10 pre-flight checks: circuit breaker, source/dest chain support, cross-chain validation, amount, fee calculation, liquidity, rate limit, estimated time, route type. No on-chain submission.
wrapped wrapped.rs Canonical wrapped asset registry: wETH, wSOL, wMATIC across 6 chains (Ethereum, Optimism, Polygon, Arbitrum, Base, Solana). Deterministic resolve-or-no-wrap — no manual attestation step.

NFT & Atomic Settlement

Module File Description
nft_bridge nft_bridge.rs Cross-chain NFT bridging with lock-mint-burn model. Full metadata preservation (name, traits, IPFS/Arweave URIs, on-chain SVG). EIP-2981 royalty forwarding. Wrapped contract registry. 24h lock timeout with auto-expiry.
atomic atomic.rs Two-phase commit for cross-chain settlement. Escrow state machine: Prepared → ProofReady → Committed → Finalized, with timeout-based rollback. Grace period before forced rollback. Guarantees: no fund loss, no double-spend.

Enterprise Features

Module File Description
enterprise enterprise.rs Institutional bridge controls: address whitelisting, per-tx/daily/monthly spend limits ($500k/$1M/$10M defaults), N-of-M multi-approver workflows for large transfers ($100k+), configurable settlement hold period, auto-resetting spend counters.

Observability & Compliance

Module File Description
metrics metrics.rs Prometheus-compatible metrics: proof gen time (p50/p95/p99), settlement time, verification time (>500ms alert), per-chain finality lag, RPC latency, TVL tracking, daily/cumulative volume, validator uptime %, daily transfers, unique users, top corridors. JSON + Prometheus text export.
sla sla.rs SLA monitoring: 99.9% uptime target, <60s settlement p99, <500ms API response p99. Sliding window (10k samples), automatic breach detection and reporting.
audit_trail audit_trail.rs Append-only compliance log with SHA-256 hash-chain integrity. Indexed by sender, receiver, corridor, time range. CSV + JSON export for regulatory reporting. Tamper detection via verify_integrity().
webhook webhook.rs Real-time push notifications: transfer start, pending, completed, failed. 3-attempt exponential backoff. Auto-disable after 10 consecutive failures.
http_api http_api.rs REST API: GET /health, GET /metrics, GET /quote, POST /simulate. Prometheus endpoint for Grafana integration.

Testing Framework

InterLink employs a multi-layered testing strategy with 451 tests across all layers, all verified passing.

Full Test Suite Summary

Layer Tool Tests Status
Relayer lib (unit) cargo test --lib 366 All passing
Relayer security cargo test --test security 30 All passing
Relayer integration cargo test --test integration 18 All passing
ZK Circuits cargo test -p circuits 10 All passing
EVM Gateway (Solidity) forge test 23 All passing
Solana Hub (devnet) Anchor / Mocha 4 All passing
Total 451 All passing

Security Test Coverage (30 tests)

Module Tests What's Validated
sequence_binding 3 Double-spend prevention, commitment binding, replay rejection
byzantine 6 Threshold enforcement (2/5, 3/5), duplicate signer detection, empty bundle rejection
malformed_input 5 Invalid proof data, oversized payloads, zero-amount transfers
amm_manipulation 4 Price impact guard, zero-amount swap rejection, slippage protection
governance_attack 5 Insufficient stake voting, double-vote prevention, premature execution
rate_limit 4 Free tier enforcement, Pro tier scaling, Enterprise unlimited, burst handling
webhook_dos 3 Auto-disable after failures, delivery tracking, registration limits

Running Tests

# All Rust tests (circuits + relayer)
cargo test --workspace

# Relayer unit tests only
cargo test --lib

# Security tests
cargo test --test security

# Integration tests
cargo test --test integration

# EVM Solidity (requires Foundry)
cd contracts/evm && forge test -vv

# Solana devnet (requires SOL balance + Anchor CLI)
cd contracts/solana/interlink-hub
ANCHOR_PROVIDER_URL=https://api.devnet.solana.com \
ANCHOR_WALLET=~/.config/solana/id.json \
yarn run ts-mocha -p ./tsconfig.json -t 1000000 "tests/**/*.ts"

# Performance benchmarks
cargo run --bin benchmark -- --iterations 1000

# Load testing
cargo run --bin load_test -- --concurrency 50 --total 1000

Specialized Circuits (circuits/)

Advanced ZK primitives built on Halo2 over BN254:

Circuit Purpose Details
Merkle Circuit Poseidon Merkle inclusion proofs Binary tree traversal with quintic S-box hash gates
SyncCommitteeCircuit Ethereum beacon chain finality BLS-aggregate participation accumulation, ≥342/512 quorum threshold
TendermintCircuit Cosmos Tendermint finality >2/3 voting power accumulation gate
FoldingCircuit Recursive proof aggregation Pairwise folding with Fiat-Shamir challenge alpha = (C1+C2)^5, O(log N) depth
BatchedInterlinkCircuit Multi-message batching O(1) on-chain verification for N cross-chain messages in a single SNARK

Multi-Chain Contracts

EVM Spoke Gateway (contracts/evm/)

Solidity 0.8.28 with BN254 pairing precompiles:

  • InterlinkGateway.sol: Message routing, swap initiation, NFT locking, ZK proof verification
  • Deploy.s.sol: Mainnet deployment with guardian address configuration
  • DeployL2.s.sol: L2-specific deployment (Optimism, Arbitrum, Base, Polygon) with per-chain finality calibration
  • 23 Foundry tests including fuzz tests (256 runs each)

Solana Hub Gateway (contracts/solana/interlink-hub/)

Anchor-based program with alt_bn128 syscalls:

  • Program ID: AKzpc9tvxfhLjj5AantKizK2YZgSjoyhLmYqRZy6b8Lz
  • PDA derivation: state_registry, stake_account, vk accounts
  • submit_proof: Verifies ZK proof, mints/releases on destination
  • process_cross_chain_swap: AMM integration with stake verification
  • Live on Solana devnet with 4 passing integration tests

Cosmos Gateway (contracts/cosmos/)

CosmWasm-based gateway for IBC-connected chains:

  • Initial implementation for Tendermint consensus verification
  • IBC channel management for cross-chain message relay

Token Economics

$INTERLINK Token

Parameter Value
Total Supply 1,000,000,000 (1B)
Community / Mining 400,000,000 (40%)
Team (4yr vest, 1yr cliff) 300,000,000 (30%)
Treasury (DAO-governed) 300,000,000 (30%)

Fee Tiers

Tier Transfer Size Fee vs Wormhole vs Across
Zero $0 - $1,000 0% Wormhole: $1-20 VAA Across: 0.25-1%
Standard $1k - $100k 0.05% Wormhole: 0.1-0.2% Across: 0.25-1%
Institutional $100k - $10M 0.01% Wormhole: negotiated Across: negotiated
OTC $10M+ 0% (negotiated)

Staking Tiers

Tier Min Stake Fee Discount Extra Benefits
Bronze 1,000 10% Basic participation
Silver 10,000 25% Governance voting
Gold 100,000 50% Validator eligibility
Platinum 1,000,000 100% Enhanced APY + zero fees

Liquidity Mining Program

  • Budget: 10,000,000 $INTERLINK over 26 weekly epochs (6 months)
  • Early-bird boost: 2x rewards in epochs 1-4 to bootstrap liquidity
  • Loyalty boost: 1.5x for LPs with ≥4 consecutive epochs
  • Vesting: 25% immediate release, 75% linear over 90 days
  • Anti-gaming: 24-hour minimum deposit before earning rewards

Security Model

ZK Proof Verification

Every cross-chain message is verified by a Halo2 Groth16 proof on BN254. The on-chain verifier performs a single pairing check — O(1) regardless of message complexity. Domain separation via keccak256("interlink_v1_domain") prevents cross-protocol proof reuse.

Multi-Layer Protection

Layer Mechanism Auto-Trigger
Circuit Breaker Auto-pause bridge operations ≥5 proof failures, ≥3 settlement failures, $1M outflow in 5min
Guardian Pause Emergency manual pause Authorized guardian key hash
Threshold Multi-Sig 3-of-5 Ed25519 validator co-signing All settlement transactions
Rate Limiting Token-bucket per API key Free: 100/min, Pro: 1000/min
Retry Engine Exponential backoff with dead-letter queue Per-chain optimized policies
Audit Trail SHA-256 hash-chain append-only log Every transfer recorded

Validator Economics

  • 10% fee share distributed to validators per epoch
  • Weighted by: stake amount × uptime percentage
  • Minimum uptime: 90% required for reward eligibility
  • Perfect uptime bonus: +5% additional rewards
  • Slashing: 5% for downtime, 50% for byzantine behavior

Technical Specifications

Parameter Value
Proving System Halo2 (IPA commitment, BN254 scalar field)
Elliptic Curve BN254 (alt_bn128)
Hash Function Poseidon quintic S-box (x^5), injective over BN254
Domain Separation keccak256("interlink_v1_domain")
Verification Complexity O(1) on-chain
State Commitment Sparse Merkle Trees
Recursion Pairwise folding, O(log N) depth, Fiat-Shamir alpha = (C1+C2)^5
Consensus (ETH) Sync Committee 342/512 threshold
Consensus (Cosmos) Tendermint >2/3 voting power
Settlement Target <30 seconds end-to-end
Uptime SLA 99.9% (8.76h max annual downtime)
Settlement SLA <60s p99
API Response SLA <500ms p99

Developer Setup

Prerequisites

  • Rust (Edition 2021)
  • Solana CLI (>=1.18) & Anchor CLI (0.32.1)
  • Foundry (forge, cast, anvil) — install via foundryup
  • Node.js & yarn (for Anchor TypeScript tests and website)

Building the Workspace

# Build all Rust crates
cargo build --release

# Build the Solana Hub program
cd contracts/solana/interlink-hub
anchor build

# Build EVM contracts
cd contracts/evm
forge build

Environment Variables

# Required
EVM_WS_RPC_URL=wss://...          # WebSocket for event subscription
EVM_HTTP_RPC_URL=https://...       # HTTP for finality polling
SOLANA_RPC_URL=https://...         # Solana RPC endpoint
GATEWAY_ADDRESS=0x...              # EVM gateway contract address
HUB_PROGRAM_ID=AKzpc9...          # Solana hub program ID
KEYPAIR_PATH=/path/to/keypair.json # Solana relayer keypair

# Optional
LOG_FORMAT=json                    # Structured JSON logging (default: text)
BATCH_SIZE=50                      # Transfers per batch (default: 50)
NONCE_POOL_SIZE=10                 # Parallel Solana nonces (default: 10)

Observability

Prometheus Metrics

The relayer exposes a GET /metrics endpoint compatible with Prometheus/Grafana:

# Proof generation
proof_gen_ms_p50, proof_gen_ms_p95, proof_gen_ms_p99
proof_gen_total, proof_gen_alerts

# Settlement
settlement_ms_p50, settlement_ms_p95, settlement_ms_p99
settlement_total, settlement_alerts

# Verification
verify_ms_mean, verify_ms_max, verify_alerts

# Chain health (per-chain)
chain_finality_mean_ms{chain_id="1"}
chain_rpc_latency_ms{chain_id="1"}

# User metrics
daily_transfers, unique_users
corridor_count{corridor="1:900"}

# TVL & Volume
tvl_usd_cents, daily_volume_usd_cents, cumulative_volume_usd_cents

# Validator uptime
validator_heartbeats_total, validator_heartbeats_expected

Alerting Thresholds

Metric Alert Threshold Action
Proof gen time >1 second Investigate prover load
Verification time >500ms Check verifier efficiency
Settlement finality >60 seconds Check chain congestion
Validator downtime >15 minutes Check nonce pool exhaustion
Circuit breaker Any auto-pause Incident response playbook

Solana Hub — Live Devnet Deployment

  • Program ID: AKzpc9tvxfhLjj5AantKizK2YZgSjoyhLmYqRZy6b8Lz
  • Deploy Transaction: 59bSsMZU9GZAvaVL5mEL8NQ24Ucs4HvgpQ7i9TmnFDYPdANivm24n3b18Yb5Nx2aSZYp9ti3NmT7GF1jsd2v59ZY
  • IDL Account: 3YddvfRCPY6MALVoVzAN59njDkzCEQ3px2NMhszBrZpp
  • Cluster: Solana Devnet

Documentation and Resources

About

InterLink is a decentralized, high-performance interoperability protocol designed to bridge fragmented blockchain ecosystems through trustless, zero-knowledge cryptographic proofs.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors