New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Buidl Democratized And Composable Ethereum Off-Chain Services With Fluence

Ethereum DenverSat, Oct 9, 2021, 12:00 AM

This talk is from ETHDenver & ColoradoJam , the world’s largest Web3 BUIDLathon and Community Gathering. ETHDenver’s content is crypto and blockchain focused. Learn more: ethdenver.com Subscribe to our channel to learn more + connect on Twitter: https://twitter.com/EthereumDenver. Speakers: Bernhard Borges, Alexey Pyshnenko and Dmitry Kurinsky This talk was recorded Saturday, February 6th 2021. ETHDenver 2021’s content themes included DeFi & Money Legos, NFTs & the Creator Economy, ColoradoJam & the Next Frontier of Statehood, Protocols & Interoperability, Open Source & Public Goods, The Ownership Economy & Digital Orgs, Usability Design & Adoption and Legal, Privacy & Identity. Industry experts also weighed in on topics like decentralization, privacy, identity, non-fungible tokens, scaling, governance, diversity, and arts and culture in blockchain technology. The 2021 event was February 5-12 and hosted virtually in 2021 with 5000+ blockchain enthusiasts, developers and community members from 80 countries and 50 U.S. states. 🔴 SUBSCRIBE ETHDenver’s YouTube https://www.youtube.com/channel/UCgz9NU06t_FkT0Py1Vadczw 💡 LEARN ETHDenver’s Official Website https://www.ethdenver.com/ 👋 CONNECT ETHDenver Twitter https://twitter.com/EthereumDenver 📖 READ ETHDenver News on Medium https://medium.com/ethdenver 🛍️ SHOP ETHDenver Official Merchandise bufficorn.com 💬 CHAT Telegram https://t.me/Ethdenver Discord https://discord.gg/AxFmNdCVnU 📱 FOLLOW LinkedIn https://www.linkedin.com/company/ethdenver Instagram https://www.instagram.com/ethdenver/ Facebook https://www.facebook.com/ETHDenver/

Transcript

