Get started with InterPlanetary Consensus subnets + Filecoin - ETHGlobal London 2024
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join Matt Hamilton from Filecoin for a workshop titled, "Get Started with InterPlanetary Consensus Subnets + Filecoin." InterPlanetary Consensus (IPC) enhances Filecoin scalability. This workshop covers IPC setup, subnet/appchain customization for extra functionality beyond EVM, and inspiring use cases for your hackathon project. This workshop took place at ETHGlobal London 2024, a 3-day hackathon held at the Truman Brewery in London from March 15 to 17, 2024. The event 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: https://x.com/ethglobal Check us out: https://ethglobal.com Email us at: hello@ethglobal.com
Transcript
[Music] okay uh good afternoon everyone my name is Matt Hamilton I'm a developer Advocate with protocol Labs you probably know us from things like ipfs and hopefully filecoin which is what we're going to be talking about a bit here but also what we're going to be talking about or what I'm going to be talking about specifically in this talk is about interplanetary consensus interplanetary consensus is a project that we've been working on for a while with regards to scaling filecoin and potentially other networks as well so it's fits in the sort of the layer two layer three layer four type space I'm going to talk a little bit about the background about it and also a little bit about um what it can do how you can get involved in it and possibly some ideas as well for your hackathons and talk a bit about the bounties and maybe some questions Depending on time so like I said protocol Labs uh you probably know us for things like ipfs ipfs is 10 years old this year we've been around for quite a while uh protocol lab stuff ipfs is a decentralized storage Network you probably have used it especially if you've done anything with nfts nfts uh use ipfs a lot and uh one of the key things with ipfs is it uses content based addressing you may have seen these addresses that start uh qm or ba and a a series of what looks like uh potentially random digits uh those addresses are actually derived from a hash of the data so the idea is that if you fetch some data you can actually verify that the data you get back is actually the data you requested and also it decouples the location of the data from the actual data itself so if you think about URLs uh when you go along you go to www. whatever.com something folder name/ report.pdf uh that is telling you the location of the data but obviously that could move uh it might be in multiple places and the whole idea behind the interplanetary file system ipfs was that data could be stored in multiple places because you might actually want to fetch it from somewhere that is nearby that especially becomes important when we start thinking about what does the internet look like when you start scaling beyond our planet now that might seem a bit of a lofty goal but actually it informs a lot of the design thinking behind ipfs and you'll see that reoccurring when I start talking about um IPC the interplanetary consensus so we had ipfs one of the issues ipfs was great but one of the issues was there was no inbuilt mechanism to actually incentivize anybody to store data so typically if you've used ipfs you may have used a pinning surface someone like pinata or infura um in which you pay them to ensure that your data stays on the network now your data may be replicated by many hosts around the network but at the same time they could all uh choose to effectively garbage collect and and and no longer store that data uh kind of Acts a bit like a caching system but you need one at least one node that is that is actually has that data pinned and that means they're always going to serve it up and that becomes a bit centralized with the way that works now ipfs has been around you know ipfs is no sort of blockchain concept at all and has nothing to do with blockchain or or cryptocurrency the next iteration was filecoin so filecoin is taking some of the concepts of ipfs and uses a lot of the same underlying technology but to build a storage Network in which you have a crypto economic model behind it so there's a filecoin token there's a filecoin blockchain and although the data is not stored on filecoin on the on the blockchain the data stored offchain the the blockchain itself stored the proof that the data has been stored and the economic side of things so who's who's paid what how much for how long and all that kind of thing and then on top of filecoin we have the fvm the filecoin virtual machine which we launched a year ago yesterday yesterday was the first birthday of FM as far as I'm aware with the first and only like layer one blockchain to like retroactively add an evm layer and a VM layer on on top so that was about a year ago go but the uh the fcoin network is huge you're talking uh between 10 or I think we say 16 there exabytes of data storage capacity worldwide put that in context that's about 1% of the entire data center storage capacity on the planet so that's uh it's it's pretty massive we're also known for lip PTP lip PTP is a protocol that underpins a lot of other blockchains so I think POC dot salana think ethereum 2 all use it um oh it's actually written there ethereum 2 polka dot and chain uh golum they all use lib P2P as a mechanism for actually communicating between nodes so kind of taking all these Technologies together um uh we then I I guess sort of mentioned this uh ipfs a sort of migration ipfs lib P2P with all of those networks is currently securing about $300 billion do worth of value on those networks so it's quite a quite a significant thing then like I say file coin there on the end but ultimately like I said if you start looking sort of beyond our planet and this may seem like I said a bit of a lofty goal but it informs a lot of the design thinking around ipfs and now IPC you can't get away from the fact that the laws of physics mean it takes a certain amount of time to transmit a signal a certain distance right the speed of light so getting data from here to the moon is going to take a few seconds uh each way going somewhere like Mars you're talking you know tens of minutes potentially each way right so how do we build a blockchain that could actually scale to those potential sizes there so IPC interplanetary consensus is our way of trying to solve that and uh the idea is to try and scale it to a level where we start to apprach approach the speeds of web two and possibly exceed web 2 so web 2 at the moment still has the speed advantage over a lot of stuff within web 3 mainly because we're dealing with consent mechanisms in web 3 right we have blockchains we have consensus we need to get a number of people to agree to validate to to ensure the Integrity of the system but that has performance implications the idea behind IPC is we can actually break a network up and have multiple subnetworks Each of which has their own consensus mechanism so again if we go back to the idea of being on another planet the consensus mechanism of the blockchain on Mars doesn't have to be in like direct consensus with the blockchain CH on Earth they could be separate subnets and then linked through a common parent so as I say sort of problems with blockchains scaling to meet demand that's the sort of problems we got at the moment scaling to web to sizes um bad composability so if you generally if you use one blockchain you kind of you you've got to swallow it all in one go right you've you've got to use kind of how that blockchain is designed and how it design is uh designed to do things uh with interplanetary consensus uh you have more flexibility if you want to change out the consensus mechanism change out the virtual machine you can do so it's it allows you um to build uh kind of things as you want to build them so we had uh this has come out of a R&D lab we had at protocol Labs um so we had a a consensus lab within um protocol labs and then like I said last year uh well F uh FM R&D started in 2020 1 uh last year we we actually launched it we started productionizing IPC inter planetary consensus so to give you kind of a bit more of a of a feel for it like I said we talk about um scalability in terms of subnets in terms of creating this hierarchy of networks each child can have its own children so you can create a layer two layer three layer four of them and so you can create vertical scalability but also horizontal scalability as well you could have subnets at a region constrain so you might have a subnet within the EU within North America within Asia for example again to try and work on the basis of uh it still takes time to transmit signals right and if you start to scale these things up and need to be going faster then you may need for example a subnet that specifically is running within one specific geographic region just to get just to deal with the laws of physics and the time it which it takes you to transmit signals an interesting uh an interesting point that somebody um brought up uh earlier on at the uh the the fcoin booth um can't remember who it was they maybe they may be in the room um was about that certain geographic regions may have certain legal implications around blockchains of what you can and cannot do so you might not be able to have proof of work in one region or proof of stake in one region for example so you may have to actually alter your consensus me mechanism dependent upon the region and IPC allows you to do that because you can create subnets within different regions um that all then connect up to like I said a a common uh parent there so within IPC you can use IPC to scale a particular application out to multiple regions or create um application specific subnets app chains right so you might have a particular application that you want to run so um some of the uh as an example at eth Oxford uh the other day last week uh some people created a sort of decentralized Discord type uh service that in which a group of friends can have a um you know group chat going on between them and they can each run a node and they create effectively a private blockchain that just exists for the communication between themselves right um that could then like I said that could be high uh anchored to a parent level blockchain and through that could then access other blockchains and other group chats uh that that are running this system there is a network called fluence that is launching I believe later this month um fluence is a decentralized compute Network and they have used IPC as the basis for what they are building because they want to actually do certain specific things that they can't do on the main Network so IPC allows you to create custom um actors custom like built in smart contracts that could be written in Rust and directly compiled to wasm and also custom subnet um sorry custom CIS calls that can access outside of the uh the the the evm um or the VM sort of sandbox you're within so if you want to access external hardware or external libraries external Services um maybe you want to actually access something like uh some AI um libraries or something like that then you can do that uh with that and you might have specific ones that are tailored for certain things like uh hard privacy you might want to have a subnet that's dedicated to fully homomorphic encryption something that is currently at the moment uh a very intensive process you wouldn't necessarily want on a on a general purpose subnet but you might want to have your own separate subnet that can do FHA for example so like I said it's uh effectively infinitely scalable because you can actually build subnets off of subnets off of subnets and also the idea is sort of going forward at the moment we've restricted it just to be aware we've restricted it just to Layer Two off of off of a layer one for now um just while we're working on things in theory you can go layer three we've just disabled that at the moment just uh while we're just ensuring that everything works there a lot of this is still very much um in in development although like I said we have got a production um project that is going to be using this and live I think later this month um fluence so um yeah and like I say it's customizable so you create your own subnet you can choose things like your own gas schedules um your own native tokens membership rules might be a public network might be a private Network um your own block time and you can also uh like I said customize things like create your own you could put your own runtime on there right so say you wanted to P it over the salana runtime and run it on there or move runtime um you could do that as well right or create custom uh CIS calls that can access outside information so just kind of giving you a a sort of diagrammatic view of what this could look like so you could have layer 1 Main net and uh IPC at the moment we anchor to filecoin but in theory you could anchor to any evm network at the moment because it is based upon solidity contracts deployed to the parent or potentially even Bitcoin we're actually investigating at the moment uh IPC being a layer to for Bitcoin networks and then like I said you could have subnets that might be specific to a a particular um application or genre of application you could create a gaming subnet or subnet for a particular game or uh subnets for particular um regions as well and one of the things we're working on as well is the idea of um kind of ephemeral subnets as well so imagine you created a game uh you have a subnet that is only necessary for the duration of that game just between the players of that game just to ensure that you know nobody is cheating and the rules are all being followed but then once the game is finished you don't need that entire subnet so that subnet could then just be torn down so it could just be run for just the duration of that game or duration of a compute job or some sort of task and then effectively roll up the uh the the end result and the output and maybe any proofs that you might need to you know validate the the process up to the higher level chain uh I think I've probably covered most of this already talk about what a subnet can host um so like I say different things um different applications um different geographic regions um yeah so deploying a subnet is kind of like sort of a start of Journey um and then it could expand onto a whole topology of its own so it depends whether you're running it you could have a whole ecosystem running it as well you could determine the incentives for what people might get for for running a node all ephemeral lifetimes this is what I was talking about just earlier you might have things like you know games compute sessions uh that just need to run for a short period of time and then the subnet can be um you know destroyed at the end of that so uh yeah this is something that uh you know we are working on this is not the ephemeral subnet is not available sort of particularly at the moment I mean you can simulate it you can fire up your own subnet do what you want and then shut it down you know effectively that's what you'll be doing for this hackathon you'll be starting up your own subnet locally on your on your laptop and at the end of the hackathon it will it will disappear so in terms of bounties uh we have two bounties from filecoin so the first one is sort of a general Bounty around filecoin so that's not particularly what I've been talking about in this talk but is about just general tooling and products that involve uh onboarding data onto the filecoin network or working with the filecoin economy as well so anything to do with lending and borrowing on the filecoin network utilizing um the uh storage Primitives of the network as collateral for example uh so you can actually create storage pools and and lend and borrow collateralized by uh lending Pools collateralized by stor storage for example and then what is most relevant to this talk is uh we got a bounty for most meaningful use of interplanetary consensus for scalability so if you were to spin up a a consensus subnet here and deploy stuff to it then that' be eligible for that Bounty one thing to be very clear is uh like I said we're very known for ipfs just using ipfs on its own is not qualifying for the bounties right we've had a number of Bounties in the past at various hackathons where people have just used ipfs uh and that is not sufficient to qualify for the Bounty so you need to use filecoin either via um one of the thirdparty aggregators or generally you you would use one of the third party aggregators uh projects like lighthouse. Storage web3 storage NFD storage um uh there's a new project that's just come out called textile Basin that's a data Lake um uh by the people behind table land uh which is a SQL database on top of filecoin um so yeah those are all potential options there as well and uh yeah a couple of QR codes that take you to link to some cheat sheets uh for the hackathon that give you some more information and some stuff about our Tech as well we got a filecoin booth if you've not seen it if you walk out of here we're just sort of straight ahead and slightly to the left at the back there and by all means come up and chat to us I'm also um hanging out on the the Discord channel the um eth Global Discord Channel under the filecoin eth global Discord server on the filecoin channel uh so come along there if you have any questions or come and find us in person and I think I've got about 5 10 minutes left if people have any questions about IPC or about filecoin in general then um feel free to ask them here or like I say you can come and grab me afterwards yeah I have a question regarding have okay so qu the question is do we already have do we have some examples of projects that are already building on IPC that on Main net just to be clear IPC is not deployed to main net yet it's deployed to our test net called calibration um so it's not yet uh on I mean in theory you could deploy it to mainnet because at the end of the day it's it's it's it's anchor basically a series of solidity smart contracts you could deploy it to filecoin mainnet obviously you'd be paying gas for real real world gas for doing that rather than test net gas um in terms of examples we've got a couple of examples in the GitHub repo and I will put some links directly in the uh um filecoin channel on the Discord so we've got one example of using uh General message passing GMP we've got a general message passing protocol to communicate between a subnet and a parent and there's an erc20 token example what's called linked erc20 token and that's uh showing how you could have say an erc20 token on the parent Network then be transferred to a uh account on the subnet by having it basically uh the the parent effectively escrow that token and then the child effectively mint a replica of that token on the on the subnet and then when the the token sent back it's burnt and then it's released at the at the top end um so effectively an internal Bridge using uh GMP so we've got that um I think we have another more complex example that is using what fluence is using that is in conjunction with aelier and doing a bridge from another Network right the way in uh which is quite example um but come and come and have a have a chat uh like I said we had some people building at eth Oxford last week um and I think they're they're about here um and so I can sort of chat about you know what they were doing the sort of Discord type Chat thing um as well but ultimately you can use IPC it gives you a sorry just to be clear here it gives you an ethereum endpoint uh RPC endpoint that you can deploy to so you can deploy using any you know your usual solidity You Know Remix hard hat uh type tools directly to a subnet so we have a um in our docs so on that one the the QR code will take you to link one of them is our docs but it's docs.
IC dospace and in there we have a quick start deploying a subnet and that will take you through the steps of deploying a subnet it will compile a bunch of rust stuff uh locally on your machine depending upon your machine that may take a while so be aware um that can take say you know between depending on your machine might be quarter of an hour might be an hour to to come to to compile stuff on there um so that allows you to basically uh compile it um initialize your config um ensure that it's pointing at the right place on the on the parent Network and that the uh what's called the gateway and the registry addresses are correct and then setting up some Wallets on there and then creating the subnet that registers your subnet with the with the parent Network um joins your nodes to the subnet and then you can deploy a child validator here now this example um you'll see the commands repeated four times that's for setting up four nodes on the network um actually if you're going through this um you just need to know you just need to deploy one I mean it'll be a consensus of one which is a bit artificial but for the purposes of the hackathon um save yourself a bit of time and you can run just a single node and ultimately when it's successful you'll get this message here and you'll see the eth API show up there right so you you can then configure that in metam mask or um uh you know uh hard hat or Forge or whatever you're using and um access it get a chain ID there as well um and Away you go right yes so question is where can you find the contracts so the contracts that are actually deployed as IPC is uh the IPC itself is actually using so those will be within the uh uh what's called consensus Shipyard um there's an organization called consensus Shipyard and this may be linked in the in the uh the the uh quick start uh docs there if not there we go it's now in the uh filecoin Discord channel uh so in there the contracts should be within there yeah so it should be within there now I think some of the contracts are there we go IPC solidity actors so there's information there and if you need any information specifically about what they do uh I can give you some more information about that but in short there's there's two contracts one is called the gateway actor and one is the um subnet actor and for each parent there's one Gateway actor that acts is basically a registry for all the subnets and for each subnet there's one subnet actor and that Gateway actor is also used as a sort of a post box for the um uh GMP the general message passing protocol to communicate uh between subnets okay cool any other questions brilant well thank you very much and like I said uh yet you can come find me at the booth sort of towards the back wall slightly to the left or you'll find me on the uh eth Global channel on Discord great thanks [Music]
Automatic transcript — names and jargon may be misspelled.