RaaS (renew, repair, replication) Smart Contracts
Attaching a RaaS worker on-demand to trigger storage deals for files uploaded through the Lighthouse Smart Contract
Last updated
Was this helpful?
Attaching a RaaS worker on-demand to trigger storage deals for files uploaded through the Lighthouse Smart Contract
Last updated
Was this helpful?
In this section B, we will discuss following:
In this method, we will pass a cid to Lighthouse Smart Contract deployed on the following address
Mainnet:
Calibration Testnet:
The source code for this contract can be found
You can directly interact with these deployed verified contracts directly from filfox by clicking on contract links above.
Within the smart contract interface, some important features are critical to the RaaS service. These include:
1
submit
Function that submits a new deal request to the oracle and will creates a new deal. By default, there will be no renewals and replications for this deal
_cid
Event: SubmitAggregatorRequest
2
submitRaaS
Function that submits a new deal request to the oracle and will creates a new deal. Here user can define deal parameters.
_cid,
_replication_target,
_repair_threshold,
_renew_threshold
Event:SubmitAggregatorRequestWithRaaS
3
getAllDeals
Get all deal IDs for a specified cid
_cid
Deal[]
4
getActiveDeals
return all the _cid's active dealIds. Critical for replication deals.
_cid
Deal[]
5
getExpiringDeals
return all the deals' dealIds if they are expiring within epochs
. Critical for renewal and repair jobs.
_cid, epochs
Deal[]
You can interact with the smart contract by submitting a CID of your choice to the submitRaaS
function. This will create a new deal request that the Lighthouse RaaS Worker will pick up and initiate deals.
We have deployed universal RaaS node which can be used by anyone through smart contracts. Thus, there are few things to be kept in mind while working with our RaaS implementation:-
The params for renewal and repair have been decided by lighthouse universally for all the deals, thus giving different params would not modify those params. This is done to handle these jobs together easily for large number of cids.
The cid uploaded for raas service must be pinned to IPFS so as to be retrieved by Lighthouse Deal Engine to execute raas jobs.
Their is maxReplication param in LighthouseDealStatus contract which is currently set to 2 for both Calibrationnet testnet and Filecoin Mainnet. This means that you can only replicate your deal to 2 different miners using Lighthouse Raas service. This would be increased soon.
We look forward to developers developing some cool dapps using our RaaS Contracts 🙂🤩
We see a bright future in enabling programmable, immutable, decentralized data storage for developers.
Lighthouse SDK is designed to be simple and easy to use. We hope that this will enable developers to easily integrate the Filecoin network as the primary data storage layer for their applications.
More importantly, this enables developers to build novel applications. Imagine a dapp or DAO that can be built to incentivize, analyze and store upload metadata on-chain. There are a couple of examples of this:
Rewarding $TOKEN based on the upload of a particular file and their CID.
Being able to track CIDs and deal IDs onchain for verification and airdropping.
For your consideration, here's some pseudocode of how you could build a simple dapp that rewards users for uploading files to the Filecoin network:
You can remove these constraints and even configure new features in RaaS through Self Hosted Raas discussed in
You can build Dapps using Raas Contracts using our ILighthouseDealStatus
provided .
For reference , look at following pseudocode
Building more advanced, robust DataDAOs (check out the starter kit !)