Perpetual Storage (draft)

Short Intro

A tool to store a file perpetually on Filecoin.

Please see here for the intro to this protocol:
https://pl-strflt.notion.site/Perpetual-Storage-on-Filecoin-7803c92462f54e50a985369a41449495

Protocol Description (EVM version)

In the following, we assume that the Bounty Contract is live on Ethereum.

The Perpetual Storage Contract is a smart contract on the Ethereum blockchain with the following data and functions:

Data:

  • Filecoin storage deal data
    • Price: at what price each deal is made,
    • RP: replication parameter, how many deal are active at the same time;
    • Duration: for how long each deal is active;
  • Governance info:
    • ActivactionList: list of addresses that can call ActivateDeal;
    • DepositList: list of addresses that can call DepositTo.

Functions:

  • DepositTo(amount): This function adds tokens to the internal balance of the perpetual storage contract:

    • Check if the caller is authorized (ie, it is in the DepositList), if yes amount is moved from the caller's account to the contract (add to contract_balance).
  • ActivatePerpetualStorage(file_id): This function is used to activate the contract (???). Repeat the following RP times:

    1. Create a storage deal: Invoke CreateBounty(file_id, Filecoin, dealers, oracle_addresses, duration, price) -> bounty_id; and then start listening to the logs,
      • If BountyAccepted(bount_id) event, then get the bounty_id_start_epoch and go to step 2,
      • If the bounty notice goes in timeout, go back to step 1;
    2. Ongoing check of a deal: At each epoch after activation, do the following
      • If current_epoch = bounty_id_start_epoch, call Renewal(bounty_id)-->new_bounty_id;
      • If dealTerminated(bounty_id) event is on chain, call Renewal(bounty_id)-->new_bounty_id;
  • Renewal:

    • This is an internal function;
    • Check internal balance, if there is enough tokens then invokes BountyContract.CreateBounty;

Protocol Description (FVM version)

TBD

Select a repo