TON Storage

Article image

We’re introducing technology for reliable storage of any size on the decentralized TON network.

Individual users and services with an audience of millions can use TON Storage to store their public and private files.

The challenge

People and services require storing more and more data.

There’s only one way to store data reliably: to copy it and store in different places. Hard drives fail, and fires and other emergencies happen; the more copies are made, the higher the chance that your data won’t be lost.

Users copy important documents into a few drives. Corporations do the same thing but on a much larger scale — they have data centers in different countries and replication systems.

However, there are other problems with data storing. For example, if data is stored in California and a user is on the other side of the planet, download speeds are going to be slow due to the large distance. In order to provide decent speeds, popular services create so-called Content Delivery Networks (CDNs) that store copies of data in various geographical locations worldwide, with the closest center working with the user.

It’s easily noticeable that all the current solutions are literally there to make storage more distributed and decentralized.

That’s why we see huge potential in the fully distributed TON Storage system on the decentralized TON network. The network’s openness allows anyone to run a node for data storage. This provides the chance for many independent nodes to sprout up across the globe. At the same time, contracts and data storage commitments are securely locked into the TON blockchain.

Torrents 3.0

TON Storage technology is based on torrents, a popular peer-to-peer file-sharing technology. TON Storage is incompatible with “classical” torrents, yet it adheres to the same principles.

The main difference is that data transfer happens through a decentralized, secure, and private TON network — the same place where TON Sites, TON DNS, and the TON blockchain are located.

The network doesn’t have a singular center; to find nodes storing data, a special technology is used, TON Distributed Hash Table (DHT).

Let’s give it a try

Let’s say you urgently need to post a photo of a duck on The Open Network.

Article image

You can do this with the create command of the special utility storage-daemon.

The utility packs the indicated file or list of files into a “Bag of files” or just “Bag” (a torrent analog), produces a “Bag ID” number, and broadcasts the information on the TON network. This is free and doesn’t require network fees.

The files are stored on your computer, but they’ve become available to everyone for download.

We assume that file storage will be handled by professional administrators using uninterrupted servers. The storage-daemon utility has open-source code and a console interface and is available for Linux, Windows, and MacOS.

Here’s the guide

Any network participant using the utility can download a file simply by knowing its ID.

Having downloaded the file, the user participates in storing, while the next user will be able to download the file from two nodes at the same time, and so on.

This is how copies of the files are distributed around the world.

Regular users can use the service http://storage.ton and download this file in a usual browser: http://storage.ton/gateway/7FEA7AF2325F0A5B6908939C9D72F92DB4C0CA52CCA8CE2C48BB2708BF188541/duck.png

Here's a document to remind you how to open TON Sites.

Files on the network are immutable; cryptography confirms their integrity. If it’s necessary to alter it, the distribution will need to be recreated and get a new ID.

More than torrents

What’s described above is excellent technology allowing people to exchange files of any size freely through the decentralized and secure TON network.

Nevertheless, this is only the beginning of describing all the possibilities of TON Storage.

Integrating with TON DNS

Simply enter the Bag ID in the “Storage” field of your TON domain and use a short and human-readable domain instead of a technical identifier.

You can find the guide here.

Integration with the TON blockchain

On regular torrents, there’s no storage guarantee. A file will exist as long as at least one node is storing it.

Such torrents also have no financial incentive to store files.

This is acceptable in a few situations — e.g., when a musician independently distributes their new album and is interested in maintaining file distribution. It’s also acceptable if the data isn’t very important.

For important data, there needs to be a storage guarantee, and TON Storage can provide such guarantees with the help of smart contracts on the blockchain.

A storage node and a user create a smart contract on the TON blockchain that guarantees that the user will pay a fixed amount in TON to store files for a predetermined amount of time.

The smart contract periodically requests a random part of the file from the storage node. Thanks to Merkle-proof cryptography, the smart contract is able to verify that the given file part is authentic. By losing the file, the storage node wouldn’t be able to present the proof, and the contract will be destroyed — the node operator won’t receive a Toncoin reward. Of course, all of this happens automatically without the participation of humans.

The smart contract can have other variations: the storage node can include some crypto as a deposit beforehand, and in the event a file is lost, the deposit gets transferred to the user as compensation.

By creating a few smart contracts with independent nodes, a user can provide themselves with a strong guarantee of their files being stored.

Ready-made smart contracts and an implementation guide.

Article image
We’ve made an example of the UI to demonstrate that for a regular user, the process of using TON Storage can be simple and convenient.

GitHub

Integration with TON Sites

The technology behind TON Sites was unveiled in September this year. It allows users to launch sites on the TON network without needing an association with a fixed IP address, a centralized domain, and a certified centralized center. Data between users and the site is encrypted.

Now, you have the opportunity to host TON Sites on TON Storage — http://just-for-test.ton/index.html, for instance, doesn’t have a web server and is fully decentralized.

Here’s the guide

Integration with TON NFT

The content of many NFTs is digital images.

Directly uploading images onto the blockchain is not the best idea — the blockchain is made for storing sensitive data, such as crypto wallet balances or documents indicating ownership.

The ideal location to store NFT content is with TON Storage.

The possibility of migrating to TON Storage was incorporated in the standard TON NFT smart contract, and now collection creators can take advantage of this.

Here’s the guide

Private data

Until now, we’ve been talking about public data available to everyone.

However, private data can also be placed in TON Storage by encrypting it beforehand. Encryption can happen with the help of your TON wallet’s key because it allows for providing high-quality security and avoiding needing to constantly enter passwords.

Meta cloud

In one of our previous articles, we discussed how TON Storage is an infrastructure solution, a decentralized analog to CDN, and cloud storage.

As an example, TON Storage can be seen as a “decentralized Amazon S3”.

One advantage over centralized cloud solution is that anyone can become a node operator on the TON network and receive payments directly from users. This will stimulate new independent participants to join the network. It’s quite difficult to try to become a competitor in the global market of cloud solutions when considering how much would be needed to spend on marketing and development. The Open Network has a place even for smaller participants who want to maintain the functionality of a single node.

Further steps

Today, we presented TON Storage, a universal technology that stores any files on decentralized TON network and is integrated with other TON components.

We invite the developer community to begin creating products based on TON Storage, from useful and convenient apps similar to Dropbox to non-commercial torrent portals dedicated to file sharing.

Another important direction is the creation of a decentralized exchange or marketplace, where node operators would be able to post their services (disk space, prices, geographical location, reputation, etc.), and users and services would be able to find the most suitable options for themselves.

The TON Foundation will be concentrating on integrating TON Storage and TON Payments to allow node operators to receive rewards for not only storing files but also their quick distribution.