VeilRailDocumentation
Developer preview

Private stock execution, one checked plan at a time.

VeilRail resolves canonical Stock Tokens, compares available venues, builds ordered unsigned transactions, simulates them against chain state, and returns an explainable policy verdict. Add a privacy mode when the trade should not publish the strategy.

01Your appIntent + privacy mode
02VeilRailResolve, plan, prove, simulate
03Your walletReview, sign, submit
Current status

This page documents the intended developer interface. A production base URL, contract address, audit result, and launch date have not been announced.

Mental model

From ticker to private settlement.

The integration is organized around a checked trade plan. Each plan binds the asset, route, transaction order, simulation evidence, privacy mode, policy verdict, and expiry into one result.

Quickstart

Your first shielded trade plan.

This example plans a 500 USDG purchase of NVDA. It returns unsigned transactions. It does not move money and never signs for the wallet.

Install the SDK

Use the TypeScript package in your server process or agent runtime.

Add a test key

Store a veil_test_ key in an environment variable.

Plan and inspect

Check verdict, reasons, expiry, simulation, and ordered transactions.

Terminal
npm install @veilrail/sdk
private-trade.ts
import { VeilRail } from "@veilrail/sdk";

const veil = new VeilRail({
  apiKey: process.env.VEILRAIL_API_KEY
});

const plan = await veil.trades.plan({
  side: "buy",
  symbol: "NVDA",
  quote: "USDG",
  amountIn: "500",
  privacy: { mode: "shielded" }
});

console.log(plan.verdict);      // allow | warn | block
console.log(plan.transactions); // unsigned
Your wallet controls the final step.

VeilRail produces a plan and proofs. The wallet reviews, signs, and submits. Simulation cannot guarantee a future fill.

Authentication

Separate test and live environments.

Project keys are environment-specific and scope-limited. Use veil_test_ for deterministic sandbox calls and veil_live_ only when the live service is available.

Environment
VEILRAIL_API_KEY=veil_test_...
market:read

Resolve assets, status, multipliers, and reference prices.

portfolio:read

Read permitted public-wallet context. Shielded records require viewing authority.

trade:plan

Create quotes, route checks, and stored unsigned plans.

transaction:simulate

Simulate an ordered transaction sequence.

Keys authorize API access, not funds.

An API key cannot sign a transaction, derive a wallet key, or spend a shielded note.

Sandbox

Test the decision path without funds.

The sandbox provides deterministic prices, simulated USDG, a funded test wallet, stable error cases, and the same plan shape intended for live execution.

Repeatable inputs

Use a stable idempotency key to receive the same plan for the same request.

Explicit scenarios

Exercise approvals, insufficient balance, blocked policy, simulation failure, or degraded providers.

No signature required

Sandbox plans stop before wallet signing and never touch live liquidity.

Assets and prices

Resolve the stock before routing the token.

VeilRail maps familiar ticker symbols to canonical Robinhood Chain Stock Tokens and checks whether each deployment can be traded.

Canonical contract

Address, symbol, name, decimals, issuer provenance, and active deployment.

Trading state

Active, halted, or inactive status is checked before routing.

Price semantics

Chainlink reference price and multiplier-adjusted value remain separate from executable quotes.

Quote asset

Examples use USDG. Liquidity is compared across Uniswap v3/v4 and Pons where available.

Privacy modes

One privacy object. No second integration.

The rest of the request stays the same. Select the disclosure boundary required by the trade.

Mode
What it does
Public-chain exposure
public
Ordinary wallet execution.
Wallet, asset, amount, and venue are readable.
stealth
A fresh single-use settlement address.
The main wallet link is hidden; settlement remains public.
shielded
Sealed notes and a zero-knowledge proof.
Owner, asset, and amount stay sealed; proof metadata remains visible.
The only request-line difference
privacy: { mode: "shielded" }
Architecture

Five layers protect different parts of the trade.

Identity, balances, pre-trade intent, public-market impact, and auditability are handled separately.

01

Fresh settlement identity

A single-use address prevents a reusable public history.

Stealth addresses · ERC-5564 style
02

Sealed balances

Commitment notes represent holdings without publishing owner, asset, or amount.

Merkle commitments · zero-knowledge proofs
03

Encrypted intent

The order is unreadable before it enters settlement.

Encrypted intents · settlement-time decryption
04

Batch netting

Opposite orders cancel before an aggregate residual reaches a public venue.

Short batch windows · net residual
05

Selective disclosure

A holder can grant read-only visibility or provide a compliance proof.

Viewing keys · compliance proofs · deposit screening
Privacy that survives a compliance review is the only privacy an institution can actually use.

VeilRail describes this property as confidentiality with auditability, never anonymity.

Trade plans

Route, proof, policy, and simulation in one result.

A trade plan is the durable object reviewed before wallet signing. It expires when its price or observed chain state is no longer reliable.

Resolution

Map the ticker to the canonical token and verify trading status.

Quote and route

Keep input, minimum output, route, fees, slippage, and expiry explicit.

Ordered calls

Return approval and swap operations as unsigned payloads in execution order.

Local proof

Generate shielded proofs in the browser or caller process by default.

Sequential simulation

Carry prerequisite state changes across the sequence before marking it signable.

Policy verdicts

Every decision names the rule.

Applications should branch on the verdict and structured reason codes, not parse prose.

Verdict
Application behavior
Transactions
allow
Passes active protocol and project rules.
Unsigned payloads may be presented.
warn
Requires human or agent review.
Payloads remain available with warnings.
block
A named rule failed closed.
No signable payload is returned.
Disclosure boundary

What stays visible.

A public observer can still see protocol-level facts in shielded mode.

Proof submission

That a valid proof was submitted, including its nullifier.

Net market activity

That an aggregate residual swap happened, without individual attribution.

Gas payer

The address that paid gas for a public transaction.

Pool scale

The total size of the shielded pool.

Operational metadata is separate.

The production retention and relayer metadata policy will be published before live release.

API contract

Small surface. Explicit outputs.

These routes define the intended v0 interface. The production base URL and OpenAPI schema will ship with the live service.

GET/assetsList canonical supported assets.
GET/assets/{symbol}Resolve a symbol to its canonical Stock Token.
GET/prices/{symbol}Read reference and token-equivalent prices.
POST/quotesRequest an executable exact-input or exact-output quote.
POST/trades/planBuild, prove, simulate, and check an unsigned plan.
GET/trade-plans/{planId}Retrieve a stored plan before expiry.
POST/transactions/simulateSimulate an ordered unsigned sequence.
GET/privacy/poolRead public pool size and supported shielded assets.
Response contract

Quantities use exact decimal strings. Failures include a stable code, retryability signal, details, and request ID.

TypeScript SDK

One client for public and private plans.

@veilrail/sdk wraps authentication, idempotency, typed errors, plan retrieval, local proof generation, and request validation. It never signs transactions.

Idempotent retries

A stable key prevents a network retry from creating a second logical plan.

Typed failures

Branch on error code and retryability.

Local proving

Proof work runs in the caller process by default.

Wallet boundary

Transactions remain unsigned, ordered, bounded, and reviewable.

Agents and MCP

Give an agent the same checked flow.

@veilrail/mcp exposes eight local tools. The project key stays in the MCP process. A wallet still performs every signature.

mcp.json
{
  "mcpServers": {
    "veilrail": {
      "command": "npx",
      "args": ["-y", "@veilrail/mcp"],
      "env": {
        "VEILRAIL_API_KEY": "veil_test_..."
      }
    }
  }
}
veil_get_assetResolve a ticker to its canonical contract.
veil_get_priceRead reference and token-equivalent prices.
veil_get_portfolioRead permitted wallet and position context.
veil_create_quoteRequest an executable route with bounds.
veil_preflight_tradeBuild, prove, simulate, and check a plan.
veil_get_trade_planRetrieve a durable plan by ID.
veil_simulate_transactionsSimulate an ordered unsigned sequence.
veil_get_pool_statusRead public shielded-pool health.
$VEIL

Optional for builders. Required for network coordination.

The API, SDK, and agent tools work without holding $VEIL. The token pays for private execution, bonds and rewards infrastructure, supports policy staking, and captures protocol fees.

Privacy gas

Cover proof verification, gas, and batch coordination.

Operator bonds

Provers and relayers bond $VEIL and earn per job.

Policy staking

Govern batch windows, fees, screening sets, venues, and emissions.

Fee flow

40% of net fees buys $VEIL; 60% funds infrastructure and treasury.

No contract address is published here.

Do not trust an address claiming to be $VEIL until the official project verifies it.

Errors

Failures are designed for software.

Branch on stable error codes. Human-readable messages can improve without changing program behavior.

CodeRetryAction
INVALID_REQUESTNoCorrect the payload.
ASSET_NOT_FOUNDNoResolve a supported symbol.
ASSET_HALTEDLaterWait for active trading status.
INSUFFICIENT_BALANCENoReduce input or fund the wallet.
PROOF_GENERATION_FAILEDMaybeInspect local prover diagnostics.
POLICY_BLOCKEDNoRead the named rule and stop.
RATE_LIMITEDYesRespect the retry signal.
UPSTREAM_UNAVAILABLEYesRetry only when marked retryable.
Limits and trade-offs

The privacy cost is explicit.

Proof latency

Shielded execution adds local proof generation, typically well under a few seconds.

Anonymity-set depth

Amount confidentiality becomes stronger as the pool grows.

Execution uncertainty

Simulation checks current state but cannot guarantee future fills.

Venue availability

Routes depend on supported tokens and liquidity across Uniswap v3/v4 and Pons.

Compliance boundary

Confidentiality with auditability.

VeilRail is not designed to conceal funds from lawful reporting obligations or a party granted viewing authority. Deposit screening and selective disclosure are protocol features.

The holder controls disclosure.

A viewing key can provide read-only trade visibility. A compliance proof can demonstrate that activity stayed within defined limits.