# Functional Programming for Ethereum by Kristoffer Josefsson, Martin Allen (Devcon5)

- Channel: [Devcon](https://streameth.org/devcon)
- Date: 2020-10-09
- Duration: 44:14
- Topics: blockchain, smart contracts, distributed ledger, ethereum
- Watch: https://streameth.org/watch/yt-QO0Nu2XFLwg
- YouTube: https://www.youtube.com/watch?v=QO0Nu2XFLwg

## Description

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on IPFS and more.
https://archive.devcon.org/archive/watch/5/functional-programming-for-ethereum

Statically typed functional programming has received more attention in the age of blockchain than perhaps ever before. Languages like Haskell and PureScript were once thought to have a more natural home in academia than in industry. Now their powerful static analysis and security guarantees allow blockchain developers to prove more about the correctness of their programs. This is especially important as we move into the era of application-specific blockchains and scaling solutions written in ordinary languages.We’ll walk through the state of Ethereum libraries and tooling in Haskell and PureScript to highlight some of their interesting features, as well as compare and contrast them with their counterparts in non-functional languages. We’ll also discuss the ongoing work on hs-abci, the Haskell bindings to the Tendermint ABCI protocol, which enables Haskell developers to write application specific blockchains backed by cosmos/Tendermint. The session will be a mix of live demonstrations and slides. There will be a repository to follow along with for the interactive portions.

Speaker(s): Martin Allen, Kristoffer Josefsson, Irakli Safareli
Skill level: advanced
Track: Developer Infrastructure
Keywords: technical

Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum
Learn more about devcon: https://www.devcon.org/
Learn more about ethereum: https://ethereum.org/ 

Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. 
Devcon 5 was held in Osaka, Japan on Oct 8 - 11, 2019.
Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

## Transcript

[Applause] a school or scripts in a lot of libraries specifically now I worked on a different project cost of really have some onions like yeah give me in the back I literally shouting now we're in a different project basically like Haskell bindings to like a you know Enderman API soccer ball and at Haskell SDK for the like cosmos Network that's also forever or my work so that's what we do or less all right so we basically focus purely functional languages with strong static typing what does that mean purity is much like referential transparency it means that your conversations actually don't know these side effects so think about your reputation as equation like X equals 5 whatever you're not actually performing any two different kinds of concepts in hospital and clear script Monat it's sort of a pure way to talk about impure programs that the type system which may be your typical program electricity with different types of data strings integers and so on the type system in the programming language that we've talked about actually are able to reason about these defenses as well so it prevents you from doing things that in the real world when you're writing something that is almost computer valid then you see what happens so we try to use that for our benefit so the language that we represent and one of the libraries that you've been developing utilize that yeah yeah basically like the kind things that work contrasting is here are widely popular target languages like JavaScript or go they're kind of like languages everybody uses this space people seem to be very productive and those things so that's your DM and like but you know basically like you can't really make the argument that really lie there is like a particularly future thinking or innovative programming languages especially like you know people like go and it's it seems like lots of programs are successful break and go but for language that was 2005 or whatever it was that knowing everything we know now like they basically just create a Java server like 1982 so it's like you can do things in those you know that's cool but there's like a lot of research and perfect kinds of reason to the program pretty my brother and we do 19 that was not possible in the night that's so because like either one of these others much in terms of like safeties of the ability to statically analyze her behavior performance or possible or whatever you know people focus especially on things like security threats in the space and all those things are really difficult oh and so basically the light rates that we're talking about right today or like you tomorrow with this other workshop course on the Democrats which we'll talk about later basically like the one so you know whatever there's a web create guide similar to Twitter and jonah jameson for your job or whatever it has lots of features that those things don't but that's some kind of like functionality that it covers and then chanterelle is like a tool that we have made like maturity at this point and is the contract employed management and testing tool similar to truffle but without other you know nonsense so and I should also mention that like okay then there's others at Haskell libraries which are maintaining for this we don't maintain this but we're I'm like the largest contributor to that we're probably this point right a fourth it's also worth mentioning that I bless this talk before last year's thing everywhere tonight because it's considered like fringe or like me to be sure whatever so if this none of these things are doing around over here and it's now we got the extra behind and yeah so that one sitter it gold or whatever those are things that he actually it's not super interesting with just a highlight the point that we actually did all this stuff last year so this isn't like your new like j/s framework you know one week or whatever this place at all I'll say is that these libraries are mature and you can use them illustrate that in this workshop tomorrow but this is not like some new thing that doesn't work all I want to skip this in the end or some time but basically all of this work really starting 2017 and more or less like accepting you know case of truffle which happens cemetery whatever it is like the truffle decision replace it it's kind of all happening contemporaneously like with our growth as a company like probably not maybe you have your haven't heard of home it's a cereal company but you know started writing software in 2017 and like basically the reason why all this software exists that we trying to use off-the-shelf stuff and I like basically smart people so all of this started to be developed in order to produce our own products and better own applications which today my main area I think and the fact we don't have like we have a lot of users and not a lot of complainers so [Music] so just before we dive into sort of like you know how these libraries work I just wanted to get a little bit of motivation for why we think it's important so Martin show that we read Mary started working on these libraries to 2017 when home was new when we started developing what's now called our map back then called spatial index that we were faced with we have a little bit of Hospital blockchain experience and we were faced with having to write a full stack application that's no credit sophisticated mental maps running the material and so we've had a couple years and we back then decided that like it's worth doing the upfront investment to develop these libraries for the front-end side as well as the backend instead of using established technologies and I guess the the recent before why we're still happy with that and like to invite you to use these tools as well is that we are basically now a small operation vertical for five developers working mostly other things at this point and we have the basically typesafe develop different another we're generating code from you know our stuff the solidity can generate kinds of binding the back end and the front end because we're using these strongly typed languages these bindings are also have a tiny straight so that means that the compiler will tell us if we've changed something on one end of the step and the rest of the stack to the Pennsylvania hasn't made Rebecca changes and because it's not just like matching word by word or County however Oregon's that's been very able to encode a lot of the actual behavior of those functions we get a lot of safety when deployed and so this you know we're not in the camera we're saying don't write tests anymore but the types of the compiler and type checking our integration effectively in my eliminates a whole and this has pretty well very creative application another point that I don't think we'll get to it to show it here but one of the really beautiful aspects of the hospital part of this is that our mobile API is a title so that means that the compiler compiler understands the type you can reason about it but so it it effectively generates all applause or take most of our bindings compiler does that for us and that means that we do get so we expose our production API in terms of swagger definition which is a standard for exposing it yet we didn't write that that's generated by the compiler every time we deploy we use that internally but other companies use the same swagger definition to integrate products so they have the same level of this you know guarantees that our salesmen so recently we've had a couple of sort of great integration have been completed without our council so you know like telegram you know health channels or create we're just exposing this API in the generative Dobson's we've had recently an Android application that knows the safe and use this phone for locating points so you need time different when sophisticated like recover your wallet they want some hackathon there's an upcoming chaining integration that uses cross chains both maintenance and hold on from our API and actually part of our host we don't have the ability to write applications for every use case so we actually have a user community that builds applications for us to serve our users and again very little support so that's kind of why this tools will only help our large learning professionals they really pay off once you have a big yeah we can probably skip this or whatever but I will say that like I had to work so yeah people you know there's like a smoothie medium hangover and Hitler kind of like look these things are talking about like five Assembly there are various states of development on those things you know okay flakes or even like in the area of like application-specific watching people were looking at not even having to worry about this entirely things like Cosmo specifically right now that you're giving like a good variety of choices it's kind of like well don't make the same mistake twice peso also there's like probably some confusion because appear script it's not really a planet language the imperative Pascal which molecular pertaineth hospital is kind of like more of this big point means like the family of languages and it does even one specific thing so they're talking about a hospital it just means like the language which has a similar type system up to a certain point and there are some more syntax so basically like pure script is an opinionated dialect and Pascal it was created the compiler first compiler was written in 2013 so like to compare with other things that people know about like type script are no words are the same like family of functioning languages but alright sorry not text for fidelity but are comparatively much weaker they're roughly the same age this is enough this is also not something like a new framework for this week and basically likes it said language itself simplifies distills a lot of concepts from Pascal that were learned over a really long period of time and don't suffer from the constantly the backwards compatibility problems that askable has because it's a very old language so a lots of things are like might it might be done it done right the first time and it's actually I'm not even really a language itself it's more like the language technology that supports like multiple patents or run types so like the peer script language and selfishness of language specification it doesn't specify the runtime behavior which means that you can technically write bindings to like the peer script word um or whatever in any language that you want and the most popular one is JavaScript because it needs to write in the browser and the reason why is that most of the peer script work at the core developers were coming from but from like user interface design and they wanted to provide friendly lunch right frameworks to write web applications in this language so that's why it's the most sophisticated but there are others there's an Erlang ones which I didn't somehow is the most advanced of them but there's also the C++ and there's something like experimental work on some go as well so basically what this means is that like if you have like a large go application in the cold not now but in the future but today if you had like a C++ application and you wanted to start offloading some of the core parts of the application to a word they typed any language you can write certain parts of this thing in your script and have a full mile that's linked to it seem plus plus like dinner later yeah sure over in this oh I see this great democracy [Music] I see how it we're like somewhere like a three-dimensional slice yes so basically like the present-day situation is that it like I said all these things are insurers or working with the standard stack of material watch chain with an ethereal watching and no solidity or something that produces an amyís of the standard type of what we're used to chantrelle itself is it's kind of like married to solidity in this one I want to build high plank but you know there's other things you could go in directions there that are kind of more they're newer they're kind of stable like stabilizing but they're not really stable enough for us to really integrate with like this need p.m. support which is like you're in package manager like that's not about the shore less it takes to do but then there's other things like language other language support like by profit or formality or whatever the case is I mean making the generates an API though is a very embarrassing and then here's like a comparative stack diagram in case none of that makes any sense to you so basically like left hand side you have like your kind of traditional stack that you know consensus you know that you kind of like because for a lot of Victorian consensus to getting it now it's kind of like offshoots companies but you have things like test RPC are like Ganesh or the same product as a point or truffle they may love it like one project sitting sorry you know those kinds of like big theorem layers or maybe a real afeared layer you have a slimming Tyler went 3GS truffle and and you build on your applications on top of that what we're advocating for us on the right-hand side so there's laying etherium and clipping it just like our version of that would like dr. container that was a real ethereal no but at the time why I didn't expect to run unit tests as delegates triskin web 3 solidity compiler chantrelle I saw your app development so these slides will be published so like that's part of talk basically giving some examples of what the stuff looks like and you know here's like progresses like gasifier life or some definition of the word simplified because there's like a pretty steep learning curve starting you know any of these things but you know at some point your life gets exponentially simpler it's just I don't know how but you kind of like yeah well basically like it's my time to decide yeah this is kind of like more of like where this is more like an in-depth section of over to my earlier if I'd like some of these more concepts of my functional programmer analyst rated through these libraries so again like pure like there's this notion of purity and insects are two separate they're somehow like a separation in the type system between was how like effectual computation their stuff it has like side effects or micro exceptions or whatever it's kind of like like the cortex like coming to in front bytes you know or byte strings whatever has possibilities like you know decoding errors and what happens when you have those two the health part they bubble up and how much do you have a liver that's the kind of side effect that's like or pure in the sense that it didn't happen because of like a network failure and something that just your program through an exception in some way throwing other kinds of runtime exceptions or indicated errors that have an unrecoverable errors such as like database failures or API call failures but also you know basically like improperly formatted data exceptions etc also like invoking a web 3 or another network call these are all things that we needed by like side effects because you communicate in that sense you communicate somehow the real world which means you've actually created some side-effects such that if you've been you made the same call again you would get different results examples of pure functions are like or kind of like you know they're everywhere but they're like somehow situation-specific but like data transformations that can't fail like storing a list for example as a pure computation of users there's really nothing what are you going to 22 ask the internet how to sort you just like way to sort out for them and it works there's no unless you ask the staff over yeah yes you basically there's no way that there's no way that I can throw an exception there's no way that thinking with a call because the network failure there's knowing that he's our leader right from the disk the sorting algorithm itself is pure data transformation from list that's an example of like a perfection for other like mathematical functions or operations that just basically stuff that can't possibly fail unless it's implemented wrong but like there's no like random reason why it might fit so like here's you know like starting to get into something with something simple looks like just as like a you know round like a common framework here like we can talk about you know private public and private keys in Imperial they use a certain signature scheme like oh yes a on this particular curve people levels probably come across this a private key uniquely determines a party this might work and an address like the typical if you're in the dress that we all talk about all the time it's basically just like blastoma bytes so like this is just a common framework to say they're like these are the things that you can actually talk about in these like these are it's probably a bit difficult to see from the back try to hear but like anybody you know this is basically like kind of like parts where you know by the types of society using the type system this way your place in the building at university to top so like there's private either public keys in it one of these things in a level they're like ice drinks of course everything at some point quite straight away but the point is so like basically build up abstractions like to do and every other language so that you know you can't confuse things like God your private keys even though they both refer by strings you basically trying to like abstraction way like the low-level things and then addressing the whatever it's the hash result so it could be like an X it's usually written as a hex string or whatever it's very high strength but it possibly whatever so like example of purity for example here like these are kind of boring functions or whatever but like basically a way to like unwrap things or to you know basically to take a public he introduced the hex string there's pretty much no way that can fail because you're taking action so it's not a computation Pedernales in you can basically you can ask for like how to get them you know how do you make a private eye sorry how do how to make a public key from a private key something that again lace in the description of a statement last night accommodation like actually obtaining slices or whatever because you know that hashes the second size you know that the slice won't fail is it pure computations these are kind of boring right these are the ones that are in some sense effectual right because like is every next ring or this every byte string or Hexter never correspond to a public key probably not it's not 20 bytes long it doesn't so there's like a potential avail here which I can you can anything it ain't extreme become the private key there are cases in any add in any extreme correspond address though it has to be a certain number of bytes long here's an example of like you know whatever encoding you know what I say like encoding certain these are like infected or not pure it's because basically like you look at this like yeah okay maybe I'm going through the specification somewhere if you read the docs how do you talk how do you encode data that can be read by Imperial smart contracted through its through codec schema called NDIS or something if it hasn't even in a middle but you know basically for any data type that you should be able to communicate across a contractor boundary line there should be a way to turn it in the Sun like bytes from your SM and similarly like if you wanted to code like a to pool of and you know Olivia page we're going to code like a tuple of EBM types eat some way to parse hex things into those things so this is like basically like this is a language specific idea that like you know there's some for some types out there we can encode them and for some times ideally there's the same right to anybody should be able to do but then like here's this idea you know like okay we have like a texturing we want to parse it into something it has a particular type and we're making a constraint on this particular type that's somewhere you've defined products for this thing this still might fail because like it doesn't matter that the thing has the decode instance the problem is is that the thing that you're during inhabit and this table by straining might be coming from somewhere else where you get done it's not long enough for it doesn't correspond in some ways nothing in your trying to decode because you made a mistake somewhere so in this second sense like this is an impure computation because it might produce the value that you're looking for it might also produce a parse error instead this you're telling you basically this is just basically saying what I could say and then like usually what we say it's like this last computation or ever that takes it takes a hex string and and runs it into either something of the type of parse error or now you're looking for it's like basically you can think about this so like resolve the effects at some point like all the effects have to come out at the end of the day the program has a title which is IO of unit every program has this type in history of mankind and at the end of the day all your texts have to resolve to something some basic thing that the program can project and as you talk about involves special programs like coming down the way you're basically constantly resolving effects at the end of the day all of these effects systems like weather may like the error in that system they all have to present all agenda today and this is part of life so how so basically like you know as a specific it's a specific example specific example look like that place where this vivid interesting it's like okay on like addresses is it practice and EVM type you can decode this if you have it from us you have by answering of a certain length you can't decode it so basically like to throw away the first 12 bytes or whatever it take or take the last 20 bytes and try to basically just figure out if you haven't already sorry if you can make an address from you that's okay bunny and then it should be good otherwise it should fail I think this last one is David and I did these finance this might not even there's no way that this can feel isolated this is basically saying you like take the first to take the first 12 remaining 20 bytes irrelevant address the only way this can fail is that this tank fails or this ting fails and what that means is the thing you had to show it wasn't long enough that's all this is say okay cool so you can decode after since four types whatever that's pretty cool but like what if you you know more complicated for example like in the EVM you also have this notion of like size to raise so later you have a precise array let's say it's like a tuple of addresses right and then type something like for example everybody's favorite event is probably the transfer and results in your address getting more money whatever and that's effectively like that free to a little rate of like well there's two mattresses in there and then there's like you went in there sorry but in this sense like there's like the notion of like it doesn't make sense to speak about like perfecter or like effector of addresses which is like a list of addresses under predefined Li and like okay so if you can somehow communicate the predefined linked to the program that you're writing it you can basically reason about it and say like okay like the only way that this thing can fail in parsing or whatever is it sorry I understand yeah so if you're looking at like a vector of a predefined length bunch of this in here of certain type a you can't decode into this thing basically what you're telling which are less you can success you're telling the program it's like no matter what at this point I know that this thing here is a it's a vector of a certain way you don't ever have to worry again about like checking the good science this thing like you pass it off to a different function that function also will know the length of this vector because it's encoded in the types of so you can build that into like the Codex or whatever basically what it means then after you're able to decode a PM you have enough information about this effect in this particular case inspector so that you'll never get an array access like it's a third argument because you know that in order to you and try to access the third argument this vector has a size emphasized occasionally like you will get and I will show you an example of this you will get a compile time error if you try to access something which is not there so rather than like trying to check for this everywhere try and throw some exception in case it didn't happen what you what's ended up happening is that like every part of your program will now be a not in sync and we'll know that this vector has it seems like a stupid thing but then you know it is a stupid thing but they want us to realize how to do this human this is a particular example of what I'm talking about you know ecstatically size factors if you did you do enough like the level stuff with solidity you know how these things are encoded or ever the first word it's like the length of the thing that you're looking at and this and then it's followed by just a concatenation of all the arguments so I can have this link this is a you know you can't read this in the back probably but this is just the number two followed by two addresses and you'd like to parse this into a vector of length two this is like some type level language that's very specific to like the libraries that we use but basically what this is going to do is try to determine this X ring into either a parse error or a vector of length two of type of migrants and after that and after that forever like you can't for example if this you can't fail in this last case when you try to take that and you try to take the first coordinate of this array and you never fear yeah so maybe the intuition here is a little bit like so when you're typically and like an inherited languages or languages less sophisticated type language every kind of operation you end up doing something important you'll have like a lot of instinct and they kind of like all end up at the same place because you're doing something you can have whatever was coming before Kari the certainty of that information at that point in your code whereas like typically by composing a lot of interactions in which the guarantees of the data is encoded in a passive way you basically don't see any of these if statements or assertions in your code itself they're all packed into the type and then they're sort of the corresponding parser or whatever it is inferred yeah so when you're looking at an actual application code you don't see any of these type oh let me just make sure right here that I did it like mess up hold on and it's in this sort of like so that company with a mission yeah totally and then you know for okay back to the inflexible system for like Network computations so we previously coverages things that are like basically hand on the arrows or exceptions or whatever what you know if you're able to encapsulate like network laws particularly in the context of a theory whatever inside of a synthetic system when it kind of guarantee visas that like you can't take for granted that if you run you know computation in one place that you would get the same results as if you try to write ahead so what it's saying is that like where you where you call where you live where you make a quick phone calls and change the code that comes after it and so you can't just like make them wherever you want you need to have them sequence in a certain way if you don't do a good tight barrier the program will never run because it can't quite say for example like whatever there's like any but three effect which is in this library which manages all of the effectual computations that run against there is a really really big difference between the value of type A and a value of type 2b domain and basically like understanding this difference or at least getting used to it is kind of the basis for everything that happens here so I can't tell you how to understand it but I can tell you that if you understand the difference between having a value of type address and having entire the value of type web 3 of interest these are very very different things I can't explain it to you all I can do examines this is an example which unfortunately it's gonna be really hard to reproduce my back but here's an example for test suite or whatever so here I have in highlighted so here I have highlighted all of the pure computations here interactively a series of led by this so basically like variable bindings and making sized integers and things and these are the things which they are not effective and then actually for example this is it says for context this is a set up to basically in the u.s. in 2002 over here is like the attentional computations are highlighted here basically as a trend is a transfer so when you want to transfer tokens that is an effect when you do that it whether it succeeds or fails the world is forever changed because all you cause some other thing else to react and then basically what I'm saying here is that like in order to run the in order to run the effects remember to give the thing that you're looking for which is effectively like at the end of this commutation is like a and results and causing this transfer event to happen it's usually previous in terms of like events or whatever this year is when is another effect like these things it has to happen before this can happen yeah so maybe just from here we're we're telling the compiler that this transformational medicine web 3 we don't know what that's what other tech centers in the other world the only way we can sort of look into it is to run the circuitry this is sort of like a run demo now you like resolve the effects so like I'm happy to talk to anybody or has some questions about this but it's kind of like saying that like you have to there are certain places where you're allowed to you know find a variable to the results of an effect and it can't be just like in a simple assertion statement here where I'd like the recipient of this token is going to be the null address that's cool I can do that because there's no effect there's no effect here but at some point if I wanted to like take the result of this transfer computation I have to do that inside there some effects but when you're saying it yes sir really like actually caused it to happen is that strict over there or is it still is it will it still be like lazy there and it will be there's something down the line will force the computation yeah so in this language the peer script is strict which means that like all these things will happen but in Haskell this but this would look identical but yeah that case actually you have some notions from instead the type of professional program in the world there are some notions about win competitions right as part of the run time is built for the language itself and that can your still guarantee that they're gonna have an importer but yeah like it what it what time like take it depends on their so basically like yeah this you can go through these slides you know and ask yourself these questions like which joke to uses previous lightly which part of this computation is pure which are effective of which parts can be throwing an exception which parts moving to our null pointer exceptions there are none because they don't exist as languages okay which person can fail which parts can't fail is these become basically like self-evident from the code itself and so rather than like skimming through line by line is inserted much Princeton's for things to figure out like when something is going to fail I can look at this program I can look at this program in advance and tell that this line could fail because it has it has commutation it's might be tripped up by network error this is a variable binding that could cause that basically his result is an ineffectual computation with in front later there's nothing being run here it's just setting it up so there's nothing that can fail here there's nothing that can fail it in these lead pipes so this this test fails because of an effectual reason I know it has to take place in this line there's no possible way that it can do anything else so it is I don't know in that sense like how you certainly look at projects large large piles of code where many things are happening it's very important to basically be able to look at looking at only this this particular block I can tell that the only way this can fail is this one this one right here so what do you gain the analogy here is that like whatever length you know you know the Commodus of the program is like the types are another program which is to say that like the compiler is taking and the types that you're giving to the program that you are writing whether you like or not is is creating it's time to like the language you don't have to probably write it yourself but you know I always have to annotate has type never the program the compiler is able to figure out a lot of that for you but by typing the language itself the compiler is able to operate on your on a newer types and to produce like certain guarantees or certain things in the same way that your program can operate on the values so in the same way that your program manipulates values the compiler here is like basically reading in time sitting and reasoning about those things the same way that you reason about boolean logic or whenever it's there and the more accurate and expressive that your types are the more working powder can do three so for example like the more accurate that your types are presenting like commit things can throw exceptions in the pecans but it might fail the compiler is able to basically like tell you more more about the possible places where your programs may be incorrectly written or where it might fail the downside of this is that this kind of program is really hard but it's different than it's different than being really hard to get right it's really hard to learn but once you learn that into it there is not really if the kind of thing that you can't it's very difficult to implement a program improperly in this language it's like you have to talk about a school especially like other person or a school program by the time I figured out how to get us here a while like a few months later you just work the first time there was no like there was no again at s2 support it's because like it's actually somewhat well somewhat difficult to express programmers in these languages there is it's difficult to get a program to compile that doesn't do the same thing as and when it does is something actually it's it's interesting because it's somehow like done in some sense like they're supposed to be impossible so they do you think you know parts of this library which I like the couch or whatever is like whatever like the way that it does you know the way that it does the parsing and what in gave me I you know decoding stuff looks like pretty bullet through this ice it's like easy to do it all this is correct so I didn't spend six months reading test me stuff I spent like a month writing it and then it just like really the thing which I would say is like the most interesting thing is probably the way that it doesn't slang tranio so there's like immune here forever I think I would say Q is probably the most interesting feature that this has is something that's his problem like the filtering or something which it's like basically a weighted as the theory of logs in a particular order that she went to specify I just still left with the remaining time before we have two questions whenever I would just specify like what that means so the theory of logs if you don't know or basically the way that it's a mechanism for applications of updates to track state so the contracts change you don't always know unless there's an ending inspired to it telling you to go back in to possibly just assume the log itself to get all the information you want you know and these are consumed by some kind of fights I mean color filter like a web three filter it's a diagram about how this works took me forever to make and so like the problem statement for like this multi filter thing for example is like you want to listen to like you want to listen to multiple events each one of them coming Traxxas is very common because you have multiple though two separate concerns you write in multiple different contracts you don't have just one giant contract each one of these things submitting different kinds of events from different addresses and you want to define specific handlers that run against you submit type this is you know most common in some cases when you're just trying to store them cash later but it also might you know whatever it might update UI examples and every time that you you want to run each handler or its event in the event so like contracts you know calling if I have one contracted innocent men to this very before its return statement makes a call somewhere in his body which causes another event to fire then like I want to resolve these things in the order that they came out and basically like a block and so the use case for this which we have there's probably lots of other people have is that you're building in cash for contract state which is updated or revalidated whenever certain times fire so because you want to want to use this your packet you want to use like a relational database but you know you don't use like the EPM as your back in here whenever there are dependencies in your events for example like to the empty market contract either get token listed for sale event that indicates like others a new token I can buy but that token itself refers to a token ID and that token ID is you would only know that that token exists if the evented like mint new token event from the NFT contract itself and fired at some cakes like there's kind of like there's all the good actions that spawn things to happen but in order to make sense of what actually I might have to know that this token was meant in a different location and the reason why is that you know in a relational database for example you know things like orange constraints that say that like this token for sale this something for sale is a row in some database in that row has a column called token ID and that token ID is pointing to a token table somewhere else and if that token is not in that token table then this schema has now been invalidated because I can't talk about a token for sale unless I know if I'm at okay so basically like you have created a situation in which you have you know foreign key constraints in a relational database that cannot you cannot maintain unless things are processed and in order to keep those quarantine violations sound and so this is particularly useful if you want to not run against like a full archive node where so like if you want to run a yeah that's not a big problem if you if you have a full are cool you can do whatever contract lookups at whatever point in time for example if I don't have a sale [Music] [Applause]
