Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query the expiry date for an RNS domain?

Tags:

solidity

rsk

In addition to direct queries, I'd also like to subscribe to events to listen for whenever the expiry date changes (e.g. when it is renewed)

I've found that NodeOwner.sol has an available function whose implementation looks promising:

    function available(uint256 tokenId) public view returns(bool) {
        return expirationTime[tokenId] < now;
    }

and that same file also defines an ExpirationChanged event:

    event ExpirationChanged(uint256 tokenId, uint expirationTime);

What I haven't been able to figure out is:

  • How to get the NodeOwner - which contract/ address should be queried?
  • If there are multiple possible addresses/ instances of NodeOwner, or there's only one of them.
like image 497
bguiz Avatar asked Sep 28 '21 15:09

bguiz


People also ask

How to check the expiry date of a domain name?

Checking the expiration date of a domain name is an easy process, by using the whatsmydns.net domain name expiry checker tool you can quickly and easily see the expiry date of a domain. When will a domain name expire?

Does domainsherpa domain expire?

As you can see above, the DomainSherpa.com domain name is due to expire on March 14, 2020, if not renewed prior to that date. ... If the domain name is renewed prior to the expiration date, or within 30 days thereafter (many registrars allow a grace period), an additional 1+ years is added to the domain name registration.

How long do domain names last after registration?

Depending on the type of domain name, they can take different periods to expire after registration or renewal. Some domain names have a minimum registration period of 2 years, however it is most common that they are registered for only 1. How long can a domain name be registered for?

How do I check if a domain name is available?

This tool is quite simple – copy/paste a domain name into the text box and click “CHECK”. Our domain expiration checker will tell you if the domain is available (and give you a link to purchase it), or if the domain is registered and has an expiration date. You can add a reminder about the expiration date via our “Add to Google Calendar” button.


Video Answer


1 Answers

To get the expiration time of a single domain, you can use the RSKOwner contract with the expirationTime method. You can query this contract to with the domain you are interested in.

On Mainnet, the contract’s address is 0x45d3E4fB311982a06ba52359d44cB4f5980e0ef1, which can be verified on the RSK explorer. The ABI for this contract can be found here.

Using Web3 library, you can query a single domain (such as testing.rsk) like this:

const rskOwner = new web3.eth.Contract(rskOwnerAbi, rskOwnerAddress);

const hash = `0x${sha3('testing')}`;

rskOwner.methods.expirationTime(hash).call((error, result) => {
    console.log('expires at: ', result)
})

You can see a working example of this on the RNS Manager.

like image 188
Jesse Clark Avatar answered Oct 19 '22 20:10

Jesse Clark