0

I checked eth.syncing in the console and it says false which should mean the blockchain is synced, but in my node script I get an error that blockchain is not done syncing:

const fs = require('fs');
const words = fs.readFileSync('b', 'utf8').split('\n'); 
var Web3 = require("web3")
let web3 = new Web3("ws://localhost:8546");
var ens = web3.eth.ens;

(async () => {
    for (let word of words) {
        const addr = await getDomain(word);
        if (!addr) {
            console.log(word+': '+addr);
        }
    }
    web3.currentProvider.disconnect()
})();

async function getDomain(word) {
    try {
        const addr = await ens.recordExists(`${word}.eth`)
        return addr;
    } catch(err) {
        console.error(err);
        return;
    }
}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.