Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TON DNS - Resolve name and nslookup utility #676

Closed
air3ijai opened this issue Apr 22, 2023 · 8 comments
Closed

TON DNS - Resolve name and nslookup utility #676

air3ijai opened this issue Apr 22, 2023 · 8 comments

Comments

@air3ijai
Copy link

How we can resolve TON DNS name in a simple way?

  1. TON DNS & Domains
  2. What is TON DNS?
  3. TEPs/text/0081-dns-standard.md

Questions

  1. Can we do it somehow via TON Explorer and which one?
  2. Can we do it somehow via CLI app?

Thanks!

@air3ijai
Copy link
Author

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

  1. http://just-for-test.ton
  2. http://utoljjye6y4ixazesjofidlkrhyiakiwrmes3m5hthlc6ie2h72gllt.adnl

How we can get ADNL address from the TON DNS one?

@justdmitry
Copy link

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.

@air3ijai
Copy link
Author

air3ijai commented May 21, 2023

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.

  1. How can we find address of the resolver?
  2. 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?

@justdmitry
Copy link

justdmitry commented May 21, 2023

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:

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 catchain/tonscan#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.

@justdmitry
Copy link

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.

@air3ijai
Copy link
Author

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

@air3ijai
Copy link
Author

air3ijai commented Jan 5, 2025

Found other ways in TON DNS documentation

lite-client

  1. Download lite-client - https://github.com/ton-blockchain/ton/releases
  2. Download global.config.json - https://github.com/ton-blockchain/ton-blockchain.github.io
  3. Run a query
    lite-client -C global.config.json -c "dnsresolve just-for-test.ton"
    Result for domain 'just-for-test.ton' (all categories)
    raw data: x{77}
    x{BF235101421CF6EA196A9F05C2AD3339936420E68D373F5B3DC74538081510EC6E_}
      x{9FD380107BFAAA5CC6E5368E5F9799188BD798CD22E04AB16D1D8EA4FC37480741E635001_}
    x{BF2EB8106C0B107B43F6293BEC0E6F1E0375ABD287C31083D09586B9C177690FFA_}
      x{747356A168B40A04E646DB7717B9E2CDAC79F904E5D0F7CDB2419FE8F8F7160C6FE7}
    
    category 6NRAUIc9uoZap8Fwq0zOZNkIOaNNz9bPcdFOAgVEOxs= : (dns_smc_address
      smc_addr:(addr_std
        anycast:nothing workchain_id:0 address:x83DFD552E63729B472FCBCC8C45EBCC6691702558B68EC7527E1BA403A0F31A8) flags:0)
      smart contract 0:83DFD552E63729B472FCBCC8C45EBCC6691702558B68EC7527E1BA403A0F31A8 = EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N
    category +64EGwLEHtD9ik77A5vHgN1q9KHwxCD0JWGucF3aQ/4= : (dns_storage_address bag_id:x56A168B40A04E646DB7717B9E2CDAC79F904E5D0F7CDB2419FE8F8F7160C6FE7)	storage address 56A168B40A04E646DB7717B9E2CDAC79F904E5D0F7CDB2419FE8F8F7160C6FE7
    arguments:  [ CS{Cell{000200} bits: 0..8; refs: 0..0} 0 123660 ]
    result:  [ 8 C{BF380AD719E6CC14935EF87C720C5D585ABADF208BC16FD444DEC96AEF43D722} ]
    remote result (not to be trusted):  [ 8 C{BF380AD719E6CC14935EF87C720C5D585ABADF208BC16FD444DEC96AEF43D722} ]

@air3ijai
Copy link
Author

air3ijai commented Jan 5, 2025

tonlib-cli

  1. Download tonlib-cli - https://github.com/ton-blockchain/ton/releases
  2. Download global.config.json - https://github.com/ton-blockchain/ton-blockchain.github.io
  3. Run a query
    tonlib-cli -c global.config.json -E "dns resolve root just-for-test.ton"
    synchronization: ???
    synchronization: 0%
    synchronization: DONE in 166.3ms
    synchronization: 100%
    synchronization: DONE in 60.8ms
    Done
      6NRAUIc9uoZap8Fwq0zOZNkIOaNNz9bPcdFOAgVEOxs= SMC:EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N
      +64EGwLEHtD9ik77A5vHgN1q9KHwxCD0JWGucF3aQ/4= STORAGE:56A168B40A04E646DB7717B9E2CDAC79F904E5D0F7CDB2419FE8F8F7160C6FE7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants