An EVM-Based Formal Rules Language by Michael Yuan, Hung Ying Tai, Timothy McCallum (Devcon5)
Devcon·Fri, Oct 9, 2020, 12:00 AM
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/an-evm-based-formal-rules-language Smart contracts are immutable programs on the blockchain. They are automatically executed based on pre-defined rules. However, complex and inferencing rules could be extremely difficult to program, test, and validate, using standard programming languages like Solidity. The long sequences of highly nested and intersecting IF / THEN statements are fragile and error-prone. The problem is compounded by the need to frequently change rules based on business requirements. Enterprise software developers have long relied on Business Rules Engines (BREs) to solve this problem. BREs allow business analysts to write transactional (state changing) programs in a specialized programming language called formal rules language, which can be generated by graphical user interfaces. BREs automatically evaluate, re-evaluate, and execute those rules. They have been proven successful in traditional financial services. The Open Source Lity project developed extensions to Solidity so that the EVM could support BRE for smart contracts. In this presentation, I will discuss the benefits and use cases of rules language and engine for smart contracts especially in the context of financial services and e-commerce applications. I will further describe how the rules language extension for Solidity, modeled after Drools, is designed and implemented, including compiler and runtime support. Speaker(s): Timothy McCallum, Hung Ying Tai, Michael Yuan Skill level: Intermediate 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] just a little bit of ourselves so we are from Table seven states and quite simply asking about a plan or customized prospect we have a mistake might come to us after that and so we are jumping in at least try to stay above the consistency where our expertise come in part from a nowhere and unabated work body lower focus has been developer tools to have original diversity [Music] ministers including a certain spot context certainly an explorer and the models be combined into a single web-based product we love this project [Music] okay [Music] that means difficult what - photoresist applications we come on enterprise world you know that DSL has always been one of the you know you look at that for maturity SPS not domain-specific language is very important for for real word and minimizing states and today in salinity is very generic everything has to be brewing companies so there's no specific optimization solutions and the second is the design of solidity and other vendors they must assess SS and SS so you know gas ourselves why so difficult discrimination of scenario why is it no random number is why is that no checks on supporting today it's because the cylindrical has to be able to criticize actions on the project if any of those cause in their place under deterministic behavior or gas fire you do need those features Tammy put those features in view functions of European countries and and so that's a great out there most of the vendors today so that's where you know we both have already no reason to be able to try to create various vessels to province because if you don't have consensus cameras or any conferences that's not something we say okay so how who shared over my time and talk about how do we address the first challenge the first is solidity is Tory complete and its general there's no domain system seniors in that language oh I'm sorry Ezra so I was some of the go ahead so first of all why do we need a ruler is 111/2 I ask this question nobody's not contracted automated stress on a triggered by end results in their eyes their very definition it's a perfect match you know my disciples must be transparent regions and the musical blockchain is perfect for Pat Wall Street fescue rules today and rice go sizes and rules engine is essentially a decision trees in rules will be living in a decision tree using a large driver impacts it relates financially absolute increase you know so if you have multiple interacting rules in trees that every single change on this side [Music] how we do our ascension into the side 13 a sake as we know if we want to add a puppy they must be some new clothes or some new instruction but you know whose engine we don't do that because we know a half of half of Harvard has too many Howard we don't want to do that so we just separate that we had a numerical rule and we just build a new pasture for years and neupogen also e is compatible with the original if you want so you should go to our country you can buy with the final summer clothes and she has V and when the passer going inspired oh that's the whole walk when my summer when somebody is 12 and a naked Testim case a mommy and so when when somebody is cute the contrary I will find all the rules and you must resist something our company I want to modify because there are lots of horrible not everywhere I will need to be modified so he was not address that and or handle were together and just feel out of something like and so we just go to our demo and this is our website you can go there and get more example yeah oh so our looks they were resetting it and our first instant okay Alpha Centauri is attention that's we define a person who has a number of edge and locate which means he attended a school for a while and packets for his money and this is we define a structure to share some money to those person and we have to we have one is called awesomest which will store all the person and total back in here and we add a new numeric encode effect in certain Factory in series just like notify our pendulum which were about shooting money in this example dance of the package will be alloyed per hour and all and we just say in 2000 and we go through a little car first II just you just write a rule like a world woman he can be a stream more each of the men and the window will will contain several conditions as you can see you can say oh I want to feel to that last person who's and is greater or equal than 65 and water is fertile and equal 5 and also our package must must have come greater than 10 yeah and if you find if our intro final edge and me any modifier objects is is in these conditions then he will check out this inspections like we will add the person and depend on us and just - our photo packets in darkness yeah and another one is how can we add a new person - here we can see we have a list here and we create lots of person of judgment and then that's insert to tell our Endora to modify a piece this object and the last action is we well called punching or the final rules it will just delete all of the rules and and just just do these actions so let me compare yet first of all we had a person like the first one okay we can just check was once they happen and we at the spawn is this is five and twenty and to Sara because these villages large or or equal to five so we want to adhere to just be wrong okay now we have three person and certified classes now we image the pay machine and just check all of the person liked on the Negro but he didn't get any money because this is only system for years second one jacket $10 and sir one known angle and dollars yeah and as though we can just check the baggage if he just he just spend $10 okay that's our our table full of loss engine if we right scan you can find more examples on our website research coming off to say that's the verdict you retired the laundry to them retire like 15 leading to the minutes if you retire at 65 67 so it's really important that's the top and have all this cool you know who gets love to retirement age so I'd actually show up [Music] so the next one I want to talk about how we saw the second review before the first Apollo is noting specific stages for the language the second problem is no separation between suspect any final winners we see you be my kids 1.1 X separated so basically we could call this an auxilary application and what we mean by auxilary application is an application that is really assisting the end-user of a blockchain application and essentially transforming full node data to make it available to the end user in a useful way so this is not a second layer solution and does not play a role in and network consensus at all and it doesn't play a role in updating the blockchain state c0 read only one axillary application example would be like a Bitcoin core wallet so as we know we have episodes and the system the Bitcoin states represented by its global collection of unspent transaction out please but the Bitcoin blockchain doesn't actually hold the account balances so it uses account balance in Bitcoin axillary application i.e the long so there's a purpose for ancillary applications they are safe because they're really just a helper right so it's important application can't really make the blockchain do anything in college so in example is yeah Alice here she's got to the point if she thinks that she's got three for some reason that she tries to execute a transaction that might actually succeed so they can't make blockchain do anything that song so the smart contract search engine falls into this category of what non-consensus code and the search engine that allows pure view infractions to be executed off chain with arbitrary programming languages and rules and example this will show you minute is it's reading the public data that exists so for example if there's a public variable the compiled traffic to the Guinness and service automatically you can go in and grab that information automatically so it's a bit of an overview of the smart contractor attention is this proponent here it is 100% free and open source in that it's just using basic Apache to on a Linux operating system already HTML Javascript and a bit of - even plus the indexing where the local using elastic search and that's also a percent open source product as well so the blockchain here reading the data here and then there's multiple interfaces out to different services from there so this is the web browser search and this is a optional third party things like push notifications and so on we'll get to this component in a little bit I'll talk about this I bet so the smart contracts search engine sits between just a sits between the full note and the data and its organizing Rossum our contract data and the blockchain are like event logs and so on and it's providing essentially like a search and discovery service for the decentralized applications okay so this demo I'm just taking some screen captures if you go to endorse it instead there's a menu down the left-hand side you'll see this data-driven depths here this year we've the first paragraph that links off to some coding get up and this is HTML Javascript and solidity smoke detector and there's might be just shown us this is the build tool that we have and so you put the salinity code in man you hit compile and deploy this so the argument for this constructor here is asking for an accounting so we put in one five underscore double zero one that to the chain and then what we see in the build tool women click the play button in the duct tape you actually deploy the front end of your done so this is what the end user will see and here we have this account and I put a belly in on one two three and we update the balance and what it does this my quick search engine goes and finds small contracts on the blockchain that match so what we do is we store the API and then we hash it so we end up with a deterministic key per API and so this my contract search engine can go through the blockchain and find all the contracts that match to that key and so what it's essentially doing here is finding accounts of contract top X with different names and it's trading the sum total of their balance and they're providing that so a smart I can't do that to another contractors they can't see each other's data but the search engine can aggregate so just move on to this part here what we call the SSS and a-goin police come talk to me afterwards because this there's too much to say in ten minutes so this is the easiest way to access all this if you don't install or do anything with any of these smart contract code or anything if you just simply go to ESS SJS and you just install that and then you have instant access to blockchain data so we're running if the remainder theorem classic sophomores marionette saga miles test net for the death train so these are already set up we have some specific premade functions here for your convenience so for example you're just esss your search using address and that's the address and all return done the next thing a specific thing search using keywords so in this case that variable name the account we put that in as the dark and returns well adjacent so then your phone can pass this right that's a really efficient way to call data blockchain data and get that back so instead of your phone having to get home there are some records and look through the wallet do decision making what you can do is quite a complex query where you can filter out so I don't want to see everything in the last AR from this address with an account name called DEFCON and then you'll just get back one report so it's really efficient and then you'll find any active process one small piece of Jason okay so one of the reasons why this is all right this because it's separating out it's very flexible but it's simmering it out the components so if you have a friend developer that's a really different skill set you can just take them you know JavaScript and HTML and CSS but what you do and this is what I want my duck to do from the users perspective you don't need to know when they push the button that's going to call smart contract functions and so on just don't worry about that just poke up the front end of the HTML Javascript and CSS so it's enabling you to have teams work together similar to the the rules engine allows like a business analyst to write rules and rules and hand that off they don't need to actually be able to contract the right contractor but that same syntax will apply and just plug straight in and work so this concept to that you can create your own custom queries you can extend on this to provide like customer push notifications you know triggering what amounts to overall under certain values etc and I'll pull it up if you're interested in building your own or using hours or deploying it up and creating the product please get in touch and we'll help you [Music] all right so we have this possible to challenges and parties in the second abilities would have a few stuff outside of the UVM so that the mountains that they can flow out [Music] we impress LVN our foots on fire twice to the heart and first of all because elegant always just like a jerk cc-come hell so it has a call like a signal to us to see or rosto provide all you can see yes they all will have support in language to you if you are not interesting with just he want to use your fire Alice languages yes in venues Albion and the umpires that with our BN if we want to define a new target West in Pakistan tonight that we have one we have yossel maybe if what that happens maybe there will be the Boston familiar with the EBS three or four or five so Albion provide a mechanism that we can very easy to define a new target and this DC vendor with your financial you don't mean to have to translate your oscillatory directly to the mean pocket you can use the Oviatt because intermediate format called lv NIR so every language will be transformed into a unit your uniform uniform language and then use this language in two different objects so this is a surprise as we have lots of new partners or dangers of problems in fortune for VN so when we just integrated their way into the question which M so the debuggers we don't - its weekend during average of the perennial VP or something like that and the host parties well we want to talk about more banana leaf love healthy infant walk we can define a new cast optimization skill that less can so we can just modify each augmentation so my style is more programming language on IBM's and all proceeds will be be translated library's certainty or writer or Rasta or Cephas or any foreign language they will be they will be passed and constructs with the SBA heart rate and funding which generates the healthy IR and in effect we call you up max are because we can add lots of manager here some sniper can reduce reduce the echo or again we can just simplify a lot of addition or multiple [Music] current it's very easy in this photo charts we only do what's the latest with Madonna Olivia I are with a native of Michael so we can know every instruction in high level the closer it is the closer is like hunter - hunter or something like that and we can apply lots of difference here right here well we met in the assembly center he was a non-indian and back into AI also we have a cost amount of here and when we have a problem here we can apply the traditional energy consumption issue the package of that into this model and we had just apply laws are the manifest engineer and we get of Mulcair some Isis Michael here okay so let's go into the demo part I will show you how to use our compiler to compile you as I recall 92 and then I are finally 482 that you Boston I seem for Evo parties okay so first of all you need to come into love in answer to the he wasn't has hands just like this and we have these muscles you can keep going as he attacks the soup I if you use is metal he may detect a one hour the audience so as to know so you can just go yet they just run it and excuses comment in our next eyes and together I go so I see I think I can do that already so it's not enough okay I know this best [Music] okay now I run the mansion of srl demo and first of all you need to create a comrade and we'll many endemic opiates Oh so just press it as you can see this is just 20 country and we have possibly without pan sets and we have event wealth transfer and here is a short term you can sell the post buy and sell like utilize basic bounces and also a budget for the affairs of people careers and families in such as crunching and if you want to add the setbacks protesting in the just include library and you see it's a lesser that's fine but for the diverse artists recommend when you use as however you can can help making like this and no worries because we all need the compound is yeah [Applause] we'll be in compilers and was no accident we were so many cars and in welcome to was final one is love one hi file called cancer that was a novice the Ebro a file called the country appointment and the vampire you want to deploy light into a certain he was a personnel was new just back here and you can find it wasn't as natural and and just some your transaction because I think this anyway to city or a remember there and because you need to pass your your your all wasn't to here so you need to enclose this finer file into a stream we have we have provide the coming here just okay that and enter okay you've got this this lots of string this is your country and because it is very very large so I need to just just scored our my coming home okay and my comments will ask you to confirm it right [Music] don't worry we have employee of amount of things before words also if you've got the arrows of where you can retry it simmer 5 because I have no idear when I just write several nine there will always be one or two well success this we're the 40s you can get your mutter here and listen to earn your badges and you can find a Westco if they want to know Weiss the use I love the what while we can see at least happen and also if we want to see how our storage parables even kind of storage have and you can find this file and it was bet here this model that shows our metamath to connect our wasn't has met and just change to occur here is your focus now you can't get pellets vote and you will get you a balance in here and you can transfer your your bath and a hot dog and just by [Music] and any monitor [Music] but you need to see your semantics all right you know I think our time is optional I don't even anyone there's a kind of second sight [Applause]
Automatic transcript — names and jargon may be misspelled.