Now that you have uploaded a file to Skynet, you'll see some of the ways you can use the network to access data, taking a closer look at skylinks before learning about SkyDB and HNS domains.
In the last section, you learned that you can't edit skyfiles (files hosted on Skynet). It's important to know that this is not a limitation, but a design feature! Data that cannot change is called immutable, and in this section, we'll see how that helps power Skynet.
Remember, when we uploaded a file to Skynet, we got back a wild-looking URL. Here's an example: https://siasky.net/CADIvje1Fdy2FP2TeBsYAbHfUsNug98wE7SYArdyczDaDg
This URL has two distinct parts:
The Portal URL, which points to the portal you're using to access Skynet:
The information needed to locate and pull your file from Skynet -- its skylink:
Although skylinks can look random, their structure is essential to the security of Skynet.
When a file is put on Skynet, the data in the file is hashed using a cryptographic function. This hash, along with some additional info, is used to generate the skylink. Because of this process, Skynet portals can always confirm that the file they receive from hosts hasn't been altered, because a different file would result in a different hash! This is also why you can't edit files on Skynet -- if you try to change a file's contents, its hash changes, and so the skylink would have to change too.
Some sites and applications will put a modified version of the skylink before the portal domain. We'll walk through how to do this (and why you might want to) on the Skylinks page.
You don't always want cryptic URLs for data you can't edit. Sometimes you want data to be mutable or URLs that are human-readable. Let's take a look at how SkyDB and Handshake Names solve these issues.
Skynet uses registry entries and SkyDB entries to enable mutable content on the network. Most users won't directly interact with these, but they're what powers content-rich web applications on Skynet.
Registry entries are a special type of content that can be updated. Registry entries are very, very small -- just big enough to point to a Skyfile and keep track of how many times they've been updated. They also use cryptography that lets anyone with the right info to read an entry while only those with a special key can update it.
Used alone, registry entries aren't that exciting for the average user since you can't fit much information in such a small space. What they power though is our database solution called SkyDB. SkyDB uses the registry entries to make powerful web applications possible. By taking advantage of the registry's mutability at a consistent URL, SkyDB can create updatable data by updating registry entries to point at the skylink of newly created data.
SkyDB entries themselves take the form of JSON files, a standard format used across the web for storing information and sharing data between applications. With SkyDB, you can store info like a follower-list or a user profile and take it with you from skapp to skapp. This is a crucial piece of building Web3 -- you control your data and which apps get to access it.
If you'll remember back to Using Skynet, none of the skapps had strange URLs. That's because they use something called Handshake Names (or HNS).
Handshake is a decentralized domain name project that Skynet Portals support out-of-the-box. Developers can bid on and purchase domain names and then link them to data and applications on Skynet. Let's look quickly at what this means for Skynet users.
When you own a handshake name, you're not "leasing" it like with
.com names -- you own the name and gain censorship resistance beyond what traditional domains can give you. If Mr. GoDaddy gets cross with you, you won't have to worry about your access to your domain names being revoked.
Skynet Portals take care of figuring out where on Skynet an HNS name points. Handshake names can point to applications, user profiles, and more.
With Handshake names, you gain access to a URL that's easy to remember (not to mention keeps developers from having to update the links to their skapp every time they want to make a small update). The trade-off to keep in mind is that, as a user, you may not want an app's underlying code to change!
By using HNS, we re-introduce an issue to Skynet that we claimed was a benefit over the traditional web. When going to a site using HNS, you can't guarantee the data or code hasn't changed, unless you can confirm that the skyfile that the name points to has the same skylink as before. And immutable data was our major feature! It's a trade-off of convenience, and, for most user-facing applications, it's best to prioritize making content convenient and accessible.