域名历史
返回针对某个具体 PIVX 名称所执行过的操作(如注册与变更)的历史记录。
端点
POST https://indexer.pivx.name/v1.0/history/richard.pivx
路径参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
domain_name | string | 是 | 要查询历史的 PIVX 域名(例如 richard.pivx)。 |
请求体
请求体必须是包含以下参数的 JSON 对象:
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
count | integer | 100 | 返回的最大行数,最多 500:更大的值会被截为 500。 |
from_block_id | integer | 无 | 只返回该区块之后的行:asc 时取更晚的区块,desc 时取更早的区块;该区块本身不包括在内。不指定时,列表从最早的行(asc)或最新的行(desc)开始。 |
from_nonce | integer | 无 | 仅与 from_block_id 一起使用:你手中最后一行的 nonce。列表随后紧接在该行之后继续,而不是在其整个区块之后;参见分页读取。 |
order | string | desc | 排序方式:asc 或 desc。各行先按区块、再按 nonce 排序。 |
代码示例
- cURL
- JavaScript
- Python
- PHP
curl -X POST https://indexer.pivx.name/v1.0/history/richard.pivx \
-H "Content-Type: application/json" \
-d '{
"count": 10,
"from_block_id": 5537000,
"order": "asc"
}'
const url = 'https://indexer.pivx.name/v1.0/history/richard.pivx';
const data = {
count: 10,
from_block_id: 5537000,
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/history/richard.pivx"
payload = {
"count": 10,
"from_block_id": 5537000,
"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/history/richard.pivx';
$data = [
'count' => 10,
'from_block_id' => 5537000,
'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": [
{
"domain_block_id": 5537326,
"domain_ts": 1784808285,
"target_address": "ps1f84lvgj0awz2yf2zha5d5gddhd4j88g0kzj5cwp776vhxp5fdjqe7e95cdx2qs5e7fcvg3ds3yq",
"owner_pubkey": "3757ee1a8b3f10353ca6edd47b66920392b02e323dca3f3edddb5de142079a53",
"domain_tx": "388241ffc5bf8ba3d7633d132298d157e26d6ac127ff8d162f26e7203084df08",
"op": "REG",
"nonce": 1784808228,
"price": 0
},
{
"domain_block_id": 5537369,
"domain_ts": 1784812590,
"target_address": "ps1f84lvgj0awz2yf2zha5d5gddhd4j88g0kzj5cwp776vhxp5fdjqe7e95cdx2qs5e7fcvg3ds3yq",
"owner_pubkey": "3757ee1a8b3f10353ca6edd47b66920392b02e323dca3f3edddb5de142079a53",
"domain_tx": "4d5419af400966616ba9325f78bb3cac2ff1229fd4d39ed022a9fc113ee4b67e",
"op": "LST",
"nonce": 1784812534,
"price": 200000
},
{
"domain_block_id": 5537421,
"domain_ts": 1784815647,
"target_address": "ps1yq6m9k7hn4wzp3gv5xun8kf0eq2dm3ay5r7vc6t9jl0sxh2pw8dz4knmg7uve3cqr6t5hxj9fda",
"owner_pubkey": "66a998241f62b4c8e4340f6e840b4570ac1d2d9840e2e42f62e713a34244f098",
"domain_tx": "3834eb36ca816f1bd9074c546ec64b3a361aca67e88c35b1586fe4ec1ae60095",
"op": "BUY",
"nonce": 1784815586,
"price": 0
},
{
"domain_block_id": 5538248,
"domain_ts": 1784878331,
"target_address": "ps1yq6m9k7hn4wzp3gv5xun8kf0eq2dm3ay5r7vc6t9jl0sxh2pw8dz4knmg7uve3cqr6t5hxj9fda",
"owner_pubkey": "66a998241f62b4c8e4340f6e840b4570ac1d2d9840e2e42f62e713a34244f098",
"domain_tx": "3c08640ed394b1a270abddcc3ca873c13793629c6a148ad0b5585003ca9e632a",
"op": "LST",
"nonce": 1784878114,
"price": 10012345678
},
{
"domain_block_id": 5538248,
"domain_ts": 1784878331,
"target_address": "ps1yq6m9k7hn4wzp3gv5xun8kf0eq2dm3ay5r7vc6t9jl0sxh2pw8dz4knmg7uve3cqr6t5hxj9fda",
"owner_pubkey": "66a998241f62b4c8e4340f6e840b4570ac1d2d9840e2e42f62e713a34244f098",
"domain_tx": "9ad75f893c002f21e9bbc3c6cdf4e151477293d64a013aa773db26598c1d5d11",
"op": "ULT",
"nonce": 1784878293,
"price": 0
}
]
}
| 字段 | 类型 | 说明 |
|---|---|---|
domain_block_id | int | 包含该操作的 PIVX 区块 |
domain_ts | int | 该区块的时间(Unix 秒) |
target_address | string | 操作之后名称解析到的地址 |
op | string | 操作:REG、UPD、CHG、LST、ULT 或 BUY |
owner_pubkey | string | 操作之后名称持有者的公钥 |
domain_tx | string | 承载该操作的 PIVX 交易的哈希 |
nonce | int | 操作的 nonce:随名称上的每次操作递增的时间戳 |
price | int | 操作之后的售价(单位为 satoshi):LST 时为挂牌价格,否则为 0。BUY 行显示 0,因为名称已不再出售;所付价格是其之前最近一次 LST 的价格 |
分页读取
要分页读取较长的历史,请把每一页的最后一行作为游标发回:把它的 domain_block_id 作为 from_block_id,把它的 nonce 作为 from_nonce。两者都要发送:一个区块可能包含对同一名称的多个操作(如上例中区块 5538248 里的 LST 和 ULT),而一页可能恰好在它们之间结束。只用 from_block_id 时,下一页会从下一个区块开始,跳过该区块的其余部分。行数少于你所请求数量(如果你请求的多于 500,则少于 500)的一页就是最后一页。
单独发送 from_nonce(不带 from_block_id),或其值不是非负整数时,会得到错误 One or several params provided have wrong value;负数或非整数的 count 也是如此。