Ocean Protocol
ETHCC 6 · July 2023 · 43:02
Trent Mcconaghy discusses verifying token-engineering designs, from TokenSPICE EVM simulation to AI-assisted computer-aided design, in a presentation on Ocean Protocol.
Speakers
Topics
From ETHCC 6, hosted by Ethereum France.
Transcript
[Music] hello hello awesome great so uh hi again everyone um Talk two of two today and it's a different talk um but actually experiences going back more than 20 years and I realized that there's some some experience to share here and things that I've done and that can be helpful to the te Community that's what this is about the title is token engineering verification verification is a very particular word so I took an engineering verification from token spice evm simulation to AI powered god let's get started
okay so as an outline I'm going to motivate the problem by just talking a bit about dollars and defy hacks then I'm going to give some history about circuit verification then I'm going to bridge from circuits to tokens for verification and I'm going to discuss what this looks like in tokenland where we're at tonight today but where I dream of us being in two years five years and so on and then so let's get started so um there's always stats on crypto because everything's open and stuff and here's some stats from last year there was 3.8 billion dollars in hacks of that 82 3.1 billion was in D5 of that 64 was in bridges and 10 was in Flash loans so
75 um of the defy hacks last year of the three billion hacked was in two things ridges and Flash loans um which is kind of a problem right um overall I mean the hacks is a huge problem but it comes down to even just two things to as to the biggest um and the hacks keep growing right crypto keeps growing so the hacks keep growing and um it's also a sign though that we haven't um we're not there yet in the tooling to stop the hacks in in their business we're getting better but I'm going to describe here is there some like going on back there because it sounds like someone's I don't know opening a candy bar okay if you I'll take the candy bar though thank you awesome
okay um all right so basically um you know we can do better is the point so let's just talk a bit about the status quo when it comes time to verify your design let's say you're um you know a protocol organization maybe a startup maybe older and um you write your solidity some more contracts and then maybe you write some unit tests do some system tests um you you hire an auditor you know if you don't want a good one you wait a month if you want a good one you wait six months or nine months um and then you know maybe you're going to do formal verification with slither and these sorts of tools and people are starting to play around with loms as well right so that's kind of the status quo right and working with the auditor you iterate back and forth and
eventually you're good once you go live or maybe before you might engage things like immunify for ongoing bounties and that's also a best practice so that's the status quo now before I talking with a problem I'm I need to download to your brains um something which is what's the difference between analog signals or systems versus digital signals or systems um so the core is the following um the the real world in in real world here in real life everything is analog it's continuous value time flows right but along the way um inside computers we discovered that it's much easier to do Computing if you abstract it in two particular ways you abstract by saying things are just true or false on or off and you abstract with
chunk chunk chunk clocking okay but if you loosen from and that's when we do programming and all that it's all digital computers right so we talk about the world being digital or going digital but even in this very digital world with silicon and Computing analog is still there everywhere right and a way you can think of what it is there's this balloon that keeps growing growing growing and inside the balloon that's all the digital stuff but the edges of the balloon the the balloon shape itself that's the analog and then there's the rest of the world so analog is always this interface to the world um so digital is easier to reason about but you can't abstract it all away right you need to interface with the real world Etc and that's where analog comes along so um this is just very good to understand
okay so going back to verifying tokenized ecosystems our blind spot is analog okay so um all these things I gave it before they are all verifying the logic of smart contracts logic is a digital thing it's a Boolean thing right we have large gaping holes in our approaches for example analog side gaping hole flash loans it's an analog thing right it's someone basically instead of just putting in a little bit of liquidity or something else it's a huge amount right or incentives that could kill sustainability the last couple talks talked a lot about that right also when you have analog interacting with digital this is called mixed signal in circuit land because we're not modeling analog
we're also missing the the mixed signal in analog land this is things like a to d converters like um and so on and then we're also missing typically Beyond one virtual machine this is Bridges right so we might have um chain one with one virtual machine one that we might have tested but are we also doing chain two with virtual machine two and Bridge often with its own VM or otherwise right and the interactions among that this is a blind spot as well so it shouldn't be surprising that we have billions of dollars worth of hacks we're not properly testing this stuff folks and it's not just testing it's verifying it's knowing that you've got it right so how do we fix this and to me it's actually well a bit of history in fact I think I'm going to get there next yes so
a bit of History before I came into blockchain land I spent almost 20 years in the world of semiconductors and specifically designing CAD tools for semiconductors specifically designing analog CAD tools to verify analog chips so this to me is near and dear to my heart and you know as I've seen things grow especially in defy it's become really really obvious to me what could be done and this is the first time I've actually spoken about it publicly in a big way and it's my pleasure to share with you where we are and what we can do so first though I need to download your brains about what circuit land looks like what are these tools like Etc and then I'm going to mirror that into token that okay so the semiconductor industry um first of all this is a massive
industry it's one of the biggest industries on the planet annual sales every year is 550 billion dollars um and the total market cap is about 3.2 trillion dollars so this is huge right um and here's some of the biggest companies you'll recognize the names are most Samsung Nvidia Intel there's lesser known ones like broadcom or tsmc tsmc manufactures more than half the world's chips um and more and why is this so big it's because chips are everywhere there's a chip inside here probably five there's probably 30 chips inside this computer there's 20 chips or 30 chips inside your phone the data centers everything there are chips all around us this is silicon it's the PCB and the chips on top okay so this is a massive massive industry
um and it's changed everything but if you think about it right um if if I'm a design team designing chips there's maybe a 10 people 30 people 50 people Max maybe you've got three months six months Max to design and ship a chip that has 20 billion transistors right how the heck do you manage the complexity of that you're not going to do it manually right you actually do it with software and it's not just getting the thing out the door you've got to minimize power you've got to maximize performance you've got to minimize area you've got to maximize yield and you've got to all do it within hitting the time to Market and that counts for a lot right so there's a huge dollar incentive to make to make those numbers great right people are willing to spend a lot
of time and money to do this and so like hinted software can help a lot so there was actually an industry born dedicated for this there was um some tools beforehand but in a boot 1980 there's actually a breakthrough textbook um by cover Mead and Lynn Conway which laid out the different layers of semiconductor and pointed to the cad tools and that was really the true birth of the the Eda industry electronic design automation or call it the cad industry for circuits and um it's on a 16 billion dollar industry on its own so maybe yeah sure it's whatever five percent of semi whatever but that's still a huge industry on its own this is just for people making tools making software to design the chips with okay so um and it's this industry that I interacted with but of course the
customers are the intels of the world okay so if we look inside the tool types remember this is Industries all about making tools for chip designers you know the chip down designers these people are trained as electrical engineers maybe they go on and do a PhD in an analog circuit design or something else to specialize in and uh so there's the way the industry is shaped there are three big players Cadence synopsis and Mentor Graphics which is now part of Siemens okay um and uh so this is just from the synopsis site if you look at its tools it's got like a whole bunch of different categories right because it's huge but there's two main categories there's a category for design and you know there's things inside that 3D IC design test Automation and so on and then there's verification and verification includes simulation but also a bunch of other
stuff so there's a bunch of different point tools for the different steps of the flow and you might ask okay well what about the steps of the flow um and actually I'll get to that in a second but um I mentioned the difference between analog and digital before but how does this manifest as a circuit I'll just give you a list so for digital at the smallest level you've got things like and Gates and or Gates but then these get combined to larger and larger sizes adders multipliers than muxes then gpus and CPUs you've also got things like digital filters you've got memories those are officially digital when you try to design them it's more analogy but they have a digital interface um and then so you saw this and by the way when you go to design digital circuits you're generally writing code in fact one of the leaders of Intel I
think was Andy Grove how to quote something like microprocessors are Simply frozen code right so um so this is an example of people writing code sometimes they even write C like code called system C and it compiles to RTL resistor transistor logic register transfer logic sorry and then that compiles to physical Etc but when people are designing digital chips it's writing code okay and of course it's always like easier to reason about when things aren't visible writing code all that right so if you go to the analog side the analog types of circuits are things like um you know your cell phone how does it talk to cell phone towers back and forth that is RF receivers and transmitters or transceivers right you've got power management you know how does the battery
feed the rest of your your cell phone you've got clock generators to power the digital stuff you've got 80d converters data a converters you've got amplifiers like I'm using right now to amplify how I'm speaking and analog filters so you've got and this is you know a lot of the core building blocks there's more but it gives you a feel and interestingly notice how these are mostly about the interface between the real world and digital so this is not going away a lot of people have thought you know with the rise of digital analog circuits go away they're not right they are as important as ever and quite often it's you know maybe analog has maybe 10 of the Mind share but it's often 80 of the problems right especially when it comes to verification and that's why I spent a lot of time there because I
wanted a help um so overall there's actually two types of Eda tools and we've seen some of the previous talks talking about you know different steps DDD and so on in in circuit land and Eda land it's really broken up in two places design and verification verification includes simulator in terms of Market size two-thirds of the market size is all about verification simulation and verification so if you think of what the tools right now that we've been seeing discussed before here in tokenland it's really been a focus on design but the real challenges are in verification and we see that we're not there yet because of all the hacks okay so then you need to say okay analog and digital so you've got digital design digital verification analog and Signal design analog and mixed signal verification it's four
different categories and each of these have many subcategories but this is how to think about it I did two startups in a PhD in this world so my first startup was about analog and mix signal design and my second startup was verification so I got to straddle both okay let's talk about digital CAD digital Eda so this is and design I'll start with design go to verification this is an example using um uh Siemens in this case so Mentor Graphics tool and notice how people are writing code up here and in this particular case it's writing code and using a compiler you know we're used to writing code using a compiler to go to assembly then machine code here the compiler goes to RTL and then you can actually take the RTL and go to a physical mask layout it's manufacturing
instructions okay so this is an example of a digital design tool but of course once you've done the RTL and so on um and then you want to go to layout so this is still part of design and remember there are lots of different design tools usually for different Niche problems there's competition all this um and overall there's a whole bunch of different flows too so synopsis has its recommended flow using this synopsis tools up here we've got the design and then system design and digital design and then the whole bottom two thirds is all about verification and there's a big also subset of verification called sign off but it's just part of verification so it just helps to emphasize how important the verification side is and how that's such a blind spot here in tokenlonde okay
um here's an example of um digital design and verification I just did a Google search for the top uh three uh firms and then digital design flow and you look at it and like even just from this first page right there's 10 different flows so um here in token engineering line we talk about the token engineering flow there's not going to be the token engineering flow there's always going to be 10 or 20 or 30 different flows and as we use tools more and more and more it's going to be guided by the tools and there's going to be an interaction back and forth this is really important to understand and I strongly believe this because this is exactly what happens in this industry the 16 billion dollar industry that absolutely Powers this 600 billion dollar industry so this is how it is okay so that's digital now I'm going to
talk into you know my sweet spot analog analog Eda I'm really going to drill into this okay so first of all um when you want to enter a design uh you you don't have the luxury of typing in um code right so analog designers they think in terms of dynamical systems very much like control systems and they actually draw this is a transistor transistor and then they draw the wires between them and this is an example of an op-amp it looks like an amplifier basically and this is using one of the leading in fact the leading tool for schematic entry called Cadence virtuoso and we've seen some emergence of this in token land right machinations has a pretty cool schematic editor and there's more great um and this is you know a starting point for entering the designs and there's you know off-the-shelf free schematic
editors too there's probably 30 schematics out there in the world but then you can also get to fancier design so here's a tool that my previous startup developed called Fast design sweep and in this case it's um doing sweeps been incentives across across three or four variables it can go across 100 variables yet still not break the bank computationally because of some fancy AI under the hood I'll get to that later so this is an example tool to help explore the design space but then also you can have tools for verification and it turned out that um you know this only got really good once we could have once compute power was fast enough for splicing the loop and I'll get to that too so this is an example of a verification tool to find worst case Corner conditions so in this case in
circuit land the main three are process variation a voltage um basically is the voltage Supply 1.2 volts or 1.4 volts and then temperature is at minus 20 degrees is it plus 50 and you basically have to run through the whole space and find the thing that really breaks the design the worst okay and to give you a feel this was a highly successful tool um basically 19 in the top 20 semis adopted to this everyone except for Intel because they build their own stuff every single chip that Nvidia has shipped since about 2010 runs through this tool so um it's become standard practice and they do this because they don't want their stuff to break right they've got gpus to ship to the the crazy AI people Etc so this is what they do um so that's um to give you a feel about uh the higher level of the tools I'm
going to drill even deeper now into some of the pieces below so the beginning of this all is spice stimulation and um so to give you to help motivate that here's another analog circuit it's another amplifier basically and the question is how do you maximize this game time bandwidth and if you really want to be like a pro analog designer to really know what you're doing you're going to go get a PhD and there's say five or ten really top schools in the world for this you know there's probably a hundred great schools for digital analog is much more rare I had done my first company realized I really didn't know analog design that well so I went to one of the top it was the only School in the world can you live in in Belgium that had great analog designers and great CAD so I went in there and I
subjected myself to the pain from these world-class designers and got them to teach me analog design one of them is Willie Sanson so he wrote a couple textbooks in analog design about systematic analytic design so instead of just flailing around how can you design analog circuits In This Very systematic way and one of his big tricks though is you write down the performance equations for this and then you add one constraint at a time until you've removed all the degrees of freedom right and this is a very good design and notice there's no simulation yet this is all in your head so you basically make sure you're good conceptually and it's not easy to do you really have to think in a very particular mode but it's actually super fun too when you get into it it's like wow and I'm still not a great analy
designer I'm really like bottom one percent but um I had the great Fortune to work with some really great designers um so how do you verify this right so you've done this all on paper how do you verify it and so Along Came this idea of spice so in uh as microprocessors were coming along in the 60s um right on the heels of that um because it was so close um so similar people immediately realized they wanted to simulate circuits analog and digital so people started building these simulators in the late 60s and early 70s and this guy Ron rare he started a class project he got each of his students to build a piece of this simulator called spice the world's first great circuit simulator and um one of the students just took it and ran
with it his name is Larry Nagel this was out of UC Berkeley right next to Steve Joy so they actually licensed it BSD on running on on the BSD um the Unix as well so basically you take a net list it runs through the spice tool and it spits out waveforms basically all text based but and you can build the tools on top so this came out in 1972 And this is an open source code there's lots of Open Source spice now but this is you know the roots of it spice and um so to elaborate on this basically you do your manual design you know the Willy sounds of the world drawing your equations out Etc and then you enter the net list it's basically you know text like that and then you run spice and you get your results and that's your way of
um basically very simple verification um after you've you know you're happy um so so that's outflow and that's been a standard flow for analog circuits for many years um here's an example of the net list there's basically a bunch of lines to declare you know for example this resistor goes from node two to node 0 with a resistance of um 10 kilo ohms and it lays out all the different parts and on the bottom it specifies the different analyzes do a transient analysis to an AC whatever whatever okay and by the way spice has since 1972 you know for 10 years 20 years it grew grew grew but it's still around in a big way so I did a Google search for Spike simulation and there's just a gazillion results right um all these different variants of that so does an industry um
given that to um analog um it's about a billion dollar market just for spy simulation maybe 1.5 billion to give you a feel right um so there's P spice and tea spice and all of these different simulators plus the big guys like Cadence have their own versions Cadence is spice like Simulator for example is called Specter so this is a thing but then um in the mid 90s something happened computers got fast enough that you could start to realistically consider having Spice in the loop and spice is really nice because it's actually silicon accurate these models of transistors have been calibrated against the process itself of whereas everything before they would try behavioral models and stuff but it was off so um splice was really trusted but until the mid 90s you could only afford enough compute to run it
once or maybe five or ten times but um by the mid 90s late 9 knees you could afford to run a hundred a thousand even ten thousand times and clusters started from Orange two so that's what happened spiced in the loop and that's actually where I did my first company too so you can basically have this emergence of spicing Loop tools where um basically you have maybe a manual initial design um you could also synthesize that but that's a whole other story but what the tool does maybe for design it might wiggle some widths and lengths and resistances whatever run twice see how it does you know what's the power consumption Etc and then loop back iterate iterate you can have a global Optimizer local Optimizer to minimize power whatever or you can run verification here too so this emerged in the 90s and several startups around this
Etc okay and um so my first company was doing this for analog design uh to optimize designs the second startup was for analog verification and here's an example uh well here's one for for design using model building optimization so anyway and here's one for um for analog verification in this case um this is for a memory a bit so let's say you have a one gigabit memory each bit cell assuming no error correction needs to have a you know much lower than 100 billion chance of failure say maybe one in 10 billion so for such that the overall one gigabit memory has decent yield right because a one gigabit is one billion bits so if you need you know one in a billion one in ten billion chance
of failure if you want to run Monte Carlo on that then maybe you have to do a trillion simulations right you know how long a trillion simulations take even if one simulation takes one second it's a long time but companies were doing this um Qualcomm was actually running this stuff on a clusters of a thousand machines for a month just to verify their bits all but if you're smart about it if you're thinking about it I and that'll still only give you this but imagine you can get up here with just five thousand simulations 10 minutes on a laptop so there was a lot of value to get there and this is actually what my previous startup did um and it made the call content in videos of the world very happy um and you can do this for statistical like tail simulation especially but also
for the worst case right in that case it's finding these Corner points like before uh so and in fact to break down that spicing the loop tools from an analog site so um we can break it down for verification and for design for verification excuse me um so uh you can start with nominal no verification that's just a spice but then layer and more and more and more stuff you can layer in worst case analysis Monte Carlo simulation that's not too bad you know to get to three sigma you need 1500 samples
High signal Monte Carlo though you need you know well sorry I've been talking too much so um thanks for your patience uh so you need you know a million to a billion samples there right to hit that and so when you somehow you need to drop that down for some time and then for design there's simple things like sweeps but then you can do optimization locally globally you can do synthesis where it's actually wiggling the shape like the components themselves popping in a resistor et cetera and then if you want to be extra crazy you can do it all at once you can do synthesis wiggling the variables having worst case design
having statistical all at once and that's where the really crazies out there right but it's actually possible um okay so and then you know I want I've already talked about some of these spikes in the loop stuff but I'm to give you a feel this stuff is all AI powered since the mid-2000s how do I know that because I was helping to build it and so this stuff that I showed you before how did we get this tail here which normally would take you you know a billion simulations or 10 billion simulations how did we get in five thousand and there's you know um people might say hey important sampling but that only works if you've got six or ten variables but an important sampling the variance grows exponentially in the dimensionality we would have even for a bit cell um 30 variables but then if you have a
sense amp you're talking about 10 000 variables and and other things so it just um you know the basic stuff didn't work we needed new tricks and we found in this case one example what you could do is you say okay I know the design is around 4.5 Sigma so I only need a million simulations so I just need to figure out which simulations do I really really need to simulate to verify and so we would simulate um once and also the things that have the the designs so you take a million Monte Carlo samples here you don't simulate them and then you take the ones farthest from nominal because those have the highest chance roughly of failing you build a response service model from that Nei model and then you use that to very quickly filter the simulations so we were able to filter a million samples on one second
on a CPU because we had you know just optimized the heck out of that and that's what allowed us to um so you would filter simulate the ones that were the most likely to fail um and then update your model and loop loop loop loop loop right and so that's some you know it sounds straightforward but the devil's in the details and then you could actually track convergence and this is super useful because then you can see if it's converging nicely here um it is you you can start to answer the question can I trust it and that was always the question we didn't have these plots at first but putting there it answers how can I trust it okay and we did the same thing for past pvt in this case it could be cast as a global optimization problem we used model
building optimization so imagine this is the true response surface and we're trying to maximize um the power then what you do is you take some initial random points like here random training points you build your model that's the red you build your model that's the red and then um you you simulate there and you build a new model and you iterate iterate until you have found all until you've converged and as an example here um this was the initial samples to build the model and then it optimizes trying to maximize this is when I found the maximum point and everything after this it couldn't find anything else but by seeing this convergence curve now you know you can trust it because it hasn't found anything else so that turned out to be really critical to adopting this
thing remember you can't you can't get a formal proof on this there have been you know formal approaches to this where you slice in dice things but this state space gets so big so quickly that you can't actually truly approach it in a practical way so you need to do things like this that are slightly heuristic but in practice they work really well okay so um to give you a feel this is the suite that my previous startup had done um and by the time we got acquired by Siemens um we had one two three four five six different key tools each tool had about three or four pieces of a iron in it so there's about 25 different pieces of AI in this so this whole thing was AI powered and it wasn't just us there was others too I just know this one well
because you know I helped to build it and so I knew it was under the hood so this was already Circa 2012 or so so AI powered CAD in 2012 to drive analog circuits right and that was the state of the art now you know it's gone that much further they went full cloud and synopsis and the big guys are all advertising Ai and stuff but the stuff was there 10 years ago 15 years ago okay so I've talked about circuits hopefully you found that as a very useful download of how this industry was right and I hope you're feeling fomo right I hope you're like wow I really got to get that into token land and that's what I'm going to show you where we're at okay so token engineering verification is a lot like circuit verification there's digital there's analog there's this mixed signal right so in um digital
you've got you know circuits the discrete time clock Stuff Etc um and analog I mean I've talked about all that but overall you know you've got a smart contract um and when it gets verified I talked about it being very mostly digital right the auditing Etc um and the analog though this is where you have incentives you have flash loans you have Bridges latency and networks all of this right the stuff that we haven't traditionally been modeling and then the mixed signal is the combinations so these things are very very similar okay so now what I'm going to do in the tail end of my talk is talk about token verification I'm going to drill into the analog which we're kind of missing some of the digital and I actually help friends from the digital verification world of circuits who did formal verification Etc I pulled them into this
world to help you know a few years ago and I hope it made a difference I don't know um and now though I see that we have work to do on the analog side okay so first of all um as a baseline for analog if you want to do this Pro you need a simulator that gets to the metal the whole thing about spice is that it's not behavioral it's not a higher level thing it's getting as close to the Silicon as you can so we need a similar thing for token land so when I say getting to the metal I mean getting to the level of the solidity implementation which goes straight to the evm ETC right or other VMS Etc too so uh you know no approximations go as close to the metal as you can so um so that's what tokenspice is and
um now there's actually I think a few others you know token spice I first released it I think two and a half three years two and a half years ago or so um and the whole idea is it's agent based and an agent could be pure python um or it could be python that's wrapping a solidity smart contract or an API or whatever you want right and the key thing is an agent has its own wallet holding tokens and you Loop one every block it's another step and each agent has an action take step and you can code out what that does for the python agents and for the smart contract agents um you don't code anything it's just a thin wrapper of python such that it all plays well together so that's the heart of it but then you can also track the metrics the kpis ETC from this okay so
uh here's an example of an agent wallet it's just part of the agent you know they have their wallets they hold different things um and critically right to make this not custom you have the idea of a netlist this is a specification of how the different um agents talk to each other right so the left um I'm creating an analyst where I'm adding a marketplaces agent a router agent to send tokens from one thing to another an ocean burner agent in this case um a mentor agent doing round exponentials and um oh yeah that one basically so four agents um this is one particular net list but in um this is all open source and GitHub token space organization token space repo and it's got lots of examples of netlist of different things
so there's the python but there's also the solidity side right so any of these agents that um that are just simply the python wrapping the solidity um then it's well it's straight up solidity so you can take any solidity code you want or any new code and use that okay so then the flow is very very similar to what we had in an analog circuit land you do your manual design where you draw out your pictures you draw your schematics whatever manually on your own or with a schematic editor once this come along and then you enter the net list you type it in Python and solidity and then you run you run spice token spice Etc and you get your plots right so this is the basic idea a basic flow and
um and critically you can have evm here right so now you no longer have to write um you know I did digital version of say a balancer amm you're just using the balancer am solidity code directly right so it's obviously 100 accurate because it's there um so that's the flow and um and then you though you can get fancier rather than just a pure manual flow you can have token Spice in the loop so just like in the analog version analog circuits you have an automated tool here that chooses the next thing to simulate right chooses a different amount for an LP to LP into or whatever you want um runs token spice iterates iterates iterates and if you're trying to say do worst case verification or then it tries to find you know how will LPs lose the
most money right um and quite often it would just emerge as finding flash loans on its own things like that right so this is an example for verification and I really want to keep emphasizing the parallel to Circuit line it's so similar right it's uncanny but that's great news because we've worked out how to do this in circuitland okay so I'm going to show you some simulation results so work that I did a couple years ago already without the evm stuff is this web3 sustainability Loop right that is taught here with the token engineering community and lots of people talk about flywheels the previous talks Etc so here's you know a very simple conceptual version that was in the original blog post but then you can draw it out as a schematic so here's a higher level schematic modeling at all and if
you want to sort of really understand what's going on here's the relationship of all the different variables of how revenue for marketplaces this is an example for ocean revenue from marketplaces lead to network Revenue lead to driving the fundamental valuation lead combined with speculation valuation it leads to the total evaluation which leads to the Token price and then the token price Loops back to um you know driving growth Etc right so that's an example of a model this is all online too by the way just sharing um so here's some examples of results a monthly r d spend given particular parameter assumptions marketplaces growth rate so it's showing you know in this case by the way it's 20-year simulations you um and that's you know what a Fidelity of I don't know one week or one month but of course we
can do six month simulation or one week simulation with higher fidelities too so different time scales however you like um token count so depending on what vesting mechanic you have you can see what the token count is taking into account um you know Investing For Your incentives program investing from initial investors all of that um and then seeing you know monthly Ocean or otherwise minted and burned there's a burning mechanic in ocean um and this actually really helped answer a bunch of questions as we were coming up with parameters for ocean uh for example we wanted to know for our 51 distribution this is um vesting of the tokens to drive incentives programs um and we asked you know we just said three different things one is uniform we're basically uh at the time for example balancer had 10-year uniform
investing and then just cut off right um so we said what does it look like and basically it's good for 10 years and then it's a big drop um in in everything so you just don't want something cataclysmic so then what about exponential you know how Bitcoin does it um and that looked pretty good but we realized that for our needs the plots aren't shown um it was too much vesting of the token in the early days when the traction really isn't quite there right so you can have a ratcheted exponential which ratchets up over the first couple years until you hit the exponential um and that can be you know schedule the ratchets or it can be heuristic like achievement talk to it in the previous talk so in the case of ocean it's uh now a defined schedule but when we designed this and initially announced we said to
be determined based on things we learned but here are the Max and Min values okay so that was simulation results without using the AVM side uh then you know when we were going from Ocean V3 to Ocean V4 in Ocean V3 we had a problem with rugbulls and uh so for ocean V4 one of the key goals was to fix the rug pulls and we used token splice to verify this so what did we do first of all we modeled what ocean Market was in terms of Agents so in this case we had a publisher agent a pool agent which is just a balancer amm a sticker Speculator agent and a data consumer agent and you can have many of these so we had many sticker Speculator and then there's actions the publisher would sell balancerpool tokens to the pool and um uh go back and forth there there's
pooling and staking there's accessing and buying data sets all of this right so that's the ocean V3 net list and we also did one for ocean V4 with the updated design so um this particular smart contract in the center had something called one-sided staking and there's some other things going on okay what did it look like with some results um so on the left this is a simulation of the ocean V3 and we managed to capture the behavior of the rug pull so here a malicious publisher came along and um they got a bunch of people to put liquidity into the market and then they rug pulled and got five thousand ocean at the time that was about five thousand US dollars with the Canada design of one side is taking we managed to show that it went down to just 50 ocean right it's
different time scales so it's actually 50 so it's 100 X lower so basically minuscule so we this helped us to see that we had solved to the rug pulls problem it turns out that there was another issue that we didn't capture properly that ended up causing problems but um we verified this particular aspect which was a really nice win we were very happy that we also did other things we put investing data tokens in the initial design and we wanted to see that it would work and by the way we were verifying the smart contracts how much time do I have five minutes perfect okay and then we also wanted to know what's the sort of overall dynamical behavior of of um investing and so on and this also had some nice results so overall there's some pretty cool
benefits When you go to evm agent-based simulation first of all it's faster and less error-prone development right because the model is the solidity code you don't have to pour any existing solidity code into python you just wrap it um you don't have to write lower Fidelity equations it's just there right and the cool thing about crypto all this stuff is online so you can go and grab these things and even inside the token spice repo right now we've got um code from quite a few things but you know it's open you can do PRS put into it but there's also very flexible agent modeling I talked about solidity here right and you can do this you know for amms with uniswap loans flash loans stable coins whatever but you can also go beyond solidity Viper wasm C rust Cairo whatever you want right whatever VMS you want you can go multi-chain
running many of these at once you can have pure python agents and even API calls to gpd4 or whatever right so lots of things you can do there and it really unlocks a lot but critically for design and for verification and it's the verification thing that I really want to emphasize right um you've got this super high fidelity simulations since it's using the actual code itself but you still have to model the uncontrollable variables these are the worst case variables things where you don't know you can't model it as a distribution you have to be good across the board right things like Network latency it might be very small very large or anything in between or how much NLP can put in um and then there's also some statistical things too that you can model getting away with modeling statistically and once you have those
uncontrollable variables modeled then you can do things like the worst case verification or the statistical verification or both okay so um for sort of recap right now we have token spice um the simulator we don't have the analog verification and I'll get to this as a call to action but this is a recap so I I talked about how um three billion dollars for the facts in defy and 75 of this was analog and I talked about how um we're basically missing this when we go to verify right the smart contract audits aren't covering this we're missing the analog we're missing the mixed signal side and Beyond one VM but you can lump that all and just call it analog so
analog token verification so the D5 problem right now is the analog token verification problem because we don't actually have good analog token verification but we can as you've seen so um to give you a flavor here to start with you can just have you know write a token space in that list say for Bridges uh chain one chain two and the bridge in between each with their own VM Etc different agents you simulate in token space and you could manually test different scenarios that's a starting point right but then also you can bring in you know token swipes in the loop with AI so here um basically you start with the design and then you run the verification tool automatically and there was a comment in the previous talk about how the GUI is
worse the more accurate you get well this is a key thing you actually can make awesome guis for this and you so you have to have really good algorithms but you can have really great GUI so this is the things that the analog designers who were verifying the designs that they stared at all day long iterating with this plus the schematic editors Etc they weren't having to write code or anything and this is my dream here too so we we can have these tools that have really great AI under the hood um a text driven interface but then there's a GUI on top that's really really easy to use very intuitive Etc really nice plotting showing confidence intervals all this stuff right so that can really make a big difference to adoptability and once again now I've talked before about the the analog CAD tools it's the
same thing here for tokens twice in the loop verification everything from nominal to fancier stuff and design as well and by the way um I did write a textbook on this for circuitland that you can go and buy it's a hundred dollars on Amazon I get exactly one dollar royalties which they ship me every 10 years so I'm not going to make money off of it but if you want to have full recipes of all the algorithms um this book very sure design of custom integrated circuits um is is actually kind of the reference or a starting point um okay and so this is my dream I dream of tool Suites for analog token verification with aggressive use of AI you know for fast pvt fast Monte Carlo hi signal Monte Carlo hire go Monte Carlo statistical optimization fast
design sweep all this under the hood AI like crazy that's actually what we need for efficiency this is my dream and that three billion dollars worth of D5 hacks let's make it thirty dollars okay and maybe we can get there or at least three k but not three billion that's pretty embarrassing um so to conclude the summary is that the 3.1 billion dollar defy hack problem is right now today the analog token verification problem that's the problem and analog circuit verification has a lot to teach us the starting point is Spike select simulation and fortunately we have an open source simulator token spice for that um great and there's other stuff but that this is the one that you know it's out there easy to use and so on and what
we need next is token spliced in the loop for analog token verification for worst case statistical Etc so my calls to action to you if you care about this at all is try token spice it's there github.com tokenspice forkit build similar tools and then build the analytical verification tools we really need this as an industry personally I would myself but I'm really focused on making ocean successful but if any of you want to chase this come to to me talk to me and I'm happy to help guide you because we really need this as an industry with that thank you very much for your time and that's it thanks thanks friend this was super inspiring and I I mean I really love this afternoon because you can feel this
engineering spirit so many different approaches on and make things better in token land and also be become more ever more sophisticated in our tools thanks so much all right we are