Lux Docs
Lux Skills Reference

Lux ADX - High-Performance CTV Ad Exchange

Documentation for Lux ADX - High-Performance CTV Ad Exchange

Overview

ADX is a high-performance Connected TV (CTV) ad exchange designed for 100M+ impressions per day with sub-millisecond auction latency. It combines VAST 4.x video ad serving, OpenRTB 2.5/3.0 programmatic bidding, zero-knowledge privacy-preserving auctions, and a home miner network for decentralized ad serving. Built on FoundationDB for petabyte-scale storage.

Quick reference

ItemValue
Repogithub.com/luxfi/adx
Modulegithub.com/luxfi/adx
Go1.26.1
Branchmain
Exchange Port8080
Miner Port8081
LicenseMIT

Hard requirements

  1. ALWAYS use github.com/luxfi/* packages -- NEVER go-ethereum or luxfi
  2. NEVER use EWOQ keys -- generate fresh keys
  3. FoundationDB 7.3.27+ required for storage backend

Key Dependencies

github.com/luxfi/crypto@v1.17.38     — Cryptographic primitives
github.com/luxfi/database@v1.2.17    — Storage layer
github.com/luxfi/metric@v1.4.9       — Prometheus metrics
github.com/luxfi/cache@v1.1.0        — Caching layer
github.com/luxfi/geth@v1.16.69       — EVM integration (indirect)
github.com/prebid/openrtb/v20        — OpenRTB 2.5/3.0 types
github.com/gin-gonic/gin@v1.10.1     — HTTP framework
go.uber.org/zap@v1.27.1              — Structured logging
github.com/prometheus/client_golang   — Metrics

Architecture

luxfi/adx
├── cmd/
│   ├── adx-exchange/    — CTV ad exchange server
│   ├── adx-miner/       — Home miner node
│   ├── adxd/            — Full daemon (exchange + miner)
│   ├── adx-attack/      — Attack simulation tool
│   └── api/             — API server
├── pkg/
│   ├── rtb/             — OpenRTB bidding engine
│   ├── vast/            — VAST 4.x video ad generation
│   ├── miner/           — Home miner management
│   ├── auction/         — Sealed-bid auction engine
│   ├── crypto/          — HPKE encryption (RFC 9180)
│   ├── proof/           — Zero-knowledge proof generation
│   ├── analytics/       — Privacy-preserving analytics
│   ├── storage/         — FoundationDB backend
│   ├── publica/         — Publica CTV SSP integration
│   ├── blocklace/       — Byzantine-repelling consensus
│   ├── settlement/      — On-chain settlement
│   ├── chainvm/         — Chain VM integration
│   ├── core/            — Core types and frequency management
│   ├── da/              — Data availability
│   ├── dex/             — DEX integration
│   ├── fhe/             — Fully homomorphic encryption
│   ├── ids/             — Identity management
│   ├── log/             — Logging
│   ├── metric/          — Metrics collection
│   └── tee/             — Trusted execution environments
├── contracts/
│   ├── AdSlotSFT.sol    — Ad slot semi-fungible token
│   └── EscrowManager.sol — Payment escrow
├── sdk/
│   ├── go/              — Go SDK
│   ├── typescript/      — TypeScript SDK
│   ├── python/          — Python SDK
│   └── browser.ts       — Browser integration
├── client/              — Client library
├── config/              — Configuration
├── k8s/                 — Kubernetes manifests
└── tests/               — Integration tests

One-file quickstart

Build and run

git clone https://github.com/luxfi/adx.git
cd adx

# Build all binaries
make build
# Outputs: bin/adx-exchange, bin/adx-miner, bin/adxd, bin/adx-attack

# Run exchange
make run-exchange

# Run home miner
make run-miner

Run with Docker

docker-compose up -d

Run a home miner

go install github.com/luxfi/adx/cmd/adx-miner@latest

adx-miner start \
  --wallet YOUR_WALLET_ADDRESS \
  --tunnel localxpose \
  --cache-size 10GB

API Endpoints

CTV Exchange

# OpenRTB bid request
curl -X POST http://localhost:8080/rtb/bid \
  -H "Content-Type: application/json" \
  -d '{"id":"req-1","imp":[{"id":"1","video":{"w":1920,"h":1080}}]}'

# VAST ad request
curl http://localhost:8080/vast?slot=homepage&w=1920&h=1080

# Miner stats
curl http://localhost:8080/miner/stats

Privacy Network

# Submit sealed bid with ZK proof
curl -X POST http://localhost:8080/auction/sealed \
  -H "Content-Type: application/json" \
  -d '{"bidder_id":"bid-1","commitment":"...","range_proof":"..."}'

# Privacy-preserving frequency cap
curl -X POST http://localhost:8080/frequency/check \
  -d '{"device_id":"...","campaign_id":"...","cap":5}'

Privacy Features

Zero-Knowledge Auctions


a := auction.NewAuction(auctionID, reserve, duration, logger)
bid := &auction.SealedBid{
    BidderID:   bidderID,
    Commitment: commitment,
    RangeProof: proof,
}
a.SubmitBid(bid)
outcome, _ := a.RunAuction(decryptionKey)

HPKE Encryption (RFC 9180)


hpke := crypto.NewHPKE()
pub, priv, _ := hpke.GenerateKeyPair()
encrypted, _ := hpke.Seal(bidData, pub, aad)

Performance

MetricCTV ExchangePrivacy Network
Bid Requests/sec1,000,000+~127,000 auctions/sec
Auction Latency<1ms~3.7ms (w/ ZK proof)
Daily Impressions100M+--
Memory per Auction--<8KB

Earnings Model

Home Miners

  • Base Rate: $0.50 CPM (per 1000 impressions served)
  • Bandwidth Bonus: $0.10 per GB transferred
  • Uptime Bonus: 10% for 99.9% uptime

Privacy Network Validators

  • Auction Fees: 0.1% of clearing price
  • Proof Verification: Fixed fee per proof

Smart Contracts

ContractPurpose
AdSlotSFT.solSemi-fungible token for ad slot ownership
EscrowManager.solPayment escrow for advertiser-publisher settlement

Makefile Targets

TargetDescription
make buildBuild all binaries (exchange, miner, daemon, attack)
make testRun tests (rtb, vast, miner packages)
make benchRun benchmarks
make run-exchangeStart the ad exchange
make run-minerStart a home miner
make run-localStart 5-node local network
make attack-allRun all attack simulations
make docker-buildBuild Docker images
make docker-runDocker Compose up
make setup-fdbInstall FoundationDB client

Docker

docker build -t luxfi/adx-exchange:latest .
docker run -p 8080:8080 -p 8081:8081 luxfi/adx-exchange:latest

Health check at http://localhost:8080/health. Requires FoundationDB client library.

Troubleshooting

IssueCauseSolution
FoundationDB connection failsFDB not installedmake setup-fdb
Build fails with CGO errorsMissing C compilerapk add gcc g++ musl-dev
Miner not connectingTunnel not configuredUse --tunnel localxpose or --tunnel ngrok
Low auction throughputInsufficient resourcesScale FoundationDB cluster
  • lux/lux-crypto.md -- Cryptographic primitives (HPKE, BLS)
  • lux/lux-lattice.md -- Post-quantum crypto for future privacy
  • lux/lux-node.md -- On-chain settlement integration
  • lux/lux-fhe.md -- Homomorphic encryption for analytics

On this page