Skip to content

Commit

Permalink
Update client contract tutorial
Browse files Browse the repository at this point in the history
- Provided placeholder to link to incoming Programmatic Storage doc
- Added Boost logs tooling into tutorial
  • Loading branch information
trruckerfling authored Aug 30, 2023
1 parent af96fd4 commit 06152bc
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,9 @@ In this tutorial, we will cover the background of creating storage deals via sma

You can find a video form of this walkthrough on [ETHGlobal’s YouTube Channel](https://www.youtube.com/watch?v=27EV3gQGY9k).

## Workflows
## Dealmaking workflows

Before we get started, let's quickly cover the two workflows for creating storage deals.

### Regular deal creation workflow

Filecoin is a blockchain tailor-made for processing storage deals. Before the Filecoin virtual machine was implemented into the network, storage deals could only be created using the following workflow:

![Offline deal-making workflow](deal-workflow.png)

This process requires a lot of different actions to be taken by both the client and the storage provider. But with the advent of the Filecoin Virtual Machine, smart contracts can be deployed on top of the Filecoin blockchain. This allows developers to access and now create Filecoin Storage Deals within smart contracts! And thus, now developers can also create new storage deals on the Filecoin blockchain. This reduces the number of actions clients, and storage providers have to take to generate storage deals.

### Smart contract deal creation workflow

To create storage deals, smart contracts need a specific Solidity event called `DealProposalCreate`. Storage Providers running [Boost software](https://boost.filecoin.io/) can then listen for this event and, if the deal is acceptable to them, pick up the deal automatically. The workflow can be seen below.

![Smart contract deal creation workflow](new-deal-workflow.png)
Before we get started, we recommend reading about programmatic storage with Filecoin here. There are two methods to programmtic storage, which are direct dealmaking and aggregated dealmaking. We will cover direct dealmaking with the client contract tutorial.

## Steps

Expand Down Expand Up @@ -139,6 +125,10 @@ Parameters such as the `collateral` and `price-per-epoch` are set to `0`. On mai
Now if you’ve invoked the task with all the correct parameters, the method will execute on-chain and emit an event that Boost storage providers will be listening to. If the deal is well-formed and the parameters are acceptable, they will download the .car file, double-check to ensure the `piece-cid` and `piece-size` match the deal and publish your storage deal! This could take up to a day. Once the deal is published, you can find it on a [Calibration testnet block explorer]({{< relref "/networks/calibration/explorers" >}}). The client in the deal should be the `t4` address of the smart contract we called `MakeStorageDeal` on.
### Monitoring deal proposal acceptance
After emitting an event and while waiting for Storage Providers to accept your deal, you can monitor its status on a provided Boost logs dashboard (for calibration testnet only). You can see a guide [here](https://github.com/filecoin-project/community/discussions/659) on how to diagnose why deals might not be being accepted and adjust your proposal for re-submission.
### Conclusion
During this tutorial, we have shown the significance of making deals using smart contracts and then walked through making a storage deal using the FVM deal-making kit and web3.storage. Developers can make use of this workflow to integrate decentralized storage on Filecoin with their smart contracts and decentralized applications.

0 comments on commit 06152bc

Please sign in to comment.