or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Bounty Contract
Short Intro
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →And specifically, the clients want to use a DSN without interacting with it. So, our question is: how can we provide host chain clients with DSN access and storage guarantees directly from/on the host chain?
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →In the following section we expand on the high-level overview above, providing full details.
Protocol Description
Parties:
Storage Dealers: In our protocol, a Storage Dealer is the party that can read the host chain (eg, it has an host chain node) and can store files in a DSN (eg, it has access to the DSN as user or it is one of the node forming the DSN). And, after posting and storage proof on the chain (see next bullet point) can claim the bounty (or part of it).
[Optional] When accepting a deal proposal, a dealer can be asked to put down a collateral as a guarantee for the storage service. This means that this collateral will be taken if the terms specified in the accepted deal are not respected.
Note that the dealer needs to provide evidence in the host chain about its activity on the DSN. To take care of this, we introduce the following entity:
Storage Oracle: The Storage Oracle takes care of providing the evidence that a file is stored on a specific DSN. And this evidence can be used by the dealer to claim the bounty. More precisely,
from the host chainspecifying afile_id
;file_id
be stored on the DSN at timeT
(the exact functioning of this depends on the DSN);on the host chainits signed statement;CallOracle(file_id) --> sig(file_id, T)
Smart Contract and Blockchain: the smart contract contains the logic to create and accept the bounty deal proposal, release bounties and eventually slash dealers.
Note, we assume that a filesharing tool that can make the file available from the client to the storage dealer is used (eg, this can be done via IPFS).
SLA:
The protocol aims to boost the use of decentralized storage networks for storage over time.
A client using our protocol to store a file on a DSN is guaranteed that it will pay for the storage service (to the dealer) if and only if there is the evidence of file be stored throughout the agreed period of time (according to an agreed check in schedule).
Bounty Contract:
Create Deal Proposal
createDealProposal(data_uri, duration, bounty) -> deal_id
The host chain client proposes a bounty deal with the following inputs and conditions:
data_uri
;The list of DSNs that he want to store the file(s) on;[edit: we will have one contract per network]The list of the dealers that can redeem the bounty (if no address is specified we consider this to be open, meaning that the bounty can be obtained by any dealer who has the required proofs);[edit: the list of dealers is specified in the smart contract];The[edit: theoracle addresses
: the list of addresses that can send the storage statement messages;oracle addresses
is specified in the smart contract];duration
: period of time for which the files has to be stored, from when storage begins (ie, the first oracle statement is posted). Note that there may be a maximum for this value specified by the smart contract;proving schedule
: it specifies which is the frequency at which the oracle statement has to be posted (eg, every day or only once at the end of duration). We refer to this events asstorage check-in
(s);proving schedule
for the smart contract and the client does not have to specify this.payment
: "bounty", total amount (in native tokens) paid by the client to the dealer (if the deal is not invalidated by lacking of an oracle statement); at the moment of the request creation, thepayment
is "locked down" (ie, taken from the client's account and deposited to the smart contract);bounty release function
: it describes the dynamics of the bounty release. For example:collateral
: amount (in native tokens) required to be locked down from the dealer.proving schedule
, we may assume that there is a globalrealease function
used in the smart contract and clients do not have to care about specifying this.Cancel Deal Proposal
A client can cancel a proposal (not accepted yet) at any time, and this action will release the
payment
.Moreover, proposals have a timeout after which they are not valid anymore (ie, can not be accepted).
Accept Deal Proposal
acceptDealProposal(uint256 deal_id, string data_uri)
A dealer can accept the terms specified in a proposal if all the following is true:
(or the proposal was open);collateral
(if collateral is needed). In this case, thecollateral
is "locked down" (ie, from the Storage Dealer's account deposited to the smart contract).After a dealer has accepted, we say there is an active Bounty Deal between the dealer who accepted and the client who crated the deal proposal.
Also, we timestamp this on-chain, and we consider the deal active from this moment onward (
timestamp_start
).Claim Bounty
claimBounty(deal_id, data_uri, signature)
This function can be called by a dealer according to the
bounty release schedule
.At each call, the function does the following
signature
release function
), this is deposited to the dealer's account from the smart contract vault.Open question: can we handle the "no proof" case in a more flexible way?
List of events in the smart contract:
DealProposalCreated(uint256 index, StorageNetworks[], DealersAddress[] OracleAddress[], Duration, BountyAmount, ProvingSchedule, ReleaseFunction, CollateralAddress)
: Event emitted when new deal proposal is created by the client;DealAccepted(uint256 index)
: Event emitted when a bounty deal is created by a dealer accepting the terms of a proposal (definestimestamp_start
);DealProposalCanceled(uint256 index)
: Event emitted when a proposal is canceled by the client before being accepted;DealInvalidated(uint256 index)
: Event emitted when a bounty deal is invalidated (ie no expected valid oracle proof, according to the proving frequency);BountyRedeemed(uint256 index)
: Event emitted when a bounty (or part of it) is redeemed by the dealer.