接入教程
1. 访问cleartracedata.com/docs查看API文档
2. 获取API密钥并设置请求权限
3. 调用归因分析接口获取交易数据
4. 使用执行质量端点评估交易表现
5. 集成数据至您的分析工具或仪表板
获取DEX交易质量数据
python
import requests
url = "https://api.example.com/v1/dex/quality"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
params = {
"chain": "ethereum",
"pool_address": "0x...",
"timeframe": "24h"
}
response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data)
查询跨前端交易归因
php
<?php
$url = "https://api.example.com/v1/attribution/cross-frontend";
$headers = [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
];
$data = [
"tx_hash" => "0x...",
"include_metrics" => true
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
获取L2网络执行分析
javascript
const fetch = require('node-fetch');
const url = "https://api.example.com/v1/analysis/l2";
const options = {
method: 'GET',
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
};
async function getL2Analysis() {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
}
getL2Analysis();
常见问题
ClearTrace API支持哪些区块链网络?
ClearTrace API目前支持以太坊主网及主流二层网络(L2s),包括Arbitrum、Optimism、Polygon等。具体支持的链列表可在文档中查看。
API密钥如何获取和使用?
您需要在ClearTrace官网注册账户并申请API密钥。获取密钥后,需在请求头中使用Bearer Token进行身份验证,格式为:Authorization: Bearer YOUR_API_KEY。
数据更新频率是多少?
DEX执行质量数据通常每5分钟更新一次,归因分析数据在交易确认后实时更新。具体数据延迟请参考API文档中的时效性说明。
Aitishiku.com