Skip to content

Instantly share code, notes, and snippets.

@pinheadmz

pinheadmz/re-claim-check.js Secret

Created Apr 2, 2021
Embed
What would you like to do?
'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