-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5979801
commit efedb7e
Showing
65 changed files
with
2,725 additions
and
749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,43 @@ | ||
# Summary | ||
|
||
- [Introduction](./introduction.md) | ||
[Introduction](./introduction.md) | ||
[Background](./background.md) | ||
|
||
# Guides | ||
|
||
- [Architecture](./architecture/index.md) | ||
- [Polka Storage Provider Server](./architecture/polka-storage-provider-server.md) | ||
- [Pallets](./architecture/pallets/index.md) | ||
- [Market](./architecture/pallets/market.md) | ||
- [Storage Provider](./architecture/pallets/storage-provider.md) | ||
- [Proofs](./architecture/pallets/proofs.md) | ||
- [Randomness](./architecture/pallets/randomness.md) | ||
- [Getting Started](./getting-started/index.md) | ||
- [Local Testnet - Polka Storage Parachain](./getting-started/local-testnet.md) | ||
- [CAR server](./getting-started/car-server.md) | ||
- [Real-world use case demo](./getting-started/demo.md) | ||
- [Building](./getting-started/building/index.md) | ||
- [From Source](./getting-started/building/source.md) | ||
- [Using Docker](./getting-started/building/docker.md) | ||
- [Local Testnet - Polka Storage Parachain](./getting-started/local-testnet/index.md) | ||
- [Getting funds](./getting-started/local-testnet/getting-funds.md) | ||
- [Launching the Storage Provider](./getting-started/storage-provider.md) | ||
- [Proving a file](./getting-started/demo-file-prove.md) | ||
- [Storing a file](./getting-started/demo-file-store.md) | ||
|
||
# Tools | ||
|
||
- [Polka Storage Provider CLI](./storage-provider-cli/index.md) | ||
- [`storage`](./storage-provider-cli/storage.md) | ||
- [`wallet`](./storage-provider-cli/wallet.md) | ||
- [`server`](./storage-provider-cli/server.md) | ||
- [`client`](./storage-provider-cli/client/index.md) | ||
- [`wallet`](./storage-provider-cli/client/wallet.md) | ||
- [`proofs`](./storage-provider-cli/client/proofs.md) | ||
- [Storagext CLI](./storagext-cli/index.md) | ||
- [`market`](./storagext-cli/market.md) | ||
- [`storage-provider`](./storagext-cli/storage-provider.md) | ||
- [`proofs`](./storagext-cli/proofs.md) | ||
- [`randomness`](./storagext-cli/randomness.md) | ||
- [`system`](./storagext-cli/system.md) | ||
- [Pallets](./pallets/index.md) | ||
- [Market](./pallets/market.md) | ||
- [Storage Provider](./pallets/storage-provider.md) | ||
- [Glossary](./glossary.md) | ||
- [Mater CLI](./mater-cli/index.md) | ||
- [Zombienet Configuration](./zombienet-config.md) | ||
|
||
--- | ||
|
||
[Glossary](./glossary.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Architecture Overview | ||
|
||
The Polka Storage parachain is, just like other parachains, composed of collators that receive extrinsics calls, | ||
and through them perform state transitions. | ||
|
||
## System Overview | ||
|
||
![](../images/architecture/system_overview.png) | ||
|
||
From left to right, we have validators (represented by a single node as only one validates blocks at a time), | ||
collators and the storage providers. | ||
|
||
The validators are handled by Polkadot itself — i.e. who gets to check the validity proofs is randomly selected by the network. | ||
|
||
The collators execute our parachain runtime and process extrinsic calls from the storage providers — such as proof of storage submissions. | ||
|
||
The storage providers are independent of the collators and are controlled by people like you, who provide storage to the system. | ||
Storage management is left to the storage providers, being responsible to keep their physical system in good shape to serve clients. | ||
We do provide an implementation of the storage provider, you can read more about it in the [Polka Storage Provider Server chapter](./polka-storage-provider-server.md). | ||
|
||
## Pallets Overview | ||
|
||
![](../images/architecture/pallets_overview.png) | ||
|
||
We've been focusing on implementing the core functionality by developing the market, storage provider, proofs and randomness pallets. | ||
|
||
The market pallet handles all things related to deal payments and slashing, | ||
being informed by the storage provider when deals haven't been proven and applying slashing in those cases. | ||
The storage provider handles the registering of storage providers and the proof submission, | ||
the latter is checked inside the collator's WASM runtime, using the proofs pallet. | ||
Finally, the proofs pallet makes use of randomness for challenges, ensuring the storage providers can't cheat the system. | ||
|
||
For a deeper dive on the pallets, you can read the [Pallets chapter](./pallets/index.md). | ||
|
||
## Resources on Parachains | ||
|
||
Reading: | ||
* [Parachains' Protocol Overview](https://wiki.polkadot.network/docs/learn-parachains-protocol) | ||
* [The Path of a Parachain Block](https://polkadot.com/blog/the-path-of-a-parachain-block) | ||
|
||
Videos: | ||
* [Introduction to Polkadot, Parachains, and Substrate](https://www.youtube.com/live/gT-9r1bcVHY?si=dmCJyWB5w2NY1bnu&t=1670) | ||
* [The Path of a Parachain Block - Joe Petrowski](https://www.youtube.com/watch?v=vRsBlVELQEo) | ||
* [The Path of a Parachain Block on Polkadot and Kusama Network](https://www.youtube.com/watch?v=m0vxqWwFfDs) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Polka Storage pallets | ||
|
||
- [`storage-provider`](storage-provider.md) - A pallet that manages storage providers and their associated data. | ||
- [`market`](market.md) - A pallet that handles the storage market operations. | ||
- [`proofs`](proofs.md) - A pallet responsible for verifying [PoRep](../../glossary.md#porep) and [PoSt](../../glossary.md#post). | ||
- [`randomness`](randomness.md) - 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](../../glossary.md#storage-provider) need to register themselves with the [Storage Provider Pallet](./storage-provider.md) — they can do so using the [`register_storage_provider`](./storage-provider.md#register_storage_provider) extrinsic. | ||
|
||
<img src="../../images/storage-provider/register_storage_provider.svg" alt="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](../../glossary.md#storage-user) and the Provider's accounts, | ||
which is done using the Market's [`add_balance`](./market.md#add_balance) extrinsic. | ||
|
||
<img src="../../images/market/add_balance.svg" alt="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`](market.md#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. | ||
|
||
<img src="../../images/market/publish_storage_deals.svg" alt="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](./randomness.md) in order to create a replica and | ||
[pre-commit](./storage-provider.md#pre_commit_sectors) 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](./storage-provider.md#prove_commit_sectors) they stored the sectors by calling [`prove_commit_sectors`](./storage-provider.md#prove_commit_sectors) extrinsics. | ||
|
||
Verification is done via the [Proofs Pallet](./proofs.md) 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. | ||
|
||
<img src="../../images/storage-provider/sector_activation.svg" alt="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`](./storage-provider.md#submit_windowed_post). | ||
|
||
<img src="../../images/storage-provider/submit_windowed_post.svg" alt="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`](./market.md#settle_deal_payments) extrinsic. | ||
|
||
<img src="../../images/market/settle_deal_payments.svg" alt="Settling deal payments"> | ||
|
||
Putting it all together, we get the following: | ||
|
||
<img id="figure-overview" src="../../images/overview_flow.svg" alt="The described flow"> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.