Quick start


npm install '@ensdomains/dnsprovejs' --save


var provider  = web3.currentProvider;
var DnsProve  = require('dnsprove');
var dnsprove  = new DnsProve(provider);
var textDomain = '_ens.matoken.xyz';
var dnsResult = await dnsprove.lookup('TXT', textDomain);
var oracle    = await dnsprove.getOracle('0x123...');
var proofs = dnsResult.proofs;

    await oracle.submitAll(dnsResult, {from:nonOwner});
}else if (dnsResult.nsec){
    await oracle.deleteProof(
        'TXT', textDomain,
        proofs[proofs.length -1],
        proofs[proofs.length -2],
    throw("DNSSEC is not supported")

Alternatively, if you want to submit the proof not only to Oracle contract but also to claim via dnsregistrar, then you can call getAllProofs and pass the result into the proveAndClaim function.

let dnsResult = await dnsprove.lookup('TXT', '_ens.matoken.xyz', address);
let oracle    = await dnsprove.getOracle(address);
let data = await oracle.getAllProofs(dnsResult, params);
await registrar.methods
    .proveAndClaim(encodedName, data[0], data[1])


The example above demonstrated the case to call proveAndClaim smart contract function directly but we have a wrapper libray at DNSregistrar which calls DNSSEC Oracle and DnsRegistrar in one function call.

var DNSRegistrarJs = require('@ensdomains/dnsregistrar');
dnsregistrar = new DNSRegistrarJs(provider, dnsregistraraddress);