đˇââī¸RaaS (renew, repair, replication) Smart Contracts
Attaching a RaaS worker on-demand to trigger storage deals for files uploaded through the Lighthouse Smart Contract
In this section B, we will discuss following:
1) Upload via Lighthouse Smart Contract
In this method, we will pass a cid to Lighthouse Smart Contract deployed on the following address
Calibration Testnet:
0x4015c3E5453d38Df71539C0F7440603C69784d7a
The source code for this contract can be found here
You can directly interact with these deployed verified contracts directly from filfox by clicking on contract links above.
Smart Contract Interface
Within the smart contract interface, some important features are critical to the RaaS service. These include:
# | Function Name | Purpose | Key Parameters | Outcome |
---|---|---|---|---|
1 |
| 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 |
|
|
2 |
| Function that submits a new deal request to the oracle and will creates a new deal. Here user can define deal parameters. |
|
|
3 |
| Get all deal IDs for a specified cid |
|
|
4 |
| return all the _cid's active dealIds. Critical for replication deals. |
|
|
5 |
| return all the deals' dealIds if they are expiring within |
|
|
Calling SubmitRaaS Functions
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.
Lighthouse Raas Specs
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.
You can remove these constraints and even configure new features in RaaS through Self Hosted Raas discussed in Appendix E
2) Building Dapps with RaaS contracts
You can build Dapps using Raas Contracts using our ILighthouseDealStatus
provided here.
For reference , look at following pseudocode
We look forward to developers developing some cool dapps using our RaaS Contracts đđ¤Š
3) Why does all this matter?
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.
Building more advanced, robust DataDAOs (check out the starter kit here!)
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:
Last updated