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
}
}
Analyze a transaction before signing for security risks
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
}
}
Bearer cg_live_xxxxxxxxethereum, bsc, polygonsafe, low, medium, high, criticalShow simulation properties
PROCEED, REVIEW, CAUTION, BLOCKcurl --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
}
}