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

Loading player…

RADON: A Domain Specific Language for Oracles (Devcon5)

DevconFri, 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/radon-a-domain-specific-language-for-oracles Oracles are bound to bridge the gap—or abyss—between the realm of smart contracts and data coming from outside the blockchain. But, at the end of the day, achieving such ambitious goal boils down to removing the inherent indeterminism of real world events by aggregating, filtering and reducing multiple data points into a single one in a predictable way. This is no easy task—even more in the case of decentralized oracles. In this talk we will introduce RADON: a domain-specific language that provides a new ontology and semantics to enable smart contract developers to define how external data will be retrieved, aggregated, filtered, reduced and reported to their contracts. In a learn-by-doing manner, we will reflect on the challenges that we faced and the quirky, wicked and hidden incentives that can be accidentally introduced by poorly constructed queries. Finally, we will also demonstrate relevant tooling for ergonomically creating and troubleshooting oracle queries within the context of existing Solidity projects. Speaker(s): Mario Cao, Gorka Irazoqui, Adán Sánchez de Pedro Crespo 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] or adults we are Gorka Damania we work for time relax which is a company and commissions by and we met Foundation Florida development and implementation of the first they tell they open them for our whole objectives of these session which is that storm oh sure Adrianna took and workshop arm and understand look decent electrical networks are what's their used white we need them it you know radon and why do you design and as it is today and then how we met excusing Reina we will show and how it works in real life and you what we're working we were moving human next and what the future or a dozen women tomorrow's so on the centralized or you know you're the problem 22 is playing that anymore probably every every single people here already very little doubt about it okay it's it's yes mom and em amassing mean and it's not formal Isis and it's not a problem that anyone has defined its death marketing so what you're talking about increasing terrible problem here that the fact that because the smart contracts between deterministic we can not very external API server to many kind of planet whose non-deterministic thing that communion the smart contracts so we need to do some way to solve resolving that kind of in the determination of that arises from having some computation being performed on multiple amounts of a network or in all the nodes in a network like is the case or is my progress in etherium and at the end of the day if we try to solve that through centralized data it will basically but having a contract have an owner that can all ragged met on that method that has multiplier so that only owner can input data we are breaking tampering censorship resistant which is a the goal of using a smart contract in with Ruby and in the purpose so the question is how do you build determination without centralization that's that's a problem that we're that we've been trying to solve so we came with the concept of a decentralized oracle Network where this centralized means that basically it's 10% exists and no one can decide with will watch which will be the result of the contract decentralization is just a way to arrive to that madness with you know an Oracle here means that there are some negative laning to the contracts and most importantly an inter minor basically an entity that express away the uncertainty that comes from making an HTTP query where you can have many many different terrorist network errors many different situations comparing multiple api's for the Scimitar for the same data how do you solve the fact that they could be different and so on that's that fail you have the Oracle and the networking means that there's some full of notes that are randomly selected for making this work of aggregating and delivering data into smartphones okay so this centralized data networks should be about speaking power so as meeting and Trust in in a single know any particular person so as to not have a point of failure so when we thought that we needed to find a way to have a DSL for articles why why are programming languages that exist today not enough or something like a decent wise work so if we want to build determinism I will require explicitness so the code needs to be really really clear about the invention of the of the requests of the big of the bigger requests we are performing we don't want and any imbuing but of course the human languages bit of work we cannot use two languages or saying I want to know the price of these women were too busy or I mean in my contract to know about the temperature in second tomorrow and so on and most programming languages are also not suitable because they are to reach in their comfort floor lowest cultures so imagine for example solidity it allows you to do looping and many fancy stuff and that is not really required for the purpose of simply taking data from memory transforming in its way at making aggregations million so mister T is the visiting some computations and then having it delivered to your mother so we need something that is we focus on information aggregation something that is between two things of more similarity they are not the news for tonight so when we started thinking of of this ESL we realized that it needed to be mastered so that is happening any specific syntax it's not tied to any syntax so that you don't need to learn a new language that is that is simply like a kind of grammar or defining data flows and then you can have libraries in your programming language that you like the most JavaScript or whatever that you can use the library support writing great on the space so it's totally data oriented it means that at night and it's free so it's a sequence of operators and operate on the result of the previous one and it needs to be really really focused on what we are doing which is putting information transfer minute I have it deliver this is probably the most important part which is that you mean to make me analyst analyst I guess so that we can predict the computing resources that you will will be useless to us to set some kind of price model it's similar to to Casper something like that and you also to detect any kind of wrong incentives that we will see later our security issues that will arise from a month oran first so we introduced written in the 2017 with an white paper as a language that includes most of the features then I just explained and radio messaging for retrieval abbreviation and the literary object notation so freedom you can finger feel like something like this that's it make something as I said it is abstract so it doesn't it means it's it doesn't have a literal representation instead so a schema let's say okay this is not any particular language is it this is just representing three operators so a script is a pipeline of course here we're bringing one of image line metal can be either the initial panel of an operator operator gold actually for an operator followed by one or more arguments every operator operates on the output of the previous one and then that obvious means that the final value for spring will be the one of the last goal easy so as a type system Reagan has its own type system let's say that it's independent from the one that you know for Janice Priya normally need you for any other languages it is scripted which means that every time that you need to change from one time to another and you need to do it explicitly random so the types are the obvious ones for value types of pool and integral screening and there are four complex types or structures that I love for more fun system more functional programming knowledge with it then one next thing is that we can take raid on the streets and serialized data using the C board which is a standard for encoding data structures in the Bible so what we get some alignment we see here that we can feed into you the resonating which is an interpreter that is one item that is at machine that simply takes a humid data that we pray from name guys for example and start interpreting the speak and putting operators are applying on triggers and then we will get the final the final result basically here this is business is just saying okay whatever do you get from the MEI parse in the station free time as a man as a hash mark let's say you value store and product get the value associated with an EM field and then return that as a boat so those are four calls and once you like this if you created like Jason and this is the expo so we're saying this is ivory really come on a screen this one is for open weather months actually so we have a spring that says all of that you know our situation you need to I get and so on in 1325 which is really redundant then as as I say we can we're not expecting you to write bytecode or to do this kind of structures because and this is not a million at all what we do is rub that we library so we have this witness request library which is available on any n and you can just you with at spring and then start pushing operators into the strip just like that with the same names let's say are stationed at math at em spot and this is actually metaprogramming so this is the writing software that writes over for you this is an internally generated in this week and the end when you you can add one more like saying to Jason and you get this structure for example or you do to seaboard and you need Michael so then we explain how these works in practice [Music] [Applause] so basically we have for the faces we start by just inserting the bike actually well done with that what we have selected to perform that task because those notes in business there may be selected randomly so that they can correlate with each other and creating graphics relations is very vital functions so basically once the subcommittee of the house is selected their graduation transcripts that their victory verses specifies the data under physical specimens passionate acceptance we met in order to avoid failures provides from American sniper so radio space there are three different stages the first one is the source this means that they relate to the US because it's fun and they could be many as you can see then when we aggregate those data points into singers at the point 5 negative space similar to say like Moses which are run by the witnessing notes themselves and finally if we have moved a million homes that we threw ourselves how do we get this data well the values which are actually from my signals but I thought the candy house backed up to - so further information can be done by the request the creators for example and Apollo is setting the number of witnesses and what we selected is that so and so what they're gonna do each of them they're gonna post resources as the sources the aggregation script so that those three points and integrated into one single variable after that there is no bigger thing to win them but I am they don't do it the straightaway but they just use the recommend removal scheme press the first commentary [Music] so it's so simple to understand like the because it doesn't mean to know see the fabulous Odyssey so once they [Music] okay so once a result is included with me again the start from this was I think they will take it and you will a poster something original things the component you mention is that with a population and it is used by the nose here to meditate transaction occurring with them and showing improve it [Music] so yeah we start with basically the weights a package with the string antennas answer you can see how they can parse it Hodgman and then but notice that both of them has a spoke in the end so basically that means that both of them know how they referenced in the invitation so then we won't have a now and we have always think which will be you have as an example a sample trip we will have to do a filter using the division sound and then our production in item have irrelevant then the mean will be sent in but if we want to fit around the earth like let's say five for element and then the means we change into more smoothly average to say I almost want unit this is normally used in order to as I said so finally the tiny Street which is the one where we reach consensus among those are values that witnesses reported so it's gonna it's gonna look very much like the regression straight but this time it's gonna be run by minor notes so basically it takes a scheme to deal the deck the data points that business is provided from the aggregation strengths and introduces proceed over the output the game gets written two books and one available this is this it's very similar to the previous one but we have a more harsh internal right so again we can see how this future is important then nobody will explain values notice how without the filters interesting like a great integrity game in which money they know if they haven't organized it will behave naturally in order to prototype to maximize the profit you will not I see and also what we're doing is like most other signal in this last stage they get slashed why it is really important and critical because they read intense whisper to be tweeted I would provide examples understand better in my team way we have a gate operator it means we have a simple an array of different with this note and we are getting only the first time but that's me it means like an impact reporter and you will be some kind of a witness no that will have more power influence a result more if the chord and a minor choose which one it s the first he can then analyze how is the filter gives it up so that means no mean time scripts are coming so a similar reduced average in average customer again so you just gotta learn to fine-tune them [Music] I actually so basically this is this is using the frontal box with a palette retractable so that you can be out with the power projects just a few seconds so you would start just by doing you know from home and walks with net upwards means I will not do it right now because it takes a minute or so and we're not that time so basically this is our women request which is now a small javascript file where I imported the women because like me okay one source for bitstamp another pointless and then I got the applicator with dolly and then I do everything together yeah like this human and request at source but Saddam has started to test I said never get arrested Natalia and then I decide or am I want this they requested me to be performed by four different witnesses Frank McCourt different nodes in the network last for backup that's expect better explaining a documentation clustering then you can set the peace for all the stages or creating incentives for the minors including those those transactions you do box and you can send this case in this case there's a zero within which means that the Reapers can be immediately perform enemy doesn't need to be known in the future although for many for many use cases it's much more convenient to have it scheduled for the future or we can delay a publication of their request and yes zero and don't send it from if you win it until until we know it can be it can be so that's that's in a request or or making that word so we asked to return fire [Music] so when you when you do compile it all this is actually just winning no this is big in the name be compressed this is just doing a note if compress the years it's run in 2000 and when the javascript is run is producing the rain okay so when it creates the java screen and turn that into engraven it's it's doing some static analysis and it can tell that the sources are even flows fabricators given flow data is very focused we can change and we can see here what learns our type change so that we make sure that we are doing things right and that the final type will be one thing that we can assume from from from solidity so what what is d he's taking a nap on firing in through in into random byte code and putting that inside our contracts older as these so this is a Salinas contract that has the random bytes inside so if we instantiate these in our salinity with salinity contracts we have the bytes and we can send that into into the double bi to the winner which interface for it to be resolved by the winner so to use it we simulate for example this is a very very simple use case which is a prize build using win that so what we need to do is import in the day using women library and saying contract recipe is using women then that by emergence we are getting a lot of methods that we can use to control the vigorous lifecycle sending requests having their their souls rent and so on so here we are instantiating their request we need to embrace request body and then what we do is send in the request like this we met was request we pass the request and they feel that you want to want to set for as I we work for that rich notes to relay the requests into into weather and then when the result is ready which is guarded by this modifier we can read the result okay we read the result within a structure focus open system algebraic and the time allows your mother's recipes will resemble that if we do is okay we can know that we got an actual result there was no failure or if something failed because they gave me ice pain or anything like that we can go into a all birthdays so much weaker from from that situation I used to think of this as an option for if I cannot resolve this contract in a completely flat trustless manner you see we met in an automatic way with no latency at all I can make this price in half and really the agency that we work great if something fails I can go into some something like iron or something like that or recovering in that in that case something that important that has human intervention but I wouldn't be 99 percent of time running automatically without human intervention because that's a that's point so these in addition to producing the contract that contains device like these something else which is what my phone which is producing default constructor arguments and migrations so it is detected that at inside my project I have using women contract so in created here in migrations folder that you will be familiar a truffle to to migrations one is me poor that imports all the women to keep blessing and this will pass but it's doing is detecting if we are on that public into your network and then we are in a public into your network will link all the things related to this when its reach interface and relay and so on and if we ran a private network it will deploy an instance of the WPI and everything and they get that into your your contracts and the most beautiful part is that it brought also the day migrations for my contract and inserted the default arguments so it detects it can read the signature of the constructor of your contracts and put the all values so that you you only need to manually said anything that has not that before party let's say but for example it detected that the contract is expecting the address of the wooden bridge interface so it has the the address right there it just okay what we the women which interface that is like right now and it's just some reference implementation that we make that we expect other developers to create other implementations that may work in a different way but there is an interface with asunder as long as you abide by the internal interface internally I work differently so the developers have the freedom to use and other women women reaching the faces that is not there the one provided by by us so one man to life I just moved here as in case work so on the future frame one what the first the first thing we think about is going be honest in the best Expedia's basic Irina Raiden spot used on precision payloads coming from gift requests don't using HTTP but we can think of other initiators like taking data from IP is scored by going and so on or even reacting to weather events so basically giving your contracts a capability of sharing events thrown by mother during contracts or if you contract selecting contracts that believe on another network which is something quite interesting or events are occurring authenticated experience one other thing we're working on is allowing some implicit conversions so basically getting rid of the as map as a whole thing and so on we can do that because the operators are actually defined as stream part station by SAS map and so on so they are already explicit of from which type to which type so we can remove that because and it becomes obvious at some point and this this is one thing that we are also quite excited about is done because of house key forwards so super as I'm looking for data structures both both the body and how device relate to each other so how what's they hurt and because of that normally there's some kind of expansion for example for representing a 45x traditional here it's using goodbyes 1845 so there's no optimization here it's for a small integer so small new takers only take one bite because they are the bodies below 25 or about - 25 impacting automatically guesses knows that it's an integer so we can turn this screen into this other in which we are in basically model 16 for all the operators and as we know the change of the types we know actually that five year actually means 45 one is 61 and so on and we can leverage that the way that works and we tend those operators from 2 bytes into a single path and in this case the reduction is around 30% because we have literal span in the Suites where we have very low amount of leaders and we are just dealing with changing the shape of the data and not using gets turn deep like this and so on we can get after 50% say which is a very important for alert for long term ability of men also you can feel that with being a Frieden as something that goes beyond witness beyond or networks actually because on Ibiza at the end of the day it's a versatile a sale for performing data flows for the final data flows and performing operations on the way so it could be used not only for women but for other particles or writing scrappers for the indica from from angular for making the next installment of tools which are quite common in the banking industry for example and so the work we will be doing a brennan in the medium term making a generalization and detaching it from the cabinet from from women so that we can have a higher-order radon in which developers can define their own stages in find their own operators and so on and just leverage let's say that the abstract syntax behind in all the tooling that they can transform that into may serve in their various case so when will we be able to use within frog into your main name again we are here we are almost there okay so we need itself and has its own blockchain you know it's like a nice change to a few exciting by this email we saw before with a rope relay and so on so right now in a dissonant is connected to two difference if you're in this net screen to be inverting and it's pretty too late we've they're all the tooling is right there we are working heavy on improvement illumination and so on right now the visual information that we need to type and you have really comprehensive tutorial for creating the correct speed that we that we saw before and right now undergoing audits and we are doing a lot of distress testing or their for the following months we also want to work on more bridges too because technically them is done and some way for cannot speak I mean that it's it's bound to serve as many different my contract platforms as possible and it's expected to be launched on maintenance for every next year so the price P is pretty low level affinity for writing things like define utilities that we can create many funny things in in a really easy way and in a decentralized way that was not possible before so or especially for tech con we try to push the limits of what we have ran out of all the tooling and what tween n is right now and we came up in this small that that guy it's called impressive it's our rinkeby Holly story complete in a few months we can migrate time maintenance and basically it's a potential market for the point prices [Music] so you can try to predict each which point we'll be performing best tomorrow so you can see here all day all the prediction volumes for each different for each different comparing different cryptocurrency right now is is waiting in a surprise and here are your return so we can I think I can double down on Connie's so let's go with speed if you see you point to send dick so this is for tomorrow's markets so they can predict what will happen tomorrow and that's when as tomorrow finishes I can we throw my price and buy if I'm one of the winners because your turn your potential we pour for you for each option and then for example we can see here is the yesterday's market predictions for yes that they are close okay this work open yesterday but uses the market work today actually this is tracking what is happening today so tonight it will be closed and and what will happen is that the contract behind this will send the data request with that women will attest what's the actual result and consuming from three different price api's and will aggregate everything push the result into the smart hunter behind the tablet and it will allow the ones that hold it for the most performing and ripped off to take a share of the other price okay so make sure to check everything so that government see how the markets all paths which are the winners and hopefully get some drinking it game so the witness knows only you guys right now behind this not okay actually it's totally like an open for anyone drama doesn't know reason very simple I can follow one right now like longer run it with that we met trust [Music] so this villainous on that note in there [Music] so many let's verify the execution of the telling on face yeah what what happens is that as soon as you have the reveals anyone everyone knows the Italians so they come free communities the results of Italian and n105 as the talents of reasoning blocks what that means is that other nodes reject blocks at the named wrong time the research the motivation that's that's no one there citing damn the result is brought about you too for example and that's very funny so there the winded reach interface actually verifies the transaction who SP realization it verifies that the transaction belongs to women and that that has been accepted as they dumped by the women Network as they tally for that particular request so this is now singing you know right now look what happens to the bees and like witness presentation if you have your persistent or intermittent error on my API like melmac peso gets 500 the other three battle response that's that's that's quite important dirt in two different things India campaign campaign out of the loop and if it's true that I know want you to take really prominent from that because they are not guilty for that the witness in notes so what happens is that the slashing right now is on reputation so there's actually some repetition system behind these which simply as a score of how often and how often every single mode and most part of the majority let's say how often they were not figured out by tally function title is pits great mental skills so it's important this like to design the tallies very very well so as not do that kind of stuff but then it's true what some attacker who come with some crazy request that varies really really cheating angry eyes so as to damage the system but actually the way that the reputation system works kind of prevents that because repetition is pretty volatile and change has really really fast and gives you if you try to plan such a thing that the point is that you cannot decide who to punish actually because there because the witnesses are randomly selected to do so okay I will cause some notes to be managed and some others to be rewarded by I don't know who they are so this what it's actually just accelerated in a way that the system redistributes presentation.we between main and not because and at the end of the day their reputation on task from emigrate which means that just because you have repetition you lose it so basically in the case overtime if it expires so you cannot have their purification for forever and it's all the changing hands so if you do that you just jack you are just accelerate that process so it's it's good for the system I just hope you didn't on this time and have it sitting in this table is this something about if I read the white papers that sounds pretty interesting so I mean in those in these two years it's 90 20% what we outlined in the white paper we have pioneered orientation site that is released it down into the basically tending to really understand what we're done here so I think that will be quite quiet because they the white paper is wet expensive here cousin to publish independent research but and technical content on our video a lot and all over a specific areas like repetitious and many different parts so okay thanks for coming [Applause]

Automatic transcript — names and jargon may be misspelled.