Core Design

Protocol

The technical foundation of Velox: a layered architecture for trustless, gas-free atomic swaps between USDT and TRX on the TRON network.

Protocol Design Philosophy

The Velox protocol is designed around three core invariants: non-custodial execution (user keys sign every transaction), atomic finality (both legs settle or neither does), and gas abstraction (the protocol covers network fees so users do not need TRX). These invariants are enforced by the TRON virtual machine at execution time — they are not promises made by an off-chain system; they are mathematical guarantees embedded in the smart contract bytecode.

The protocol is deployed as a set of interconnected smart contracts on TRON mainnet, with an off-chain relay layer that handles quote generation, gas funding, and transaction submission. Critically, the relay layer cannot move user funds — it can only submit signed transactions that the user's wallet has explicitly authorized. This separation of concerns ensures that even if a relay node is compromised, no user assets are at risk.

Architecture

Protocol Architecture

A five-layer stack from user interface to on-chain finality. Each layer is independently verifiable and has a well-defined security boundary.

L1

Presentation Layer — Wallet & UI

The Velox web interface communicates with the user's wallet via the TRONLink JSON-RPC provider or WalletConnect v2. The UI is a stateless client — it holds no private keys, caches no transaction data, and operates entirely in the browser. All rate quotes and transaction parameters are fetched from the relay layer over HTTPS with certificate pinning.

L2

Relay Layer — Quote & Orchestration

Geographically distributed relay nodes aggregate liquidity data from on-chain pools and provide signed quotes to the presentation layer. Relays construct the transaction payload (including gas sponsorship parameters) and submit it to the TRON network on behalf of the user. Relays hold the gas reserve wallet but cannot initiate or modify swap transactions — they only relay user-signed payloads.

L3

Consensus Layer — TRON DPoS

Velox inherits TRON's Delegated Proof-of-Stake consensus. The 27 Super Representatives validate blocks every 3 seconds, providing single-block economic finality. Velox transactions are standard TRC-20 token transfers wrapped in a single atomic contract call. No custom consensus mechanism is required — the protocol runs entirely within the standard TRON execution environment.

L4

Execution Layer — Smart Contracts

The core swap logic resides in a set of audited Solidity smart contracts deployed on TRON mainnet. The contracts enforce atomicity: both token transfers (input debit and output credit) execute in a single EVM call. If any sub-operation reverts, the entire transaction is unwound. The contracts also enforce the slippage tolerance, rate lock expiry, and minimum/maximum swap size constraints.

L5

Data Layer — On-Chain State & Events

All swap state is recorded on TRON mainnet. Every completed swap emits a structured event log containing the user address, input amount, output amount, exchange rate, timestamp, and transaction hash. These events are indexed and queryable via TronScan and the Velox API, providing a complete, immutable audit trail for every trade executed through the protocol.

Message Specification

Signed Message Format

Every Velox swap is authorized by a canonical signed message. The structure below is what your wallet signs when you confirm a trade.

{
  "protocol": "velox-swap-v2",
  "version": "2.4.1",
  "chainId": 728126428,
  "timestamp": 1723996800,
  "expiry": 1723996815,
  "swap": {
    "id": "0x1a3f5b8c9d2e...",
    "input": {
      "token": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
      "symbol": "USDT",
      "amount": "1500.00",
      "decimals": 6
    },
    "output": {
      "token": "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb",
      "symbol": "TRX",
      "amount": "12427.50",
      "decimals": 6
    },
    "rate": "8.28500000",
    "slippageBps": 50,
    "feeBps": 30
  },
  "gasSponsor": {
    "address": "TVLoxGasReserve11111111111111111111111",
    "maxGasTrx": "15.000000",
    "multiplier": "1.35"
  },
  "signature": {
    "v": 27,
    "r": "0xb4f8a1c3d5e7f9...",
    "s": "0x2d4e6f8a0b1c3d..."
  }
}

Field Reference

