This guide shows the basic information of Filecoin Storage Mining, including main functions, storage mining explanation, Filecoin implementations, hardware considerations, and more.
Table of Contents
Since the publication of our most recent set of recommendations for Filecoin testnet storage miners, a lot has changed. Our recommendations at the time reflected the inexperience and experimental nature of the developing network since we had only recently launched the first iteration of the testnet. We owe a huge debt of gratitude to everyone who joined (and is still joining) the testnet because of your help, we’ve been able to quickly develop our protocols and implementations. We are currently in the second testnet phase and moving forward steadily with the mainnet launch.
In this article, we provide an updated overview of Filecoin storage mining and talk about a few recently announced incentives and opportunities for the rapidly expanding Filecoin community.
Attention: Filecoin is still being improved. The ultimate specification is actively being updated to reflect fresh information gained from the experimentation made possible by the testnet. As a result, crucial network parameters could still change before the mainnet launch. Before making a significant financial commitment, we strongly advise miners to purchase hardware at a small scale for testing, experimentation, and benchmarking.
Participating in the Filecoin Network
Currently, a node in the Filecoin network has two main functions: storage and retrieval. We anticipate that miners will try to hone their skills in specific occupations.
In the Filecoin network, nodes can enter into agreements with users, promising to store their data for a predetermined period of time in exchange for Filecoin.
Nodes that supply storage to the Filecoin network are termed storage miners. Periodically, these nodes are given the option to add blocks of their own design to the Filecoin blockchain. Storage miners receive newly created Filecoin as well as transaction fees they can charge to other nodes attempting to include messages in the block as payment for their work.
A node can also take part in retrieval contracts, providing clients with a specific file in exchange for Filecoin. This encourages strategically located nodes with high-throughput, high-bandwidth connections to participate in the network, promoting the wide and quick distribution of files, especially those that command high demand.
A number of other roles (for example “repair” nodes that facilitate network self-healing) are presently in development, but are not yet finalized or supported in any implementation. But even without these suggested upgrades, the network is fully operational.
Storage Mining Explained
On behalf of the Filecoin network, storage miners are responsible for maintaining files. Storage miners must cryptographically prove that they are honoring their pledge to store these files – this is achieved via the mechanisms of Proof-of-Replication (PoRep) and Proof-of-Spacetime (Filecoin is required to pledge storage to the Filecoin network itself; these are used as security to make sure storage miners uphold their contractual obligations.
In the Filecoin network, data is stored in fixed-size sectors. Generally, storage miners fill these sectors with data stored on behalf of clients, who contract storage miner services for a particular length of time via deals. However, storage miners are not forced into making deals; if a storage miner doesn’t find any of the available deal proposals appealing, they can alternatively make capacity commitments, filling sectors with arbitrary data. This enables them to prove that they are making space reservations on the network’s behalf. If desired, sectors created to serve as capacity commitments can later be “upgraded” to provide the contracted storage for future deals.
Once a sector has been filled, PoRep sees storage miners seal the sector – sealing is a computation-intensive process that results in a unique representation of the data (the original representation can subsequently be reconstructed by unsealing). Storage miners create a proof after data has been sealed, apply a SNARK to compress the proof, and then submit the compressed proof to the blockchain as proof of the storage commitment. Storage reserved for the network through this process is termed pledged storage.
When PoRep is finished, storage miners must continue to demonstrate that they are keeping the data they promised to keep. This is done through a process called PoSt, where storage miners are presented with a cryptographic challenge that can only be correctly answered by directly accessing a sealed sector. The computational difficulty of sealing ensures that storage miners must maintain easy access to and integrity of the sealed sector. The storage miner must respond to this challenge within strict time constraints.
In Filecoin, PoSt manifests in two distinct challenges: WindowPoSt and WinningPoSt.
WindowPoSt is the mechanism by which the commitments made by storage miners are audited. Each day is divided into a number of windows in this system. Accordingly, a subset of each storage miner’s set of pledged sectors is divided, one subset for each window. Each storage miner must submit a PoSt for each sector in their specific subset within a predetermined window. A SNARK-compressed proof that has been published to the blockchain as a message in a block will be the result of this, which calls for immediate access to each of the challenged sectors. In this way, every sector of pledged storage is audited at least once every 24 hours, and a permanent, verifiable, and public record attesting to each storage miner’s ongoing commitment is maintained.
The Filecoin network anticipates that stored files will always be accessible. Failing to submit WindowPoSt for a sector will result in a fault, and the storage miner supplying the sector will be slashed – that is, a portion of their collateral will be forfeited, and their storage power (see Storage Power (see below) will experience a decrease. Storage miners will only have a brief window to repair faults before it is assumed that they have completely abandoned their storage commitment. Should the need arise, storage miners will also have the ability to preemptively issue a declared fault, which will result in reduced penalties, but which still must be addressed within a reasonable timeframe.
WinningPoSt is the mechanism by which storage miners are rewarded for their contributions. The Filecoin network discretizes time into a series of epochs, and the height of the blockchain reflects the number of epochs that have passed. At the beginning of each epoch, a small number of storage miners are elected to mine new blocks (Filecoin makes use of tipsets, which enable the mining of multiple blocks at once. Every elected miner that successfully produces a block is given filecoin and has the option to charge other nodes a fee to include messages in the block.
The likelihood that a storage miner will be chosen varies with storage power. Storage miners are given the task of submitting a compressed proof of storage for a specific sector before the epoch expires, in a procedure similar to that underlying WindowPoSt. Storage miners who fail to finish WinningPoSt within the required window will lose the chance to mine a block, but they won’t be penalized in any other way.
A Filecoin storage miner’s power, which corresponds to the likelihood that a storage miner will be elected to mine a block, is roughly proportional to the amount of storage they have sealed on behalf of the network. To further incentivize the storage of “useful” data over simple capacity commitments, storage miners have the additional opportunity to compete for special deals offered by verified clients. The power a storage miner earns from such deals is multiplied, and these clients are certified with regard to their intention to offer deals involving the storage of valuable data. The total amount of power a given storage miner has, after accounting for this multiplier, is known as quality-adjusted power.
The Filecoin Distributed Storage Network is an open specification with numerous implementations.
The Go-based Lotus is the most advanced implementation as of the time of writing and the one that should be used to access the live testnet. Linux and macOS can both run the Lotus client; comprehensive installation and usage instructions are provided in the documentation.
Other implementations are actively being developed for at least three more. These include forest, a Rust implementation created by ChainSafe, go-filecoin (another Go-based implementation), and fuhon, a C++ implementation created by Soramitsu.
Participants in the Filecoin Network Will Need to Ensure That Their Systems Are Sufficiently Equipped for the Role They Are Intended to Fill.
Running the Lotus Client Without Mining
A system with 2-4 CPU cores, 8GiB of RAM, and enough storage for the Filecoin blockchain should be sufficient if you don’t want to mine but still want to run the Lotus client in order to maintain a wallet or communicate with the network (the current testnet chain grows at a rate of about 12GiB per week; improvements to reduce this storage requirement are ongoing).
It’s important to note that Filecoin storage mining currently requires fairly powerful hardware to meet the storage and proof requirements. These requirements are primarily motivated by the design restrictions imposed by the PoRep and PoSt mechanisms, as well as the need to strike a balance between accessibility, computational viability, and cryptographic security.
Filecoin storage mining is not proof-of-work mining – sealing storage is the only way to gain power on the network – but fast and efficient hardware is required to compute the necessary proofs in an acceptable timeframe. Currently, Protocol Labs is working on ways to relax these requirements (for instance, by adding efficiencies to the proof mechanisms themselves or by outsourcing SNARK computation to do away with the need for pricey GPUs). However, prospective storage miners should carefully consider and experiment with the composition of their systems in the interim to make sure that they are able to deliver the necessary performance before making a sizable investment in hardware.
Example Mining Machines and Benchmarks
The Optimal System Composition Will Depend Largely on a Storage Miner’s Operating Model, Include Capital Expenditure and Operating Cost; as Such, Protocol Labs is Unable to Give Any Concrete Recommendations. We Have, However, Published Some of Our Own Designs, Including Outlines for Machines That Are Presently Suitable for Testing and Small-scale Mining.
It is possible to mine on the testnet using alternative configurations, and we anticipate that many of these configurations will be more efficient than our own builds. We anticipate storage miners to customize their configurations to suit their own needs. We support experimentation and kindly request that any interested community members share their own benchmark results on GitHub.
General Hardware Concerns
We can offer some general guidelines, but we are unable to provide specific advice.
CPUs. Generally speaking, multi-core CPUs with high clock rates will hasten the sealing procedure, enabling storage miners to onboard storage to the network more quickly. Modern AMD processors with SHA extensions are significantly superior to other processors, according to Protocol Labs’ testing.
GPU. To finish SNARK computations in the allotted time frames, powerful GPUs are required. Lotus is currently built to support chips made by NVIDIA, but we anticipate adding support for cards made by other manufacturers in the future. The chips that have worked well for us can be gleaned from our benchmarks.
RAM. Only 32 GiB and 64 GiB sectors can currently be sealed on the Filecoin network. It is recommended that mining systems have at least 128 GiB of RAM in order to perform the necessary computations on these larger sectors.
Storage. The specific revenue model adopted by the mining operation is one of many factors to be taken into account when choosing a suitable storage solution, and it may even be the most crucial. In order to mine blocks, storage miners must currently commit 1TiB of raw storage (or its quality-adjusted equivalent; for the mainnet, this will increase to 100TiB), but there are a lot more things to think about besides this constraint.
- The slashing penalties for losing data should be storage miners’ top priority; even one flipped bit could result in severe penalties. Because of this, storage miners might want to account for the cost of implementing data redundancy.
- It may also be prudent for storage miners seeking to participate in the retrieval market to consider incorporating additional storage in preparation for serving “hot” copies of sealed data. Although it is of course possible to open a sector to recover the original data, a Filecoin implementation that supports this use-case would remove this computational burden (this is a feature that Lotus is currently working on).
- The Filecoin network’s requirement for high availability should also be taken into account. While most common HDDs, SSDs, and other suitable non-cold storage options should theoretically allow storage miners to participate, not all storage options can be trusted to operate at their peak levels around-the-clock.
- Shrinking the footprint of the blockchain on-disk is a feature that Lotus is actively working on. Storage miners currently need enough space to store the blockchain itself as well. Additional on-disk space, corresponding to a small portion of the storage that has been pledged, may also be needed for bookkeeping in Filecoin implementations.
- Finally, Protocol Labs has discovered through testing that using NVMe storage as swap space can act as a supplement in systems with less RAM (128 GiB); otherwise, storage miners may encounter issues with running out of memory during some operations (sealing, in particular, requires a large amount of working memory).
Network. High-performance networking is advised (10GbE+ network cards and switches are suggested) if using distributed Lotus seal workers (see Advanced mining considerations, below). When using network-attached storage, high-performance networking is also advised.
Advanced Mining Considerations
The PoRep and PoSt mechanisms are a major source of worry for Filecoin storage mining, as was previously mentioned. PoRep itself is comprised of several stages, and the Lotus implementation of Filecoin facilitates the delegation of these stages to different machines for maximum efficiency using seal workers. For large-scale mining, Protocol Labs has created an example architecture that makes use of these features. Here, we outline the different bottlenecks to take into account when developing systems that are similar.
Sealing preCommit phase 1. PoRep SDR encoding happens in this stage. This stage cannot be parallelized because it is CPU-bound and only supports a single thread. The length of time needed for this stage is anticipated to be in the range of several hours, with the exact time needed largely reliant on the size of the sector that needs to be sealed and, of course, the technical requirements of the machine that will be sealing it. As previously mentioned, Protocol Labs (and others) have discovered that AMD processors with SHA extensions significantly speed up this process. Additionally, performance will be enhanced by the use of CPUs with higher clock rates.
Sealing preCommit phase 2. The Poseidon hashing algorithm is used in this stage to generate Merkle trees. While a CPU can be used as an alternative, it should be expected that it will perform this process much more slowly. This process is primarily GPU-bound. This stage is anticipated to take between 45 and an hour when using a GPU.
Sealing commit phase 1. The preparation needed to produce a proof is carried out during this intermediate phase. The typical completion time is tens of seconds, and it is CPU-bound.
Sealing commit phase 2. The creation of a SNARK, which is used to compress the necessary proof before it is broadcast to the blockchain, is the final step in this sealing phase. It is anticipated that this GPU-intensive procedure will take between 20 and 30 minutes to complete.
Using high-density compute machines for preCommit phase 1, Protocol Labs has found that it is effective to co-locate preCommit phase 2, commit phase 1, and commit phase 2 on the same machine. The large file transfer between preCommit phases 1 and 2 may, however, outweigh the performance improvements in other areas on machines with slower network access or that use hard disks rather than solid state drives. It might be more efficient in this situation to run all phases on the same machine.
PoSt is primarily GPU-reliant, but it can benefit from a CPU with many cores to speed up the process. For instance, WindowPoSt must currently be completed within a 30-minute window; the performance gap between an 8-core and a 24-core CPU could mean the difference between comfortably finishing within the window and barely missing it. A Filecoin epoch (currently 25 seconds) is a much smaller window of time than a WinningPoSt computation, and it has much less time constraints.
Joining Testnet Phase 2
Our testnet is the preliminary stage to the official launch of the Filecoin network – we’re currently in Testnet Phase 2, which is expected to run until the mainnet launch in Q3 2020.
Storage miners can get filecoin from our faucet to use as collateral for storage pledges during the testnet phase.
Please be aware that testnet filecoin has no value; official filecoin will only be made available following the mainnet’s launch.
Accelerating the Filecoin Ecosystem
The number of opportunities for community members to get involved with Filecoin is expanding as the mainnet launch draws near.
Protocol Labs recently announced an incentive program, called SpaceRace, to stress-test the testnet in advance of the mainnet. By onboarding the most storage, participants will have the chance to compete for mainnet filecoin.
A 30-day online hackathon called HackFS aims to lay the groundwork for a decentralized web. Developers will create dapps, games, dev tools, DeFi integrations, and other hacks that make use of decentralized storage. The hackathon staples—workshops, mentorship, motivational talks, AMAs, and prizes—will all be present at the ETHGlobal and Protocol Labs-hosted HackFS.
A recently launched initiative called Filecoin Discover aims to provide Filecoin with some of the most important cultural and scientific data ever collected. One-year quality-adjusted storage contracts will be provided to participants in the Discover program, with Discover serving as the verified client.
Filecoin Dev Grants
By supporting contributors through Filecoin dev grants, we continue to encourage the development of the Filecoin ecosystem. In order to receive priority consideration, Wave 4 grant proposals had to be submitted by July 1st. However, we will still review any additional submissions as long as space permits. October 1st is the deadline for Wave 5 proposals.
Building a successful blockchain from scratch is a huge undertaking because blockchains are intricate software components with many moving parts. We can’t express how appreciative we are to everyone who has assisted Filecoin in reaching this point enough—Filecoin would not be where it is today without the support it has received from community members all over the world! As we approach the final days before the mainnet goes live, I want to thank you once more for your support, involvement, and patience. We hope that this guide can act as a starting point for anyone looking to join us as we take the next steps of this amazing journey. We are very excited to be welcoming new community members into the fold, including miners, developers, and users alike.