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

Loading player…

Smart Transactions by Vlad Zamfir | Devcon Bogotá

DevconSat, Oct 7, 2023, 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 Swarm, IPFS and more. https://archive.devcon.org/archive/watch/6/smart-transactions/ Smart Transactions act as if they know how they are being situated and whether they are being treated fairly. With context dependent semantics, uncanny awareness of the future, and mid-execution access to actual and virtual services, smart transactions challenge us to elaborate on Ethereum’s transactional semantics. Speaker(s): Vlad Zamfir Skill level: Intermediate Track: Opportunity & Global Impact Keywords: Transactions,MEV,time 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 6 was held in Bogotá, Colombia on Oct 11 - 14, 2022. 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

foreign [Music] who said hi just now I didn't hear hi all right oh great thank you so today I'm going to share some exciting research that I've been doing I don't know for the greater part of the last six months eight months nine months I don't know most of this year not not that this is the only research I've done this is just the most exciting stuff the stuff that I want to blow your mind with right now so I had to cut out a lot of content from The Talk so I'm going to try to go through it quickly and add it back in without slides because I don't think I'm going to make it let me just take out my notes just in case I get there and then I need a refresher all right hey everyone so smart transactions sounds great it is um a prophecy of a new paradigm it's basically a prophecy because it's not something like I decided I'm not like imposing this on you guys I'm like making a prediction that you're going to agree with me is like sort of a sound prediction and then the only thing they might be imposing is accelerating the timeline which is sort of maybe my fault if I'm accelerating it but it's not my fault it's going to happen this wasn't me it's like a pair I'm like the prophet here it's I didn't do it so here's the prophecy basically ethereum transactions will become smart which means yeah they're already programmable network but they're going to become context aware in this way that's like characteristic of smart products that like sort of like you should you know you go you walk beside them and then they start like breathing and like knowing what you're about to do and you know they sort of like act smart um in a way that's sort of more than just programmable network but actually like they're they're reactive to their context um and basically that means sort of over their actual impossible Futures in this context and also over their uh over like this this their context and we'll get into that a little more detail but like today relatively speaking let me say that transactions are dumb and blind basically transactions today are not smart and they will become smart uh in the sense of like smart products which is like a kind of kind of research in product design where you try to make products like yeah programmable networked and reactive to their contacts in order to you know in order that they act right depending on what's Happening to them actually so basically ethereum is and has always already been uh profoundly disrupted by unexpected semantics of DVM like solidity and the re-entracy or like just all sorts of weird quirks you know it takes a lot of time to become a City developer because of the weird ways that behavior behaves that you wouldn't think and basically this has come to a real real head now with Mev where sort of it's much very much not the expected transaction semantics it sort of like it ends up being like the worst possible semantics that could be interpreted for that transaction and sort of it ends up being kind of worst case execution reintermediation censorship literally um and this is actually putting all blockchain communities into crisis into like a deep constitutional crisis so like what is a blockchain even like what is a transaction what does it mean what does this transaction mean because like all the different possible ways it could be executed in different context um and so especially what does it mean if it's not just sort of included in a block in this sort of natural simple way that we were taught in the white paper and like all the white papers even so basically transactions faced an evolutionary pressure due to these changing circumstances and they're basically like in fact de facto changing semantics even though in some abstract computer science sense like oh unless there's a new unless there's a change to ethereum or their semantics aren't changing actually when people when the transaction pool changes when the way people order them and blocks changes it changes in fact the transaction semantics and so and they're going to become aware basically at first slowly and then and then a lot and any of these search awareness basically will start and is starting out as a sort of really minor uh little hacks and it's going to become sort of much more much more aware so basically today you know you might pay out Nev in a favorable outcome in the future you'll be much more actively and much less packively interacting with the search in order to get better performance and sort of a better even understanding of how your transaction is being treated during the transaction Zone validation so that was the prophecy basically like because this same pressure by Mev transaction is going to become smart the semantics are going to be totally different than what we recognize today because basically um well I mean I'll get i'll get to exactly like how and why that's like a secured prophecy and not like a speculation so let's talk about the past like how did we get here so we have this um this Dark Forest basically we have I call them ethereal predators in the dark Forest because you don't always really know what happened and how this all went down worst case performance freak liquidation is still an Arbitrage hijacked hacks it's the stuff that we love to read about but also stuff that really hurts people when they transact financially and just in terms of like imagine you're trying to like be a white head hacker and then like your white head hacking gets hacked by some like front running about it's sort of dark um and basically transactions went into hiding because of this they avoid the mempool they use trusted Searchers they basically try to eliminate their men in order to avoid this this this treatment and this is like what I consider to be sort of dumb Behavior I mean it's a little bit smarter than getting wrecked right away but it it could be a lot smarter really um so you know we have also this concept of good Mev not all Mev is bad right um and I think this originated with Mev tips in bundles but I wasn't around so someone could correct me later that's great um and you know so that sort of distributed power from the the sort of big bad minor who was supposed to take all the med to Searchers who are supposed to be like sort of the good guys protecting your transactions and giving them the ability to influence the block outcome without just sort of this pure extractive politics more like you know we pay for the thing to win as long as we win the auction you know and we're providing a good bundle that's that's good and then there's also this sort of really really I mean nascent kind of good map which is like the saving and out of gas exceptions which is sort of like a really classic thing that like Mev was sort of built for from the start we're basically like sort of the space really was for Traders who were getting wrecked in this uh gas price auction and so the gas production became Mev and then there was a good Mad Men have asked people sort of you know exploited and also try to defend themselves and use it as a sort of lever um and basically um you know I really have to power through here so basically you know I I sort of um picked up on this research um this this year right I ran again got into the AV space basically when I realized that there's this thing called Mev time which is like sort of the time when the search is happening when the time when the search for this like bundle or block is happening where you can actually interact with ethereum transactions in a sort of on conventional way basically rather than sort of only having um you know interactions with transactions you can actually interact as the Searcher with the transactions directly basically by you know the Searchers have been adding their own transactions to bundles and interacting with them to like sort of take our profits in the normal way um but sort of to directly interface with them via like an i o interface where you just like load values and they read values um it really opens up the ethereum transactions to a credible sort of semantics by basically letting you interrupt transaction flow do some stuff and then continue transaction flow as the Searcher in a way where you can sort of update Oracle values many times within the trace of a transaction you can do all sorts of operations in the middle of a transaction and sort of in some way violating atomicity but in some way it's not because ultimately you still have the same you know bundle of transactions just that the bundle was set up in a way where the earlier transactions are put in as a function of like what happened in the middle of the other ones so it's sort of really just Mev time interaction with transactions really opens up non-deterministic semantics of the evm now instead of having like you just literally have the evm choose arbitrarily and then like your the Searcher tells you what you chose and they have like an incentive if you tip them good to choose the right thing and that actually um not just lets you take advantage of these Magic not her music choices but lets you have more information in the transaction than you than you could before you should literally just give them anything with like an oracle at it maybe time during the middle of their transaction execution and so this is actually um a tremendous uh change but however it's not really secure today because of the way that like bundles and like transactions can be reordered out of the search result that you find so you imagine you like search for this amazing interaction with the smart contracts sorry with the smart transactions uh excuse me no um and then and then someone else Jacks it and changes uses different input values for the same transactions and then you sort of get wrecked on your execution um you know basically like the search is not secure that means that these Mev time interactions are not secure um but if they can be secured actually um uh basically anything a Searcher knows can be given to the transaction and they can use it they can become aware of not just their execution on this Trace but all the other counter factual timelines they have many possible presence Futures and pasts because that's sort of like what transactions are like before they're included in a block and finally actualize so basically you know um we have sort of with nvd time interactions you can transactions can become aware of like sort of this superposition of different possibilities and counter factual traces that end up being very very useful um and then and basically um we need these we need these searches to be secure basically like I was saying earlier and so basically I did a lot of research as a result into securing the semi-v search like how do we secure the search results so that it can't get checked uh that the transaction receipts can't change after you sort of like finished search like those are the ones and they can't change um thankfully I'm like happy to announce that I did succeed I'm not sharing the solution I'll share an outline um and therefore uh and therefore I could make this prophecy very very comfortably because basically if it's competitive enough viability is inevitability um basically like it's like strictly dominant over over dumb transactions it's possible we can do it and it's going to happen because like the the competitive pressure is too great uh and so this is sort of this argument I like to say underwrites my prophecy um sort of signs off on it um and and basically it's sort of you have to take it for granted or you have to believe me that I can secure the search but if I can secure the search I can do this Mev time interaction I can inform the transactions of anything basically and then they can sort of do this crazy stuff of like lots of like wild magic which we'll get to very soon so what is the state of the art in smart transactions today well this is sort of the state of the art in my tech research the economics and law and like other research has been sort of uh there's not enough time for for all of it unfortunately um so basically smart transaction infrastructure is basically a story of store transactions like pulling themselves up by the bootstraps using a little bit of awareness to get a little more awareness to try to get sort of you know uh very secure basis a lot of awareness for the transactions and so I split it up into phases that are designed to be sort of acceptable to our current normal trust model at first and then deviate a little bit only as necessary and then come back so that like it's a minimally politically objective objectionable for everyone so basically in phase one we save gas in this very classic way of like not doing those pesky out of gas transactions save one and phase one sorry um we we have semi-automacy which means like you can execute the prefix of a bundle you can't choose the suffix or like anything that isn't a prefix so it's like not a Missy but you least you sort of I can restrict using the evm's rules only sort of that you can only do a prefix I'm using this thing I call cumulative validation it's sort of like a you know it's going to invalidate if anything else invalidate it and also it's cumulative math to sort of like say stores up the map and then paste it only at the end of the bundle kind of story phase two is the interesting one that deviates from like the current trust model that people have which is basically I'm saying like oh you know we actually need to like essential it's essential that we trust the proposal for a moment just for a moment just for like this phase two we trust the proposer and then in phase three we removed the trust from the proposal by sort of locking down their commitments making it making them like unable to screw us so basically in phase two we sort of normally are very uncomfortable with because like the whole movie space has been set up to defend you against the search and I guess the proposer but I insist it's necessary there's no way to do bundle protection without this if you try to do it without the proposal you won't be able to do it the proposal is so important he's either they're the they're the signature on the Block they make it a block you can't make a block without the stake validator it's just not a thing like they're important for building the block there's no such thing as a block Builder is not a proposer no offense I'm sorry I wasn't even supposed to say that I take it back yeah um basically the today we sort of had this idea we don't trust the proposal but we really got it we really got to in order to get out of my City full of atomicity and then we can lock it down not trust them anymore in the next phase and then after we have the the atomicity of these of these search results basically and like sort of like the guaranteed like full inclusion of them fully or whatever um then we can open it up to basically all source of smart contract development all right sorry again oh smart transaction development virtual and the virtual Services which is a very cool concept of sort of to the Mev server they're just extracting value for you to you you're getting a service from them but sort of like they're not a real service provider they're just they're extracting value from you from their perspective review for any perspective you're sort of hijacking that in the way that like for example like fruit hijack uh fruit eating animals in order to spread their seed as an example so here's um some more Tech City art stuff so this is an example of uh formal semantics of what I call Smart transitions so smart transitions is sort of like a idea that comes from Smart transactions it sort of generalizes it to like all sorts of different computer science um this is like a system for describing distributed systems that I'm doing all this notation in there's going to be a paper release about this should have been today but it's gonna be like tomorrow or maybe the next day like latest um so like look out for this it's going to be it's going to help you understand this but basically we have like a a labeled State transition message production system V and then I can Define another one or which has these Special Operations duplicate speculate and validate which is going to do basically a speculative execution of this other system in order to see in the future whether the thing that happened was supposed to happen and then validate basically the current transition based on like what happens many transitions down in the future sort of violating normal transition semantics in a very very interesting way which I call Smart um and basically the the idea is like they can sort of look into the future but in general um you know far and wide all over the place so basically here's like the transitions so let's just like go through them quickly duplicate takes a state creates two copies of the state if you try to duplicate an already duplicated state it does nothing uh speculate basically it only works on duplicated States otherwise it does nothing this one is on a duplicated State what it'll do is it'll apply the transition with this label L and this message m to the second state so the original state is left untouched and the second state is updated to the new state and then it outputs like a message in this like little temporary buffer zone um from that transition and so like it collects these messages and updates the state while it's speculating and then you can do a validate transition which will either do one or two things one of them is it'll it'll delete the speculative execution state or it'll delete the current like current state like the old State and so the one you just validate stuff it's like a few transitions later at least one transition later and then based on the validity of that transition you sort of either revert all the previous transitions or you sort of choose them you sort of collapse this superposition of like the old State and the new state you just get the new state so this sort of is a speculative execution transition system based on like a one transition and basically the amazing thing about this is that you can sort of implement ethereum out of gas semantics sort of like just with this basically you charge an account gas you do a bunch of execution speculatively thinking they won't run out of gas if they run out of gas you throw out all those changes you go back to that just after the charge state and sort of you can use this as like justify actually that ethereum transactions are already sort of smart just with respect to the out of gas exception that is that the block is aware of on the sort of block limit uh transaction uh limit sort of uh um level I mean the block I mean it might be the validator or something you know and so basically but this idea of like validating based on what happens in the future uh sort of it could be done much much more widely than just out of gas you can just sort of refine those validity checks to add whatever constraints you want um you know you could you could have you know more than this amount of men of like better than this performance as you revert Etc and the nice thing about this is sort of okay that was one specular execution but we do the same thing where we do many many many specular executions where and then this could sort of very well encode uh at an EV search where basically you're just trying a lot of different possibilities and then you can validate based on the whole search whether you'll do any of those Transitions and which one you'll do and that's sort of like extremely powerful semantics um but that's just looking forward I mean like and this stuff really can look back and a different alternative presence either also which is sort of it's sort of a trip and sort of really really helped me get intuition for quantum mechanics randomly um anyways so use cases challenges and implications there's there's stuff from the slides I haven't read I'm trying to really rush through this um but some of it's going to come back up now I realize so basically there's a bunch of stuff that's used before first I'm going to stress again the infrastructure and the way that it's pulling us out by the blue structure bootstraps by like using transactions to make transaction infrastructure um and then also all all blockchain use cases I'm trying to say this is this is like totally dominant Paradigm um or basically like no matter what you think of you can do more efficiently with smart transactions except for maybe a simple send Maybe Jerry's out it's probably more efficient with smart transactions anyways um but it's gonna be more like a smart trans smart operation or something like that so basically long story short or I mean here's a bunch of here's what it says oh you know we have these Access Control lists that don't really work because like you sort of might get outside of them and then you still have to execute the transaction and then you just get it you just get less of a discount if it doesn't work it's like sort of a weird hack it'd be nice and we can do this to have access control lists that actually work without having to do any code analysis to prove that they work you just sort of try it and if it doesn't work convert it's great validation was amazing um we can save gas and pay without you this is sort of like classic stuff for Mev but the way that it's done in smart transactions is a little more Capital efficient maybe a lot more Capital efficient in some cases um rent as expected Mev to justify stated Ram this is sort of interesting thing we have like a long problem in ethereum about State rented statelessness and how will people have the state why will they know to how will they validate my transaction like now like how will they search it and the answer is like oh if you have enough if they expect enough amount of they they'll store it and they'll speculate on that in all sorts of ways maybe they'll even do it in a way that's sort of like public value as opposed to internalized value and so basically um rent actually comes in through the back door not through smart transactions but like Mev in general but I think smart transactions in particular because sort of they can be metal they can be rent aware in a way that's sort of like a function of what is happening on the searcher's realm and what the serger's policy is for what they choose to put in their Ram and so it could be like sort of very specific um and very flexible compared to like all the men all the red proposals so far automated collective bargaining pretty cool right you have a bunch of transactions with a bunch of people in your little Union and you decide hey we're not going to transact unless we're all treated good very very good very very good stuff you know we'll get that we'll we'll get those beasts from the Dark Forest get our met back um um direct economic interventions at all scales is very very cool you can basically use macro statistics micro statistics mental statistics and like just pay for those outcomes in a sort of very direct way that's sort of lacking today in like public policy or basically like helicopter Ben has a really hard time dropping money on people um but like sort of we see all the transactions on all the timelines like collapse into one and sort of like can pay the Searchers to for whatever policy goal we want it's amazing um just in time liquidity pools it's pretty cool imagine the liquidity follows the different trades within your transaction around just to serve you better amazing can't happen today because of the transaction uh timing and the operation timing doesn't allow for it um zero Capital zero credit trading this is very cool where you can do time travel to borrow profits from the future to do your trade now you wouldn't think but totally possible in ethereum today already um uh but just within the scope of a single transaction in the future it'll be across many transactions because you know an atomic block happens all at the same time which means at the end of the block have the same as the time as the start of the block which means you can sort of borrow the profit from the end of the block at the start of the block and sort of have it all work out uh amazing amazing um you can hedge quote unquote using exactly the cost that are incurred at the end of the block it's not even really hedging because you know for sure the cost it's like the most efficient it could possibly be for certain instruments and lots of other stuff but we have challenges still unfortunately unfortunately this can be very very computationally expensive simultaneously searching for all these Solutions at the same time for all these transactions especially if everyone's demanding them you know there's a lot of them uh it can be very hard who knows how the complexity grows in the search transactions it depends on what they're doing I could definitely design smart transactions that do really bad um for the Searchers and they basically don't have Solutions the more you add to them like you know they might have a solution subtractively for a few but then like the big goes so bad like you add 10 more and then just you can't solve them anymore and this is why this dos and gas Insurance Market is so important because like you kind of need they need to figure out like is this a Dos attack is this a legitimate smart transaction is it something that is going to have a solution or is it something that's we're wasting our search on in order because um it just computationally very difficult to find all these Solutions also you know I mentioned all these kind of counterfactual stats and claims and things sir the Searcher knows that but like why should your transaction trust the Searcher to give it the right values like there are sort of like challenge challenges with respect to verifying um these these inputs um especially efficiently um and then there's a multi-block issue which is like actually we wouldn't we don't want in some way transactions should like end in one block to finish to just finish validating everything in one block it's a very nice to have multi-block transactions and to do this efficiently is a challenge especially composed with all the other search so rather than all the searches being sort of like this block imagine if you have searches on different timelines um sort of uh for different transactions that are executed in different timelines so and also there's a whole search organization problem around this like how do you organize the Searchers actually so basically but like very very interestingly that this sort of has actually a lot of implications beyond the sort of birthplace of these transactions as sort of you know this Mev space where basically you know you're responding to this meta search uh because actually like the smart transaction validation is sort of very wide it doesn't need to be validating anything to do with map and this sort of useful industry the systems in a broad way is in transactional systems in our very broad way and especially smart transactions are sort of not just Mev Nev is sort of you know like an economic thing it's like only one side of the story they also have really amazing computer science Innovations not that the economic stuff isn't great I mean the risk management customer transactions do like that hedging that I was talking about earlier amazing basically can really really make things much more economically efficient and then sort of like um legally if you will it's very low liability to hire quote unquote uh or to be a virtual service provider because you're not a real service provider and and so you're just extracting money or just being sort of a selfish maximizer which means that you're limited in liability so basically unfortunately out of time this is my concluding slide and they're missing a will there oh no they do they do actually revolutionize now ethereum is transactional semantics and sort of like that's like sort of um you know the prophecy and like sort of like the fact in the future which is sort of like I guess what a prophecy should do thank you so much everyone really appreciate it I have more I have more come come see me later thank you so much so much lad and sadly there's no more time for questions but I'm sure he's going to answer a all your questions over here um yeah outside the outside yeah outside

Automatic transcript — names and jargon may be misspelled.