Skip to content

Instantly share code, notes, and snippets.

@pinheadmz
Created April 2, 2021 18:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pinheadmz/83b09668a2484f6c5a7b31f09a2e5054 to your computer and use it in GitHub Desktop.
Save pinheadmz/83b09668a2484f6c5a7b31f09a2e5054 to your computer and use it in GitHub Desktop.
'use strict';
const {NodeClient} = require('hs-client');
const {Network} = require('hsd');
const network = Network.get('main');
const NAMES = require('hsd/lib/covenants/names.json');
const NULL_HASH =
'0000000000000000000000000000000000000000000000000000000000000000';
const nodeOptions = {
network: network.type,
port: network.rpcPort
};
const nodeClient = new NodeClient(nodeOptions);
let count = 0;
(async () => {
await nodeClient.open();
for (const hash of Object.keys(NAMES)) {
if (hash === NULL_HASH)
continue;
const target = NAMES[hash];
const url = target[0];
const labels = url.split('.');
const name = labels[0];
const info = await nodeClient.execute('getnameinfo', [name]);
if (info.info) {
count++;
console.log(`${count}:${name} : ${info.info.claimed}`);
if (info.info.claimed !== 1)
throw new Error('Possible re-claim found!');
}
}
process.exit(0);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment