This is an experimental proof-of-concept smart contract for a Filecoin oracle on Ethereum.
It was built as part of the Protocol Labs remote hack week held from February 1st, 2020 to February 5th, 2020.
The experimental Filecoin Oracle consists of two parts:
-
smart contracts- Solidity smart contracts for Ethereum -
web oracle- A trusted web service which monitors the state of the Filecoin blockchain
The web oracle continuously monitors the Filecoin blockchain, once an hour processes the state for all deals, and produces a merkle tree root hash of the serialized data. This service is backed by the Filecoin Sentinel.
Users are able to query data CIDs of interest on the web oracle and get a merkle inclusion proof with all the relevant data for the data CID at that point in time:dataCid, pieceCid, dealId, provider, startEpoch, endEpoch, signedEpoch
Once deployed, you can use two of the public methods:
SubmitProof verifies an inclusion proof and emits a StoredCid event for other contracts to consume.
function submitProof(
...
) public {
...
}VerifyProof verifies an inclusion proof, similarly to SubmitProof, and returns a boolean to the caller.
function verifyProof(
...
) public view returns(bool) {
...
}This code is based on and heavily influenced by the following libraries: