Skip to main content
POST
https://api.chainguardai.dev
/
v1
/
scan
/
transaction
curl --request POST \
  --url https://api.chainguardai.dev/v1/scan/transaction \
  --header 'Authorization: Bearer cg_live_xxxxxxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "from": "0x742d35Cc6634C0532925a3b844Bc454c459dFE2C",
    "to": "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
    "value": "500000000000000000",
    "data": "0x5ae401dc...",
    "chain": "ethereum",
    "options": {
      "simulate": true,
      "explain": true
    }
  }'
{
  "success": true,
  "data": {
    "riskScore": 12,
    "riskLevel": "low",
    "decoded": {
      "functionName": "exactInputSingle",
      "parameters": [
        { "name": "tokenIn", "value": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" },
        { "name": "tokenOut", "value": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" },
        { "name": "amountIn", "value": "500000000000000000" },
        { "name": "amountOutMinimum", "value": "1237500000" }
      ]
    },
    "explanation": {
      "summary": "Swap 0.5 ETH for approximately 1,247 USDC on Uniswap V3",
      "details": "This transaction swaps 0.5 WETH for USDC using Uniswap V3 SwapRouter. The minimum output is set to 1,237.50 USDC, representing ~1% slippage tolerance. The router contract is verified and widely used.",
      "warnings": []
    },
    "simulation": {
      "success": true,
      "gasUsed": "184532",
      "balanceChanges": [
        {
          "asset": "ETH",
          "before": "2.5",
          "after": "2.0",
          "change": "-0.5"
        },
        {
          "asset": "USDC",
          "before": "500.00",
          "after": "1747.23",
          "change": "+1247.23"
        }
      ],
      "approvalChanges": []
    },
    "warnings": [],
    "recommendation": "PROCEED"
  },
  "meta": {
    "requestId": "req_tx_swap_safe",
    "timestamp": "2024-01-15T14:32:00.847Z",
    "processingTime": 523
  }
}
Pre-signing transaction analysis with simulation, balance changes preview, and risk assessment.

Authorization

Authorization
string
required
Bearer token. Format: Bearer cg_live_xxxxxxxx

Body Parameters

from
string
required
Sender wallet address.
to
string
required
Recipient/contract address.
value
string
default:"0"
Transaction value in wei (as string).
data
string
Transaction calldata (hex encoded). Required for contract interactions.
chain
string
default:"ethereum"
Blockchain network.Options: ethereum, bsc, polygon
options
object
Analysis options.

Response

riskScore
integer
Transaction risk score (0-100)
riskLevel
string
Risk classification: safe, low, medium, high, critical
decoded
object
Decoded transaction data.
explanation
object
AI-generated explanation.
simulation
object
Transaction simulation results.
warnings
array
Security warnings with severity and description.
recommendation
string
Action recommendation: PROCEED, REVIEW, CAUTION, BLOCK
curl --request POST \
  --url https://api.chainguardai.dev/v1/scan/transaction \
  --header 'Authorization: Bearer cg_live_xxxxxxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --data '{
    "from": "0x742d35Cc6634C0532925a3b844Bc454c459dFE2C",
    "to": "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
    "value": "500000000000000000",
    "data": "0x5ae401dc...",
    "chain": "ethereum",
    "options": {
      "simulate": true,
      "explain": true
    }
  }'
{
  "success": true,
  "data": {
    "riskScore": 12,
    "riskLevel": "low",
    "decoded": {
      "functionName": "exactInputSingle",
      "parameters": [
        { "name": "tokenIn", "value": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" },
        { "name": "tokenOut", "value": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" },
        { "name": "amountIn", "value": "500000000000000000" },
        { "name": "amountOutMinimum", "value": "1237500000" }
      ]
    },
    "explanation": {
      "summary": "Swap 0.5 ETH for approximately 1,247 USDC on Uniswap V3",
      "details": "This transaction swaps 0.5 WETH for USDC using Uniswap V3 SwapRouter. The minimum output is set to 1,237.50 USDC, representing ~1% slippage tolerance. The router contract is verified and widely used.",
      "warnings": []
    },
    "simulation": {
      "success": true,
      "gasUsed": "184532",
      "balanceChanges": [
        {
          "asset": "ETH",
          "before": "2.5",
          "after": "2.0",
          "change": "-0.5"
        },
        {
          "asset": "USDC",
          "before": "500.00",
          "after": "1747.23",
          "change": "+1247.23"
        }
      ],
      "approvalChanges": []
    },
    "warnings": [],
    "recommendation": "PROCEED"
  },
  "meta": {
    "requestId": "req_tx_swap_safe",
    "timestamp": "2024-01-15T14:32:00.847Z",
    "processingTime": 523
  }
}