Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can storage proofs be implemented using bitvm? #1

Open
starius opened this issue Oct 10, 2023 · 3 comments
Open

Can storage proofs be implemented using bitvm? #1

starius opened this issue Oct 10, 2023 · 3 comments

Comments

@starius
Copy link

starius commented Oct 10, 2023

Storage proofs are used in some altcoins, e.g. Sia

The idea is that one participant (renter) uploads data to another participant's server (host). The renter and host lock some funds in a contract. After predefined period of time, if the host publishes a storage proof on Sia blockchain, the funds go to the host. Otherwise the hosts looses his funds (the collateral) as a punishment of failing to provide storage proof.

Storage proof is a merkle proof of random 64 byte segment of the stored data, which is chosen based on block hash at a certain block height, predefined in the contract.

Can a similar contract be implemented using bitvm? I don't know other ways to implement storage proofs in Bitcoin blockchain.

@supertestnet
Copy link
Owner

supertestnet commented Oct 11, 2023

It certainly sounds possible. The merkle tree of stored bits would be known in advance by both host and client, and the host could send their proof to the client (I don't see why posting it to the blockchain would be necessary). If the proof is wrong the client can slash the host.

@starius
Copy link
Author

starius commented Oct 13, 2023

It is necessary to post the proof on blockchain at least in non-cooperative scenario to enforce the penalty for the host for not storing the data. Absence of a proof is interpreted as host losing data. Penalty can not be done client side, because how one can prove absence of something?

So, let me define it in more formal way. A (renter) and B (host) agree on storing some amount of data provided by A for certain period of time, defined in blocks. A allocates funds to cover payment for storage and B allocates a collateral. There is a certain agreed upon ratio between payment and collateral, say 1:1. All that money is locked in a smart contract. As time passes, A uploads data to the contract. Each successful upload results in updated balances in the contract and updated Merkle root. There are 2 outcomes in the contract, each having two outputs: to A and to B:

  • Successful outcome sends change back to A and earned money + collateral to B.
  • Penalty outcome sends the change of collateral (the unspent part) to B and the remaining of money to A.

Both outcomes are updated upon uploading, moving some money from one output to another.

After the storage contract expires, B has certain time [block height] window to publish a storage proof. Publishing storage proof unlocks the successful outcome of the contract. Non publishing results in penalty outcome.

That is more or less how this is done in Sia. (They also burn the collateral in penalty case, but I think it should be sent to A as compensation for lost data.)

In Bitcoin it could work more or less the same, with the same incentives structure, but the cooperative case might happen without publishing a Merkle proof, similar to cooperative channel closure in Lightning Network.

@supertestnet
Copy link
Owner

Good point about proving the absence of something. I suppose the proof needs to be posted somewhere public, but I'd prefer to use a spacechain for that instead of clogging up bitcoin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@starius @supertestnet and others