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.
This page documents the intended developer interface. A production base URL, contract address, audit result, and launch date have not been announced.
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.
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.
npm install @veilrail/sdkimport { 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); // unsignedVeilRail produces a plan and proofs. The wallet reviews, signs, and submits. Simulation cannot guarantee a future fill.
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.
VEILRAIL_API_KEY=veil_test_...market:readResolve assets, status, multipliers, and reference prices.
portfolio:readRead permitted public-wallet context. Shielded records require viewing authority.
trade:planCreate quotes, route checks, and stored unsigned plans.
transaction:simulateSimulate an ordered transaction sequence.
An API key cannot sign a transaction, derive a wallet key, or spend a shielded note.
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.
Use a stable idempotency key to receive the same plan for the same request.
Exercise approvals, insufficient balance, blocked policy, simulation failure, or degraded providers.
Sandbox plans stop before wallet signing and never touch live liquidity.
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.
Address, symbol, name, decimals, issuer provenance, and active deployment.
Active, halted, or inactive status is checked before routing.
Chainlink reference price and multiplier-adjusted value remain separate from executable quotes.
Examples use USDG. Liquidity is compared across Uniswap v3/v4 and Pons where available.
One privacy object. No second integration.
The rest of the request stays the same. Select the disclosure boundary required by the trade.
privacy: { mode: "shielded" }Five layers protect different parts of the trade.
Identity, balances, pre-trade intent, public-market impact, and auditability are handled separately.
Fresh settlement identity
A single-use address prevents a reusable public history.
Stealth addresses · ERC-5564 styleSealed balances
Commitment notes represent holdings without publishing owner, asset, or amount.
Merkle commitments · zero-knowledge proofsEncrypted intent
The order is unreadable before it enters settlement.
Encrypted intents · settlement-time decryptionBatch netting
Opposite orders cancel before an aggregate residual reaches a public venue.
Short batch windows · net residualSelective disclosure
A holder can grant read-only visibility or provide a compliance proof.
Viewing keys · compliance proofs · deposit screeningVeilRail describes this property as confidentiality with auditability, never anonymity.
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.
Map the ticker to the canonical token and verify trading status.
Keep input, minimum output, route, fees, slippage, and expiry explicit.
Return approval and swap operations as unsigned payloads in execution order.
Generate shielded proofs in the browser or caller process by default.
Carry prerequisite state changes across the sequence before marking it signable.
Every decision names the rule.
Applications should branch on the verdict and structured reason codes, not parse prose.
What stays visible.
A public observer can still see protocol-level facts in shielded mode.
That a valid proof was submitted, including its nullifier.
That an aggregate residual swap happened, without individual attribution.
The address that paid gas for a public transaction.
The total size of the shielded pool.
The production retention and relayer metadata policy will be published before live release.
Small surface. Explicit outputs.
These routes define the intended v0 interface. The production base URL and OpenAPI schema will ship with the live service.
/assetsList canonical supported assets./assets/{symbol}Resolve a symbol to its canonical Stock Token./prices/{symbol}Read reference and token-equivalent prices./quotesRequest an executable exact-input or exact-output quote./trades/planBuild, prove, simulate, and check an unsigned plan./trade-plans/{planId}Retrieve a stored plan before expiry./transactions/simulateSimulate an ordered unsigned sequence./privacy/poolRead public pool size and supported shielded assets.Quantities use exact decimal strings. Failures include a stable code, retryability signal, details, and request ID.
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.
A stable key prevents a network retry from creating a second logical plan.
Branch on error code and retryability.
Proof work runs in the caller process by default.
Transactions remain unsigned, ordered, bounded, and reviewable.
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.
{
"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.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.
Cover proof verification, gas, and batch coordination.
Provers and relayers bond $VEIL and earn per job.
Govern batch windows, fees, screening sets, venues, and emissions.
40% of net fees buys $VEIL; 60% funds infrastructure and treasury.
Do not trust an address claiming to be $VEIL until the official project verifies it.
Failures are designed for software.
Branch on stable error codes. Human-readable messages can improve without changing program behavior.
| Code | Retry | Action |
|---|---|---|
| INVALID_REQUEST | No | Correct the payload. |
| ASSET_NOT_FOUND | No | Resolve a supported symbol. |
| ASSET_HALTED | Later | Wait for active trading status. |
| INSUFFICIENT_BALANCE | No | Reduce input or fund the wallet. |
| PROOF_GENERATION_FAILED | Maybe | Inspect local prover diagnostics. |
| POLICY_BLOCKED | No | Read the named rule and stop. |
| RATE_LIMITED | Yes | Respect the retry signal. |
| UPSTREAM_UNAVAILABLE | Yes | Retry only when marked retryable. |
The privacy cost is explicit.
Shielded execution adds local proof generation, typically well under a few seconds.
Amount confidentiality becomes stronger as the pool grows.
Simulation checks current state but cannot guarantee future fills.
Routes depend on supported tokens and liquidity across Uniswap v3/v4 and Pons.
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.
A viewing key can provide read-only trade visibility. A compliance proof can demonstrate that activity stayed within defined limits.