protocol Protocol identifier. Must be "velox-swap-v2". Rejects any other value at the contract level.
chainId TRON mainnet chain ID (728126428). Prevents cross-chain replay attacks by binding the signature to a specific network.
expiry Unix timestamp after which the signed message is invalid. Set to timestamp + 15s (the rate lock window). Expired messages are rejected by the contract.
swap.id Unique swap identifier generated by the relay. Used for idempotency — the contract rejects duplicate swap IDs to prevent double-execution.
slippageBps Maximum acceptable price movement in basis points (1 bp = 0.01%). Default is 50 bps (0.50%). The contract aborts if the on-chain rate deviates beyond this threshold.
gasSponsor Address of the Velox gas reserve wallet and the maximum TRX allocated for this transaction's network fee. The contract verifies that the gas sponsor has sufficient balance before execution.
Cryptography

Cryptographic Primitives

The mathematical foundations that secure every Velox transaction, from wallet signatures to cross-chain attestations.

ECDSA (secp256k1)

All user signatures use the Elliptic Curve Digital Signature Algorithm over the secp256k1 curve — the same primitive used by Bitcoin, Ethereum, and TRON. The user's private key signs the canonical swap message; the contract recovers the public key and verifies it matches the input token's owner. Signature verification is enforced by the ecrecover precompile on the TRON VM.

Industry Standard

SHA-256 / Keccak-256

Swap message hashing uses SHA-256 for the canonical JSON payload digest, which is then wrapped in an EIP-712-style typed data structure and hashed with Keccak-256 for signature. This dual-hash scheme provides preimage resistance and domain separation between Velox messages and any other signed payload the user's wallet might process.

Dual-Hash

Merkle Proofs (Bridge)

Cross-chain bridge attestations use sparse Merkle trees for efficient proof of deposit on the source chain. A bridge contract on TRON verifies that a given deposit was included in a finalized block on Ethereum or BNB Smart Chain by checking a Merkle inclusion proof against a trusted block hash root. Proofs are generated off-chain by bridge relayers and verified on-chain.

Merkle Proof

ZK-SNARKs (Future)

The protocol roadmap includes zero-knowledge succinct non-interactive arguments of knowledge (ZK-SNARKs) for trustless cross-chain swaps. In this model, a ZK proof attests that a deposit event occurred on the source chain without requiring the TRON contract to store or verify full block headers. This reduces on-chain verification cost from ~200k gas to a constant ~30k gas per bridge attestation.

Roadmap — Q1 2027
Cross-Chain

Cross-Chain Bridge Protocol

How USDT arrives on TRON from other networks before being swapped for TRX — via the Velox bridge relay network.

Deposit Detection

Bridge relayers monitor deposit events on Ethereum and BNB Smart Chain. A deposit is considered confirmed after the source chain reaches probabilistic finality (13 blocks on Ethereum, 20 blocks on BSC). Once confirmed, the relayer constructs a Merkle inclusion proof and submits it to the Velox bridge contract on TRON. The bridge contract verifies the proof and mints the equivalent wrapped USDT on TRON, which is then immediately routed into the user's requested TRX swap. The entire bridge-to-swap flow completes in a single TRON transaction.

Relayer Network Security

The bridge relayer network uses a 3-of-5 multisig threshold for proof submission. At least three independent relayers must attest to the same deposit event before the bridge contract accepts the proof. Relayers are operated by separate entities with no overlapping infrastructure. Economic security is provided by a slashing mechanism: relayers stake VELOX tokens (a governance token planned for Q2 2027), and any relayer submitting a fraudulent proof loses their stake and is permanently excluded from the network.

Supported Bridge Routes

The bridge currently supports USDT deposits from Ethereum (ERC-20) and BNB Smart Chain (BEP-20) into TRON (TRC-20). Bitcoin deposits arrive via a wrapped BTC (WBTC) integration on Ethereum before being bridged to TRON. Each route has independent security parameters based on the source chain's finality guarantees. Cross-chain swaps carry an additional 0.15% bridge fee, which covers relayer compensation and proof verification gas costs on the TRON side.

ETH → TRON BSC → TRON BTC → ETH → TRON