so we're gonna move on to the next uh person or the next group in our um in our effort here so bernard alexian dimitri fluence labs i have two well i've got anna too okay cool well we're just going to influence the the the microphone here and let them do their thing um off-chances you guys ready yeah ready all right take it away uh hi folks thank you for coming on fluence's east denver workshop my name is dmitry and almost the whole team is here nice so what uh we are going to cover today first of all i will make a short overview of what is fluence what problems could be solved with it and what skills it requires uh then we will discuss the bounties and how to approach them and finally i will share the resources uh how to learn more about fluence how to start what is the best way to begin hacking so first of all what is fluence fluence is the network and protocol it enables open applications it's a new concept that requires detaching ownership of the application of services from authorship it will have its own chain but it doesn't yet and what's most important right now is that it can complement blockchains with off-chain computations fluence is all about distributed composition so it has off-chain computations and state and you can access external resources like apis file storages full nodes of different chains or demonized processes on the local machine where the fluence node is running so it's open to the external world these capabilities are provided with the help of web assembly with web assembly modules which are bonded into services service is the main building block of the computations these service capabilities can be composed in this open distributed network and this composition is expressed with the fluency's special language echo marine which is driven on the client side so execution of the function of the service looks like this this is a one call instruction so what we have there we have the instruction we have the location where the code will be executed it's an identifier of the peer then we have a service which has different functions service is a web assembly code we state the function we have a list of arguments and we can assign a name to the output it could be more complex so in this snippet we make two blocks of sequential calls so first we do a call for filter change on an ethereal node then we go to uh node for to which the client is connected and then we provide the data from ethereum node to the client so it's a request response pattern expressed there with the echo marine actually our comrade scripts could be much more complex you can handle errors uh make iterations do parallel computations um and so on but it starts with these simple instructions and the ecomerine is based on p calculus full featured calculus with parts of lambda calculus so finally about the technologies fluence to approach fluence we have two surfaces you can make a service or you can make an application make a composition of different services services are compiled to web assembly and rust language is the best choice for web assembly we run this webassembly code with the fluence compute engine and we have a wonderful rust sdk to aid developers and hackers to start as fast as possible and then you can use a composition on client it's done with a javascript uh we have a fluence javascript sdk actually it's a typescript but uh you can use it from javascript as well and uh to express this composition uh you need to use echo marine that's what was on the previous slides uh is called ear accumulated intermediate representation it's the language for composition um and probably nobody knows it so we have a thoroughful documentation about ekmarine that was the short technical intro and now i want to ask bernard to tell about the bounties okay uh for the bounties we fundamentally get two tracks an application track and enable track for a total of uh six thousand dollars and the end the application track is really geared towards building decentralized apps and uh you know in our case actually decentralized services could be uh around oracle's relays or um actually processing algorithms for data so in the context of a smart contract uh we believe fluents could be a really really great off-chain complement and uh one example would be in the oracle space where we could pull price pairs and related data from various taxes possibly even across blockchains and implement the necessary data processing algorithm i mean you have to get from from the inputs to the oracle the the truth at particular point in time and and to get there you need data processing data transformation so for example sliding window averages are one way of doing that and this could be a set of interesting services where the data processing algorithms themselves could be each one a service that then could be composed in runtime even depending on the data feed user requirements so you compose these services then into an application and that really allows the data feed recipient to select the inputs adex blockchains for example our inputs and the actual data processing algorithm as a bonus uh we would be really really cool if uh if a team could tackle the issue of trust and reputation with respect to service components but also actual algorithms and it's actually not it's not that hard but it's uh it's super interesting because uh that you start getting a trust and reputation dependency graph and this would be something we'd uh really really would be super happy to see our other track is the f3 enabler track and that's really geared towards seeding the fluence web3 ecosystem we don't have let me just step back uh the underlying technology is wasm and in particular uh wazi and it's fairly early in the development even though everything's maturing rather quickly but it is early so there is no no web3 library like etherjs or ethers or web3pi available today and jason rpc is what rules and in this track we'd be really interested in seeing people uh implementing type systems especially around ethereum type systems codex rpls as composable and reusable services so instead of if you want to think it from a reaper perspective instead of having one repo with all the components for a web 3 library or development kit you actually could start composing the equivalent of that repo on the network and uh if uh if you're really ambitious you could look at several web three sdks that could i think were close to being easily ported not without any work but it's it's doable because there's a lot of awesome support already and if you do decide to do that i mean first of all reach out we're super happy to help you but uh start thinking about it as as as a repo as a distributed repo really and uh how you break down the service granularity matters to a certain extent even though i think best practices for micro services could really really help in making that decision those decisions and this can reach out we're super super interested in helping you know this and succeeding uh reusability obviously entire system is built in reusability and as dmitri pointed out earlier the fluence tech stack the runtime and the composition tools are going to be supplemented by a or augmented by a blockchain where the blockchain among other things holds licenses to your services subscription licenses so if you build a component and you attach a component to a license on this on the blockchain then other users developers can reuse that component subscribe to the license get permissions to your component and start building so you really should keep that in mind because you're not only eligible for prizes right now for the hackathon but there's a pretty uh interesting uh monetization track for you and for the work you're doing once the blockchain is up and running because obviously the services you develop today are fully eligible to be a subscription licensed on the blockchain so keep that in mind so reusability is really really big deal in composability because that's really what drives the definition and the value of your components in a composable system it should be it should be fundamentally useful it it really should i mean it it shouldn't be a toy example it should be something that's needed that's useful and that's be used by other people and eventually this obviously the the usefulness could be measured by simply the the license subscription volume on the blockchain and finally we if i've given you examples but uh it's it's it's those are open tracks and if you want to integrate with other projects whether it be on on the file side iphone any one of them if you're interested in integrating with a security layer or a decentralized key management solution like new cipher for example would be absolutely welcome and please reach out and that was it on the bounty side if you have any questions just please get them to us we have many resources available discord channel we have a cleanly link that's somewhere that you can set up calls so we're here to help you for the next week have fun um thank you bernard i will make sure the overview of the main resources to start with if you want to how confluence so first of all it's a fluence labs github organization and we have a few repositories pinned there it's fluence repository the main one with the node implementation it's echo marine with implementation of the language of the composition language and its interpreter is flint's compute engine for running modules and linking them together to make services is rfcs with a high level documentation of the paper and we also have two special wrappers that i will cover a little bit later um you're very welcome to raise any questions in the fluency discussions in the main repository uh if you face recurrent questions uh we'll make uh we will move it there and if you ask any questions there um it will we will definitely answer it and it will be visible and helpful for anybody uh we have a dedicated is denver hackathon repository uh bernard will probably cover it a little bit more after the presentation it's in is denver hackathon repo it has a code examples and tutorials and links to all the required resources so take a look on it then we have a fluentpad example project it's a quite a sophisticated project with um crdt text editing capabilities and the wrapper contains both back end on rust and front-end on typescript and react so take a look at it the main source of knowledge about the fluence network is that the computational portal fluence.def we have a tutorials and reference documentation for each part of the fluency stack there and finally during the hackathon we will be on discord for sure so join there ask questions shout out anything it would be nice and uh we have slots on calendar so if you want to brainstorm your idea or figure out the right design for the components and so on please book a time and let's discuss it that's all on my side bernard can you share the code yep it's up okay uh as dmitry pointed out uh this is the repo reflection we've we have on github and uh the idea really is to to illustrate how to use the technology in a very stylized educational manner on uh doing web3 services and service calls and for this we need two two modules one is a curl adapter curl is our transport of choice that's uh how it's how it's how it is within the uh wasm environment and we have another model module called facade which basically contains all the code and functions for the things we need to do to interact with ethereum so how do we interact with here well it's actually at the json rpc level so uh ethereum has a very well documented json rpc and that defines basically the underlying structure of pretty much every sdk web3 library or sdk you're using so this is the level we're getting in from right now and obviously as part of the hackathon we really would like to see it to make some progress on abstracting over that lower level so what do we need to do we need curl and let me actually go back to curl first so there are different ways of using services in the system if there was a curl service available on the network already you could subscribe to that as part of your development process and integrate it this way in in our case because it should be educational we put it all together and you actually use curl as a wasm input module and it's pretty straightforward if you've done wasm and the entry point into awesome is through a main function it's not through a lib function it's not a it's it's remain and uh so it's cargo new default which uh is really important oh by the way we're talking rust here it's just in case and uh that gives you your your curl command and uh it's pretty simple just the way curl works it's uh it's your string because we don't we're not working in shell we're just going straight to the to the sysline and uh so you can't really give your list of arguments it has to be a and that's pretty much all there is to it to to include a curl adapter into your project so going back to uh some very fundamental so if get balance which is you know it basically gives you compounds on a particular chain where the chain is obviously defined by your url and first we need our our curl request function and then we got a few utilities we can go over those and your results we definitely go over those and but what's most important is fluence from fluence we import the fluence compute environment portion of the crate and that really gives us a macro that transforms or augments each of your functions into uh runtime compatible code snippets so if you and alexa anytime you want to pitch in uh uh do it right just don't don't be shy uh so if we ask it balance so it's it's a very simple it's a very well defined json rpc call and the method name in the jsonrpc api is fgetbalance we also want to get announce which is really the id in the parametrization and anybody who's ever worked with ethereum smart contracts we have three uh sdks and libraries you know that managing the nonce is a or the id is a huge deal or can be and what we've done in in this case if you go into the utilities you see that we made we automated the nonce counter as a threat safe incrementer and that's really takes care of it as long as you obviously stay within that application space once you move out you have to start accounting for the nonsense yourself the response from json rpc is obviously a json string which is a well defined for each of one of these calls in the ethereum json rpc and you then get it once you get back you get the response back and you start processing the response now one of the tricks right now and we are working heavily on changing this but one of the tricks right now is you can't return the standard result to argument structure in your function in within the fce marked up functions so what you have to do is you have to build your own and uh here it's it's it's in fce results and what you're basically doing is you build your own result as a single variable type structure and the way we're doing it we're going from solid string and we're implementing it for our own okay and for our own error so basically result either is okay or it's error and in this case the discriminant actually is the error string you can do it whichever way you want but i find it pretty simple and i actually remember without having to look at my own stuff and so basically if if you return an okay a good result your error string is empty and if it's not then you return your error message and that's a very easy match discriminant to determine what your result outcome is uh okay so that's what you really get back and then we have a a utility function check response string that basically checks that uh the response saying hang on we'll just go to it basically here that really determines the discriminant with respect to a successful or uh error-prone result and you can get this back okay can i add something yes go ahead zoom a little bit so it's clearer yeah can you enlarge the text great awesome and uh regarding the the result here the thing is that if a function is marked as fc it's available to call from outside um and in order for this to work this realization should work and that requires every structure that's returned from fc function to be also marked as fc that's why bernard had to implement the json rpc result here yeah for example if we if bernard would kindly scroll down we would see their transaction structure all the way down here this is the first one that's uh the one uh that works with the uh serdes sterilization so it's an easy way to visceralize all the fields at once from json rpc call yeah and also there is a tx structure that's marked with fc it's a little bit upper sorry for for making you scrolling yeah that's what you need to ask i can scroll anytime nice so this structure is marked as fc so it's automatically serialized and can be used inside accommodating code this script so that metric was showing so you can access any field right in the script no need to wait for it on the client and parse it's already available in the script through jsonpath you can look that up in our documentation hopefully yeah and the way it's used below you can see that there is a get filter changes function below hopefully or well this one no no no the the function down below the last one let me scroll again yup this one this one batches json rpc requests and returns a vector of transactions and you can iterate on this vector right in the script so for example you can now get cash ticks hashes from somewhere from another rpc call in the script and compose it with get things by hashes so it all happens in the one uh script and one request no need to wait for round three it's like batching but better it's composing and you can start processing those uh transactions right in the script and for example send different requests to different services you write you write different oracles or anything you can imagine uh to process those transactions you can uh you can manipulate the network to to your needs and standing on the information you see in the transaction you can send requests there or there and draw them any way you want yeah that's regarding the fc structures that's it okay we got four minutes i don't know dmitry do you wanna like uh close it out or are there any questions from anybody i think questions would be nice and if we haven't any maybe you can show the front end part as well especially the use of a comraine i can do that hope it will work i'll stop sharing and then it's all yours so we have this simple simple frontend application in its denver hackathon repository that basically shows the transactions uh the transactions that are taken through polling from some eth no some ethereum node and it works very very simple uh it it uses uh set interval to update data periodically and on every update it queries uh transactions that are new in transactions from the ethereum node and then it simply displays its through react means what's done here uh could be even further simplified by using the script storage api that every node in the network has it allows you to automate this volume thing and to avoid running the front end uh for that so you you can just say no please uh periodically like chrome on every given interval run this function and set and send results somewhere to the client to another service anywhere you want on the network the api is pretty simple it looks like this so you just call send the code to your relay that says add this script and you provide another air script for example like this one there and it will work you can also specify the custom interval as a second argument it has to be in the in the quotes meaning it's a string even though it's a number uh just keep that in mind because it's yeah and you can remove it if you want and you can also order you know to list existing scripts and see what others have run and what if you have run anything you can see your script here yeah and another thing if you don't specify an interval it will run just once that's useful for writing scripts in background okay cool all right let me know thanks guys we really appreciate the presentation thank you so for anybody that wants to come and learn more about fluence make sure that you head over to their table during the virtual events later this afternoon uh make sure you collect their nft they've got some things that they'll probably have you do for that and uh yeah they've got some really interesting bounties to work on so engage them these guys have got a lot of things to offer and we really appreciate the opportunity to work with them so thanks guys thanks for having us

Automatic transcript — names and jargon may be misspelled.