Điểm kiểm tra
Trả về danh sách các điểm kiểm tra đồng bộ mang tính mật mã do nút tạo bằng chứng sinh ra, cho phép ứng dụng khách kiểm chứng tính toàn vẹn dữ liệu ứng với những chiều cao khối cụ thể.
Điểm cuối
POST https://indexer.pivx.name/v1.0/checkpoints
Thân yêu cầu
Thân yêu cầu phải là một đối tượng JSON gồm các tham số sau:
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
count | integer | 100 | Giới hạn số điểm kiểm tra tối đa trả về trong một phản hồi. |
from_block | integer | Không có | Yêu cầu dữ liệu điểm kiểm tra bắt đầu từ chiều cao khối này. |
order | string | desc | Thứ tự sắp xếp các điểm kiểm tra. Giá trị chấp nhận: asc hoặc desc. |
Ví dụ mã
- cURL
- JavaScript
- Python
- PHP
curl -X POST https://indexer.pivx.name/v1.0/checkpoints \
-H "Content-Type: application/json" \
-d '{
"count": 2,
"from_block": 1,
"order": "asc"
}'
const url = 'https://indexer.pivx.name/v1.0/checkpoints';
const data = {
count: 2,
from_block: 1,
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": 1,
"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' => 1,
'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);
Ví dụ phản hồi
{
"response": [
{
"idx": 41,
"block_id": 3422048,
"smt_root": "b4c9dacf8e194e353dce7638d76f282fe40399f7b0ad74a2229a6d4f5be774de"
},
{
"idx": 42,
"block_id": 3422335,
"smt_root": "eba675788f0fbf1df8a3c32e83da3e71dfd9337cca5a7c8ae2f51e963d03be17"
}
]
}
| Trường | Kiểu | Mô tả |
|---|---|---|
idx | int | Vị trí trong mảng rootChain của hợp đồng neo; con trỏ tiếp tục khi khám phá checkpoint |
block_id | int | block_id PIVX cuối cùng có trong điểm kiểm tra |
smt_root | string | Gốc SMT của điểm kiểm tra |