As a Dat publisher: call register_data to register the current state of your archive on-chain.
As a seeder: call register_seeder to register your intention to seed a dat. watch for the NewPin event, which will tell you which dat archive you should be pinning. You can also query UsersStorage(AccountId) to see all dats you should be pinning simultaneously.
Every Block after there are registered seeders with Pinned dats, a Challenge event will be emitted by the chain.
State:
Seeder and Dat registered successfully
As a Dat publisher: no action required. As a seeder: watch for Challenge events to your AccountId
Challenges are (AccountId, BlockNumber) tuples - where AccountId is the selected seeder, and Blocknumber is the deadline. (All active challenges are enumerated in the ChallengeMap linked_map storage item - (x, y) where x refers to the index of a challenge in the SelectedChallenges map, and y refers to the challenged seeder in the SelectedUsers map.) for reference, SelectedUserIndex is a mapping from AccountId -> (index, challenge count)
If you have an active challenge as a seeder, you clear it by calling submitProof with the proof for the requested chunk (chunk index retrievable via the SelectedChallenges map).
If a challenge has not been successfully cleared by the end of the deadline block, it should emit a ChallengeFailed event and punish the failed seeder.
(Current Runtime as of 24/12/19) Source code: https://github.com/playproject-io/datdot-substrate/blob/master/bin/node/runtime/src/dat_verify.rs
State:
No Seeders, No registered Dats
As a Dat publisher: call
register_data
to register the current state of your archive on-chain. As a seeder: callregister_seeder
to register your intention to seed a dat. watch for theNewPin event
, which will tell you which dat archive you should be pinning. You can also queryUsersStorage(AccountId)
to see all dats you should be pinning simultaneously. Every Block after there are registered seeders with Pinned dats, a Challenge event will be emitted by the chain.State:
Seeder and Dat registered successfully
As a Dat publisher: no action required. As a seeder: watch for Challenge events to your
AccountId
AccountId
is the selected seeder, andBlocknumber
is the deadline. (All active challenges are enumerated in theChallengeMap
linked_map storage item - (x, y) where x refers to the index of a challenge in theSelectedChallenges
map, and y refers to the challenged seeder in theSelectedUsers
map.) for reference,SelectedUserIndex
is a mapping fromAccountId
-> (index, challenge count) If you have an active challenge as a seeder, you clear it by callingsubmitProof
with the proof for the requested chunk (chunk index retrievable via theSelectedChallenges
map). If a challenge has not been successfully cleared by the end of the deadline block, it should emit aChallengeFailed
event and punish the failed seeder.