const verify = require('ensverify');
// verify a specfici name and address to be correct
verify('registrar.firefly.eth', '0x6fC21092DA55B392b045eD78F4732bff3C580e2c')
.then(result => console.log(result)) // true
.catch(console.log);
// Returns Promise Object
// true if verified correct
// throws otherwise
curl -L -XPOST "https://verify.ensverify.com" -d '{"name":"registrar.firefly.eth"}'
const axios = require('axios');
const ethers = require('ethers');
// name and address in question (unverified by resolver)
const name = 'registrar.firefly.eth';
const address = '0x6fC21092DA55B392b045eD78F4732bff3C580e2c';
// provider address
const provider = '0xa75D20DdA7883CBF720b131938B6DcE4d733F877';
// json params for axios
const payload = axios.post('https://verify.ensverify.com/', JSON.stringify({ name }))
.then(result => {
// build payload (minimized for data)
const payload = {
name, // name to verify
address, // address to verify
timestamp: result.data.t, // call timestamp
};
// signed digest
const hashDigest = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(JSON.stringify(payload)));
// verified
if (provider == ethers.utils.recoverAddress(hashDigest, result.data.s)) {
console.log('Name has been verified by ENSVerify.com!');
} else {
console.log('The name has not been verified.');
}
})
.catch(console.log);
Independant engineering Ethereum guru and lover of all things crypto.
Github . @IAmNickDodson