Building Community Owned & Funded Virtual Infrastructure With Spheron | Chris Anatolio - Spheron
Ethereum Denver·Wed, Oct 9, 2024, 12:00 AM
Integrating Spheron with communities unlocks a new realm: DAOs and groups can now actively manage and maintain virtual infrastructure without token offloading. It's a leap towards true digital ownership and participation for everyone. APPLICATIONS FOR ETHDenver 2024: #YearOfTheSpork ARE OPEN APPLY NOW https://ethdenver.com/apply
Transcript
[Music] my name is uh Chris anatalio uh I'm a developer Advocate at spiron network uh today we got a cool talk uh we're talking about uh community-owned infrastructure uh so basically the idea here is we are going to actually deploy operate and manage infrastructure you know for instance you know nodes indexers you know basically anything you can run in a Docker container basically any kind of application or database where they talk about actually managing that using a dow so for instance creating a dow proposal and then when that proposal gets executed it'll actually automatically kick off a deployment pipeline so one of the big uh complaints with Dows is basically you're you're voting on a wall of text right so so you have this discussion you have a vote but basically you are relying on the good faith efforts of essentially a third party you know maybe the developer team uh to actually execute those instructions in good faith um and actually to the letter of what was agreed on um so just uh real quick about spiron uh spiron is a decentralized Computing platform basically we try to make it butter smooth to deploy basically any type of infrastructure um basically you can deploy anything in a do rator with like a super butter smooth uh developer experience um and it's it's robust it's scalable it's uh resilient it's good to go um so basically uh here is the highle process so I imagine you know just a basic you know standard Dow okay and we're gating membership to that Dow with the nft right um so members you know based on certain requirements can uh create a proposal right so uh what's different about this proposal is you are actually defining infrastructure as code so embedded inside the proposal you actually have a Json that's describing uh infrastructure you know it could point at like a Docker image it could be like uh this type of VM you know was one CPU and 2 gigs of RAM you know 4 gigs of memory you know but basically you're defining exactly what is going to be deployed right um so you create the proposal you discuss it you vote on it and then you execute it right um so after you execute it uh that uh smart contract actually emits a uh a solidity log event right um and that uh event um you could find it by uh polling by polling uh The Ether skan API for instance you know um so let's say you deployed on sepolia you know you're just polling for like a specific smart contract that Dow is deployed to and once you actually see that event um you can actually take some action so so basically uh what we did is we just created like a basic uh nestjs app uh running in a doctor container on spiron and basically what it does is it's using the ether scan API um to like pull ether scan you know looking for these events um and when it uh finds the mided event it'll actually use uh the speedon SDK to uh deploy that um container that was defined in the proposal um right um and SDK is just a wrapper around API right because uh speedon is really composable you know you could use the UI or you can just call the API to like deploy anything basically um so digging a bit more into the architecture you know U so so we have the smart contract you know it's uh where we deployed onia I did this beforehand just uh so so we could um get through the demo um and then we have we have a specific defined event that we emit um and then we're using The Ether scan API um so what you need for that is basically just uh an API key embedded in your application and then we're using the spiron STK which is basically just an npm dependency we import into our application um and then we're deploying infrastructure uh basically we're just deploying a something called a busy box which is just a set of Linux tools wrapped in a Docker stator um so basically just uh the process is for a dow you know you would discuss uh the specific configuration you'd want to deploy you're like uh we want to deploy you know this specific uh graph indexer or this specific reddis database um and then you define that as a Json and then you would vote and you would execute that proposal uh so let's dive into the demo real quick um so this is the spiron interface we actually have um the application deployed on the back end that's pulling for events um and deploying to spiron in response to that um so just to dig into that code a little bit basically it's just a really simple uh application you know we have a Chron expression so basically saying every 5 Seconds execute this logic we're hitting uh ether scan API endpoint um on spolia um and we're doing some filtering on the events we get back um not sure if you can see this but basically you just get back there's Json that's listing every event uh admitted by you know your Dow contract based on the address you pass in um so basically uh we just do some filtering and then we called the uh speedon SDK um and actually pass in that Json to um get that specific infrastructure deployed um and now let's take a look at the contract so it's a very standard um down contract you know basically you have a proposal uh you count votes um you check vs executed uh you're tracking voters you're tracking your permissions to check that they have a nft so you know you have a modifier that checks that they own this mft um and then the customizations we added are we added in the STG to track uh the actual infrastructure is code Json of what we want to deploy um and then we also have this trick called a deployment manifest CID basically what that is it's a uh an ipfs CID that points to a Json that tells you what was deployed you know so you can actually verify like Okay so this was deployed at this instance ID um at this time uh if you need to update it at a later point you know you have that ID um and it's also like a verification that this action was actually taken in response to the contract being executed um and then we also have proposal type um basically that just is a enum the differ differentiates between deploying new infrastructure and um and updating existing infrastructure um so let's actually go through the flow we have we have this contract deployed to spolia we have the polling service on the back end deployed um I already minted nft in my account um I'm sure you all know how to meant nft um so basically uh I I have the set of scripts reading it hard hat to create a deploy proposal vote on it and then execute it so we we going to go through this flow right now uh using hard hat scripts so first I'm going to create the uh deployment proposal yep so yeah this just uh executing the transaction waiting for confirmations um and then we can we can see the actual proposal is created here um it's going to take a little bit to get indexed all right well uh while that's getting indexed uh let's go on to the next step which is voting um so voting on proposal uh I might update the index to two uh for that's since that's the second proposal we've created uh and then zero for yay for yes so I'm actually going to vote Yes on this proposal yes so just gu run another hard hat script uh that's going to vote Yes on that proposal yeah and so we can see the proposal creation here um let's see all right so so we voted yes uh so we have to wait a little bit uh for the deadline to elapse on that proposal and then we're going to execute it um and then the final step is after we execute that proposal it's going to emit that uh that event um our back at service that we went through here previously um it's going to basically it's going to find that event it's going to say like in the logs like oh I found this event and then it's going to um actually execute that creation um so if you see here uh this is this is uh my speedrun dashboard it's all my different projects each project has a bunch of different instances in it um you know so just different kinds of Docker cators you know like database node indexer uh but whatever you need to run you know you can put anything into doat and run it on spear on uh so basically what's going to happen after we execute that proposal is um we're going to see another instance created here um the SDK is going to create a project it's going to spin up um a new instance pull down the doc rator import all the environmental variables do all that automatically for you and then that it's going to come up um and now you have running infrastructure um automatically provisioned by a dow proposal without any intervention without any manual intervention needed um so so basically you're taking your Dow proposal and the actual Act of executing it is what kicks off the deployment pipeline without needing to rely on a third party so that that further decentralizes uh the will of the Dow and uh the execution of proposals um so let's check back into our uh proposal hopefully hopefully I can execute it now okay uh so I read this hard hat script and I going try to execute that proposal oh wait number two oh wait sorry I got the ID Rog on my vote okay sorry I lost track of the ID here let me uh create this new proposal okay so dab creating proposal number three okay and now let me make sure I'm voting on the right one okay yeah I'm voting on proposal number three now oh wait no I was right okay oh no no so so I tried to execute propos propal number one I wanted to execute proposal number two so here we go okay so running the execute script uh for parad uh and I am running the execute uh transaction on the uh second proposal The Proposal I created originally um here we go uh so that's going to take a little bit to index okay yep so here we go so this is uh the the execute transaction uh that's successful on spolia uh we can see in the logs um we we admitted the uh deploy event so basically if you want to dig into that real quick yes so we have this event defined here uh basically it um you you you just have some some metadata and then you actually have that um that Json uh infrastructures code embedded within the event um then that you can pick up on the other end and be like okay I'm going to deploy this for you now um five minutes okay uh so now I'm going to go back to um oh there we go okay yeah so cool um Let me refresh um yeah so if you saw that little toast on the uh upper right hand side that was actually um this instance being deployed here um so let me see so let me pull up the L real quick yeah so uh we can see here uh this transaction um is actually the execute the The Proposal execution transaction our back in service is polling ether scan uh it's looking at that deploy Dow contract it's like okay I I saw a new event um and then in response to that event being admitted it's like okay uh let me grab the Json U let me grab the infrastructure you defined as code and let me just go ahead and deploy that for you um and then we can see here uh we actually uh deployed this uh instance of infrastructure um let's see yeah it's going to take a little bit to start up um but yeah I mean yeah that that's basically it that that's that's uh main that's the main flow um so basically uh some application some use cases for this uh like for instance imagine if you wanted to do like fractional node ownership you know uh so let's say you you have like a dow you have a group of people um and let's say they're interested Ed in you know creating something like a shardi node um or creating some kind of new blockchain node that's coming up that's in test net um and one and it's cost prohibitive for a single person to operate that node or that series of nodes or um maybe writing the node as nft gated uh you'd be able to split the uh cost of running that node um across several people uh for for instance let's say you have 10 people that are all part of the Dow uh they each Min an nft they each have an equal ownership of this Dow um and then the Dow could actually um run that node for instance you know and they each have like a fractionalized ownership of this node uh but let's say that node is incentivized uh right uh let's say there's an air drop for all the node Runners um at a later point you can take those airdrop rewards and distribute them amongst the Dow members um that would be one one idea of uh a use case for this um you know Dow trigger deployment pipeline this community-owned infrastructure um so yeah that's about it for me uh yeah I just want to thank everyone for hanging out listening uh definitely try to check out spear on if you need to run any kind of infrastructure if you need to run any nodes any indexers you know any sequencers whatever you need if you want to Reddit on decentralized infrastructure that's robust resilient and elastic go ahead and check out spiron um if anyone wants to chat more about this or or anything uh related to you know infrastructure deployments I might be over here uh right behind the Neptune stage just check me out I have blue hair I'm easy to find um and uh yeah thank you everyone for uh for uh listening to my talk I appreciate it and uh keep all building happy e and for everyone
Automatic transcript — names and jargon may be misspelled.