Filecoin Storage for Building Resilient Applications
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join Sarah Thiam from Filecoin, for a workshop titled, “Filecoin Storage for Building Resilient Applications.” In the rapidly evolving blockchain technology, resilient and scalable storage solutions are crucial for the success of DApps, AI-driven platforms, and innovative data management systems. This workshop delves into the practical aspects of using Filecoin for decentralized storage, focusing on overcoming common challenges and building robust, future-proof projects. This workshop took place during ETHGlobal Brussels, a 3-day hackathon held in Brussels, Belgium from July 12 to 14, 2024. ETHGlobal Brussels brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ---------------- Follow us: x.com/ethglobal Website: https://ethglobal.com Email us at: hello@ethglobal.com
Transcript
[Music] all right cool um so we're going to run through fcoin storage for building resilient applications um as I mentioned my name is Sarah if you want more updates on DX resources from filecoin we recently posted some template contracts to do cross chain payments and there are more things you can find in the documentation which is docs. FAL coin.io or you can follow us on Twitter for at Phil builders for more Technical Resources to come or oh this um there is no story to it just to clarify trucker fling means nothing um if anyone ask okay all right cool um so fcoin tldr it is a crypto powered storage Network we have one of the largest decentralized storage networks around um with a huge storage capacity and what we are focused on is getting more data onto that already committed storage capacity from our storage providers and also to enable now with the fbm launched new defi applications around the fal coin Network because collateral is very different in the filecoin network it is based off hardware and it's really high tool so there are a lot of opportunities for the defi based on filecoin so yeah how have we been doing since we launched we launched the fcoin virtual machine back in March 2023 um I was part of the team that was launching it and so we've been working very very closely with Builders uh you probably see me and my team at different hackathons now um we've had um about 4,000 unique contracts deployed to date um and that's still growing very steadily over time yeah if anyone's curious this is built by starboard so if you just search starboard fcoin virtual machine you can check out the stats for our contract deployments so high level what is the ex uh what is the fcoin master plan um it started about 7 to eight years ago we started with ipfs which is why everyone knows and loves it well um that to clarify because we have had this question very often at the booth I also took a really long time like to kind of understand the difference and I don't want to assume um ipfs is not on the blockchain it is P2P Network and so if you store data on ipfs you effectively pinning a copy of your data um on a note that is unless you pay like an infura or a pinata um it is not actually going to store your data the note might actually go down so if your peer peer Network goes down your data disappears so that those are the like trade-offs with ipfs but it is very fast and it's also it's fast to pin and it's fast to retrieve so now we go outside of uh ipfs we go on to filecoin so you have the filecoin layer zero um filecoin itself is a protocol that represents all the different storage deals that are made on filecoin so it doesn't your data is not actually stored on chain um it is stored of course with storage providers that are represented on chain and they get slashed if they do not guarantee your data to be available when you want to retrieve it so that is how the file coin network works um on top of that we've launched the fal coin virtual machine uh last year which is to enable programmability so before this you could not do any kind of depth development on fcoin um but today you can um the fcoin virtual machine is also fully evm compatible um there are some op codes and if you have questions you can come by the booth that we are as every EIP launches we are keeping up with all the different upgrades um so we're we're not like straight straight off the B like on par with evm compatibility but we're mostly evm compatible um you can use Foundry you can use hardhead that um we have starter kits for those as well so you should be able to build your Deb um and then very recently back in about November last year we launched the interplanetary consensus um I won't run through that today but it is a resource that you can use and you will qualify for the Bounty if you want to use it um just a just an FYI IPC is a framework kind of similar to Cosmos um but built for FAL coin where you can um build your own chain or Layer Two on top of f coin today using the fbm under the hood and what that allows you to do is to build custom CIS calls to do with storage yeah and buildin actors on file coin so you could build a very storage focused um ler to so yeah that's kind of starage evolution of fcoin um and so I'm going to get into the mechanics of how you do data storage um some of you might noce but most most people do require like a little bit of a refresher on this and then we'll get into the tools that you can use and then all this will make sense so data storage 101 on how it works on fcoin you start with a file and you have your own file what happens then for your file to get stored onto the network um you have to prepare that data and turn it into a car file which is a Content archive file so content archive files are a special way of packaging your data such that it can be represented across ipld notes IPL is kind of like a complimentary feature to ipfs um but it allows you to content address um the different parts of your your file that you're trying to store so it's important to prepare your data into a car file if not it can't really get sted on the network um once it's packaged into a car file it gets represented by a Content ID and so cids are very important if you you used ipfs you would have seen this around um when it gets start on file coin it is also represented by a Content ID so these are really important once you have your content ID your storage provider will then take that Content ID uh find the doc car file that is related to it download your do car file through some kind of buffer maybe it's across HTTP maybe you put it into a Dropbox maybe you mail it across totally up to you they'll download that file and they'll put it into a storage deal that then gets represented on the blockchain so tldr this is very high level on how FAL coin works as a protocol okay so um we're targeting some key use cases here um I can go on and on and you know Juan and the entire FAL coin ecosystem has like so much information like people are brilliant um but we're going to Target some really key use cases that you will use within a 48 hour hackathon which is namely to store small data um small data either directly to file coin from a de built on file coin or storing small data from uh Deb that you have on different chain and how you can access that um the other one we'll run through is how to SP uh store larger pieces of data and then I'll show you some easy cookbooks that you can use for your hackathon so if you're storing smaller pieces of data and this refers to things that are smaller than one gig like really really small images um we have what we call Storage on Rams which are like lighthouse. storage and web. storage and what they've done is to provide an SDK that you can use um available in typescript or JavaScript and you can use it across um cross chain from any depth that you have deployed onto if you're deploying a polygon you can just call this and then store the results that you have onto um Lighthouse and web.
storage so what happens there on the back end and you can scan this QR code it will bring you to those sites and you can use the sdks um what will happen in this case is that you upload your files pathway so you know in your desktop what is the pathway to your file how do you download it um the storage on RAM will then package the data for you they'll prepare it into a DOT car file which I mentioned earlier on and they'll give you a CID because they're printing it to ipfs but know that that CID only represents the copy of your data that is on ipfs so that you can do quick retrievals so if you have a debt that you know every transaction need to store retrieve store retrieve ipfs is really important here um but to have long-term guarantee of your data it will also store a copy and a backup onto filecoin um the process that I showed you earlier on from a CID to a storage deal can take anywhere between 24 to 48 hours because ceiling is a computation heavy process and it also requires a storage provider to receive enough data to want to package it into 32 gigabytes of data which is this the typical sector size it's a whole process we won't get into it but that's why your deal takes 24 to 48 hours um so these are a really good stop gap for you to use as a solution so you can serve the needs of your Deb but also get that data gued on backup for a long term okay and if you want to manage small data so the cool thing about filecoin and I think this is a little bit different from what you can do with other platforms out there is you can actually um programma tize how you want to store your data so when for and Lighthouse is a really good example of this this is a different QR code that goes through that one page where they have offered a new feature that we built with them called uh r r stands for replication renewal and repair of your data so when you upload your small piece of data you can specify how many copies you want to have how many um how often or any conditions you want for replication um or repair and renewal uh renewal of your data deal so for example the duration is only for five months uh maybe based on a certain condition um it will then renew that deal after a certain period or if the deal if the sector breaks um it will identify that issue and then fix it for you so you can specify all these different parameters within the lighthouse SDK and still within the SDK so that's really amazing and easy to use and once again pin ipfs start the file coin you can then retrieve that data so that is an additional function um I don't know what use case you want to use it for it could be a legal use case it could be gdpr um that's a really good one for you to check out okay and then we come to storing larger data so if you have large data sets um that you want to get stored um and you don't have that time constraint of having to store it super quickly you can considered um storing it directly within a filecoin smart contract on fbm um to the filecoin network so I'm going to assume here if you are storing larger dealing with larger data um you might want to build your debt within fcoin if you're doing so you can use the client contract there is a documentation here that you can use um you will deploy the contract yourself and you'll prepare your data and put it into the client contract and what the contract does is to send a deal proposal to the fcoin network and we already have storage providers on test net um that have that are subscribed to this contract to look out for events from this this type of contract and once they see those events they will pick up the deal and St it for you this should typically happen within 12 to 24 hours that is the agreement we have with them um and so you can use this method if you're storing larger pieces of data yeah and you should get a deal ID back at the end of the day so if you don't have a deal ID it means your data isn't actually stored on fcoin yeah okay so that that is another method for you to use okay and then it comes to retrieving that data so for those of you who raised your hand earlier on and you sted the file coin but you found it hard to retrieve your data um this is where this comes into play so um you can use Lassie which is a very easy CLI that you can use to retrieve your data if you have your deal ID um it should also come together with a root CID which represents your data store on FAL coin you can just easily call that um bfy um root CID and then retrieve your data using Lassie so that's how you're going to get your data back um and if you want to retrieve ex if you want to use existing data sets that we have already sted on filecoin for you we've uploaded some of the popular amness data sets onto data sets. FAL coin.io and so you can just use that off the cuff and start building an application from there for the hackathon yeah okay so building depths on F coin why do it um as I mentioned earlier on if you want to we you know multi-chain is the future if you have your Deb deployed on another another chain SDK great way to go if you want to build it natively within fcoin um here are some key advantages um it's great for data Centric use cases there's a lot of manipulation you can do with the filecoin Dos solidity library that I'll share the resource with you in the next few slides um to then call on file coins built-in actors so we have actors like the market actor for example that deals with how deals are being made how um storage providers are being incentivized and so you can actually call those using solidity methods and build your debt from there so if you have a data Centric app great to build it there um it's also evm compatible and if you have unique def use cases um if you want to check out filecoin and understand the collateral Network and what kind of new data defi use cases you can build um file coins interesting we have like liquid staking pools for example so minor um storage providers which are kind of like our miners have a huge amount of collateral to stake um that leads to use cases of like lending pools where they would like to get collateral length to them and then we have like fill token holders for example that can then put their fill into a lending pool or staking pool and then that gets lent out to Miners And whatever they get from block rewards which are pretty substantial can then go back into the pool so these are some defi use cases you can think of that you won't really see in other ecosystems um but we'll love to see some interesting ideas from all of you um and then lastly cheap transactions um uh fcoin in general if you're using the fbm it's not super widely used right now we only launched last year transactions are really cheap so if you're running a application it's going to be much cheaper um it might be a little slower for now um because we we are launching some protocol changes in by September that will allow much faster block time but for now the block time is about 30 to 90 seconds so it might be a little bit slower but the trade-off is that it's a lot cheaper to run um we used to have a Fill gas estimator but the tool is down for this hackathon so I can't show you um but yeah it's definitely much cheaper to run so if you want to build a de on FAL coin here are some tools that you can use um Falin dool is the solidity Library I mentioned mentioned earlier on we just recently did a round of audits and also made some updates to it um so it should be working really really well right now um so you can check that out um if you want to see how to use it some examples we have it on the doc. file coin.io as well whoa all right totally awake now um cool you know I can just send this slides to you right like okay I'm kidding um and then um if you want some depth codebooks um I'm going to run through this site really quickly um but we have these cookbooks ready for you to use um if you want a query chain data um we have tools that apis available for you um we have some oracles integrated as well we have about I think we have pith and Tor um we maybe have a few more coming in the next few months um but we're building up our Integrations at this point in time um but you can access price feeds there we have cross chain Bridges with exler we if you follow the field Builders Twitter we actually just launched some template contracts that you can use for this hackathon um so that makes it super easy to do some um payments within your deps and then lastly we have um if you're looking to do SQL queries um a decentralized database running on filecoin you don't have to build it from scratch table land is a really good partner for us and they have already built that tooling for you so you can easily set up a decentralized database with SQL queries on filecoin today yeah so um I talked a bunch but I'm going to show you real quick uh I don't know if you guys can see this just oops um yes so if you want to check out the cookbooks um these are all over here for you to use um we also have oh I don't think that's on testet um I wanted to show you because we are block Scout is integrating with us and I know block Scout is one of the bounties here in the hackathon as well um they have soft launched on filecoin um but it's only for mainnet so it's not for test net so if you want to pay fill to use mnet and use their API like good for you um but yeah so yeah all in all that's mostly it and I think I have some time for questions so anyone has a question they want to ask yes uh G access yes um let me just show you real quick what do you mean in terms of micro payments oh okay right um let me show you geta access first so so Lighthouse has a really easy SDK for you to use um once again where is it yeah if it will load yeah so they have a SDK you can use um how this works is through um decentralized key sharing um and that will allow you to encrypt your data before it gets pinned on the ipfs so you can use this there uh micro payments wise you can use x for crossing payments today they do swaps um that's probably the easiest oh we also have CA if you want to use it as well so those are the two options for payments yeah uh question I saw another hand it's not yes yeah um so this allows you to encrypt your files um before it start to the network if a lot of the data we have on fcoin doesn't go through this method right it's only if users choose to privacy on fcoin um the data is openly available so your storage providers could technically look at your data um but yeah yeah they could look at your data so it is a good idea to think about encryption um Also regarding one of our bounties around privacy preserving tools um I would be interested to see maybe someone using like protocol for example to integrate with FAL coin through the fbm to see how you can provide Access Control to data we don't have that we used to have the integration running but the contract hasn't been updated um but we would love to see some new usage of third party Integrations with FAL coin data yeah that would be really cool it takes about uh so on Main net it takes about 24 to 48 hours on test net it takes about 12 to 24 hours yeah but typically within 12 hours you should get your deal um that is the commitment we have with the storage provider that's servicing our test net um so everything should be available within the yeah if so I I would give you the link directly but then you get lost but if you go to doal coin.
io there will be a high starter kit that you can access yeah yes uh FAL and AI we have some projects like fluence and Lily Pad that are providing like decentralized compute of a FAL coin data um fluence itself I think is super new I'm not sure if you can actually develop on it just yet might be wrong but you should check it out oh the but can developers use it okay okay maybe yeah so so um if you use fluence fluence actually backs it up to FAL coin you could use them for decentralized compute uh liad Lily Pad is another project to check out um these are available within the cookbooks under decentralized compute we have the links for them uh Lily Pad is a set of smart contracts that allows you to coordinate decentralized compute onto another Network called bakay yaa um but the smart contracts are there for you to use the last time I tried it like two weeks ago smart contracts were not updated it yet and they were like broken but you should check yeah if not we have the team on Discord to like fix it and we're asking them to fix it right now that's why I didn't show it in this um tutorial yeah um that's a really good question um I think data set marketplaces to support AI models will be very interesting um another interesting one is if anyone can figure out traceability of generating a computation result so traceability of data being used to run a model that would be really interesting to see U maybe some kind of attestation that you can see like a crowd source of data being uploaded and the model running on top of it um and what kind of result that puts out um that would be really cool to see yeah um generally too if anyone thinks about how to backup llm snapshots to fcoin in a in a really user friendly way that would be a useful that would be a useful one too I know like quite a few clients asking for that yeah I mean just some ideas to put out there but I think these will get the team really excited um okay I think I'm at time so I will thought but I am okay cool I will be at the booth and yes those two of you come I'll give you SW thank you so much for your help thank you [Music]
Automatic transcript — names and jargon may be misspelled.