ton
ton copied to clipboard
TON DNS - Resolve name and nslookup utility
How we can resolve TON DNS name in a simple way?
Questions
- Can we do it somehow via TON Explorer and which one?
- Can we do it somehow via CLI app?
Thanks!
Now, we are trying to follow the guide Accessing TON Sites, it does not work as it was already mentioned in the Access TON Site on TON Storage via TON Proxy #677.
In the guide, you propose to access the site just-for-test.ton
using two addresses via TON Proxy
- http://just-for-test.ton
- http://utoljjye6y4ixazesjofidlkrhyiakiwrmes3m5hthlc6ie2h72gllt.adnl
How we can get ADNL address from the TON DNS one?
How we can get ADNL address from the TON DNS one?
ADNL address is stored in "site" record in DNS NFT contract data, see https://github.com/ton-blockchain/TEPs/blob/master/text/0081-dns-standard.md#dns-records
Once you spin-up some server to host your site - you should put adnl address of this server to 'site' record of your domain via dns.ton.org (or programmatically). And proxy will read this record and request specified server for your site files.
ADNL address is stored in "site" record in DNS NFT contract data, see https://github.com/ton-blockchain/TEPs/blob/master/text/0081-dns-standard.md#dns-records
Sounds clear, but how we can do it via Explorer?
For example, just-for-test.ton
is owned by the EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N address.
- How can we find address of the resolver?
- How can we call resolver to get the value stored in the
site
record? Is there any examples how can we do that using curl or maybe there is a native CLI app for that?
Once you spin-up some server to host your site - you should put adnl address of this server to 'site' record of your domain via dns.ton.org (or programmatically).
I'm discovering a way to do it via TON Storage, rather than TON Proxy. It is much easier to run 10 TON Storage nodes which will download and redistribute specific BagID, than to run TON Proxy and take care about distributing same private key to all of them.
And proxy will read this record and request specified server for your site files.
It means that proxy can resolve the address?
Sounds clear, but how we can do it via Explorer?
I don't know if any explorer can show you this (this info is public, but no one can list all stored DNS "records" AFAIK). To update - only domain owner can do it via dns.ton.org or by sending special message to dns nft.
For example, just-for-test.ton is owned by the
EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N
address.
Do not be confused with "NFT owner". For example "foundation.ton" domain (I don't want to spend time repeating for just-for-test one, sorry) has this addresses:
- DNS NFT item itself is EQB43-VCmf17O7YMd51fAvOjcMkCw46N_3JMCoegH_ZDo40e
- Owner of this item is EQCdqXGvONLwOr3zCNX5FjapflorB6ZsOdcdfLrjsDLt3Fy9 - person who has this NFT in his "NFT list" in explorers
- Assigned "wallet" (DNS entry in DNS NFT item data) is EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N - but it doesn't have "foundation.ton" NFT in his "NFT list" in explorer.
So "owner" opened dns.ton.org and put "assigned" address in "wallet" record. It's like in real life, say, Everscale devs purchase "the-best-crypto.org" domain and make it redirect to "ton.org".
For now explorers (e.g. tonscan.org) will redirect you to "assigned" wallet EQCD...qB2N when you search for "foundation.ton", not to NFT one. I have created https://github.com/catchain/tonscan/issues/63 issue for them to show both.
I don't know if other explorer can show you more info, instead I used this C# code.
I'm discovering a way to do it via TON Storage
To server side from TON Storage, you need to put storage bag-id into "site" record of DNS NFT Item (instead of server ADNL) on dns.ton.org. The proxy is responsible for connecting to storage bag instead of adnl server.
How we can resolve TON DNS name in a simple way?
I created Telegram bot https://t.me/TonDomainInfoBot that shows detailed info from DNS-enabled smartcontracts. It currently supports *.ton domains, *.t.me usernames and +888 anonymous numbers.
Thank you for implementation 💜
And let's check how it works
Information for domain just-for-test.ton:
{
"address": "EQCaoY-mwc8LShGcAgeVsq03giBUsak-9h2OuJ9ctH7QZG3y",
"isDeployed": true,
"index": "sD1oUJVNRRUleevcrILAtW3rvgTSDWBwXAXIR2rVsKQ=",
"collectionAddress": "EQC3dNlesgVD8YbAazcauIrXBPfiVhMMr5YYk2in0Mtsz0Bz",
"domain": "just-for-test",
"ownerAddress": "EQCdqXGvONLwOr3zCNX5FjapflorB6ZsOdcdfLrjsDLt3Fy9",
"auctionInfo": null,
"lastFillUpTime": "2022-12-29T20:11:12+00:00",
"entries": {
"wallet": "EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N",
"siteToAdnl": null,
"siteToStorage": "56A168B40A04E646DB7717B9E2CDAC79F904E5D0F7CDB2419FE8F8F7160C6FE7",
"storage": null,
"dnsNextResolver": null
}
}
Information for domain just-dmitry.ton:
{
"address": "EQCzXYXCzjEuCk1MqQcy7Qzs1brmshaFzNunV55QxJhF8hfY",
"isDeployed": true,
"index": "aJ/xjzHX02XcfBqE86QQsz3Xsl1ojYvsFbRwOBCa0KU=",
"collectionAddress": "EQC3dNlesgVD8YbAazcauIrXBPfiVhMMr5YYk2in0Mtsz0Bz",
"domain": "just-dmitry",
"ownerAddress": "EQDP_JFi4IucdPmEHJBSjEoSHlbC57G_8HLJAgqe05a-sGZ8",
"auctionInfo": null,
"lastFillUpTime": "2023-06-05T09:37:31+00:00",
"entries": {
"wallet": "EQDP_JFi4IucdPmEHJBSjEoSHlbC57G_8HLJAgqe05a-sGZ8",
"siteToAdnl": null,
"siteToStorage": "9686AAB427C3337928A33E3EFDEA0C3A9AEFBC0922447B61402CDE389F955885",
"storage": null,
"dnsNextResolver": null
}
}
As we see in the comment, tonutils-proxy
shows same result for just-dmitry.ton
2023/05/22 12:12:03 SEARCHING FOR BAG ID 9686aab427c3337928a33e3efdea0c3a9aefbc0922447b61402cde389f955885