Decentralized Name Service (DeNS) implementation for Free TON by Augual.TEAM.
Unlike web domains this implementation of Free TON domains has the following structure:
Example Free TON domain "org/freeton/name" is the analog of "name.freeton.org" web domain. org, freeton and name represent segments or levels of the domain.
Segments can be up to 31 letters long, can include lowercase letters, numbers and "-". Segment separator is "/".
Every Free TON domain can have from 1 to 4 segments. Our implementation provides flat structure (any domain address can be resolved offline without needing any information from its parent) with hierarchical parenting for all domains.
Top-level domains (domains with 1 segment) don't have a parent, their registration/claiming is unconditional and instant.
2+ level domains care only about their closest parent and its registration type (for 2-segment domain it is a top-level domain, for 3-segment domain it is a 2-segment domain, etc.).
After a successfull registration domain ownership is not limited by time, but there is one condition: every 90 days owner needs to prolongate() his domain, showing that domain is actively used and the owner still needs it.
Prolongation function becomes active 10 days prior to domain expiration.
When the owner doesn't need the domain anymore, he can:
- Wait for the domain to expire (after 90 days);
- changeOwner() to transfer ownership manually;
- releaseDomain() right away;
Expired domain can be claimed by anyone, but every claim requires parent domain registration requirements to be met.
Deployment and Registration/Claiming
Contract deployment is equal to domain registration. Automatic claim is performed on deployment for top-level domains only, because they don't have a parent domain to meet its registration requirements.
When a 2+ level domain is deployed, claimExpired() should be explicitly called to claim the domain.
When a 2+ level domain is deployed, and deployment is done via internal message with value, claimExpired() is called automatically.
Before calling claimExpired() potential owner needs to check parent domain registration requirements - getWhois()->registrationType and successfully fulfill them:
- FFA: Free For All; any domain will be registered right away;
- MONEY: In order to complete registration, an amount of TONs equal to parent's getWhois()->registrationType need to be attached as value to claimExpired() message (don't forget to add extra TONs to pay all the fees);
- OWNER: In order to complete registration, owner of the domain needs to be equal to the owner of the parent domain;
- DENY: All registration requests will be denied right away;
DnsRecord contract can be owned only by another contract address (no Public Keys).
When calling DnsRecord functions from another contract, any amount of value can be attached (minimum recommended is 0.1 ton), all change (extra TONs) will always be returned to sender using (value:0, flag: 128) (with one rare exception, info below).
When calling DnsRecord claimExpired() function, a chain of total 2 internal messages (and 2 events) is created. If attached value is not enough to process the whole chain and one of the messages is aborted, unintended loss of TONs may occur. Be sure to always include enough value to cover all the fees (long story short: extra 0.5 TON will cover everything, the change will be sent back).
Please use DeBot: 0:e49d816061c8d83f3f31d44a6bfa938855ad8848a5ab9b7206d2d9808636dac0 for domain deployment and management.
WARNING: when you deploy DnsRecord contract using DeBot, consider including 3 times more value to the message (e.g. 1.5 TON), because:
- 1: The checks, that claimExpired() does are almost the same checks that constructor does (it already doubles the value);
- 2: Minimum balance that DnsRecord contract maintains is the equivalent of 500k gas (or 0.5 TON at the moment), this amount will be reserved from the message value;
Again, when claiming already deployed DnsRecord, 0.5 TON will be more than enough.
Please follow https://github.com/laugual/dens-v2 README.md for manual deployment examples in Python.
Things that require our (developers') attention:
- DeNS DeBot updates/improvements;
- Website updates/tuning;
- Website integration with web wallets (like ExtraTON);