IPFS & Filecoin 🛠️ Intro to FVM & Filecoin Storage Deal Demo - Amean Asad
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Amean Asad from IPFS & Filecoin for a workshop titled "Intro to FVM & Filecoin Storage Deal Demo". Thank you to everyone who joined us for ETHGlobal Lisbon! After being away from Europe for almost a year, we've decided to bring the heat and excitement back to the stunning historic streets of Lisbon! All over the world, hundreds of thousands of developers, users, hobbyists, creators, artists, and market makers spend their days and nights thinking, building, talking about Ethereum because we are... excited. We're excited by the idea that Ethereum can change things. This May, we invited you to come learn what all the talk is about. We were joined by the leading teams in the ecosystem such as Polygon, Metamask, Aave, 1inch and Gnosis Chain who have a number of prizes up for grabs! This event is focused on building a new product/protocol, learning at the summits through talks and workshops, and giving opportunities to gain valuable feedback from ecosystem champions at the beautiful Convento do Beato. Find your future team at our Hacker Café and create even more meaningful connections while engaging with some of the most notable speakers in the industry at Pragma Lisbon. At ETHGlobal Lisbon you'll have the support of a huge community of experts, mentors, sponsors, developer advocates, and other community members who want to help you build something awesome. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Music] my name is Amin I'm a software engineer part of protocol Labs I work on a project called falcoin shutter and recently we've been using the newly launched fevm and I'm here to present uh a quick intro to falcoin and fevm and give a quick demo of some of the cool things we've been building with it so here's a quick agenda of the kind of Workshop presentation today I'm going to start with a recap or intro on on filecoin and then going to give an introduction to the sem and what it's about I'm going to give an example use case of how we use it at uh at five coin Saturn and explain what Falcon Saturn is and then give a short demo okay so before we dive into the intricacies of uh of fvdm Let's uh have a quick recap on what falcoin is and uh the the de facto term that we say is falcoin is a decentralized storage system that is meant to onboard Humanities most important data and you can think of falcoin as an AWS without a central entity or company that owns anything um then how does this work essentially it's a peer-to-peer Network that stores files and as a built-in economic incentive system um to incentivize nodes on the network to behave well and the consensus system is essentially proving that you store things reliably for an uh a given period of time and there are some really marvelous cryptography that goes on to make sure that all of this is provable and reliable um and basically in falcoin users pay to store their files on what we call Storage providers and storage providers are essentially the the nodes or computers responsible for storing these files and proving that they're keeping these files on the network so um essentially anyone who wants to store their files or get paid for storing other people's files can join the Falcon Network so let's implement this with an example let's say you have a lovely cat named Dolores and you love the Lords so much you think that Dolores should remain with the world forever and you want to upload dolores's picture to the Falcon Network to store it forever now you choose a nice compression type PNG is nice because PNG is lossless and you know I want to keep every feature of the Loris there for people to see and what you can do is essentially come to the Falcon Network and kindly ask to store dolores's picture on there and what will happen is that um you'll be contacted by like a storage provider you can make a deal with that storage provider there will be a fee for storing it and you can determine how long you want to store that the the doloresis picture for and you pay the fee and essentially it's on there and from there you can get reliable provable uh methods they prove to you that dolores's picture will be replicated and you can retrieve it whenever you want as long as your deal is valid and it's as simple as that and hopefully this gives you a better idea what filecoin is in the network and then how it works um this is kind of a more detailed slide or what happens is part of a storage deal so if you're a client um you attempt to make like a Time limited deal on the Falcon Network um you will make a deal with a storage provider initially the storage provider will give you an initial proof of a replication and that essentially proves that your data has been replicated on the file core Network it's it's available and then over time these providers will essentially give you what's called a proof of space-time essentially just proving that they have stored your file and they're storing your file as time moves on and this is all done by some of the marvelous cryptography that's part of the the falcoin network and towards one when the the deal is going to expire you can choose to renew it or if the deal expires you can just let it expire and um Dolores this picture will disappear so I want to motivate how naturally to come across something like the the fvm like why do we need it how does it help Falcon so Falcon is great we can store things we can retrieve them we can make sure that this storage is reliable but let's think of some use cases now let's say that um you you're a user that wants actual user experience you want to store doloresis picture but you don't want to keep renewing that deal wouldn't it be ideal is you can automate the renewal of your storage deals that way that whenever a deal expires you can have it just like a subscription like a paid subscription and just as long as I have funds let me keep renewing my storage deal um another example is that you can think of a developer let's say a developer you're trying to build an application on top of falcoin that's a photo album application um you know a natural feature is part of a photo album application would be to add permissions who can access a certain album who can edit images on the album who can upload images to an album so if you have a storage Network like falcoin and you want to build something on top of that how is that possible with such feature um another example is let's say you're a researcher um you wanna you're a researcher in machine learning you want to build a nice model that detects meerkats in your backyard and you have a nice data set for that that's stored on falcoin and now you want to train that data set so you want to Outsource that computation and pay for whoever does that competition for you how can you do that um so these examples so with these examples what I described the Falcon Network would be really difficult to implement and the common theme between these examples is that they need what they call programmability over storage and that is exactly what the fevm gives us it enables us to add a programmability layer on top of the things that we store so it enables us to develop applications that have features like this then this makes total sense if you think of major Cloud providers like AWS they have Storage storage solutions like RDS S3 and all that but they also have solutions that complement and supplement these Storage Solutions like um like Lambda compute cloudfront which is a CDN Etc um companies have realized that there's a lot of value to allowing people to add programmability to their storage and the same applies for the filecoin network and that's why the fvm exists and a good question you might have is not why not use the evm then the the ethereum virtual machine and the reason is that the evm doesn't have access to Falcon storage deals Falcon storage deals and that that that aspect of storage is unique and native to the file core Network so that's why you need the fvm and you cannot just not use the the evm um so yeah evm is the answer evm brings programmability to Falcon decentralized storage and this is a nice diagram to kind of display like how it's layered you can think of the l0 as the Falcon Network that's all your storage um that that's your data and then on top of that there's the fvm which brings compute to um to the state of the data and that enable us to build other L2 Solutions on top of um the falcoin network which do computation over data and that happens off chain all right so now hopefully it's clear what problem the fem is solving and how it naturally comes in into the Falcon ecosystem um so let's explore more about what the fvm is so what is the function of a blockchain VM essentially it should act as a runtime to execute smart contracts and it should allow various smart contracts to interact with each other and additionally an ideal feature of a VM is that it allows you to reuse smart contracts that you've written for other blockchains um on on that existing VM without having without you having to rewrite that or modify it um and these are like the core features of the fvm basically fvm is like a multi-vm runtime for the Falcon Network and it's built on webassembly and what does that mean it means that it's built to support multiple run times so you can actually build multiple VMS on top of the fvm and the f evm is one of them I'm just going to describe that in a moment and you can you can bring your own VMS and build on top of that so as I mentioned um you can you can basically this diagram shows like kind of how multiple runtimes can be built on top of the falcoin network and uh as long as your VM compiles to awesome you can run it on top of falcoin and the evm was the first one that was launching and essentially it uh it's in it's an it's basically it's an ethereum virtual machine that runs on top of the Falcon Virtual Machine it's ethereum compatible means that you can reuse all the features of the evm for filecoin like the addressing the account types Etc and um this is just hopefully one of many and you can build any type of VM as long as it compiles down to awesome so I don't know if you really like your cat delore so much and you want to build the Dolores VMS where the account types are just unique pictures of Dolores you can do that as long as it compulsive awesome um all right so hopefully it gives you a better idea of the faqua network fvm what fevm is and all that so I'll go into a use case so uh I mentioned earlier is I work on a project called five coin Saturn and I wanted to present a production use case for the fvm because we just deployed one of the very big production use cases for uh for it earlier this year and what Falco and Saturn is it's a basically a decentralized CDN that's meant to accelerate retrievals on the Falcon Network and what that means basically is right now Falkland is really good at storing things and can store things reliably but we want to complete that storage Loop by having really fast retrievals because that's what that's what that's what we expect we expect to deliver the same experience as a web 2 and for web3 which means we need to have really fast retrievals and that's why Falcon Saturn exists and Saturn is an absolute monster we currently have 2000 nodes that's eight times more than cloudflare and we serve around 150 million requests every day and what's what's really cool about Saturn is that actually there are real people running these nodes and what's even cooler is that these people get paid for the retrievals that they make and how do we orchestrate payments for the shutter Network the answer is the fvm so we want to run Saturn as a protocol which means that um when you're a node operator in Saturn and you want to serve retrievals you interact with a protocol and you get paid through a protocol because that's trustless and that's decent centralized and that's what three is about and the fem coming to fall coin enabled us to do that and the fem allowed us to deploy smart contracts that Maps the contributions of our Saturn nodes to payouts and eventually these nodes can claim these payouts and the smart contract will distribute the payout and this is kind of like the level that the fvm can play at from all the way from Tiny applications to doing the accounting for a whole CDN so I'll give you a quick demo for uh for for our payouts um here is well actually I'll start with the UI um here's the UI for our payouts and this is built with existing this is all built in this is also open source I'll give the the links for the repos later on but this is built with existing infrastructure that works for the ethereum virtual machine and it's running on the Falcon now so um as a Saturn operator you can um you can go claim your funds from a falcon deployed sorry a VM deployed smart contract and you can still use things like ethereum addressing and all the account types um and on sec sorry the internet is a bit slow here all right yeah so this all runs on regular web three tool Underwood use and this runs on the fvm and the Saturn node operator you can see kind of like what your earnings are um now what transactions you can claim Etc and um what's on Saturn we've been working on some some really cool tools and makes deploying on the fem really easy and also very flexible if you wanted um our our payments contract cerebral is open source and it's a really nice uh resource if you want to really dive deep into how evm can work and all that and just to demo so um we actually built a CLI for Saturn to deploy things on fvm and I was obviously testing in before uh before the workshop just to make sure I'm clear with the demo gods and if it doesn't work I have a uh I don't want to show up but yeah like um running it is essentially just as easy as like a very simple CLI command that just gives you the uh the RPC URL and uh here I'm copying a local secret which you should never do before the sake of the demo I am doing because I don't have my Hardware wallet and you just deploy and as you can see you're seeing all my rust linting errors and this is live stream so no shame clear the block times on the Falcon network is like 30 seconds so it does take a while to deploy uh but yeah the RCL gives you release full tools like what the gas price is um it can convert ethereum style dressing to Falcon cell addressing and it you can edit for example the gas multiplier so you can make it really flexible or you can just use it as out of the box and since the blocked eyes are really long I'll just show you what the deploy contract oh my God I have so many linting errors all right so this so Phil Fox is a falcon blockchain explorer that you can use to check out your contracts and all that and this is the contract that I deployed before the demo and it's a it's essentially exactly the same experience as you would use with an evm smart contract and fall coin it has a falcon address has an ethereum address you can see the the message ID this is like one of the payouts we deployed and uh here it is live and hopefully and the other one would have deployed why yep there we go so this is the one I just deployed just want to show it's working the demo gods are with me today and I'm very proud about that um but yeah so um all right back to the presentation to wrap things up I've lost my mouse there it is all right so here's some useful resources um the fevm team has um has a bunch of starter kits for uh working with uh with the sevm um we had Saturn really like rust so we use The Foundry kit but there is hard hat there is remix there is a ton of other tutorials also that are available there to show you how to deploy how to deploy and work with the fem and it's really useful um the testnet hyperspace is a repo dedicated to the hyperspace testing and it shows you how to get test fill how to add that hyperspace to your meta mask wallet and it's very very similar to what you would do on ethereum basically if you're familiar with ethereum and development um Saturn contracts is our contracts repo so basically um everything like the way we do accounting for Saturn is in that repos public as open source and uh it's uh it's a great it's a great demonstration with how to use the fevm with rust and we've developed some Rust fevm we developed a rust fevm utils library and has very useful things like sending transactions the fevm has its own gas calculation model so sometimes when using it with some of the ethereum tooling you run into some annoying bugs in Rust we've completely removed the experience for you from with the utilities Library other things like converting fog coin to ethereum addresses you can find it all there the library is very new we're developing it and there are some issues so if you feel the the web pretty hard in you to come and contribute feel free to do so and lastly this is the contracts UI so the UI I just developed that I just shown is also open source and in case anyone wants to look at how to build front-end applications on fevm it's very similar to ethereum and expect like the same exact tooling and we have it out there um so just uh just a reminder so we have some prizes and and this hackathon we have an evm fevm uh sheet if you want to scan the barcode um so we have a grand prize and another Pool prize if anyone is interested to hack on the the fevm that would be really nice and just a reminder to to qualify for the prize if you wanna if you want to deploy things on the Falcon Network nft.storage and with three dot storage are really really nice apis abstract away a lot of the uh you having to do a storage deal and all that it does that all for you so if you don't want to get too deep in the weeds this is a really nice these are really nice services that offer your apis to store things directly on the the filecoin network and uh that is it if anyone has any questions happy to take them sorry I can't hear you yeah so you can do it a few ways like um you can encrypt the data before you send it and then decrypt it um and uh some like I'm guessing like nft storage or a few dot storage do some recruiting for you or you can like go through like a smart contract row so that is what it means like reading programmability is that you can do things also just to repeat the question is uh how do you ensure that the data is encrypted or not visible to someone or not accessible so ipfs so okay just so you can access storage deals from the evm itself you can access them from the fevm so and then ipfs is content addressed so you can access yeah okay and so the question is it possible to use Smart contracts on fvm to store data and yes you can make you can make a yeah you make a storage deal with a smart contract yeah yeah so you can make storage deals with a smart contract for sure correct that's it okay so the question is does Falcon store the relationships between different files so um not really like so I don't know if you're familiar with uh how ipfest store things in like it's a Merkle dag basically so if something is another Merkel dag you like there is no like connection unless like essentially unless it's part of the file you can reference another file in some file and that's fine but unless look it's actually part of the directory it you can just like link it natively you mean like having like versioning for uh for yeah yeah you can have that but like a a nice feature that comes baked into merkeld eggs is that um like for example um if you have files that are really similar or have the same content like they will share like uh we don't need to create like a new Miracle dashboard they will share that from an existing Miracle deck and just like extend it so does that make sense yeah yeah yeah yeah you can you can Traverse it and query like certain parts all right you're welcome thank you this yep so the question is is there uh some infrastructure ready for uh off chain Computing so yeah there's a there's a project that spawner the pl called bakaya and bakayo is all about computation uh computer for data it's called Cod that's why the name background came up um but yeah it's all about that um if you want I can share with you after but you know it's basically a dedicated project for that and it's an L2 skill later for computation over data on the Falcon Network does answer your question okay perfect all right I think we have no more questions thank you very much for coming listening
Automatic transcript — names and jargon may be misspelled.