-
-
Save pinheadmz/83b09668a2484f6c5a7b31f09a2e5054 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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