Nodejs script for fetching node list from registry
Posted: Tue Oct 28, 2025 2:05 am
Just do a npm i evernode-js-client
Run the script with node scriptname.js (and wait an hour for it to load all nodes)
Run the script with node scriptname.js (and wait an hour for it to load all nodes)
Code: Select all
const fs = require("fs");
const evernode = require("evernode-js-client");
async function main() {
evernode.Defaults.set({
governorAddress: "rBvKgF3jSZWdJcwSsmoJspoXLLDVLDp6jg",
rippledServer: "wss://xahau.network",
});
const registryClient = await evernode.HookClientFactory.create(
evernode.HookTypes.registry
);
await registryClient.connect();
console.log("Connected to registry hook.");
console.time("fetch");
const activeHosts = await registryClient.getActiveHostsFromLedger();
console.timeEnd("fetch");
console.log(`Fetched ${activeHosts.length} active hosts.`);
console.log("Sample hosts:");
console.dir(activeHosts.slice(0, 5), { depth: null, colors: true });
fs.writeFileSync("hosts.json", JSON.stringify(activeHosts, null, 2));
console.log("Saved full list to hosts.json");
}
main().catch(console.error);