Name Resolving
Resolve a Name
Resolves a KNS name to retrieve its associated Kerrigan Address, its proof details, synchronization checkpoints, and registration data.
Endpoint
GET https://indexer.kerrigan-name.space/v1.0/resolve/{name} (Just name resolving)
POST https://indexer.kerrigan-name.space/v1.0/resolve/{name} (If additional parameters are required)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
{name} | string | Yes | The KNS name to resolve (e.g., richard.krgn). |
Request Body
The request body must be a JSON object containing the following parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
extended | boolean | false | If true, additionally returns created_block_id, updated_block_id and domain_tx (the hash of the transaction of the name's latest operation). |
with_checkpoint | boolean | false | If true, also returns checkpoint: the anchored checkpoint whose root (the same as smt_root) this proof was built against. It is null while a sync is being committed; repeat the request. updated_block_id comes with it as well. |
Code Examples
- cURL
- JavaScript
- Python
- PHP
curl -X POST https://indexer.kerrigan-name.space/v1.0/resolve/richard.krgn \
-H "Content-Type: application/json" \
-d '{
"extended": true,
"with_checkpoint": true
}'
const url = 'https://indexer.kerrigan-name.space/v1.0/resolve/richard.krgn';
const data = {
extended: true,
with_checkpoint: true
};
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.kerrigan-name.space/v1.0/resolve/richard.krgn"
payload = {
"extended": True,
"with_checkpoint": True
}
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
<?php
$url = 'https://indexer.kerrigan-name.space/v1.0/resolve/richard.krgn';
$data = [
'extended' => true,
'with_checkpoint' => true
];
$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);
$result = json_decode($response, true);
print_r($result);
?>
Response Example
{
"response": {
"domain_name": "richard.krgn",
"target_address": "ks166cahjdadxwwrajd7mqqyscmrzy9xpt94vy7xptq7luetq6258qclhmmmxlelnj36an6ah632vp",
"owner_pubkey": "1111111111111111111111111111111111111111111111111111111111111111",
"price": 250000000,
"nonce": 1793536201,
"created_block_id": 181240,
"domain_tx": "9fe75bfbbf10ad4f5e3517ee65908da0f13da09f04f63d08caf0bd74fa884849",
"updated_block_id": 181655,
"smt_root": "02c6c822fb1b7f51f0474a5b3a22b7672d32e8baf30e4e16a0b3d503cc5a81fa",
"merkle_proof": [
"29bc98ae3a939618e50ba72e11a25ba30b37bb53a168a17463b9ef3fe90495d8",
"0000000000000000000000000000000000000000000000000000000000000000"
],
"proof_depth": 2,
"proof_terminal": "Occupied",
"checkpoint": {
"idx": 5,
"block_id": 181702,
"smt_root": "02c6c822fb1b7f51f0474a5b3a22b7672d32e8baf30e4e16a0b3d503cc5a81fa"
}
}
}
This is an example, not an answer of indexer.kerrigan-name.space: its values are made up, and its address has a wrong checksum, so that nobody pays it. Its proof is complete all the same: it folds to its own root with the code on Verifying Proofs. The root changes with every new batch of operations, so requests made at different times may return another smt_root and other siblings.
| Field | Type | Description |
|---|---|---|
domain_name | string | The registered name |
target_address | string | Target Kerrigan address |
owner_pubkey | string | Public key of the name owner |
price | int | price tag (used for Marketplace) |
nonce | int | incremental nonce |
smt_root | string | The Merkle tree root (hex) the proof was built against, in every answer |
merkle_proof | string[] | sibling hashes, hex; [0] is deepest. Length equals proof_depth |
proof_depth | int | number of siblings — verify it equals merkle_proof.length |
proof_terminal | string | object | "Occupied", "Vacant" or {"Blocked":{…}} — see below |
| extended: | ||
created_block_id | int | domain creation Kerrigan block_id |
updated_block_id | int | domain last update Kerrigan block_id |
domain_tx | string | The Kerrigan transaction hash of the name's latest operation: its registration, until the name is updated, transferred, listed, unlisted or bought |
| with_checkpoint: | Fields inside "checkpoint" (null while a sync is being committed): | |
idx | int | Index of the root in the anchor contract’s rootAt mapping (0 is the genesis root); the resume cursor for checkpoint discovery |
block_id | int | The Kerrigan block_id the checkpoint covers |
smt_root | string | The checkpoint's root (hex) — the same as smt_root above |
proof_terminal
Describes what sits at the end of the proof path, which is what lets a proof show absence as well as presence:
| Value | Meaning |
|---|---|
"Occupied" | the name's own leaf is there — a successful resolution. Reject any resolution whose terminal is not this. |
"Vacant" | an empty subtree is there — the name is unregistered |
{"Blocked": {"record": {…}}} | a different name's leaf occupies that position, so the queried name is unregistered. The blocking record is included in full so you can verify the claim rather than trust it. |
A name the indexer does not know is answered with the error Domain not found, without a
proof: the API does not return Vacant or Blocked proofs yet, so a "not found" is the
indexer's word. Check it with a second indexer before relying on it.
If new names are being saved while the node answers, a lookup can get the error The names are being updated, repeat the request: repeat it a moment later. All the errors are listed on Errors.
Verification code for all of this, in Python, PHP and JavaScript, is on Verifying Proofs.
Reverse Name Lookup
Provide a Kerrigan Address to perform a reverse resolving:
GET/POST https://indexer.kerrigan-name.space/v1.0/resolve/reverse/{address}
The POST params are described above.
Names by Owner
All names owned by a given Ed25519 public key.
GET/POST https://indexer.kerrigan-name.space/v1.0/resolve/owner/{Ed25519_public_key}
The POST params are described above.
Paging the Lists
The reverse and owner lookups answer one page of names at a time, in name order (A to Z). Two more POST parameters page through them:
| Parameter | Type | Default | Description |
|---|---|---|---|
count | integer | 500 | Names per page, 1 to 500. A larger value is cut to 500. |
after | string | — | The last name of the page before: this page starts after it. Leave it out for the first page. |
A page holding count names may have more after it: ask again with after set to its last name. A shorter page is the last one, and a page past the last name is an empty list, [].
curl -X POST https://indexer.kerrigan-name.space/v1.0/resolve/owner/{Ed25519_public_key} \
-H "Content-Type: application/json" \
-d '{"count": 100, "after": "alice.krgn"}'