<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ENS on Victor42</title><link>https://victor42.eth.limo/tags/ens/</link><description>Recent content in ENS on Victor42</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>hi@victor42.work (Victor42)</managingEditor><webMaster>hi@victor42.work (Victor42)</webMaster><lastBuildDate>Sat, 19 Feb 2022 21:47:00 +0000</lastBuildDate><atom:link href="https://victor42.eth.limo/tags/ens/index.xml" rel="self" type="application/rss+xml"/><item><title>Blockchain-Powered Blogging</title><link>https://victor42.eth.limo/post-en/3608/</link><pubDate>Sat, 19 Feb 2022 21:47:00 +0000</pubDate><author>hi@victor42.work (Victor42)</author><guid>https://victor42.eth.limo/post-en/3608/</guid><description>&lt;img src="https://cdn.victor42.work/posts/2022-02/IPFS.jpg" alt="Featured image of post Blockchain-Powered Blogging" /&gt;&lt;p&gt;During the Spring Festival, I dove into some tech projects I&amp;rsquo;d been curious about. The best way to learn is by doing – using the tech, reading the docs, and getting hands-on. This led me to move my blog to the blockchain.&lt;/p&gt;
&lt;p&gt;And it worked! My new blog is at &lt;a class="link" href="https://victor42.eth.limo/" target="_blank" rel="noopener"
&gt;https://victor42.eth.limo/&lt;/a&gt;. Eventually, when blockchain browsers are common, I might just use &lt;a class="link" href="https://victor42.eth/" target="_blank" rel="noopener"
&gt;https://victor42.eth/&lt;/a&gt;, the actual address.&lt;/p&gt;
&lt;p&gt;This is a long post, so here&amp;rsquo;s a summary of what&amp;rsquo;s covered, and the background you&amp;rsquo;ll need:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Traditional Web&lt;/strong&gt;: A basic overview of how websites are accessed. No prior knowledge needed (hopefully!). Skip this if you&amp;rsquo;re familiar with networking.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ownership on the Traditional Web&lt;/strong&gt;: What a website owner does to publish, and who controls each part. No prerequisites, but easier if you own a website.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;New Tech Explained&lt;/strong&gt;: How websites work in the blockchain world, compared to the traditional web. You&amp;rsquo;ll need a basic understanding of blockchain, Ethereum, and BitTorrent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Putting the New Tech into Practice&lt;/strong&gt;: Tools and steps to deploy your own blockchain website. You&amp;rsquo;ll need experience building traditional websites, understanding DNS, and setting up a static site on GitHub. For a blockchain domain (optional), you&amp;rsquo;ll need to understand crypto wallets, transactions, and buying Ether.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="the-traditional-web"&gt;The Traditional Web
&lt;/h2&gt;&lt;p&gt;I&amp;rsquo;ve been exploring ENS and IPFS, which I&amp;rsquo;ll explain later. First, let&amp;rsquo;s see how my blog worked before.&lt;/p&gt;
&lt;p&gt;Key components include the domain name, DNS, IP address, and server. Accessing a website is like sending a package.&lt;/p&gt;
&lt;p&gt;Imagine sending a gift to a friend at the Palace Museum. You need their address. They receive it and send you postcards in return.&lt;/p&gt;
&lt;h3 id="domain-names"&gt;Domain Names
&lt;/h3&gt;&lt;p&gt;My blog was previously at &lt;a class="link" href="https://victor42.eth.limo/" target="_blank" rel="noopener"
&gt;https://victor42.eth.limo/&lt;/a&gt;. I&amp;rsquo;ll keep that domain for about six months, but I don&amp;rsquo;t plan to renew it.&lt;/p&gt;
&lt;p&gt;A domain name is a website&amp;rsquo;s nickname, making it easy to remember. Sharing the domain lets others access your site.&lt;/p&gt;
&lt;p&gt;A website can have multiple domains. However, a domain can only point to one website. It&amp;rsquo;s first-come, first-served.&lt;/p&gt;
&lt;p&gt;Think of &amp;ldquo;The Palace Museum&amp;rdquo; – everyone knows it. But asking for directions in a Guangzhou dim sum restaurant might get you strange looks.&lt;/p&gt;
&lt;p&gt;Knowing the name isn&amp;rsquo;t enough.&lt;/p&gt;
&lt;h3 id="dns-ip-and-servers"&gt;DNS, IP, and Servers
&lt;/h3&gt;&lt;p&gt;DNS (Domain Name System) points a domain name to an IP address.&lt;/p&gt;
&lt;p&gt;DNS needs DNS servers to work. Think of these as large machines in a server room – just the unit, no monitor or keyboard. They&amp;rsquo;re usually controlled remotely.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/taylor-vick-M5tzZtFCOfs-unsplash.jpg"
loading="lazy"
alt="Close-up photograph of cloud server racks in a traditional Web2 data center, showing rows of black server cabinets with blinking indicator lights and network cables, representing the physical infrastructure that hosts websites on the conventional internet"
&gt;&lt;/p&gt;
&lt;p&gt;You likely encounter IP addresses with your router (e.g., 192.168.1.1). This number string is your router&amp;rsquo;s location on your home network. Typing it into your browser usually opens the router&amp;rsquo;s settings. On the internet, IP addresses can represent PCs, phones, cell towers, cameras, servers&amp;hellip;&lt;/p&gt;
&lt;p&gt;When you visit a website, the IP usually points to a server storing the website&amp;rsquo;s code and data. Your browser uses DNS to find the IP and tells the server to send the content. The content appears in your browser.&lt;/p&gt;
&lt;p&gt;Back to the real world, DNS servers are like people guiding you. You ask, &amp;ldquo;How do I send something to the Palace Museum?&amp;rdquo; A grocery shopper says, &amp;ldquo;Ask someone younger.&amp;rdquo; A Starbucks barista says, &amp;ldquo;Ask someone in Beijing.&amp;rdquo; A colleague from Beijing says, &amp;ldquo;It&amp;rsquo;s 4 Jingshan Front Street, Dongcheng District, Beijing.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;People who know tell you directly; others point you to someone else. This relay gets you the address, the Palace Museum, from just the name. That&amp;rsquo;s how DNS servers work. The IP is like the street address, unique without duplication. You send your gift. Your friend sends back postcards, showing the Palace Museum&amp;rsquo;s beauty (like the server sending website content).&lt;/p&gt;
&lt;p&gt;IP addresses are unique in both directions. One address, one place.&lt;/p&gt;
&lt;h2 id="ownership-on-the-traditional-web"&gt;Ownership on the Traditional Web
&lt;/h2&gt;&lt;p&gt;That&amp;rsquo;s how accessing a website works. But who controls each part?&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve looked at it from the visitor&amp;rsquo;s side. Now, let&amp;rsquo;s see what a website owner does to make their site visible.&lt;/p&gt;
&lt;h3 id="domain-names-1"&gt;Domain Names
&lt;/h3&gt;&lt;p&gt;Let&amp;rsquo;s examine a familiar URL:&lt;/p&gt;
&lt;p&gt;&lt;a class="link" href="http://www.baidu.com" target="_blank" rel="noopener"
&gt;http://www.baidu.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It has four parts:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="Educational diagram breaking down the structure of a URL, highlighting the four components of http://www.baidu.com: protocol, subdomain, main domain, and top-level domain, with arrows pointing to each section for clear visual explanation"
&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;http://&lt;/li&gt;
&lt;li&gt;www&lt;/li&gt;
&lt;li&gt;baidu&lt;/li&gt;
&lt;li&gt;com&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;http://&lt;/strong&gt; is the protocol (&lt;strong&gt;H&lt;/strong&gt;yper&lt;strong&gt;T&lt;/strong&gt;ext &lt;strong&gt;T&lt;/strong&gt;ransfer &lt;strong&gt;P&lt;/strong&gt;rotocol). It&amp;rsquo;s an agreement between your browser and the server on how to transmit information.&lt;/p&gt;
&lt;p&gt;Other protocols exist. But HTTP is standard for websites, so we often omit it and just say &lt;a class="link" href="https://www.baidu.com" target="_blank" rel="noopener"
&gt;www.baidu.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s discuss the other three parts in reverse.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="URL structure diagram with the com top-level domain section highlighted in orange, explaining that TLDs categorize websites by purpose such as company, education, or military, and are controlled by the international organization ICANN"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;com&lt;/strong&gt; is the top-level domain (TLD), categorizing websites. Examples: .com (company), .edu (education), .mil (military). Two-letter TLDs represent regions (e.g., .cn for China, .uk for Britain).&lt;/p&gt;
&lt;p&gt;ICANN controls top-level domains. It decides which names can be TLDs. See the allowed TLDs here: &lt;a class="link" href="https://data.iana.org/TLD/tlds-alpha-by-domain.txt" target="_blank" rel="noopener"
&gt;https://data.iana.org/TLD/tlds-alpha-by-domain.txt&lt;/a&gt;. ICANN is a non-profit, but with enough money, you might get a TLD.&lt;/p&gt;
&lt;p&gt;Apple registered .apple (different from apple.com; it&amp;rsquo;s xxx.apple!). They could use iphone.apple, ipad.apple&amp;hellip; shorter than apple.com/iphone.&lt;/p&gt;
&lt;p&gt;But .com is ingrained. People say it automatically. You only need the brand name, apple, and add .com. Registering .apple is mainly brand protection.&lt;/p&gt;
&lt;p&gt;.com is so common because of commerce. Businesses register and maintain domains to build brands and drive revenue. They have more incentive than educational institutions or non-profits. So, .com became dominant, broadening its meaning.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="URL structure diagram highlighting the baidu main domain section in orange, explaining that the main domain combined with the top-level domain forms a complete address controlled by domain registrars and cloud service providers"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;baidu&lt;/strong&gt; is part of the main domain. With the TLD, it forms the complete main domain. Baidu.com means &amp;ldquo;a company called Baidu.&amp;rdquo; Baidu bought this domain and pointed it to their search engine.&lt;/p&gt;
&lt;p&gt;Domain registrars and cloud providers control main domains, charging annually. GoDaddy is well-known internationally; in China, there&amp;rsquo;s Wanwang, Ename, Alibaba Cloud, and Tencent Cloud. You choose a domain and pay for a few years. You can use it and point it anywhere. But the service provider still owns it and can take it back.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="URL structure diagram with the www subdomain section highlighted in orange, explaining that subdomains like www represent World Wide Web and can be freely created by the main domain owner to point to different services"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;www&lt;/strong&gt; is a second-level domain, or subdomain. &lt;a class="link" href="https://www.baidu.com" target="_blank" rel="noopener"
&gt;www.baidu.com&lt;/a&gt; and baidu.com are different.&lt;/p&gt;
&lt;p&gt;Owning the main domain (baidu.com) lets you add subdomains through your registrar or DNS provider. For example, help.baidu.com (customer support), map.baidu.com (Baidu Maps). www points to the search engine, like the main domain.&lt;/p&gt;
&lt;p&gt;Why the redundancy? &amp;ldquo;www&amp;rdquo; means World Wide Web. Early on, websites weren&amp;rsquo;t the internet&amp;rsquo;s core. Domains were used for email, file transfer, etc. Websites were another service. So, www indicated the official website. Later generations did the same, even without other services. People still do it, forgetting why.&lt;/p&gt;
&lt;p&gt;Subdomains belong to the main domain. You control their usage, but the registrar owns them.&lt;/p&gt;
&lt;p&gt;As an aside, the domain name order seems reversed. But the internet&amp;rsquo;s inventors were Western, especially English speakers. English addresses go from smallest to largest:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#20A, 2345 Belmont Avenue, Durham, NC， 27700&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Building, street, city, state. It&amp;rsquo;s a cultural difference.&lt;/p&gt;
&lt;h3 id="dns"&gt;DNS
&lt;/h3&gt;&lt;p&gt;Don&amp;rsquo;t announce your domain yet. Typing it in a browser won&amp;rsquo;t work. It&amp;rsquo;s not pointed to a server. Pointing is called domain resolution.&lt;/p&gt;
&lt;p&gt;A domain points to one website. Resolution rights are crucial. Whoever controls them decides where the domain is used.&lt;/p&gt;
&lt;p&gt;Initially, resolution rights are with the domain provider. But specialized DNS providers offer better services (Cloudflare internationally, DNSPod in China). To use them, transfer resolution rights from the registrar to the DNS provider. Then, set the domain&amp;rsquo;s destination in the DNS provider&amp;rsquo;s interface. DNS services often have free and paid features.&lt;/p&gt;
&lt;p&gt;The DNS provider now has resolution rights. You control where the domain points, but it&amp;rsquo;s not 100% yours. An employee or hacker could point your domain elsewhere. It&amp;rsquo;s like the fine print: final interpretation rights belong to the DNS provider.&lt;/p&gt;
&lt;h3 id="ip-and-servers"&gt;IP and Servers
&lt;/h3&gt;&lt;p&gt;Finally, put your website code and data on a server so the domain can point to it via DNS. Let&amp;rsquo;s assume a simple website with one server.&lt;/p&gt;
&lt;p&gt;Rent a server from a cloud provider (Alibaba Cloud, Tencent Cloud). Servers have monthly bills based on disk space, data sent, etc.&lt;/p&gt;
&lt;p&gt;Once the server is set up, you&amp;rsquo;ll have its IP address. Use DNS to point your domain to it. Your website is now public.&lt;/p&gt;
&lt;p&gt;Since the server is rented, you only have usage rights. The cloud provider can shut it down or delete its contents.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e5%a4%a9%e5%bc%baTR261F.jpg"
loading="lazy"
alt="Product photograph of a Tianqiang TR261F tower server hardware unit, showing a black metal chassis with front panel drive bays and ventilation grilles, representing the type of physical server that can be self-hosted in an office"
&gt;&lt;/p&gt;
&lt;p&gt;Alternatively, buy a server and put it in your office. A company I worked for did this. The server and contents are completely under your control. But this needs a high-quality network. Small websites usually don&amp;rsquo;t do this.&lt;/p&gt;
&lt;h2 id="the-new-tech-explained"&gt;The New Tech Explained
&lt;/h2&gt;&lt;p&gt;That&amp;rsquo;s the traditional web. Now, let&amp;rsquo;s explore the new technology.&lt;/p&gt;
&lt;h3 id="ens"&gt;ENS
&lt;/h3&gt;&lt;p&gt;As mentioned, ICANN controls top-level domains. But many teams challenge this. They believe domains are internet infrastructure, concerning everyone, and shouldn&amp;rsquo;t be controlled by a centralized organization – not even a non-profit. They advocate blockchain smart contracts to manage domains (top-level, main, subdomains). This ensures open, transparent, and trustworthy management.&lt;/p&gt;
&lt;p&gt;Four main blockchain projects provide domain services: HandShake (HNS), DecentraWeb (DWEB), Ethereum Name Service (ENS), and Unstoppable Domains. The first two offer top-level domain registration/trading; the latter two control some top-level domains and offer main domain registration.&lt;/p&gt;
&lt;p&gt;![Screenshot of the ENS blockchain domain registration website search page, showing the interface where users can search for and purchase .eth domains, with a search bar and domain availability results displayed on a clean white background](&lt;a class="link" href="https://cdn.victor42.work/posts/2022-02/" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/posts/2022-02/&lt;/a&gt;截屏 2022-02-17-下午 3.26.59.jpg)&lt;/p&gt;
&lt;p&gt;The blockchain world has strange top-level domains: .x, .eth, .coin, .wallet, .888, even emojis. These bypass ICANN. Control and ownership are recorded on the blockchain, operating by smart contract rules, not controlled by the founding teams.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Snipaste_2022-02-19_22-53-11.jpg"
loading="lazy"
alt="ENS dashboard screenshot showing the blockchain ownership record details for the victor42.eth domain, displaying the wallet address that owns the domain and the registration expiration date on a dark themed interface"
&gt;&lt;/p&gt;
&lt;p&gt;My domain (victor42.eth) is from &lt;a class="link" href="https://ens.domains/" target="_blank" rel="noopener"
&gt;ENS&lt;/a&gt;, an Ethereum-based service where domains end in .eth. After purchase, a smart contract records on Ethereum: &amp;ldquo;victor42.eth belongs to wallet xxxxxxxxx for 20 years.&amp;rdquo; This is recognized and protected by Ethereum. xxxxxxxxx is my Ethereum wallet address.&lt;/p&gt;
&lt;p&gt;ENS also provides domain resolution. In the blockchain world, DNS isn&amp;rsquo;t strictly necessary. On the traditional web, DNS providers ensure security, preventing tampering. But the blockchain is inherently secure. Domain resolution becomes simpler, a feature domain service providers can easily add.&lt;/p&gt;
&lt;p&gt;With this domain, no one can transfer it or point it elsewhere during the usage period, not even Vitalik, Ethereum&amp;rsquo;s founder. After the period, if I don&amp;rsquo;t renew, the smart contract reclaims it.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s the difference between blockchain and traditional domains? Let&amp;rsquo;s compare the traditional web and blockchain.&lt;/p&gt;
&lt;p&gt;The traditional web transmits information. Domains are nicknames for content. WeChat Pay transmits monetary value &lt;em&gt;as information&lt;/em&gt;, requiring UnionPay to verify it.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/v2-1c7c39a838509163666786299a1aaa0c_1440w.jpg"
loading="lazy"
alt="Comparison diagram illustrating the difference between the traditional information transmission web and the blockchain value network, showing how traditional networks require intermediaries like UnionPay while blockchain networks verify value transfer directly through cryptography"
&gt;&lt;/p&gt;
&lt;p&gt;The blockchain network transmits value. It&amp;rsquo;s an economic system using cryptography, verifying value transfer itself. Wallet accounts are the infrastructure. Domains nickname wallet addresses. Pointing to content is an additional function.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Screen-Shot-2018-06-29-at-6.00.20-PM.jpg"
loading="lazy"
alt="Screenshot of a cryptocurrency wallet interface displaying a long hexadecimal Ethereum address, showing the complex string of characters that represents a wallet account on the blockchain network"
&gt;&lt;/p&gt;
&lt;p&gt;An Ethereum wallet address is hard to remember. That&amp;rsquo;s why it needs a domain.&lt;/p&gt;
&lt;p&gt;Blockchain domains can point to a wallet and content. Entering the domain during a transfer sends it to the wallet; opening it in a browser displays the content.&lt;/p&gt;
&lt;h3 id="ipfs"&gt;IPFS
&lt;/h3&gt;&lt;p&gt;The previous section covered blockchain domains, which I now own and can point to a website. The next step is finding a decentralized hosting solution.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll detail the specifics later. This section explains IPFS&amp;rsquo;s technical principles. It works differently than the usual C drive, folder, subfolder structure.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re able, check out this video first (it&amp;rsquo;s more intuitive than my explanation): &lt;a class="link" href="https://www.youtube.com/watch?v=5Uj6uR3fp-U" target="_blank" rel="noopener"
&gt;https://www.youtube.com/watch?v=5Uj6uR3fp-U&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/IPFS.jpg"
loading="lazy"
alt="Official logo and icon of the InterPlanetary File System (IPFS), featuring a distinctive geometric honeycomb-like network pattern in blue and white colors, representing the decentralized storage technology"
&gt;&lt;/p&gt;
&lt;p&gt;Despite the &amp;ldquo;IP&amp;rdquo; in its name, IPFS is unrelated to traditional IP addresses. It stands for InterPlanetary File System. Crucially, if anyone on the IPFS network deems content valuable and keeps it, no one can delete or stop its spread.&lt;/p&gt;
&lt;p&gt;This might seem commonplace. Isn&amp;rsquo;t the traditional web similar? If a Weibo account posts something inappropriate, even after deletion, screenshots can ensure it&amp;rsquo;s not forgotten. That&amp;rsquo;s the internet&amp;rsquo;s open spirit.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Snipaste_2022-02-19_23-09-55.jpg"
loading="lazy"
alt="Diagram illustrating how IPFS distributes data across multiple nodes using sharding and hash validation, showing how files are broken into pieces and stored across a decentralized network with cryptographic verification"
&gt;&lt;/p&gt;
&lt;p&gt;However, PR exists. Most content spreads on major platforms. If these platforms cooperate to remove content, widespread dissemination stops. PR can&amp;rsquo;t erase content globally, but it can make it invisible to most. You can still copy it to a USB, but those unaware won&amp;rsquo;t know where to find it.&lt;/p&gt;
&lt;p&gt;But, how do pirated movies spread? Studios can&amp;rsquo;t stop them, right? Exactly. Pirated movies use distributed networks, not just the traditional web.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/18aebc5f0c14c27bc4ccc13a2a46b7b1eff939e1.jpg"
loading="lazy"
alt="Screenshot of a BitTorrent client window showing peer-to-peer file downloads in progress, displaying multiple seed connections and transfer speeds, illustrating the distributed network technology that inspired IPFS"
&gt;&lt;/p&gt;
&lt;p&gt;Downloading with Xunlei requires a BT torrent file. Xunlei uses the torrent, showing seed count. More seeds mean faster downloads; no seeds mean no download. Each seed is a device storing the content, often other downloaders. You&amp;rsquo;re not downloading from a server, but from other seeds. Blocking content requires finding and destroying all seeds – practically impossible.&lt;/p&gt;
&lt;p&gt;IPFS uses this for file transfer, but also as a storage method. How does the network know each seed has the &lt;em&gt;same&lt;/em&gt; movie, given different versions (full, cut, original audio, dubbed)?&lt;/p&gt;
&lt;p&gt;The answer: content separation at the file level. Different BT torrents mean different versions. This uses a &lt;em&gt;hash algorithm&lt;/em&gt;, encrypting any content into a fixed-length string, like:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;23db6982caef9e9152f1a5b2589e6ca3&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Download sites often show a file&amp;rsquo;s MD5 code (a type of hash algorithm) to verify against tampering or viruses after download.&lt;/p&gt;
&lt;p&gt;Hash algorithms have a key feature: identical content, using the same algorithm, &lt;em&gt;always&lt;/em&gt; produces the same result, regardless of time or location. Even a tiny change (e.g., a Chinese period to an English one) drastically alters the resulting code. This one-to-one correspondence means hash algorithms provide a unique ID for any content, like a social security number.&lt;/p&gt;
&lt;p&gt;This makes IPFS efficient. Content is distributed via its hash code. Displaying it requires retrieving the entire content from the IPFS network.&lt;/p&gt;
&lt;p&gt;For example, NFT digital collectibles. Ownership is recorded on the blockchain (&amp;ldquo;Content xxxxxx belongs to so-and-so&amp;rdquo;). A collectible can be large (image, music, video). How can a blockchain, with small blocks, store this? It stores the &lt;em&gt;hash code&lt;/em&gt;, uniquely identifying the content, confirming ownership. ENS domains are also NFTs, but with practical uses beyond viewing.&lt;/p&gt;
&lt;p&gt;IPFS builds its storage on this. Unlike traditional storage (retrieving by &lt;em&gt;location&lt;/em&gt;, like sending a package to a specific address), IPFS retrieves by &lt;em&gt;content&lt;/em&gt;. Knowing the content (its hash code ID) is enough. You request &amp;ldquo;content 23db6982caef9e9152f1a5b2589e6ca3,&amp;rdquo; and IPFS finds and delivers it from the closest source.&lt;/p&gt;
&lt;p&gt;This has advantages:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Reliability:&lt;/strong&gt; Any device with the content can transmit it. Even if major data centers are destroyed, you can still download from a neighbor via IPFS, as long as the network is up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Speed:&lt;/strong&gt; It finds the closest source, ensuring fast transmission, like BT seed downloads.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resource Saving:&lt;/strong&gt; On the traditional web, the same video posted on multiple platforms (WeChat, Weibo, TikTok) is stored multiple times. IPFS theoretically needs only minimal server backups, with most storage and transmission through personal devices.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tamper-proof:&lt;/strong&gt; Each piece of content has a unique code. Tampering creates a new code. The original code always leads to the original content, making it ideal for recording information age history, avoiding the &lt;a class="link" href="https://victor42.eth.limo/post-en/3584/" target="_blank" rel="noopener"
&gt;digital dark age&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Disadvantages:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Unpopular content may be harder to access if few devices store it and are offline. However, uploaders can keep important content online.&lt;/li&gt;
&lt;li&gt;IPFS is open; it can&amp;rsquo;t store private data. It&amp;rsquo;s unsuitable for personal cloud drives. Posted content is publicly visible.&lt;/li&gt;
&lt;li&gt;Think before posting; there&amp;rsquo;s no going back. Changes generate new content, not overwrites.&lt;/li&gt;
&lt;li&gt;Version fragmentation: Updates create new versions. Identifying the latest is addressed later.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/1_QVpq6pw2gbbtCmVybBrEuA.jpg"
loading="lazy"
alt="Technical comparison diagram showing the difference between IPFS content addressing and traditional network location addressing, with visual representations of how each method retrieves data from the network"
&gt;&lt;/p&gt;
&lt;p&gt;The name &amp;ldquo;InterPlanetary File System&amp;rdquo; isn&amp;rsquo;t just hype. If we colonize Mars, how will information transfer? Earth-Mars distance varies. Communication can take 4-24 minutes one-way, or be impossible during solar conjunction (like Tianwen-1).&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/de4c7603471048a69eea26092fa89d0f.jpg"
loading="lazy"
alt="Scientific concept diagram showing solar conjunction interference with Mars space probes, illustrating how the sun blocks communication between Earth and Mars spacecraft during certain orbital positions"
&gt;&lt;/p&gt;
&lt;p&gt;With the traditional web, a Martian accessing Wikipedia on Earth would face 8+ minute delays &lt;em&gt;per page&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Why not store Wikipedia&amp;rsquo;s data on Mars? Martian colonization will be gradual. Earth&amp;rsquo;s internet holds vast data. Copying &lt;em&gt;everything&lt;/em&gt; is impractical. Only important data would be prioritized; less important data (like &lt;a class="link" href="https://baike.baidu.com/item/%E5%B7%B4%E6%96%AF%E5%85%8B%E8%AF%AD/6715189" target="_blank" rel="noopener"
&gt;Basque&lt;/a&gt;) would remain on Earth.&lt;/p&gt;
&lt;p&gt;With IPFS, the &lt;em&gt;first&lt;/em&gt; Martian accessing Basque still faces the delay (blame Einstein, not me). But subsequent Martians can access it directly from the first user&amp;rsquo;s device, quickly. If that first user is a linguistics professor who deems it important, they can put it on a Martian IPFS server, establishing Basque data on Mars.&lt;/p&gt;
&lt;p&gt;IPFS itself isn&amp;rsquo;t a blockchain; it&amp;rsquo;s a network like BT downloads. The IPFS team created Filecoin, a blockchain using cryptocurrency to reward users for providing storage, maintaining IPFS and improving reliability. I won&amp;rsquo;t detail that. IPFS is crucial for the blockchain world, less so for the traditional web, so I consider it part of the former. Calling websites on IPFS &amp;ldquo;blockchain websites&amp;rdquo; isn&amp;rsquo;t perfectly accurate, but it&amp;rsquo;s simpler.&lt;/p&gt;
&lt;h3 id="ipns"&gt;IPNS
&lt;/h3&gt;&lt;p&gt;ENS handles domain + DNS, IPFS handles IP + server. Ready to build a blockchain website? Not quite. There&amp;rsquo;s a key issue, unique to IPFS.&lt;/p&gt;
&lt;p&gt;Traditional storage updates by replacing content at a location. IPFS finds content via hash codes. Updates create &lt;em&gt;new&lt;/em&gt; content; the old hash code remains. How do users see the &lt;em&gt;latest&lt;/em&gt; version of a constantly updated website? Announcing new hash codes constantly is impractical.&lt;/p&gt;
&lt;p&gt;IPFS has a built-in mechanism, IPNS (InterPlanetary Name System), similar to DNS. The &amp;ldquo;NS&amp;rdquo; is the same. It&amp;rsquo;s like a hash code, but points to different content without changing itself. Associating IPNS with IPFS content makes IPNS automatically point to the new version&amp;rsquo;s hash code after updates, like a traditional URL.&lt;/p&gt;
&lt;p&gt;ENS domains can point to IPNS, connecting everything. The website access process is entirely within the blockchain world:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ENS domain -&amp;gt; ENS points to -&amp;gt; IPNS -&amp;gt; Latest IPFS content -&amp;gt; Website&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="putting-the-new-tech-into-practice"&gt;Putting the New Tech into Practice
&lt;/h2&gt;&lt;p&gt;Theory is done, now for practice, which is simple.&lt;/p&gt;
&lt;p&gt;The blockchain world has evolved beyond speculation. Many practical applications are building the next-generation network infrastructure. You can use existing applications for deployment, which is convenient.&lt;/p&gt;
&lt;h3 id="blockchain-domains"&gt;Blockchain Domains
&lt;/h3&gt;&lt;p&gt;Domains and storage are separate. Blockchain domains can point to traditional websites, and &lt;strong&gt;traditional domains can point to blockchain websites&lt;/strong&gt;. A blockchain domain isn&amp;rsquo;t mandatory.&lt;/p&gt;
&lt;p&gt;This is likely the only part requiring money. You buy a domain on &lt;a class="link" href="https://ens.domains/" target="_blank" rel="noopener"
&gt;ENS&lt;/a&gt; using Ether. Cryptocurrency trading regulations in mainland China might be a hurdle. But if you&amp;rsquo;re this far, you&amp;rsquo;ve likely bought crypto before.&lt;/p&gt;
&lt;p&gt;If not, &lt;strong&gt;wait&lt;/strong&gt;. Understand cryptocurrency wallets (accounts, transfers) &lt;em&gt;before&lt;/em&gt; buying. Don&amp;rsquo;t use shady exchanges. Lack of understanding can lead to financial loss.&lt;/p&gt;
&lt;p&gt;Once you understand, you&amp;rsquo;ll know how and where to buy. Bypassing the firewall and using Google is prerequisite. It&amp;rsquo;s hard to navigate within the Chinese internet.&lt;/p&gt;
&lt;p&gt;The purchase is similar to traditional domains; no step-by-step tutorial is needed. You&amp;rsquo;ll have an Ethereum wallet with a .eth domain. Leave extra Ether for transaction fees during domain pointing setup.&lt;/p&gt;
&lt;h3 id="fleek"&gt;Fleek
&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://fleek.co/" target="_blank" rel="noopener"
&gt;Fleek&lt;/a&gt; handles everything else: deploying websites on IPFS and domain pointing. It&amp;rsquo;s free for personal websites with low traffic.&lt;/p&gt;
&lt;p&gt;Fleek has two upload methods. &amp;ldquo;Storage&amp;rdquo; is like Baidu Netdisk. Upload a file, get an IPFS-stored link:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a class="link" href="https://cdn.victor42.work/tools/ps-bulkrename.png" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/tools/ps-bulkrename.png&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;![Screenshot of the Fleek decentralized platform Storage dashboard showing uploaded assets and file management interface, where users can upload files to IPFS and get shareable links](&lt;a class="link" href="https://cdn.victor42.work/posts/2022-02/" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/posts/2022-02/&lt;/a&gt;截屏 2022-02-18-下午 4.51.35.jpg)&lt;/p&gt;
&lt;p&gt;This is for sharing individual files, not domain binding. I use it for image hosting in blog posts.&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Hosting&amp;rdquo; links to your GitHub account, reading code from a repository.&lt;/p&gt;
&lt;p&gt;![Screenshot of the Fleek Hosting page showing the step-by-step process to link a GitHub account for decentralized website deployment on IPFS](&lt;a class="link" href="https://cdn.victor42.work/posts/2022-02/" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/posts/2022-02/&lt;/a&gt;截屏 2022-02-18-下午 4.52.01.jpg)&lt;/p&gt;
&lt;p&gt;Then choose your static website system.&lt;/p&gt;
&lt;p&gt;![Screenshot of the Fleek configuration page showing the selection of Hugo as the static site build framework for deploying a blockchain website on IPFS](&lt;a class="link" href="https://cdn.victor42.work/posts/2022-02/" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/posts/2022-02/&lt;/a&gt;截屏 2022-02-18-下午 4.43.25.jpg)&lt;/p&gt;
&lt;p&gt;My previous blog used &lt;a class="link" href="https://hexo.io/" target="_blank" rel="noopener"
&gt;Hexo&lt;/a&gt;, a good system. But its creators and users are mainly Chinese-speaking, with low international recognition. Fleek, an overseas product, doesn&amp;rsquo;t support Hexo. I chose &lt;a class="link" href="https://gohugo.io/" target="_blank" rel="noopener"
&gt;Hugo&lt;/a&gt;, rebuilt a blog on GitHub, and moved content. Hugo is also excellent. Research building websites with Hugo; it&amp;rsquo;s not blockchain-specific.&lt;/p&gt;
&lt;p&gt;Next, choose the deployment network. The default is IPFS.&lt;/p&gt;
&lt;p&gt;![Screenshot of the Fleek network selection page showing the choice to deploy the website on the decentralized IPFS network rather than other blockchain options](&lt;a class="link" href="https://cdn.victor42.work/posts/2022-02/" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/posts/2022-02/&lt;/a&gt;截屏 2022-02-18-下午 4.52.36.jpg)&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Internet Computer&amp;rdquo; is another option, a different blockchain for deploying services, with its own pros and cons. It&amp;rsquo;s newer and more isolated. I tried it; it&amp;rsquo;s interesting.&lt;/p&gt;
&lt;p&gt;After these steps, the website deploys quickly. Fleek grabs content from GitHub, deploys on IPFS, and provides a subdomain. Your blockchain website is accessible.&lt;/p&gt;
&lt;p&gt;![Screenshot of the Fleek deploy log showing a successful website build on IPFS, displaying the deployment status and the generated IPFS content hash for the blockchain website](&lt;a class="link" href="https://cdn.victor42.work/posts/2022-02/" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/posts/2022-02/&lt;/a&gt;截屏 2022-02-18-下午 4.53.17.jpg)&lt;/p&gt;
&lt;p&gt;Domain pointing is done in Fleek&amp;rsquo;s Domain Management. For traditional domains, it guides you on filling resolution records with your domain/DNS provider. For ENS domains, follow its instructions; it requires your Ethereum wallet and a small Ether fee.&lt;/p&gt;
&lt;p&gt;You can also add HNS domains (a blockchain top-level domain provider). Ownership is recorded on the Bitcoin blockchain, obtainable via auction on &lt;a class="link" href="https://www.namebase.io/" target="_blank" rel="noopener"
&gt;Namebase&lt;/a&gt; with Bitcoin. You need to generate a main domain after getting the top-level domain. I haven&amp;rsquo;t tried this.&lt;/p&gt;
&lt;h3 id="ethlimo"&gt;eth.limo
&lt;/h3&gt;&lt;p&gt;Your blockchain website is set up: domain, IPFS deployment, domain pointing. But with a blockchain domain, typing xxxx.eth into a browser &lt;em&gt;won&amp;rsquo;t work&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;This isn&amp;rsquo;t the blockchain&amp;rsquo;s fault. Most browsers are from the traditional web era, recognizing only ICANN-approved protocols/domains. Non-HTTP protocols or domains not on ICANN&amp;rsquo;s list won&amp;rsquo;t open. There&amp;rsquo;s a gap.&lt;/p&gt;
&lt;p&gt;&lt;a class="link" href="https://eth.limo/" target="_blank" rel="noopener"
&gt;eth.limo&lt;/a&gt; bridges this gap. Add .limo to your domain (e.g., &lt;a class="link" href="https://victor42.eth.limo/" target="_blank" rel="noopener"
&gt;https://victor42.eth.limo/&lt;/a&gt;) for any browser. Blockchain-supporting browsers (like Brave) can open it without .limo. But you can&amp;rsquo;t assume all visitors have these.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a creative solution. What does eth.limo do?&lt;/p&gt;
&lt;p&gt;victor42.eth and victor42.eth.limo are fundamentally different. victor42.eth uses .eth as the top-level domain; I own the main domain victor42. victor42.eth.limo uses .limo as the top-level domain; eth.limo is the main domain (not mine); victor42 is my subdomain.&lt;/p&gt;
&lt;p&gt;eth.limo&amp;rsquo;s servers access the blockchain world. Accessing their subdomain, they cross the bridge, package the website&amp;rsquo;s content, and deliver it.&lt;/p&gt;
&lt;p&gt;This diagram explains. The rows: traditional website, traditional domain + blockchain website, blockchain domain + blockchain website.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/processed-faef701d-d810-454e-bef5-5b4b69f5597a_1d9a7f02-b98e-4f64-b034-aeac075ca384.jpg"
loading="lazy"
alt="Multi-row flow chart comparing DNS and ENS routing paths, showing three scenarios: traditional website routing, traditional domain with blockchain website, and blockchain domain with blockchain website using IPFS"
&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;DNS points the domain to the server, opening the website.&lt;/li&gt;
&lt;li&gt;DNS points the domain to Fleek&amp;rsquo;s server; Fleek finds content on IPFS, opening the website.&lt;/li&gt;
&lt;li&gt;Accessing the traditional domain, the delivery person accesses the blockchain domain, pointing to IPFS content, opening the website.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Red/blue lines: the traditional web/blockchain network border. Crossing it enters a new world.&lt;/p&gt;
&lt;p&gt;eth.limo isn&amp;rsquo;t unique. &lt;a class="link" href="https://eth.link/" target="_blank" rel="noopener"
&gt;eth.link&lt;/a&gt; is more widely used, with a more normal-looking domain name.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/limousinerental1518120210.jpg"
loading="lazy"
alt="Photograph of an ultra-long white Lincoln stretch limousine car parked outdoors, used to humorously explain the meaning of the .limo top-level domain in blockchain naming"
&gt;&lt;/p&gt;
&lt;p&gt;Limo refers to this. It&amp;rsquo;s still weird.&lt;/p&gt;
&lt;p&gt;I initially used eth.link (by Cloudflare). It&amp;rsquo;s centralized, using Cloudflare&amp;rsquo;s servers. As an overseas product, it had issues in China, occasionally going down. eth.limo uses multiple servers, with multiple bridges, preventing access failures at the last mile.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;That&amp;rsquo;s all.&lt;/p&gt;
&lt;p&gt;ENS and IPFS show a world where new technologies are thriving. They remind us to keep exploring.&lt;/p&gt;</description></item><item><title>区块链博客</title><link>https://victor42.eth.limo/post/3608/</link><pubDate>Sat, 19 Feb 2022 21:47:00 +0000</pubDate><author>hi@victor42.work (Victor42)</author><guid>https://victor42.eth.limo/post/3608/</guid><description>&lt;img src="https://cdn.victor42.work/posts/2022-02/IPFS.jpg" alt="Featured image of post 区块链博客" /&gt;&lt;p&gt;春节期间，想着利用长假来学学之前关注已久的几个技术项目。最高效的学习，就是直接投入使用，边用边查文档，容易产生最直观的理解。整个学习过程，就是一个把博客内容搬进区块链世界的实验。&lt;/p&gt;
&lt;p&gt;当然，最终实验挺成功，我的新博客可以通过&lt;a class="link" href="https://victor42.eth.limo/" target="_blank" rel="noopener"
&gt;https://victor42.eth.limo/&lt;/a&gt;访问。可能在未来的某一天，区块链浏览器普及的时候，博客链接可以去掉.limo小尾巴，回归&lt;a class="link" href="https://victor42.eth/" target="_blank" rel="noopener"
&gt;https://victor42.eth/&lt;/a&gt;，这才是链接本体。&lt;/p&gt;
&lt;p&gt;文章很长，预先说明一下各章包含什么信息，以及看懂它有什么前提：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;传统网络&lt;/strong&gt;：让你大致理解一个网站是如何被打开的，现有网络世界如何工作。没什么阅读前提，大家都能看懂，我希望如此。熟悉网络技术的朋友就跳过吧。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;传统网络的归属&lt;/strong&gt;：让你明白作为网站主人，发布一个网站该做些什么，各环节的控制权到底在谁手里。也没什么前提，如果你自己就是站长，那更容易懂了。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;新技术原理&lt;/strong&gt;：让你理解区块链世界的网站是如何部署和工作的，和传统网络有何不同。要看懂这部分，你需要大致明白区块链的原理，知道以太坊，接触过BT种子下载。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;新技术实践&lt;/strong&gt;：告诉你用什么工具可以亲自部署区块链网站，过程大概是什么样的。想做成这一步，你要有传统网站的建站经历，知道域名解析具体该怎么做，搭建过Github静态网站。如果想使用区块链域名（非必须），你还需要了解加密货币钱包是怎么回事，转账是怎么进行的，并且有实际渠道能买到以太币。&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="传统网络"&gt;传统网络
&lt;/h2&gt;&lt;p&gt;这次研究的技术是ENS和IPFS，后面会详细解释。为方便对比，先大篇幅科普一下我的博客以前是怎么工作的。&lt;/p&gt;
&lt;p&gt;这里面涉及到几个主要环节：域名、DNS、IP、服务器。在这种传统网络架构中，任何人访问一个网站的过程，类比到现实世界，相当于往一个地方寄包裹。&lt;/p&gt;
&lt;p&gt;比如你有朋友在故宫博物院工作，你要给他寄个小礼物，出于惊喜只能另想办法搞到他的地址。他收到后，作为答谢回赠了你一套故宫明信片。&lt;/p&gt;
&lt;h3 id="域名"&gt;域名
&lt;/h3&gt;&lt;p&gt;以前，我的博客可以通过&lt;a class="link" href="https://victor42.eth.limo/" target="_blank" rel="noopener"
&gt;https://victor42.eth.limo/&lt;/a&gt;这个域名访问。当然，接下来大半年也可以，只是之后我不打算续费这个域名了。&lt;/p&gt;
&lt;p&gt;域名是网站的一个代号，这样比较好记。通过分享域名，可以很容易地告诉别人如何打开一个网站。&lt;/p&gt;
&lt;p&gt;一个网站可以有多个域名，这和现实很像。反过来就不一样，一个域名只能对应一个网站，拒绝同名同姓，先到先得。&lt;/p&gt;
&lt;p&gt;类比现实世界，域名就相当于“故宫博物院”这个名字，名满天下，家喻户晓。但你如果你走进广州一家茶楼，随机问正在吃早茶的叔叔阿姨们，怎么往故宫博物院寄东西，你可能会收获许多关爱的眼神。&lt;/p&gt;
&lt;p&gt;所以，只知道名字，你是够不着那个地方的。&lt;/p&gt;
&lt;h3 id="dnsip与服务器"&gt;DNS、IP与服务器
&lt;/h3&gt;&lt;p&gt;DNS全称是Domain name system，它通过一系列的操作，把域名指向某个具体的IP地址。&lt;/p&gt;
&lt;p&gt;DNS只是一个虚的概念，它需要靠DNS服务器来维持运转。DNS服务器是一类特殊的服务器，把它想象成机房里那种大铁疙瘩好了，只有主机没有屏幕键盘鼠标的那种电脑。这种服务器电脑，一般是通过个人电脑远程连接来控制的。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/taylor-vick-M5tzZtFCOfs-unsplash.jpg"
loading="lazy"
alt="传统Web2网络中托管网站的云服务器机房机柜近景"
&gt;&lt;/p&gt;
&lt;p&gt;IP地址在你生活中最常出现的场合是路由器，192.168.1.1。这一串不好记的数字，代表了路由器在你家这个小小网络中的位置。通常，你在电脑浏览器里输入这个IP地址，就能打开路由器的后台管理界面。在整个互联网中，IP地址可以代表各种各样的东西：一台个人电脑、一部手机、一个通信基站、一个交通摄像头、一台机房里的大铁疙瘩（没错它又来了）……&lt;/p&gt;
&lt;p&gt;以访问一个网站为例，IP通常是代表大铁疙瘩服务器，网站的代码和数据就在这里面（简单理解）。你的浏览器通过DNS顺藤摸瓜找到IP地址，告诉服务器，把网站内容发过来。发来的内容呈现在浏览器上，因此你才看到这个网站。&lt;/p&gt;
&lt;p&gt;对照现实世界，DNS服务器相当于帮你找地址的人。你在街上随便逮个人问，怎么往故宫博物院寄东西啊？那人是买菜路过一大爷，大爷说我哪知道啊，你们年轻人办法多，你找个年轻人问问。你问一个星巴克服务员，她说这是广州啊，你好歹找个北京人问问啊。你问公司里一个从北京来的同事，他说，你可算问对人喽，故宫博物院地址很多北京人都不知道，不是长安街多少号，准确地址是北京市东城区景山前街4号。&lt;/p&gt;
&lt;p&gt;知道的人直接告诉你，不知道的告诉你应该问谁。就这样，在众人接力下，你最终仅凭一个名字，成功找到了准确地址，找到了故宫博物院这个大铁疙瘩。这就是DNS服务器的工作方式，而IP也就相当于现实世界的门牌号地址，加上省市区，绝对不会重复。然后，你把礼品发了个快递到这个地址。朋友收到了，给你寄回了一套明信片。你通过明信片上的照片，看到了故宫四季的美景（这就相当于服务器发你的网站内容）。&lt;/p&gt;
&lt;p&gt;需要注意的是，IP地址是双向唯一的。一个地址只能代表一个地方，一个地方也只能有一个地址。这和现实世界一样。&lt;/p&gt;
&lt;h2 id="传统网络的归属"&gt;传统网络的归属
&lt;/h2&gt;&lt;p&gt;打开一个网站的过程大致如上，但在这个过程中的各环节都是受谁控制、谁在负责维护呢？&lt;/p&gt;
&lt;p&gt;之前我们是从网站访客的角度来看。现在转换一下视角，看看作为一个网站的主人，要做些什么，才能让你的网站被世界看见。&lt;/p&gt;
&lt;h3 id="域名-1"&gt;域名
&lt;/h3&gt;&lt;p&gt;首先，域名的知识我展开说下。先看一个你铁定熟悉的网址：&lt;/p&gt;
&lt;p&gt;&lt;a class="link" href="http://www.baidu.com" target="_blank" rel="noopener"
&gt;http://www.baidu.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;它分为4个部分：&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="传统互联网网址中顶级域名和二级域名结构拆解示意图"
&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;http://&lt;/li&gt;
&lt;li&gt;www&lt;/li&gt;
&lt;li&gt;baidu&lt;/li&gt;
&lt;li&gt;com&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;http://&lt;/strong&gt; 是协议，全称叫&lt;strong&gt;H&lt;/strong&gt;yper&lt;strong&gt;T&lt;/strong&gt;ext &lt;strong&gt;T&lt;/strong&gt;ransfer &lt;strong&gt;P&lt;/strong&gt;rotocol，超文本传输协议。不讲虚的，它是你的浏览器和网线那头的服务器之间的一个约定，约好以一个双方都理解的格式来传输信息。&lt;/p&gt;
&lt;p&gt;也有其他类型的协议，用来做别的事情。不过访问网站的主流做法就是使用HTTP协议，所以我们谈论网址时，经常把协议的部分省略掉，直接说 &lt;a class="link" href="https://www.baidu.com" target="_blank" rel="noopener"
&gt;www.baidu.com&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;剩下3部分我们要把顺序倒过来讲。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="网址结构示意图中 com 顶级域名的分类与定位说明"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;com&lt;/strong&gt; 是顶级域名，Top-level Domain，常缩写为TLD。这种域名最初设计出来可以起到一定的分类作用，不能单独使用。比如.com代表company，适合商业公司；.edu代表education，适合教育机构；不常见的.mil，代表military，适合军事组织。还有两个字母的顶级域名代表地理区域，.cn代表中国的网站，.uk代表英国的网站。&lt;/p&gt;
&lt;p&gt;顶级域名的控制权在一个叫ICANN的国际组织手中，它决定了哪些名称可以作为顶级域名使用，其他的都不可以。这是ICANN允许的顶级域名清单：&lt;a class="link" href="https://data.iana.org/TLD/tlds-alpha-by-domain.txt" target="_blank" rel="noopener"
&gt;https://data.iana.org/TLD/tlds-alpha-by-domain.txt&lt;/a&gt;。虽然ICANN是非盈利组织，但你如果愿意付给它一年几十万，还真有可能让它开放一个专属于你的顶级域名。&lt;/p&gt;
&lt;p&gt;比如苹果就注册了.apple域名，注意这和apple.com不一样，是xxx.apple喔！只要苹果愿意，它可以把官网的频道调整成这种体系：iphone.apple、ipad.apple……这其实比 apple.com/iphone 、 apple.com/ipad 短，按理说更好记。&lt;/p&gt;
&lt;p&gt;但苹果为什么没有这么做呢？因为.com已经深入人心了，大家张口就来，不用记。这样一来，只需要记住apple这个品牌名称就行了，后面肯定是加.com。注册.apple主要是起到一个品牌保护的作用，防止别人注册来干坏事。&lt;/p&gt;
&lt;p&gt;至于为什么.com深入人心，使用频率远超.net、.org等其他顶级域名，乃至一些非公司（比如个人博客）注册域名时也会选.com，我认为这纯粹是商业的力量啊。你想啊，最热衷于注册和维护域名的是什么群体？是商人！商业企业做好品牌建设和宣传，对营收是有直接帮助的。它们比教育机构、非营利组织更有动力注册域名、搭建网站。自然地，.com成了被使用最多的顶级域名，以至于它的含义被广泛化了。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="网址结构中 baidu 主域名部分的作用与服务商归属图示"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;baidu&lt;/strong&gt; 是主域名的一部分，加上后面的顶级域名构成了完整的主域名，主域名才是一个完整可访问的域名。通常网站主是找一个现成的顶级域名，在它下面买一个主域名。baidu.com翻译成人话，就是“一家叫baidu的company”。显然，百度公司买了这个主域名，并指向了装有自家的核心产品（搜索引擎）的大铁疙瘩。&lt;/p&gt;
&lt;p&gt;主域名的控制权在各种域名和云服务商手中，按年收费。国际上较出名的是Godaddy，国内则有万网、易名中国。当然，阿里云、腾讯云等综合云服务商也有域名注册业务。你在这些平台上选好一个心仪的主域名，花钱买它几年。然后，这段时间内域名的使用权就归你了，你可以把它指向你想要的地方。不过，域名的所有权仍然在服务商手中，因为极端情况下它们有能力收回你的域名。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Domain-Explanation-2.12.2019-02.jpg"
loading="lazy"
alt="网址结构中二级域名与万维网子域名部分的含义解释"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;www&lt;/strong&gt; 叫做二级域名，或者子域名。很多人可能不了解一个事实，www.baidu.com和baidu.com虽然打开同一个网站，但本质是不同的。&lt;/p&gt;
&lt;p&gt;当你拥有了主域名（baidu.com）后，你可以在域名服务商或者DNS服务商（后面会讲）那里随意添加子域名。比如创建help.baidu.com，指向客服板块；或者创建map.baidu.com，指向百度地图产品。至于www，百度也把它指向了搜索引擎，和主域名一样。&lt;/p&gt;
&lt;p&gt;这不多此一举吗？里面有历史原因。因为www代表的是World Wide Web，万维网。在互联网诞生早期，网站并非互联网的核心，域名还用来做很多其他的事情，邮件服务、文件传输服务之类。在当时观念里，网站只是和邮件、文件并列的业务，而没有像今天这样成为品牌入口而凌驾于其他服务至上。所以，为了区分，当时人加上www专门表示官方网站，用它而非主域名对外宣传。久而久之，不明就里的后继者们也都这么做，哪怕他们只有官网，没有其他网络业务。几十年过去了，大家仍然这么做，却忘了为什么。&lt;/p&gt;
&lt;p&gt;子域名从属于主域名，所以和主域名一样，你掌握它的使用权，所有权仍属于域名服务商。&lt;/p&gt;
&lt;p&gt;插个题外话，了解了域名每部分代表什么，是不是就觉得它很别扭，为什么顺序是倒过来的？你想，互联网是什么人发明的？西方人，尤其是英语国家。在英语中地址是怎么表达的？&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#20A, 2345 Belmont Avenue, Durham, NC， 27700&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;某某建筑多少号，某某大街多少号，某市，某州。在英语中习惯由小到大表达，文化差异而已。&lt;/p&gt;
&lt;h3 id="dns"&gt;DNS
&lt;/h3&gt;&lt;p&gt;有了主域名之后，还不能急于昭告天下。因为这时候大家（也包括你自己）在浏览器里输入这个域名，什么也打不开，它还没有被指向任何服务器。指向的过程也叫域名解析。&lt;/p&gt;
&lt;p&gt;记得前面说一个域名只能指向一个网站吧？所以域名是个稀缺资源，这时候解析权就非常重要了。谁掌握了，谁就能决定这个域名用在哪儿。&lt;/p&gt;
&lt;p&gt;通常情况，初始的解析权在你购买域名的服务商那里。不过术业有专攻，有一些专业的DNS服务商，可以提供更灵活稳定的解析服务。国际上有Cloudflare，国内有DNSPod等。使用这些服务时，你得先去域名服务商那边设置一下，放弃域名服务商自身的解析权，转交给DNS服务商。然后在DNS服务商的管理界面中，设置域名的指向。DNS服务往往是基础功能免费，高级功能收费。&lt;/p&gt;
&lt;p&gt;这样一来，解析权就来到了DNS服务商手中。虽然它受你控制，你有权告诉世界，这个域名指向哪台服务器，但解析权并不100％属于你。DNS服务商的某个员工，或者某个黑客，也有本事把你的域名指向别处，因为他们能操纵你的DNS账号。这就好像优惠券使用规则末尾的小字，最终解释权归xxx（DNS服务商）所有。&lt;/p&gt;
&lt;h3 id="ip与服务器"&gt;IP与服务器
&lt;/h3&gt;&lt;p&gt;现在，最后的环节，你得把网站代码和数据放在某一台服务器上，域名才能通过DNS指向服务器上的网站。就假设你的网站比较简单，只用到一台服务器。&lt;/p&gt;
&lt;p&gt;常见的做法是在阿里云、腾讯云等云服务商租用服务器。服务器通常按月出账单，计费因素较多。网站数据占用的磁盘空间越多，就要付越多钱；服务器往外发送的数据量越大，也要付越多钱。&lt;/p&gt;
&lt;p&gt;服务器这头弄好了，你就会知道它的IP地址，通过DNS把你的域名指到这里来就可以了。到此为止，你的网站可以正式对外开放。&lt;/p&gt;
&lt;p&gt;既然服务器是租的，控制权自然也不在你手上，你只有使用权。在极端情况下，云服务商有权把你的服务器给关了，或者把其中的内容删掉。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e5%a4%a9%e5%bc%baTR261F.jpg"
loading="lazy"
alt="塔式服务器主机硬件设备天强TR261F实物产品照片"
&gt;&lt;/p&gt;
&lt;p&gt;不过有一种情况例外，你也可以自己买一台大铁疙瘩放在办公室，我以前一家公司就这么干过。这种情况下，服务器以及上面所有内容都完全受你的控制了。但这对你公司网络要求很高，访客涌到你公司的小小网络里，那速度就别想快了。小网站不太有这么干的。&lt;/p&gt;
&lt;h2 id="新技术原理"&gt;新技术原理
&lt;/h2&gt;&lt;p&gt;以上，传统网络的科普告一段落，这里开始要使用新技术了。&lt;/p&gt;
&lt;h3 id="ens"&gt;ENS
&lt;/h3&gt;&lt;p&gt;前面讲到，顶级域名控制权在国际组织ICANN手中。但是，半路杀出了很多团队，想要挑战它。这些团队认为，域名作为互联网的基础设施，关乎全人类福祉，不能让它掌握在一个中心化组织手中，由少数人决定其命运，非营利组织也不行。他们主张，用区块链的智能合约来管理域名，既包括顶级域名，也包括主域名、子域名。这样才能保证域名的管理公开透明、可信赖。&lt;/p&gt;
&lt;p&gt;提供域名服务的区块链项目主要有4个：HandShake(HNS)、DecentraWeb(DWEB)、Ethereum Name Service(ENS)、Unstoppable Domains。前2个提供顶级域名注册和交易；后2个自己掌握了部分顶级域名，开放相应的主域名注册。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e6%88%aa%e5%b1%8f2022-02-17-%e4%b8%8b%e5%8d%883.26.59.jpg"
loading="lazy"
alt="ENS等区块链域名注册平台的主页及检索购买界面截图"
&gt;&lt;/p&gt;
&lt;p&gt;在区块链的世界中，你可以看到许多千奇百怪的顶级域名，.x、.eth、.coin、.wallet、.888……还有用Emoji表情的。无论哪家，提供的域名都不在ICANN许可范围内，他们绕开ICANN，开辟了一个不受它管辖的域名世界。这些域名的控制权、所属权都记录在区块链上，并不受创始团队控制，而是依据智能合约中的规则在运转着。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Snipaste_2022-02-19_22-53-11.jpg"
loading="lazy"
alt="ENS管理后台victor42.eth域名所有权区块链登记截图"
&gt;&lt;/p&gt;
&lt;p&gt;我的域名（victor42.eth）来自&lt;a class="link" href="https://ens.domains/" target="_blank" rel="noopener"
&gt;ENS&lt;/a&gt;，这是一个基于以太坊区块链的域名服务，这里的域名都以.eth结尾。购买之后，智能合约的规则被触发，在以太坊网络里记上一笔，“victor42.eth这个域名从此刻起属于钱包xxxxxxxxx，为期20年”，这笔交易被整个以太坊网络承认和保护。其中钱包xxxxxxxxx，就是我的以太坊钱包地址。&lt;/p&gt;
&lt;p&gt;ENS同时还附带了域名解析功能。实际上，在区块链世界里，已经不太需要DNS这一个环节了。因为传统网络中，专业DNS服务商一个很大作用是保证解析过程的安全，不被篡改指到别处去，不被恶意拦截阻断，不被截获提取私密信息。但在区块链世界中，网络本身是安全的，这些情况不会发生。域名解析回归了它纯粹的指向作用，变得简单多了。所以域名服务商顺手提供一下就够了。&lt;/p&gt;
&lt;p&gt;这样注册下来的域名，在使用期内，没人可以绕过我而把它转走，或者把它指向别处，哪怕以太坊的创始人Vitalik也不行。使用期过后，如果我没有续费，它会被智能合约回收，可以再次被别人买走。&lt;/p&gt;
&lt;p&gt;区块链域名和传统域名使用上有什么区别呢？我简短讲一下传统网络和区块链网络的区别，可能让你有概念。&lt;/p&gt;
&lt;p&gt;传统网络是为了传输信息而存在的，域名是为了给内容起代号。我们虽然可以用微信支付转账，那也是把货币价值以一种信息化的方式来传输了，需要有银联这样的机构来验证价值的转移。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/v2-1c7c39a838509163666786299a1aaa0c_1440w.jpg"
loading="lazy"
alt="传统信息传输网络与区块链价值网络运作模式对比图"
&gt;&lt;/p&gt;
&lt;p&gt;区块链网络是为了传输价值而存在的，是一个由密码学维持的经济系统，系统本身就能验证价值的转移。钱包账户是这里的基础设施。域名的出现，是为了给钱包地址起个代号，这是它的初衷。至于指向某个网站，或者说某个内容，是它的附加功能。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Screen-Shot-2018-06-29-at-6.00.20-PM.jpg"
loading="lazy"
alt="加密货币以太坊钱包的超长十六进制地址显示界面截图"
&gt;&lt;/p&gt;
&lt;p&gt;以太坊钱包地址是这样一个东西，比IP可难记多了，你现在可能清楚为什么它需要域名了。&lt;/p&gt;
&lt;p&gt;区块链域名厉害之处在于，它可以同时指向钱包和内容。转账时，填入域名会转给钱包账户；在浏览器里打开时，则会展示内容。&lt;/p&gt;
&lt;h3 id="ipfs"&gt;IPFS
&lt;/h3&gt;&lt;p&gt;上一节已经搞定了区块链域名，所有权归我，且已经准备好指向某个网站了。接下来要做的，就是找一个去中心化的方案来存放我的网站，让域名有地方可以指。&lt;/p&gt;
&lt;p&gt;不过，具体操作我在后面的章节讲，这节介绍IPFS本身技术原理。因为它的工作方式略微烧脑，不是你习惯的那种C盘、某某文件夹、某某子文件夹的存储逻辑。&lt;/p&gt;
&lt;p&gt;能翻墙、英语无障碍的朋友可以先看视频，比我用文字讲直观多了：&lt;a class="link" href="https://www.youtube.com/watch?v=5Uj6uR3fp-U" target="_blank" rel="noopener"
&gt;https://www.youtube.com/watch?v=5Uj6uR3fp-U&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/IPFS.jpg"
loading="lazy"
alt="星际文件系统IPFS的经典蜂窝网络几何图形标志与图标"
&gt;&lt;/p&gt;
&lt;p&gt;IPFS里也有IP两个字母，但和那个传统IP没有半毛钱关系，撞脸纯属巧合。它全称是InterPlanetary File System，星际文件系统，口气不小。IPFS上的内容，只要世上有一个人觉得这内容有价值，愿意把它保留下来，其他任何人都无法在网络里消灭这些内容，也不能阻止它传播。&lt;/p&gt;
&lt;p&gt;这听起来好像没什么了不起，传统网络不也是这样吗？哪个官方微博号发了什么不当言论，哪怕第一时间删除，只要有人截图了，传开了，它也没法抵赖。互联网的开放精神就体现在这。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/Snipaste_2022-02-19_23-09-55.jpg"
loading="lazy"
alt="分布式IPFS网络中数据分片与多节点存储哈希校验原理"
&gt;&lt;/p&gt;
&lt;p&gt;但是别忘了，有一种操作叫公关。网络世界中，绝大部分内容是在极少数几个社交媒体上传播的。只要搞定了这些平台，让它们配合把服务器上的相应内容删除，大规模传播也就停止了。公关不能在全世界抹掉这些内容，但可以让大多数人无法看到。你要拿个U盘拷来拷去我管不着，但没见过的人想看一眼时，八成不知道该去哪找。&lt;/p&gt;
&lt;p&gt;不过……等等，好像事情也不像我说的这样吧？要不然盗版电影是怎么传出来的，制片方不也没本事阻止吗？没错，这就说在点子上了。盗版电影的传播，并不完全是靠传统网络完成的，它用到了分布式网络。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/18aebc5f0c14c27bc4ccc13a2a46b7b1eff939e1.jpg"
loading="lazy"
alt="BT种子文件下载过程中显示多节点连接与传输的界面截图"
&gt;&lt;/p&gt;
&lt;p&gt;当你用迅雷下载盗版电影时，是不是要先下载个BT种子文件？种子文件打开，迅雷才把它变成一个视频。界面上还显示当前有多少种子。种子多下载就快，没有种子则下不动。这是一种分布式网络的特征，每个种子背后都有一台存储了这个内容的设备，背后大多数是像你这样正在下载这部电影的人。你下载的过程并不是从什么盗版电影网站的服务器下载数据，而是从其他种子那里下载。在这样的传输网络里，想要彻底阻断一个内容传播，只能把所有种子找出来，挨个消灭掉，这几乎不现实。&lt;/p&gt;
&lt;p&gt;IPFS的文件传输就是用的这个原理，但它走得比这更远，没有止步于传输。它想直接把这种网络作为一种存储方式。不知道你有没有想过一个问题，网络是怎么知道每个种子设备上存放的是同一部电影呢？有的是完整版，有的是删减版；有的是原声版，有的是译制版。&lt;/p&gt;
&lt;p&gt;答案很简单，在文件这一层就把内容分开，不同BT种子文件下载下来的是不同的版本。这背后用到的技术叫做哈希算法，是一种加密技术，能够把一个无论多大的完整内容，编码成一串特定长度的字符，类似这样：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;23db6982caef9e9152f1a5b2589e6ca3&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;它经常在各种下载网站出现。网站把文件的MD5编码（哈希算法有不止一种，MD5是其中之一）贴出来，提醒你下载后用工具验证该文件有没有被篡改过，有没有被加入木马病毒。&lt;/p&gt;
&lt;p&gt;之所以能这么干，是哈希算法的一个技术特征决定的。同一个内容，用同一种哈希算法来加密，只会得到一个结果。你白天算也好，晚上算也好，在广州算也好，在新加坡算也好，都只能得到同一个编码。如果内容稍微改动一丁点，哪怕把一个中文句号改成英文句号，得到的编码也会完全不同。有这个特征，哈希编码和内容就有对应关系，双向唯一对应。因此，哈希算法不仅可以加密，还可为任何内容赋予一个唯一代号，就像身份证号一样。&lt;/p&gt;
&lt;p&gt;这样一来，IPFS就可以作为一种很高效的存储基础设施。传播内容时，使用内容的哈希编码。要呈现内容了，再到IPFS网络里把它完整取出来。&lt;/p&gt;
&lt;p&gt;有个很实际的例子，就是存储NFT数字藏品。数字藏品的所有权是记在区块链上的，“内容xxxxxx的所有权归谁谁谁”。数字藏品可能是一张图、一段音乐、甚至一段影片，可能会有几十个G那么大，区块链一个区块几MB空间，怎么存得下这么大的信息量，不得原地爆炸啊？所以区块链上记录的不是完整内容，而是哈希编码，与内容唯一对应，照样能起到确权效果。顺便说一句，ENS域名也是一种NFT，只不过相比大多数图片、音乐类藏品，它有实际作用，并非用于观赏。&lt;/p&gt;
&lt;p&gt;IPFS就是用了这种原理来构建它的存储系统，下面讲讲它与传统存储的本质不同。传统存储通过位置来获取内容，就像之前往故宫博物院寄包裹一样，你得知道这个内容在哪里，才能从那儿取出来，现实生活也如此，很好理解。IPFS存储则通过内容本身来获取内容，有点绕哈，这意思是说，只要你知道内容（的哈希编码身份证）是什么，就能直接获取到它。你在IPFS里吼一嗓子，“我要23db6982caef9e9152f1a5b2589e6ca3这个内容”，IPFS看谁有这个内容，就近调配给你。&lt;/p&gt;
&lt;p&gt;这种存储有几个优势：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;可靠&lt;/strong&gt;：只要有你要的内容，任何设备都可以把它传输给你。即使哪天世界大战了，亚马逊云、微软云、阿里云、腾讯云机房全被炸了，微博、微信、抖音服务器也全挂了。只要网是通的，你隔壁小区某住户有这个内容，你也可以通过IPFS从他那里下载到。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;快速&lt;/strong&gt;：总是给你找最近的，传输当然就快了。这和BT种子下载没什么两样。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;省资源&lt;/strong&gt;：这里指的是节省全人类的服务器资源。传统网络里，你在朋友圈、微博、抖音都发了同一条视频，它们就会分别存到3家的服务器上，各一份。你发多少个平台，就存多少份。有多少人发这同一条内容，那再翻多少倍，这个数字是很恐怖的。但在IPFS的世界，发的次数再多，发的人再多，理论上只需要少量分散存一些在服务器上兜个底，大多是通过个人设备存储和传输。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;防篡改&lt;/strong&gt;：一个内容一个编码，即使有人想混淆视听、歪曲历史，他篡改过的内容也会产生新的编码。你拿着原始编码始终能找到最初的内容。所以这个系统很适合忠实记录人类信息时代的历史，避免我另一篇博文里提到的&lt;a class="link" href="https://victor42.eth.limo/post/3584/" target="_blank" rel="noopener"
&gt;数字年代的历史断层&lt;/a&gt;问题。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;当然，也不是没有劣势：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;对冷门内容不友好。如果一个内容无人问津，存储它的设备很少，而且不巧都离线了，你可能一时就获取不到。但只要上传者认为这个内容重要，他自然会想办法让内容保持在线。&lt;/li&gt;
&lt;li&gt;IPFS是开放网络，不能存私密信息。你不能把IPFS当私人网盘或记事本用，发上去的内容全网可见。&lt;/li&gt;
&lt;li&gt;发布需三思而后行，因为没有撤回修改的余地。你的任何修改只会额外产生新内容，并不会覆盖掉旧内容。&lt;/li&gt;
&lt;li&gt;内容版本碎片化。每更新一下就产生一版新内容，怎么知道最新的是哪个？这个问题后面会讲，有办法解决。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/1_QVpq6pw2gbbtCmVybBrEuA.jpg"
loading="lazy"
alt="IPFS内容寻址与传统网络位置寻址技术差异对比图示"
&gt;&lt;/p&gt;
&lt;p&gt;回到它的名称，星际文件系统，可真不是在吹牛。如果未来人类在火星建立城市，两边要如何传输信息？地球到火星距离不固定，转到太阳同一侧时，无线通信时间单程短至4分钟；转到太阳两侧时，通信时间长至24分钟。如果刚好被太阳挡在中间，通信还没法进行，太阳的电磁干扰太强了，就像天问一号遇到日凌那样。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/de4c7603471048a69eea26092fa89d0f.jpg"
loading="lazy"
alt="天问一号探测器在火星轨道受太阳日凌电磁干扰科学配图"
&gt;&lt;/p&gt;
&lt;p&gt;要是采用传统网络，火星城市的人想打开百科查个资料，光是从地球服务器上获取个内容，每次来回都要至少等8分钟。注意，是每打开一个页面就等8分钟喔，你受不受得了？如果是48分钟呢？&lt;/p&gt;
&lt;p&gt;你可能会问，为什么不把百科的数据在火星也存一份呢？很现实的问题是，火星的殖民必然是渐进式的，刚开始一定是个小城市。而地球互联网存储着人类几千年文明史的大量资料，数据量是不可想象的，全部复制到火星吗？初期的火星城市有那么多基础设施、有那么多服务器吗？既然不能全部带走，只带走重要的呗。至于冷门资料，比如&lt;a class="link" href="https://baike.baidu.com/item/%E5%B7%B4%E6%96%AF%E5%85%8B%E8%AF%AD/6715189" target="_blank" rel="noopener"
&gt;巴斯克语&lt;/a&gt;，肯定留在地球的网络里呀，需要时再临时获取。&lt;/p&gt;
&lt;p&gt;如果用IPFS，会有什么不同呢？对火星上第一个查询巴斯克语的人来说，没什么不同，他还是得等上8-48分钟。这个问题没法解决，是物理限制，不服你找爱因斯坦去。但只要火星上有人打开过巴斯克语的百科页面，其他火星居民查询时，就是直接从第一个人的设备上获取了，那速度就和地球居民打开地球网页一样快。假如第一个查询者是火星上一个语言学教授，这些资料对他很重要，他就会想办法通过IPFS把这些资料放在火星的服务器上，从此巴斯克语资料就在火星落地生根了。&lt;/p&gt;
&lt;p&gt;需要注意的是，IPFS自身不是区块链，只是一个类似于BT下载网络的东西。但IPFS的创作团队也创造了Filecoin，这就是区块链了。它通过区块链和加密货币，奖励那些愿意提供闲置存储空间来存放他人内容的人，以此保持IPFS存储的持续，提高整个网络的可靠性，这方面就不深入展开了。加之IPFS网络是区块链世界不可或缺的基础设施，传统网络则不太用得着它，因此我也把它当作区块链世界的一员。我把部署在IPFS之上的网站称为区块链网站，并不严谨，在此解释一下，只是为了科普方便。&lt;/p&gt;
&lt;h3 id="ipns"&gt;IPNS
&lt;/h3&gt;&lt;p&gt;现在，似乎万事俱备了。ENS负责域名+DNS，IPFS负责IP+服务器，这已经齐活了嘛，我们可以搭建区块链网站了。且慢，还有个重要问题没解决，这是传统存储中不存在的问题，是IPFS带来的新问题。&lt;/p&gt;
&lt;p&gt;在传统存储中，要更新一个内容，只要到对应的存储位置把旧内容替换掉。之后人们再到这个位置来，直接就看到新内容了。可是在IPFS的世界里，人们是通过哈希编码来找内容的，更新产生了一个新内容，旧内容的哈希编码又不会变。对于一个持续更新的网站来说，如何让人总是看到最新版的内容？总不能每次更新都向全世界发消息，说我网站更新了，下次来看要用这个新的哈希编码，这显然不可接受。&lt;/p&gt;
&lt;p&gt;为解决这个问题，IPFS系统也内置了一个类似于DNS的机制，叫IPNS，InterPlanetary Name System。这个NS的含义和DNS里是一样的。它自身也是一个类似于哈希编码的东西，但可以指向不同的内容，自身编码却不会改变。把IPNS和某个IPFS内容关联上，每次更新内容时，IPNS会自动指向新版内容的哈希编码，这种方式就很像我们熟悉的传统网址了。&lt;/p&gt;
&lt;p&gt;巧妙的是，ENS域名也是可以指向IPNS的。这样一来就全部串起来了，整个网站访问过程，在区块链世界里可以完整走通，如下：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ENS域名——&amp;gt;ENS指向——&amp;gt;IPNS——&amp;gt;最新IPFS内容——&amp;gt;网站&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="新技术实践"&gt;新技术实践
&lt;/h2&gt;&lt;p&gt;原理已经到位，终于开始实践了，这部分反倒很简单。&lt;/p&gt;
&lt;p&gt;区块链世界经过了十多年的发展，如今已不是投机炒币的大赌场了。出现了许多有实际作用的区块链应用，它们正试图构建新一代网络基础设施的方方面面。懂了原理，不必真的从零开始白手起家，用一个现成的应用来帮你完成部署，很方便。&lt;/p&gt;
&lt;h3 id="区块链域名"&gt;区块链域名
&lt;/h3&gt;&lt;p&gt;提示一下，域名和存储是两件相互独立的事情。区块链域名可以指向传统网站，&lt;strong&gt;传统域名也可以指向区块链网站&lt;/strong&gt;。所以你也不是非得注册区块链域名。&lt;/p&gt;
&lt;p&gt;这应该是区块链建站唯一需要花钱的地方，你要在&lt;a class="link" href="https://ens.domains/" target="_blank" rel="noopener"
&gt;ENS&lt;/a&gt;购买一个域名，用以太币支付。这一步可能会难倒一些人，毕竟大陆对加密货币交易的管制很严格。不过我觉得，既然你都坚持看到这儿了，八成也是买过币的人，应该不在话下。&lt;/p&gt;
&lt;p&gt;如果真没买过，我建议&lt;strong&gt;先别尝试&lt;/strong&gt;。动手买币之前，&lt;strong&gt;务必&lt;/strong&gt;弄清楚加密货币钱包的工作方式。钱包账户是怎么回事，转账是怎么进行的，不要随便找个野鸡交易所就买了。这些不弄清楚，容易造成财产损失。&lt;/p&gt;
&lt;p&gt;等你弄明白之后，也基本知道怎么买、去哪买了。学习这些的前提是能翻墙，用Google，仅凭墙内世界很难找到门路。&lt;/p&gt;
&lt;p&gt;购买的操作步骤非常容易，就不手把手贴图教了，跟传统域名购买差不多。总之，最终结果是，你会拥有一个以太坊钱包，钱包里有一个属于你的.eth域名。注意多留一点以太币，之后做域名指向时还要付一些手续费。&lt;/p&gt;
&lt;h3 id="fleek"&gt;Fleek
&lt;/h3&gt;&lt;p&gt;域名以外的事情，都交给&lt;a class="link" href="https://fleek.co/" target="_blank" rel="noopener"
&gt;Fleek&lt;/a&gt;即可。它能在IPFS上部署网站，并且帮你搞定域名指向。对于数据少、流量小的个人网站，它完全免费。&lt;/p&gt;
&lt;p&gt;在Fleek，有两种上传文件的方式。一种叫做Storage，就像百度网盘，选本地文件，上传，它就被存储到IPFS里了。你会得到一个像这样的链接，可以在任何网络环境和浏览器里直接打开：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a class="link" href="https://cdn.victor42.work/tools/ps-bulkrename.png" target="_blank" rel="noopener"
&gt;https://cdn.victor42.work/tools/ps-bulkrename.png&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e6%88%aa%e5%b1%8f2022-02-18-%e4%b8%8b%e5%8d%884.51.35.jpg"
loading="lazy"
alt="Fleek平台Storage存储桶管理文件上传界面截图"
&gt;&lt;/p&gt;
&lt;p&gt;但这种方式不能绑定域名，只能用于分享个别文件。我则是把它当图床用了，获得的链接插入到博客文章里。&lt;/p&gt;
&lt;p&gt;另一种叫Hosting，这种可以关联上你的GitHub账户，从中读取某个仓库的代码。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e6%88%aa%e5%b1%8f2022-02-18-%e4%b8%8b%e5%8d%884.52.01.jpg"
loading="lazy"
alt="Fleek托管平台Hosting页面关联GitHub账户步骤截图"
&gt;&lt;/p&gt;
&lt;p&gt;然后需要选择你使用的静态网站系统。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e6%88%aa%e5%b1%8f2022-02-18-%e4%b8%8b%e5%8d%884.43.25.jpg"
loading="lazy"
alt="Fleek部署设置中选择Hugo作为静态建站系统框架的截图"
&gt;&lt;/p&gt;
&lt;p&gt;我原先博客用的是&lt;a class="link" href="https://hexo.io/" target="_blank" rel="noopener"
&gt;Hexo&lt;/a&gt;，这套博客系统其实不错的。但是它的创作者和使用者主要是华人圈子，海外知名度不高。Fleek是个海外产品，还不支持Hexo。我只好选了&lt;a class="link" href="https://gohugo.io/" target="_blank" rel="noopener"
&gt;Hugo&lt;/a&gt;，重新在GitHub搭了一套博客，把内容搬过来。其实Hugo也很好用，在此推荐。至于怎么用Hugo建站，就请自行研究吧，这不是区块链世界的事情，传统网络里也可以。&lt;/p&gt;
&lt;p&gt;下一步选择部署在什么网络上，默认是IPFS。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e6%88%aa%e5%b1%8f2022-02-18-%e4%b8%8b%e5%8d%884.52.36.jpg"
loading="lazy"
alt="Fleek平台选择部署网络为去中心化IPFS网络的设置截图"
&gt;&lt;/p&gt;
&lt;p&gt;还有另一个选项叫Internet Computer，那也是一个可以部署网络服务的区块链，采用了与IPFS不同的技术原理，各有优劣。不过它比较新，生态还较为孤立，有兴趣也可以创建一个玩玩。我试过，感觉也挺有意思。&lt;/p&gt;
&lt;p&gt;这几步做完，网站一小会儿就部署好了。Fleek把GitHub里的内容抓过来，部署到了IPFS上，还送你一个子域名。你的区块链网站已经可以访问了，就这么简单。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/%e6%88%aa%e5%b1%8f2022-02-18-%e4%b8%8b%e5%8d%884.53.17.jpg"
loading="lazy"
alt="Fleek平台显示博客网站在IPFS上部署成功的详情截图"
&gt;&lt;/p&gt;
&lt;p&gt;至于域名指向IPFS，在Fleek里的Domain Management操作即可。传统域名它会教你解析记录怎么填，在域名或DNS服务商那边设置。ENS域名照着它的指示来，没几步，过程中要用到你的以太坊钱包，并且支付少量的以太币作为手续费。&lt;/p&gt;
&lt;p&gt;里面还可以添加HNS域名，这是之前提过的一个区块链顶级域名服务商。它们家的域名所有权记录在比特币区块链上，可在&lt;a class="link" href="https://www.namebase.io/" target="_blank" rel="noopener"
&gt;Namebase&lt;/a&gt;公开竞拍获得，以比特币支付。但你获得了顶级域名后，还得生成一个完整的主域名才使用，这个过程是怎样的我没试过，有兴趣请自己尝试。&lt;/p&gt;
&lt;h3 id="ethlimo"&gt;eth.limo
&lt;/h3&gt;&lt;p&gt;到此为止，你的区块链网站已经全部就绪。域名有了，网站内容也部署到IPFS，域名也指向网站了。但如果你用了区块链域名，就会发现一个问题，在浏览器里输入xxxx.eth根本打不开。&lt;/p&gt;
&lt;p&gt;这不能怪区块链世界。这是因为目前市面上绝大多数浏览器都是传统网络时代的产物，它们只认识ICANN许可的协议和域名。你输入一个非HTTP协议、不在ICANN许可列表里的域名，浏览器自然是打不开的。传统网络世界与区块链世界之间有一道鸿沟，你的网站在区块链世界里已经成形，但传统网络世界够不着它。&lt;/p&gt;
&lt;p&gt;这么严重的问题，当然有人解决，&lt;a class="link" href="https://eth.limo/" target="_blank" rel="noopener"
&gt;eth.limo&lt;/a&gt;就是连接两个世界的桥梁。想要使用它，你什么也不用做，只要对外宣传你的网站时，在域名后再加个.limo。就像我的域名，我对外宣传都用的是&lt;a class="link" href="https://victor42.eth.limo/" target="_blank" rel="noopener"
&gt;https://victor42.eth.limo/&lt;/a&gt;，这个网址能被任何浏览器打开。如果你装了Brave等支持区块链网络的浏览器，不带.limo也能打开。但你不能指望你网站的访客都装了这些新式浏览器。&lt;/p&gt;
&lt;p&gt;这个解决方案很神奇，个人觉得脑洞很大。那么，eth.limo到底做了什么呢？&lt;/p&gt;
&lt;p&gt;在传统网络域名那一节认真听讲的朋友，应该马上就能反应过来，victor42.eth和victor42.eth.limo有本质区别啊。victor42.eth是以.eth为顶级域名，在下面注册了一个名称叫victor42，我拥有的是主域名。victor42.eth.limo是以.limo为顶级域名，主域名eth.limo也不是我的，只有这个名为victor42的子域名才是我的网站。&lt;/p&gt;
&lt;p&gt;显然，eth.limo他们家的服务器做了一些努力，使自己具备进入区块链世界的能力。当你试图访问它们家的子域名时，eth.limo的服务器走过桥梁，进入区块链世界，把网站的内容打包回来，呈递到你面前，像一个外卖小哥。&lt;/p&gt;
&lt;p&gt;我画了个图给大家解释一下，3行分别代表：传统网站、传统域名+区块链网站、区块链域名+区块链网站。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/processed-faef701d-d810-454e-bef5-5b4b69f5597a_1d9a7f02-b98e-4f64-b034-aeac075ca384.jpg"
loading="lazy"
alt="传统建站与区块链建站三种域名解析及请求路线对比图"
&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;域名被DNS指向服务器，打开网站。&lt;/li&gt;
&lt;li&gt;域名被DNS指向Fleek的服务器，Fleek进入区块链世界找到IPFS上的内容，打开网站。&lt;/li&gt;
&lt;li&gt;访问传统域名，外卖小哥进入区块链世界访问区块链域名，区块链域名指向IPFS上的内容，打开网站。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;红蓝线表示的，就是传统网络和区块链网络的边境，穿过去，就进入一个新世界。&lt;/p&gt;
&lt;p&gt;提供这种服务的也不止eth.limo这一家，使用更广泛的是&lt;a class="link" href="https://eth.link/" target="_blank" rel="noopener"
&gt;eth.link&lt;/a&gt;，这域名看起来正常多了。limo是什么东西，莫名其妙。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://cdn.victor42.work/posts/2022-02/limousinerental1518120210.jpg"
loading="lazy"
alt="一辆超长款白色林肯皇家林肯加长豪华轿车室外近照"
&gt;&lt;/p&gt;
&lt;p&gt;其实limo是指这个，档次一下子就上去了，但还是莫名其妙。&lt;/p&gt;
&lt;p&gt;我最初用的也是eth.link，它是著名DNS服务商Cloudflare提供的服务。eth.link是中心化的，用的是Cloudflare自家的传统服务器。作为海外产品，在国内水土不服，用了一段时间，发现它偶尔会挂。eth.limo则使用了许多不同服务器，有多座桥通往区块链世界，可以避免访问网站的旅程倒在这最后一公里。&lt;/p&gt;
&lt;h2 id="结语"&gt;结语
&lt;/h2&gt;&lt;p&gt;以上，我觉得值得讲的事情已经全部讲完了。&lt;/p&gt;
&lt;p&gt;透过ENS和IPFS两个技术，看见了它们背后所代表的世界，新技术在那边正成长为参天大树。提醒我们，永远不要停下探索的脚步。&lt;/p&gt;</description></item></channel></rss>