The simulation API lets you preview transaction execution against the current chain state. It returns gas estimates, state changes, event logs, and a risk score that flags potentially dangerous transactions.
Endpoint
POST /simulateTransaction
Also available via WebSocket gateway as mev_simulateTx.
Request:
{
"chain_id": 1,
"from": "0x1234...abcd",
"to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
"data": "0x38ed1739000000000000000000000000...",
"value": "0x0",
"gas_limit": 300000,
"block_number": "latest"
}
Response:
{
"success": true,
"gas_used": 182340,
"effective_gas_price": "25000000000",
"output": "0x00000000000000000000000000000000000000000000003635c9adc5dea00000",
"logs": [
{
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
"data": "0x..."
}
],
"state_changes": [
{
"address": "0xC02aaA39...",
"key": "0x03",
"before": "0x1000",
"after": "0x0f00"
}
],
"risk_score": 0.15,
"risk_factors": [],
"revert_reason": null
}
Risk Scoring
The simulation engine assigns a risk score between 0 and 1 based on detected patterns:
| Score Range | Level | Description |
|---|---|---|
| 0.0 -- 0.3 | Low | Standard transaction. No suspicious patterns detected. |
| 0.3 -- 0.7 | Medium | Potential risks identified (e.g., high slippage, unknown contract). |
| 0.7 -- 1.0 | High | Dangerous patterns detected (e.g., approval to known phishing address, honeypot token, rug pull signatures). |
Risk factors are returned as an array of strings describing each detected issue:
{
"risk_score": 0.82,
"risk_factors": [
"approval_to_unverified_contract",
"token_has_transfer_fee",
"contract_deployed_recently"
]
}
Pricing Tiers
| Tier | Rate Limit | Price | Features |
|---|---|---|---|
| Free | 10 req/min | $0 | Basic simulation, risk score. |
| Builder | 500 req/min | $49/mo | State overrides, full traces. |
| Searcher | 5,000 req/min | $199/mo | Priority execution, batch simulation. |
| Enterprise | Unlimited | Custom | Dedicated infra, SLA, custom chains. |
SDK Usage
TypeScript
import { MEVGatewayClient } from "@yoorquezt/sdk-mev";
const client = new MEVGatewayClient("ws://localhost:9099/ws", {
apiKey: process.env.YQ_API_KEY,
});
const result = await client.call("mev_simulateTx", {
chainId: 1,
from: "0x1234...abcd",
to: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
data: "0x38ed1739...",
value: "0x0",
});
if (result.success && result.riskScore < 0.3) {
console.log("Safe to submit. Gas estimate:", result.gasUsed);
} else {
console.warn("Risk detected:", result.riskFactors);
}
Code Examples
Simulate a transaction
curl -X POST https://mev.yoorquezt.io/simulateTransaction \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"chain_id": 1,
"from": "0x1234...abcd",
"to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
"data": "0x38ed1739...",
"value": "0x0",
"gas_limit": 300000
}'
Check risk score
curl -s -X POST https://rpc.yoorquezt.com/v1/simulate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{"chain_id":1,"from":"0x...","to":"0x...","data":"0x...","value":"0x0"}' \
| jq '{success: .success, risk: .risk_score, factors: .risk_factors}'