SWRM Labs’s blockchain-powered distributed content distribution and delivery network (dCDN) will provide secure content distribution network (CDN) services at a fraction of a traditional CDN price. SWRM Labs currently uses ten high-performance bootstrap nodes and up to 200 edge servers in its beta-level service offering. We plan to increase the number of edge nodes by 10x as we continue to roll out our beta testnet, on the road to Mainnet in 2021. The current implementation of the SWRM Labs service features two critical user environments:
- a web-based content management environment, where customers can upload content files, manage organization access rights, track content popularity and usage, pay bills, along with numerous other features, and
- a desktop-based graphical or command-line interface (CLI) “Hive” environment, where edge storage hosts can allocate storage capacity, earn tokens based on content throughput and manage their token wallets.
The SWRM Labs CDN also has the capability to provide a peer-to-peer file sharing function (not currently implemented) using the distributed storage network. SWRM Labs holds a utility patent for its distributed CDN technology.
The SWRM Labs CDN is a blockchain-based content delivery ecosystem based on Protocol Labs’ InterPlanetary File System (IPFS) with a multi-tier architecture to provide superior performance than commonly found in IPFS peer-to-peer storage and distribution networks.
The core storage and distribution backbone currently consist of up to ten bootstrap servers in North America, Europe, and Asia, where customer content is always available, ensuring complete content distribution to all intended end-users, regardless of their physical location. Those bootstrap nodes are connected to hundreds of local peer nodes worldwide, replicating the customer content up to 100 times to provide high bandwidth and rapid “Time to First Byte” (TTFB) performance metrics.
Support cloud services are being developed to help customers use the network services for storage and distribution, to manage the communities of users who have rights to upload and remove content, analyze network performance with statistical visualization techniques, and to manage customer account and billing details.
The core operations are:
- Store data - When a content file is uploaded to the service, a copy of the data is always maintained in the SWRM Labs network. The file is stored in the form of multiple chunks (called “shards”) and replicated to the default number of peers in the network. The network maintains the metadata, which contains information about where the file shards are located.
- Retrieve data - When a client wants to retrieve content from the network, the service responds by sending current routing information for the requested data file. The client connects to these peers, receives the data in multiple blocks, and reconstructs it on the local machine.
- Replicate data - The network always maintains a default number of copies of the data. Based on the demand for retrieval, the network could alter the number of copies of data dynamically.
- Pay for usage - A unit of value should be sent in exchange for services rendered.
The core technical components include:
- Hive node - The role of the Hive node is to store data and to service retrieval requests. These nodes are incentivized with SWRM tokens to deliver more and more data. One should create an account and download the Hive software from the SWRM Labs website to join the network. It is available as a desktop-based graphical or command-line interface (CLI) application. The users should log in with their account details to initialize and run the node. Hive nodes are selected to store data based on various criteria: ping time, latency, throughput, bandwidth, sufficient disk space, geographic location, uptime, etc. The SWRM Labs Hive also requires the node to enable port forwarding in the network router to accept incoming requests.
Hive software uses IPFS as its distributed file system. On top of IPFS, SWRM Labs implemented a micropayment system that enables the hive host to deliver the data in exchange for rewards. A micropayment is an electronic transfer of cryptocurrency made in very small quantities, a fraction of a penny. In blockchain, often these transactions are stored locally (off-chain), many of these transactions are then converted into one and posted to the main transaction chain. Each node has a public-private key pair created during initialization. When a node connects to another node, they exchange their public keys. The private key is used to sign the micropayments. In order to receive data from other peers, a node should transfer a small amount in the form of micropayment in exchange for data. Once received, these micropayments are stored locally until the current billing period ends. Peers use each other’s public key to verify the integrity of the transaction. The billing period is set at SWRM Labs central server. One micropayment record for one peer is maintained, if multiple transactions occur between the same peers in the current billing period, the same record is updated i.e small transactions are accumulated in one record. So, even for million transactions between two nodes will have a single record in both nodes. After the end of a billing period these micropayments are collected, cryptographically validated, and settled.
Hive node operators earn tokens by downloading the data once and delivering it multiple times. Download incurs fees and serving gains rewards. Hive nodes get data from SWRM Labs managed nodes or other Hive nodes and deliver it to the SWRM Labs CDN customer end-users. The data they serve can be anything from a text file to a huge 4k video of up to 100GB. The Hive host will not have any idea what is being stored, as the data is stored in chunks and may be encrypted from the client end. Hive software also runs a garbage collection program, which will clean up unused data and make space for new data.
- Bootstrap nodes - Bootstrap nodes are trusted Hive nodes maintained by SWRM Labs. When the Hive nodes initially join the network, they connect to these bootstrap nodes to get access to the content in the network. These nodes are always available and maintain live information about the peers that are participating in the network. These nodes also determine which peers get to store what content, and maintain the routing information for the data. Depending on the demand for retrieval, they are responsible for dynamically adding or removing copies of the data.
The bootstrap nodes always maintain at least one copy of the data file added to the network and then select Hive nodes to perform replication. These Hive nodes are selected based on a variety of factors. The Hive nodes need to pay the bootstrap nodes in order to get new content to cache and they, in turn, earn token rewards when they service the retrieval requests from our clients’ end-users. The bootstrap nodes also maintain the current reachability information of different Hive nodes used by clients to connect and download the data. The responsibility of maintaining and updating the current routing information of the data is shared across all the bootstrap nodes. This way, as the network scales, we can increase the number of bootstrap nodes to distribute and handle the load. Information maintained by these nodes is shared across all of them. So even if a bootstrap node goes down, the data retrieval process will not be affected.
- Billing engine is software that runs at SWRM Labs central server which processes micropayments, creates bills for CDN customers, and makes settlements to the Hive node operators (also called Hivers). The process happens at the end of every billing cycle starting with collecting micropayments from the Hiver nodes. These micropayments are either between the Hive nodes or end-user to Hive nodes. If the transaction goes from one Hiver to another, the transaction fee is deducted from the first Hiver account and settled into the second Hiver’s account. If the transaction goes from customer end-user to the Hiver, SWRM Labs admin credits the same amount to the Hive users and posts the bill to the CDN customer. Every transaction is recorded in a ledger database that provides a cryptographic signature trail to the history of any transaction. Automated backups are also in place to restore in situations of disaster recovery.
- End-user downloader - In order to retrieve the data from multiple hive nodes parallelly in the SWRM Labs network, the clients need to use a special downloader that runs a very minimal version of the Hive software. This downloader can connect securely to the other Hive nodes and obtain the data from them, paying for it at the same time. This downloader is provided to the customer when they add data to the network. When data is added to the network, a unique link is created for it. This link can be used with the downloader to download the data. Certain metadata are associated with each download which helps us bill the clients and reward the Hive nodes. Currently, we provide three options to customers for integrating the downloader:
- CLI - In this approach, the downloader is packaged in an executable format, which can be run on all the widely used platforms like Windows, Linux, and Mac. This is typically useful in the case of integration with desktop applications.
- SDK - SWRM Labs maintains SDKs for multiple different languages. These SDKs use the above CLI tool and provide a simple programmatic interface for clients to interact with the network. They can use the SDK of their preferred language and begin interacting with the network.
- Browser npm package - The same downloader is also available for integration with websites as an npm package. With this approach, the clients can integrate the downloader with their existing websites as well.
- DDNS - For Hivers to serve data through their personal computing environment, their nodes need to be publicly available on the internet. Other peers should be able to connect to these nodes and download data. This is particularly difficult today, as most network providers implement NAT (Network Address Translation). With NAT, multiple different home routers are able to share the same IP address. This helps the provider reuse a limited number of IP addresses. There are a few solutions available in peer-to-peer systems to get past this issue. SWRM Labs has implemented Dynamic DNS (DDNS) to dynamically assign DNS addresses to hive nodes and make them publicly available on the internet. This enables us to connect to multiple Hive nodes in parallel in the browser and download the data parallelly from all of them. This is different from conventional file downloads in the browser where the client obtains the data from one particular server. The Hive software uses secure WebSocket connections to serve the data at the same time to prevent unauthorized downloads.
- SWRM Wallet and Payment methods - A cryptocurrency wallet that holds SWRM Coin tokens integrated into both hive and customer accounts. These wallets are managed at SWRM Labs cold storage. The Hivers and the customers have access to their wallets to deposit and withdraw tokens. SWRM Coin is the main currency used in this environment. Hivers are incentivized with SWRM coins, which are credited to their wallet. Customers have an option to pay the bill via SWRM coin from their wallet balance or pay them via credit card. SWRM Labs plans to implement an offline billing system for large customers.
- Customer web application - A web-based application built using node js core backend and react js as the frontend. This application enables CDN customers to create organization accounts, add users, upload files and folders, and assign or change user access controls. We are using Mongo-DB to store user and organization account information and PostgreSQL for storing transactional data. Our resources are deployed across multi-cloud providers such as Google Cloud Platform (GCP), Amazon Web Services (AWS), and OVH Cloud.
The application provides the customer with a simple interface to add data and browse already added data. Once the data is added, a unique link is created for it. This link differs for different customers although they may be adding the same content. This link can be used with a downloader provided by SWRM Labs to download the data from multiple Hive nodes. Customers can track their data usage and make a payment using a credit card or cryptocurrency.