Introduction to Decentralized Serverless Compute With Fluence Functions and Aqua | Bernhard Borges
Ethereum Denver·Wed, Oct 9, 2024, 12:00 AM
Speaker
Learn how to use decentralized serverlesss compute with Fluence Functions to create new or support existing decentralized applications and protocols. Join us to discover how to improve your dAPP with fRPC, a decentralized RPC substrate created with Fluence Functions and executing on HA DePin. APPLICATIONS FOR ETHDenver 2024: #YearOfTheSpork ARE OPEN APPLY NOW https://ethdenver.com/apply
Transcript
[Music] hello everybody Welcome to eth Denver 24 great to see you great to be here it's always a good time February starting out e Denver ritual obviously and um I'm Bernhard and this is Alexa we're both with fluence and we're here to introduce or discuss uh fluence cloudless cloudless compute with fluence in general and of course how it pertains to unlocking 25,000 USD through the hackathon so we influence believe that the cloud as we know it is broken it's uh controlled by oligopolists that uh uh seek excessive rents that uh uh want your trust but at the same time don't give it they have high exit barriers technology lock in uh deplatforming uh approaches and more the way fluence attempts to solve this problem is through a set of protocols where we have decentralized serverless compute we have decentralized uh physical infrastructure and we have a decentralized compute Marketplace that matches compute capacity from uh independent uh data center operator participating in the deepen structure with developers requests and desire for uh capacity to run the serverless compute and uh influence everything being uh decentralized uh we verify we don't trust so from a use case perspective obviously it's serverless so you can do whatever you want with any other serverless however due to the uh proof-based cryptographic system underlying uh the fluence cloud is compute verifiability at the uh runtime and execution layer is actually Paramount and uh lends itself to some really interesting use cases particularly around verifiable data preparation networks uh real-time data pipelines decentralized RPC Solutions and whatever you can imagine in your trustless mind uh on the verifiable data side it's interesting because as AI is getting increasingly regulated and uh you you you want Provence from data through data preparation to data Lakes to AI models uh fluent serverless can really help you significantly more than uh any other of the traditional Cloud providers can from an implementation perspective we don't have time to dig into all the protocol aspects but uh the behavior of the protocol which is offchain compute is actually uh um carried out by what we call a reference Pier it's a rust implementation called nox and it's built on lip P2P and it has a marine pool which is uh a generalized web assembly run time developed by fluence and an aqua VM pool which actually handles your distributed uh choreography of your functions you can think of it as distributed workflows and on top of it you have a schedule basically gr jobs that uh uh allows you to manage your event triggers and from the network perspective it it's it's truly deep in bottom up we have uh uh large data centers mostly filecoin miners right now that uh provide significant capacity to the network for which they get paid if they're if they're just providing capacity through proof of capacity and uh or executing your functions for payment from the developer side uh how just how do you create these functions how do you go about it you basically have your business logic you code them in Rust you end up with marine services which is web assembly and then you uh package your availability requirements do I want one invocation do I want one instance of my function do I want three this is how you can build through our distributed choreography engine your own uh uh failover and high availability solution uh provider specifications do you want to only operate with or work with green data centers uh do you have Geo preferences and of course the willingness to pay for your services on the other side you have the providers which uh they have their servers they have peers which we just saw these noxes and then H spelling we uh we slic uh capacity into what we call compute units which actually are cores uh for the most part uh two threaded cores and uh I think right now for 4 GB of RAM per CU allocation which is what will run your functions uh providers give these capacity commitments to the chain and the chain is actually uh it fluen its own blockchain build on IPC inter interplanetary consensus blockchain from uh protocol labs and uh they also provide their offers where they say hey this is what we offer this is the kind of CPUs this is the kind of ram this this is our location this is our green status our carbon footprint uh what developer attributes these are the services we can provide or we want to provide and how much we actually need to pay or accept and uh that gives an offer and then the marketplace which is onchain matches those offers from developers and providers and then you create a deal which then leads to deployment and the execution or the availability of your functions to be executed okay I only got the uh 5 minutes left to get to the Bounty so let me go through this quickly because Alexa is going to dive into dive into some of the aspects a little bit deeper we're going to have H we have five cloudless serverless compute tracks for a total of 25,000 we have 5,000 uh for each track and hackers should be uh cognizant that a you can provide or submit to more than one track and you can actually integrate our Pro our challenges if you will our Bounty tracks into any of your other uh uh hackathon projects over the week so the first one and it goes sort of from easy to a little bit harder along the way the first one's basically just uh you know hit hit the uh documentation uh hit some of the videos and create an employ and execute a cloud D function and uh that that's basically it and for that we have five times usdc 1000 uh improve your dap with f frpc so as most of you are aware RPC is a sticky subject in in the community on the one hand it's it's almost impossible for most app operators to to run their own failover nodes so you end up with uh uh RPC as a service which is uh very very available and uh very very cheap however it has problems it has single points of failure issues it has uh privacy issues had Data Trust Issues and um multiple Solutions have emerged and and what we've done is we built on fluence uh uh cloudless compute we we built a substrate for you to basically orchestrate multiple RPC endpoints service endpoints in fura alchemy many of them into a decentralized solution to eliminate the uh uh uh major sticking points which I just mentioned including a single pointer failure all this good stuff you work on that we have that substrate ready and that substrate consists of multiple components including some uh including some fluence cloudless functions but also uh uh some pretty interesting uh distributed algorithms on how you manage the workflow the the choreography of these Services uh anyway you manage to do this you implement it in and use it in your daap and you're in the running four five times 1,000 USC uh fluence cloudless is stateless fundamentally so if you want persistence particular data you need to add that on your own and uh one of the more interesting projects is ceramic and uh if you integrate ceramic uh ceramic stream or compos DB into uh your fluence Cloud list you're in the running for again 5,000 2500 1500 a th000 each now this is uh this is my pet project and I hope we going to get a lot of participation in that one uh uh with EIP 4844 it's interesting that you can use this blob as a sort of intermittent or intermediate if you will a state persistent option and uh anybody who wants to indulge me and use that in their uh hackathon project uh go ahead again you're in the running for 5,000 usdc 2500 1500 and 1,000 the last one is a little bit more involved and is more on the library enabling side we give you two options an NPC options and in the CK option on the MPC option uh basically what I want you to do is uh part A multi-party TSS crate ecdsa yeah and demonstrate it's use through orchestration with uh our orchestration language which is aqua on the CK side port the Halo 2 crate which already is close to web assembly to Marine web assembly and demonstrate its use by proving Hamming distances the CK option is actually fairly is not as complic at as it seems since the circuit is I I give you examples for that in the repo is already WR has been written so you literally can copy that circuit and uh and uh and demonstrate this so it's all about how to use it from fluence as opposed to how to write the circuit again 5,000 2500 1500 and 1,000 and uh that's it for me so Alex a will take over thanks thank you Berard hello all I'm Alex um we're going to go through the experience of developing apps for fluence and today we're going to focus on cloudless functions and their architecture you may already kind of know it because it's resembles a lot of serverless architectures out there for example AWS Lambda so it's pretty simple you have compute functions on the right they're usually written in Rust they're accessible from the p toer network and we have HTTP Gateway which is complex a little bit and it can call this compute functions and can serve HTTP API so HTP client can call it if we look a little bit deeper then what happened my laptop hang no oop sorry I have no idea yeah thanks uh no it's my laptop it's not it's not yours so I guess there going to be no demo so uh the cloudless functions are usually written the compute functions are usually written in Rust and are accessible uh through the peer-to-peer Network so if we look inside the HTP Gateway we will see that it actually consists of several components obviously it consists of simple HTP server and it has a cloudless function inside which you could also call uh distributed workflow it's written in aqua language and we have a flu J client that lets you send those uh cloudless functions to the peer-to-peer Network and the cloudless function itself specifies the peer Discovery mechanism uh to discover peers that host certain compute functions so what uh in order to start developing fluence fluence project you will need uh to set up fluence CI project and there are two ways to do that uh one easy way to do just fluence in it here on the right um on the left in your case um on the down interactive wizard will guide you for all the steps you will have to select quick start or whatever and uh just follow the instructors or if you're proficient enough with fluence you could do uh fluence uh in it with all the uh things specified so it will create uh quick start project with the following structure it the most important things it contains are cloudless functions in the aqua directory the HTP Gateway which calls those cloudless functions um it contains compute functions definitions written in Rust um and it contains configuration files uh which configure your deployment and if you're using local development environment which we recommend you to do um then it you will also configure it in provider. yamu so let's see it in action but yeah I I guess not today so yeah um so what uh it does so in under the hood of uh U what happens in fluence you will find uh pure Discovery it works based on the fact that uh deal participants are stored on chain so whenever you deploy something to the network uh it actually finds the process looks like that so whenever at first you have deployment um in your fluence yaml you configure different stuff like uh how many what's the replication Factor that's the target workers that's how many peers will be chosen to deploy this function to how much you would like to pay for a certain period of time for this function to be husted and available uh what's the initial balance of the deal that means how long it will leave until you have to put more money on it and what services uh what kind uh compute functions it includes once you have that you run fluence deploy uh and you get cloudless distributive uh uploaded to ipfs or to IPC uh effectively you get CID back which is sent to the chain which creates a developer offer which is then matched on chain uh through through the market uh deals are matched with providers so providers specify their prices available uh apis and stuff developers specifi desire desired price uh desired uh apis and stuff and Market matches it all and as a result you receive an active deal deal is active once it has enough balance to go on to burn through the money to pay to Providers and once providers signal to the chain that they are ready to serve that function So based on that information on change uh the peer Discovery mechanism works by querying that information from chain and going and returning that information back to Aqua which is your distributed workflow it iterates through the piers in the Subnet in the deal and is able to call the function on each of them collect the answers and present it to user or let it do whatever it wants to do modify data process and and stuff and the last thing of the puzzle is how Aqua knows uh the functions API because Aqua is a type safe language so so it doesn't let you do Sly mistakes it does though let you do clever mistakes but um so what we do we take a web assembly file that we generate from by compiling rust code we look at its interface types that we insert there and we generate Aqua bindings for it so that whenever uh the cloudless function the distribute workflow finds the right piers and goes to them it actually knows this the types it should pass and can validate that stuff so there are no errors or if there's some some data is wrong it will alert the user and that's that's unfortunately it a little bit shorter and yeah and uh what's uh resources in in your presentation sure this is all right thanks okay so a lot of things Alex H has covered are actually things you as a developer don't have to take care of this is all taken care of for you by both the CLI which is our uh uh ma it's not magic but it's it's it's your your way to scaffold and manage your project and uh by the various components including Marine in particular Aqua so Aqua manages the topology so you don't have to program at the P2P level at all and uh one of the interesting part that comes from from those deals uh Alex was talking about basically those deals when they're done where you match providers with developers uh their requirements as well as the resource the peers you actually get something what we call a subnet which uh actually is a is a overlay Network on the lip P2P Network that is managed through the configuration of your so again you don't have to chase down any of that the discovery is is it's not inherent it's not intrinsic but uh it's taken care of for you so you can really focus on uh building your function and uh choreographing choreographing them into uh these uh cloudless applications you probably want to end up with now I know this was like really short 20 minutes it's uh it wasn't much time so we have a much longer workshop on the 27th UH 60 90 minutes starts at 1 uh and uh you'll just have to check our uh channels including uh um Discord which is fluence.com fluence project for more details but if you're interested uh definitely come to that Workshop uh if you have questions in between now and then hit us up on Discord or track us down in the building and we're we're happy to help we obviously want you to take home that money those usdc that's our entire purpose of being here for you to succeed so uh uh if you want to take advantage of it we're certainly up for it a little bit let me show a little bit okay Alex has one more thing can you switch me please I hope it won't crash again yeah so just quick I have like 30 seconds or something so this is how compute functions look it's just rust code right and it can do whatever it wants it can access external resources for HTP or whatever but here it just Returns the string here is what your fluence Yama looks where you configure the development and here you can see that it specifies that it uses the service that contains the this compute function uh and specifies the price all that and we can deploy it to the chain and it will work that's how the project looks that's how config looks this is it
Automatic transcript — names and jargon may be misspelled.