检查点
检索由证明者节点生成的加密同步检查点列表,允许客户端根据特定块高度验证数据完整性。
端点
POST https://indexer.pivx.name/v1.0/checkpoints
请求正文
请求正文必须是包含以下参数的 JSON 对象:
| 参数 | 类型 | 默认 | 描述 |
|---|---|---|---|
count | integer | 100 | 100限制单个响应中返回的检查点的最大数量。 |
from_block | integer | 无 | 请求从该特定块高度开始的检查点数据。 |
order | string | desc | 检查点的排序顺序。接受的值:asc 或 desc。 |
代码示例
- cURL
- JavaScript
- Python
- PHP
curl -X POST https://indexer.pivx.name/v1.0/checkpoints \
-H "Content-Type: application/json" \
-d '{
"count": 2,
"from_block": 5361212,
"order": "asc"
}'
const url = 'https://indexer.pivx.name/v1.0/checkpoints';
const data = {
count: 2,
from_block: 5361212,
order: 'asc'
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error('Error:', error));
import requests
url = "https://indexer.pivx.name/v1.0/checkpoints"
payload = {
"count": 2,
"from_block": 5361212,
"order": "asc"
}
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
<?php
$url = 'https://indexer.pivx.name/v1.0/checkpoints';
$data = [
'count' => 2,
'from_block' => 5361212,
'order' => 'asc'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
响应示例
{
"response": [
{
"block_id": 5432535,
"smt_root": "b4c9dacf8e194e353dce7638d76f282fe40399f7b0ad74a2229a6d4f5be774de",
"evm_block_id": 272705819,
"evm_tx_hash": "0x7af621b112cc009e65ac66cd9f589f24908efad28bd3451297050824bbb46af4"
},
{
"block_id": 5434368,
"smt_root": "98cbb0d3cecb4b18105f6406bf473c9b92c11b670ee7071d47fd155dc1e9cfda",
"evm_block_id": 272706827,
"evm_tx_hash": "0x491c52ce65e2a6a32956a5aec01ac0b903641b1ee6e79e0bb49d88739b50159e"
}
]
}
| 领域 | 类型 | 描述 |
|---|---|---|
block_id | 整数 | 检查点中包含的最后一个 PIVX block_id |
smt_root | 字符串 | Checkpoint 的 SMT 根 |
evm_block_id | 字符串 | 检查点创建的 EVM block_id |
evm_tx_hash | 字符串 | 检查点创建的 EVM tx_hash |