Polka Storage pallets

  • storage-provider - A pallet that manages storage providers and their associated data.
  • market - A pallet that handles the storage market operations.
  • proofs - A pallet responsible for verifying PoRep and PoSt.
  • randomness - A pallet providing randomness source for blocks, mainly used by Proofs.

Overview

The Polka Storage parachain is all about making storage deals. Let us go over how a deal is done!

Before anything else, Storage Providers need to register themselves with the Storage Provider Pallet — they can do so using the register_storage_provider extrinsic.

Storage Provider registration

Now that storage providers can be registered in the storage provider pallet, we need to add some balance to both the Storage User's and the Provider's accounts, which is done using the Market's add_balance extrinsic.

Adding balance to Market accounts

Afterwards, storage users and providers negotiate data storage deals off-chain. Once a deal between the two parties is reached, the client can sign the deal and send it to the storage provider for publishing — the storage provider will then publish the signed deal using the publish_storage_deals extrinsic.

After publishing, the funds allocated for the deal will be moved from free to locked, and they can no longer be withdrawn until the deal has ended.

Publishing storage deals

At this point, the remaining responsibility is shifted to the storage provider, which needs to activate the deal. First, the storage provider needs to call get_randomness from the Randomness Pallet in order to create a replica and pre-commit the deal's sectors. The sealing and pre-committing takes some time, after that the storage provider needs to fetch yet another randomness seed to create a proof. Subsequently, they prove they stored the sectors by calling prove_commit_sectors extrinsics.

Verification is done via the Proofs Pallet and reported to the Market pallet to terminate the deal and apply penalties to the storage provider (remove and burn its collateral — i.e. locked funds) if they fail to activate the deal on time and return the funds to the client.

Deal activation

Suppose the deal has been completed successfully or is Active. In that case, the storage provider is now required to periodically submit proofs that they're still storing the user's data — the storage provider does this by calculating a proof and submitting it using submit_windowed_post.

Proving the data is still stored

Finally, storage providers can then settle deal payments to receive their fair share for keeping the user's data safe — using the settle_deal_payments extrinsic.

Settling deal payments

Putting it all together, we get the following:

The described flow