Gate Alpha 2nd Points Carnival Round 4 Hot Launch! Trade to Share $30,000 MORE & Alpha Points
Trade $MORE to unlock Listing Airdrops + $300K Points Prize Pool!
💰 Total Airdrop Volume: $30,000 MORE, Limited slots—first come, first served!
✅ Total Points: 2 Alpha Points per trade—accumulate points to share the $300K prize pool!
🔥Trade the Hottest On-Chain Assets First
For more information: https://www.gate.com/campaigns/1342alpha?pid=X&c=MemeBox&ch=vxDB0fQ5
How to access a website "on-chain"
A recent event has prompted me to rethink traditional domain access services. We have always considered domain name resolution services to be very stable, yet they can also encounter issues. This leads me to wonder if a Decentralization solution might be a worthwhile alternative to explore?
After thinking about it, deploying a page on the blockchain may have the following benefits:
Decentralization: All modifications require the collective agreement of everyone involved; no single institution has the final say.
No certificates required: Because blockchain itself uses encryption technology, there is no need for additional certificate configuration.
I had previously seen the domain name solution on TON and thought it seemed just fun, with average practicality, after all, traditional access methods have been very stable and commonly used. But now that I think about it, there might really be places where it will be useful, so I plan to study it more thoroughly.
Creating a Website on the Blockchain
This article will attempt to deploy a website on TON and allow users to access this page in their browser. The process is divided into three steps: 1. Purchase a domain name; 2. Prepare the front-end page; 3. Bind the page to the domain name.
The concept of domain names in blockchain is actually similar to that in the WEB2 world; both serve as aliases for complex and hard-to-remember addresses. In blockchain, they represent the user's address, while in WEB2, they correspond to the service's IP address.
Purchase Domain Name
Taking TON as an example, the official purchase address for the domain is priced in TON. Like WEB2, the shorter the domain name, the more expensive it is, with prices ranging from 1 to 100 TON.
If the domain name is not owned by anyone, you can bid at a low price, and after bidding, enter a countdown, during which everyone can bid until the countdown ends. After the auction, the domain name will be stored in the user's wallet as an NFT. Domain NFTs can be traded. The validity period of the domain is 1 year, and it will be reclaimed after expiration.
In summary, domain names can be obtained through auctions on the official website or traded from other users.
Prepare the front-end page
At this step, a front-end page needs to be prepared for display. For simplicity, this article only prepares an HTML file along with nginx to expose the page, and of course, the project also requires a cloud server to run the front-end page. This step is the same as deploying traditional front-end applications.
Bind the page to .ton
After acquiring a .ton domain name, you can bind your ANDL address on the official TON DNS website. Of course, you can also use the binding tool provided by TON to bind your page according to the instructions on the official website.
After the binding is complete, you also need to start a listening port on the server to listen for http requests and forward them to udp. You can use the official rldp-http-proxy tool for this, and you can start it by entering the command below:
rldp-http-proxy/rldp-http-proxy -p 8080 -c 3333 -C global.config.json
Among them, 8080 is the TCP port that will listen for incoming HTTP queries on the localhost, while 3333 is the UDP port that will be used for all outbound and inbound RLDP and ADNL activities (i.e., connecting to the TON website through the TON network). global.config.json is the filename for the TON global configuration, which can be downloaded here.
Access the .ton domain
Trying to directly access a website by typing a .ton domain in the browser will not work, as the browser does not know where to resolve this domain. Therefore, some additional steps are required here.
Request process of .ton
When requesting a .ton domain, the corresponding ANDL address will first be queried on-chain. This address can be simply understood as an IP address in WEB2, which is automatically generated when you deploy a website. This querying process can also be likened to a DNS query process.
After that, based on the address of ANDL, the request will be forwarded to your corresponding machine, at which point you can specify the corresponding return page. The overall process is quite similar to WEB2, with the main difference being that the querying method for address and domain name mapping is somewhat different.
Accessing the page through a proxy
The most recommended way is to use the proxy tool Tonutils Reverse Proxy provided by the official website. After downloading, installing, and starting it, a port 8080 will be launched for the proxy, and then you can access the .ton domain.
You can see the websites that can access the .ton domain.
Usage Summary
Currently, I have encountered the following issues:
In summary, the current experience is actually quite average, and there are many areas that can be improved in the future. However, I think this direction is quite good and innovative, and it's worth trying.