TxShield API

Pre-flight transaction intelligence for Solana wallets, bots, and DEX frontends.

Authentication

All endpoints require authentication via API key or JWT token.

X-API-Key: your_api_key
# or
Authorization: Bearer your_jwt_token

POST /api/v1/solana/tx/simulate

Simulate a single Solana transaction and get a full risk breakdown.

Auth required

Request

{
  "transaction": "base64-encoded-solana-transaction"
}

Response

{
  "success": true,
  "compute_units": 42000,
  "fee_estimate_sol": 0.000005,
  "priority_fees": {
    "low": 1000,
    "medium": 10000,
    "high": 100000,
    "very_high": 1000000,
    "samples": 150
  },
  "failure_reason": null,
  "failure_code": null,
  "is_terminal": null,
  "risk": {
    "mev_score": 0.3,
    "mev_level": "low",
    "mev_type": "swap_frontrun",
    "has_blacklisted_program": false,
    "blacklisted_programs": [],
    "dex_programs": [{"program_id": "JUP6...", "name": "Jupiter v6"}],
    "token_risk": {
      "mint": "...",
      "symbol": "BONK",
      "risk_score": 0.2,
      "risk_level": "low",
      "flags": [],
      "top_holder_concentration": 0.15,
      "has_mint_authority": false,
      "has_freeze_authority": false,
      "has_liquidity": true
    },
    "risk_level": "safe"
  },
  "logs": [],
  "latency_ms": 47
}

Risk levels

LevelMeaning
safeNo issues detected
lowMinor MEV exposure (e.g. simple swap)
mediumModerate risk (multi-hop swap, simulation warning)
highHigh MEV risk or terminal simulation failure
criticalBlacklisted program or token rug-pull indicators

Failure codes

CodeTerminal?Meaning
insufficient_solYesFee payer lacks SOL for fees
insufficient_token_balanceYesSender lacks token balance
account_not_foundNoRequired account missing (ATA?)
blockhash_expiredNoStale blockhash — rebuild tx
program_errorNoOn-chain program returned error

POST /api/v1/solana/tx/simulate-batch

Simulate up to 50 transactions in parallel.

Auth required

Request

{
  "transactions": ["base64_tx_1", "base64_tx_2", "..."]
}

Response

{
  "results": [
    {"index": 0, "success": true, "risk_level": "safe", "mev_score": 0.0, ...},
    {"index": 1, "success": false, "risk_level": "high", "failure_code": "insufficient_sol", ...}
  ],
  "total": 2,
  "succeeded": 1,
  "failed": 1
}

GET /api/v1/solana/simulations/stats

Get your simulation usage statistics.

Auth required
{
  "total_simulations": 12450,
  "success_count": 11200,
  "fail_count": 1250,
  "success_rate": 0.9,
  "avg_latency_ms": 52.3,
  "avg_mev_score": 0.12,
  "mev_distribution": {"none": 8000, "low": 3000, "medium": 1200, "high": 250},
  "top_failure_reasons": [{"code": "insufficient_sol", "count": 500}],
  "risk_distribution": [{"level": "safe", "count": 9000}],
  "simulations_today": 340,
  "simulations_7d": 2100
}

GET /api/v1/solana/simulations

Paginated simulation history.

Auth required

Query parameters

ParamTypeDefault
limitinteger50 (max 200)
offsetinteger0
successboolean(all)

TypeScript SDK

npm install @txshield/sdk
import { TxShieldClient } from "@txshield/sdk";

const txshield = new TxShieldClient({
  baseUrl: "https://api.txshield.dev",
  apiKey: "your_api_key",
});

const result = await txshield.simulate(base64Transaction);
if (result.risk.risk_level === "critical") {
  console.warn("Transaction blocked:", result.risk);
} else {
  // Safe to submit
}

Rate limits

PlanSimulations/monthPrice
Free1,000$0
Starter50,000$49/mo
Growth150,000$99/mo
Pro500,000$299/mo
CustomUnlimitedContact us

Overages: ~$0.001/sim. First 2 weeks free on paid plans.