#245 Martin Becze: Primea – The Next-Generation Blockchain Operating System

24 Jul 2018 · 1:05:21

Martin Becze, a researcher at Dfinity, joins Epicenter to discuss Primea, a next-generation blockchain operating system built as an actor-based IPC layer for WebAssembly programs. He traces the project's roots in eWASM, the WebAssembly-based virtual machine he helped develop at the Ethereum Foundation, and explains how Primea's actor model and object capabilities depart from the EVM's design and fit into Dfinity's broader blockchain architecture.

Speakers

Topics

Transcript

[Music] this episode of epicenter is brought to you by shape-shift oh the easiest fastest and most secure way to swap your digital assets don't run the risk of leaving your funds on centralized exchange visit shapeshifter IO to get started hi welcome to epicenter a cryptocurrency show we are known for interviewing entrepreneurs academics and researchers in the blockchain space I'm Hanoi and with me is sunny Agarwal and

today we have with us Martin bessie who is a researcher at divinity and is working on a project called premia which he describes as a next-generation blockchain operating system we'll ask him we'll get into what that means but first Martin could you introduce yourself and tell us a little bit about your background and how you got involved with this space as introduced I'm Martin BZ um I work researcher at affinity and I've been involved in this space since 2013 14 probably before that I was also I've been interested in Bitcoin ever since I saw the white paper but didn't really start to programming in getting

heavily involved in it till around aetherium came out that was sort of my initial initial step into this space I was with the theorem and generalizable smart contracts cool and so you know for a while when I first met you I think you were actually still working at the etherium Foundation how did you initially get involved like take the stuff like you know learning aetherium to actually like joining the foundation and getting involved from that side of things so before the theorem foundation I was just working on some of my own projects and I was trying

to make a federated I was trying to build federated systems so if you're familiar with Macedon which is popular now they're federated they have servers and you have an account in the server but all the servers can talk to each other so riot is another example or sorry at the matrix chat protocol so you could have a count on one server and still talk to someone on a different server so I was all working on a federated protocol and was thinking about how I could decentralize it a

little bit further and this sort of led me to start doing research in lock hands and the constraints I had could not fit into Bitcoin at the time and when I saw aetherium was like well this is really interesting it's wide open I can put anything I want on it so I thought it'd be a good use case for theum and yep so I just started implementing it I I think it was early spring of 2014 i sat down and just started implementing some basic

data structures so I started with implementing RLP and it would be if you don't know at our ala p RL p is it's the serialization format and then I moved on to implementing the Merkle tree and then finally built my way up to implementing the virtual machine and networking and I did this all in JavaScript so yeah that's how I kind of got involved with aetherium and so is this what turned into the like aetherium tree ash library which like you know I'm sure everyone

who's like done some sort of development or theorem at some point has like played with at some point so it was act like in that that turned into three MJS yeah precisely so that's how a theory MJS got started originally I was trying to keep up with gas and parity well it wasn't parity at the time it was etherium C++ or aloft zero so originally it was just a client it wasn't the libraries that everyone thinks about undoing Jess and at the time I had a whole client that could even synced blockchain which is pretty cool now there's more transactions and

it's a little bit hard to sink the whole blockchain but no so it started off as a client and then we sort of broke it off and do a bunch of a bunch of little little modules that became a theory MJS cool and then so I guess the thing that you were your most famous for at world while at I think information for working on is the project called he wasa so you know stand for aetherium flavored web assembly so could you tell us a little bit about what the goal of this project was and why you chose to tackle the vm problem as opposed to any of the

multitudes of like exciting projects going on and like the theorem foundation the vm problem can be exciting to you right now no it was I felt like there was a lot of talk about these really hard problems like scalability and you know cool zero knowledge proof sand Krypto but we were sort of lacking on just basic engineering stuff and uh kneeling down like yeah some simple stuff that should be at the base of the

chain I felt like so that's what I wanted to tackle the PM for it felt like no one it didn't seem it felt like no one really seemed interested in it and there was a lot of room for improvement there so the number one rule of open-source development is if you see a need that's that's what you should work on right so like yeah that's I saw a need there so that's what I thought I should work on so you saw some deficiencies with the idiom virtual machine and then you saw that there was this other other work being done outside etherium which was

the web assembly work and we wondered if webassembly could be put into etherium as eve awesome right so could you explain to us what what deficiencies you solve it EVM and why did you specifically choose web assembly to to repair them um right this is a really good question so there's a lot of I think the thing that that I realized that caused me to rethink the theorem well at first I came into it thinking yeah a theorem virtual machine is pretty cool I had no knowledge of virtual machines or not much never implemented

one before hadn't really got into one too deep so as well as implementing D implementing it I just kept saying things like oh if this was different it'd be a lot easier to implement things would be faster and then you know you started I started to research virtual machines a little bit and there's a lot of research on virtual machines started wondering okay why aren't we using you know a virtual machine that is already in production that you know has really great implementations and things like this

this was 2014-15 so this was really before whoever simply was available and what was out there at the time was java and java virtual machine which is you know it's a pretty good virtual machine but it's very complex it has a lot of opcodes and it is not necess deterministic in the specification of it so any virtual machine operating in the blockchain space or more general implementing or any virtual machine that is involved in symmetric computation the

symmetric computations where you have multiple parties doing the same computation and needing come arrive with the same result so whenever you have that situation and that's what you have in the blockchain you need to have a virtual machine that is always produces the same result with the same inputs so it has to be very strictly deterministic there wasn't a lot of options that is your first is that is one of your main concerns I was looking I was looking at kept looking for something that could fill the need and there wasn't really anything out there when was it I think it was 2015 when Brandon Ike made the post about

webassembly announcing it and I got involved pretty early on just following discussions and commenting on github and thinking about this as a possible replacement for the theory of virtual machine in like being involved early on in the discussions with really interesting for me I learned a lot from people that had been designing virtual machines from a long time oh and one thing I really the that the that webassembly brought the table that previous virtual machines hadn't was that it was deterministic it was very

well specified and it was a very it was open and simple standard and it had the same goals that virtual machines in the blockchain made and its goals were to be deterministic to be size efficient meaning the size of the program should be compact small and have a have a minimal trusted computing base so these are all the things we need in the blockchain space I thought it would be a pretty good fit what exactly would be like you know the main like what is the

benefit of using the web assembly over the EVM though so like you know you could say that you know it's just like two different bytecode formats like why does it's just switching the type of op codes you're using and stuff and give you performance benefits I've heard you talk about like you know with representing Lee we no longer need like for example pre compiles and stuff what is it about using a new opcode system that allows you or a new VM allows you to like drastically change the efficiency and stuff of the system great great great so there are several reasons um first of all like what assembly is designed to be

a virtual instruction set which means mmm it's a little bit higher level than individual instruction sets so your CPU has what's called the instruction set which is just a list of base instructions it can understand and rents so we have these low-level instruction sets and a web assembly is a virtual instruction set that can easily map to all the low-level instruction sets and you compare that to what aetherium did is it didn't we didn't start from the premise of okay here are all the instruction sets and how do we make an instruction set that can efficiently map

to all of them we just started with the premise of um you know whatever was the simplest thing as possible just to get us running which was logical at the time no etherium was a lot of work so there's no way we could spend one or two years just designing a virtual machine um so that was the first moment design standpoint that was that that that is web accessibility spent a lot of time focusing on building an efficient instruction set on a technical side some things that make web assembly faster than EVM is the word size um the theory

virtual machine has word size of 256 bits which real Hardware doesn't actually have you have 32 and 64-bit operations and the other thing is that the theory and virtual machine has unlabeled it has unconstrained jumps so you can jump to random spots in the program which is fine most the time but when you try to translate a APM program to native bytecode or native opcodes native opcodes our theory and virtual

machine stack based and when you can jump around to arbitrary spots in the program and you still have to maintain the stack there's there's no good way to produce a it becomes much harder to write a program that is called cheating but that compiles to native bytecode so webassembly it fixes this problem it can only jump to certain spots in the program you have nested blocks and you know we can jump to the end of the block and that's it so it becomes really easy to get or write a program or translate a web civility program to native code so

one thing I noticed was a you know a lot of like the server list computing people like you know people from Amazon lambda blue cloud they've actually been poking around like the polka dot webassembly repos late lately and so it's almost like a little bit like you know they're actually depending on the block' industry was depending on the like web industry to like kind of build stuff for us but our teams like a little bit the web industry is I kind of like depending on us to build it for that and so it's kind of like you know maybe the tables have turned a little bit what do you think about this I you know maybe like how beneficial has you you think the industry support of web assembly has been yeah that's the super awesome I had not heard that surrealist people were

poking around parodies stuff yeah that's really cool I'd love to see more of that though so yeah this started out for me like I wanted to bring better just development standards to the black chain space because I felt like was lacking so the fact that you know um you can get the same system web assembly to run in watching and gets used everywhere else I think that's a that's a great sign that were on the right track yep so shared effort if we can have a common virtual machine that like lots of that has lots of use cases not specific use case logjam but can also be using

service for example fastly which is a CDN is using it to do computation it's used in games and browsers so it has we have lots of development coming in from all different angles onto a common platform and that platform gets mapped into a lot lot of different hardware infrastructures and this is kind of I think a waste in protocol one Benes sort of I think popularized that term when he talked about IP pass as being always in protocol we're back and web assembly is also a great example of a

potential waste in protocol so you try to bring West web assembly into as a replacement for the EVM I wonder what was the reception la so a how far did you get in the development and B what kind of reception did you have from the etherium foundation for this world so it they met a lot of resistance to start with and and you know rightly so because like it was fairly new no one knew what it was so yeah it took some work Vincent people and you know whenever you make a change to a blockchain system that holds a lot

of money or a monetary value it shouldn't really I don't I don't think it should be easy to change like the core component of it so I don't feel like that's a bad thing but we like we slowly gained momentum I think that the big things the big arguments that one out of his time was that it became obvious that we were going to keep wanting and keep needing to add pre compiles and if you don't want to precompiled opcode is it's a opcode that acted it is almost like a contract in itself that just gets added

natively so in aetherium right now we have like different hashing algorithms as precompiled and we have some pre compile that are used for verifying their knowledge proofs to do pairings and stuff so each of these pre compiled the problem with them is they open up a large attack space they can be really complex so for example he ones the pairing was that handle pairing I believe there was a bug not too long ago that was found in guess I'm not sure if it's got a parity anymore but it could

have been a consensus breaking bug if it hadn't been caught but the day the central problem still remains you have these are fairly complex programs and you say ok this is going to be part of the specification now so that every time you for example if I add half three as a precompiled I have to add the specification for hash three to the specification of aetherium and that makes this entire thing much much larger now if we can have a simple instruction set that is efficient enough to allow us to implement all three or any other

hashing algorithm in the instruction set itself we don't have to add sha 3 as a specification to the theorem specification we can just implement it in the base instruction set so what this gives us is the smaller what is called a smaller trusted competing base and the trusted computing base is the amount of code you have to trust for the system to run correctly so instead of trusting you know aschoff 3 implementation sha-256 these pairings all these other pre compiled code all we have to trust now is the implementation of what the sun

glai and we can run everything inside it so um I think that was probably the the largest argument for it the second argument that we like sort of briefly touched on earlier is that like and so I think it's a waste in protocol so you have a lot more mindshare being directed into web assembly from lots of different industries whether it been gaming web browser service you have a lot of different people thinking about it and building common utilities for it so it gets easier to develop over time you get

a wider or wider variety of libraries or development tools more people knowing about it and you move toward affinity and you started this new project premier which is like the main theme of our conversation today so give us a sense of why Definity in particular and what is premier the sort of isn't clear where I stopped you awesome started Crimea they were kind of the same thing for a while actually so Remiel was an implementation of the awesomer started out that way we should wish talk really quick about you

wasum and the fact that so you awesome just took it doesn't change anything else about aetherium other than the virtual machine um and i started with that but then i was thinking okay well if we have an optimal virtual machine what would it look like if you know we had an optimal or a better way for contracts to interact with each other um and that's what premia started out to be um so I started changing I tried to like start with some small changes after the DAO hack I became interested in adding something called that actor model and this was because the DAO hack was closed

by something called a reentry bug and that's where a program like talks to another program and then that program talks to the first program again and what happens in aetherium is you get a new instance of the original program with the same state and that can lead to confusion and the DAO and cause bugs but that is not what happens in the actor model and every instance of a contract there's only one instance that stays around forever or not forever one instance per contract ever exists so a contract might contract a it might send

a message contract B and beam I sent a message to a again but he's gonna finish this execution then it's going to process the next message in askew so you never can get into this reentry situation I started playing around with that after the DAO hack Greg Colvin was also also sort of interested in that one so we sort of talked about and yeah started to implementing it and that was premier so kymia was basically like you know it came out of this idea of like okay this he wasn't projects good but it's like stuck with the backwards compatibility issues like

trying to remain somewhat backward compatible with the EVM you if not in like directly like the contract and call each other at least like in the programmer mindset of backwards compatible and so Definity was like okay what if we wanted to like yeah sorry hi Mia was sort of like what if we wanted to start from scratch altogether so the second part of my hairs question was so why Definity why did why why move over to Definity to work on hi Mia instead of continuing to work on it within the etherium foundation all right yeah so that's really simple is just there's no way to there's the easy path forwards to change the virtual machine

anything well easy kind of easy um it's still pretty hard um it's really hard to change anything about chain block chains that are running especially when it requires hard work it becomes near impossible to make a change that would break old contracts right in a chain and that's what permeated it wasn't immediately clear or possible to represent all the old contracts if we made these changes things would have to break so I actually spent a while trying to figure out how

we could make this backwards backwards compatible and I just sort of gave up at some point I thought well it'd be a lot easier and we get a lot further if we just started fresh so you and yeah that's where the community comes in it was a fresh chain and it was doing some really cool stuff Dominic Williams was doing some really cool stuff with a previous take so um yeah so joined efforts with Definity to like launch this forward it's been really great like having a

fresh table a clean slate to work on you know I have to worry about backwards compatibility makes your life a lot wiser this episode is brought to you by shape-shift the world's leading trustless digital assets change quickly swap between dozens of fleeting cryptocurrencies including Bitcoin ethers e cash gnosis manera golem walker and so many more when you go to shape-shift dot IO you simply select your currency pair give me receiving address sent the coins and boom shape-shift is not your traditional cryptocurrency change you don't need to create an account you don't need to give them your personal information and they

don't hold your coins so you are never at risk from a hacker or other malicious actor shape-shift has competitive rates and is even integrated in some of your favorite wallet apps like Jack's so you can swap your digital assets directly within your wallet just as easily as putting on your slippers whenever you see that good-looking fox you know that's where shape-shift is so to get started visit shape-shift I owe and start trading and we'd like to thank shape-shift for their support of epicenter now it looks like maybe talk a little bit about what this whole actor model is I you know I've normally always heard of it this analogy of these like mailboxes and stuff could you try to like maybe like break it down very

simply what the actor model is and maybe how it's different than the current model of smart contract at the EBM and what are the benefits of it the actor model is actually really really simple I think um and you can think of them at every actor as like a person really or entity and people can usually at least me I I only can respond to one thing at a time so an actor has a mailbox and you other actors can put messages in their mailbox

and each actor can take one thing I have their mailbox at a time and designate what to do with that message it can read it and then you know send other messages or do something or discard it right so that's essentially what after the the really broad model for an actor is and what aetherium has is it's more like everything is compatible its game acts like one big program right now where you have a function in this program every contract acts like a

function and a function can call another function and that function if it calls the original function again it's going to start a new instance of the function and with the same state yeah so the looser the I think the big difference I might i'ma try to make it a little bit more clear in this cerium when you have a program it doesn't send a message to another program but it does this make a call and what that means is it pauses itself so it's running it's running running it pauses this message now the

other programs running running running running and then if that program can set into motion other one it's going to both do this program screen to be paused and in actor/model this never happens programs down pause or lock like this because they always run they get a message and they run to completion and then they grab that next message from the inbox to of the properties that the EEM basic provides then in that case are these concepts of being synchronous and being atomic could you actually you know maybe explain to the listeners that

kid what are these two concepts are they the same thing or what's the different or are they different you know uh yeah they're actually not the same thing so asynchronous synchronous versus asynchronous so um synchronous would be like let's say work we do this as humans synchronous is would be like I say one thing to you and then I pause and I can't please while you talk and I can't do anything else so I'd be like I'd be like hello sunny and they're like hi yeah that's synchronous that that's really weird

humans don't act that way um asynchronous is what we were more accustomed to you like I say one thing but I keep on moving and I keep doing things and then when you receive my message you respond atomicity atomicity means let's say we all all are trying to if I want to convince everyone's opinion opinion or no one's opinion so I try to convince you of something and I try to convince you know Alice of something and I want to convince both of you or none

of you and I don't want to be second state where one of alice is convinced but you're not convinced and so this this is the basis of sort of atomicity like I either can convince you to both and you're both committed or you're both not committed um yeah does that explain it you think um okay oftentimes Adam isset II is like the example use is this common trainin hotel problem maybe could you describe this like how that what that problem is and what add Mississippi means in that

context right so the training and hotel problem is where I want to convince the both the train and the train company and the hotel company to book me a train raid in a hotel room or I don't want to convince either of them because I don't want to be stuck in a situation where I only have a train but no hotel or in situation where I have a hotel but no train so that's the idea there so if I'm understanding this story correctly so you you worked on the the VM you saw its flaws but I think the first level of

flaws you saw were in the addition of op codes and things like that but then you realize that okay they're like deeper like conceptual issues around how the how the etherium virtual machine runs and like these issues are the first is the lack of an actor model which which essentially allows if I am a contract and you are Martin you're another contract me to call you and then I get post but then Martin you can again call me while I'm post and a new instance of me will will still spawn up and these two instances can basically conflict and

that's what led to the dowel so like so that's that's sort of one issue you realize the second issue it seems to me is in you you wanted you saw the need for a system in which contracts can keep it executing sort of in parallel that's what I that's how I understood a synchronous asynchronous meaning that so Martin has a contract sends me a message I process that message and I then move on to the next message so I keep moving on from message to message to message and then I don't need to depend on other things being complete in order to keep

processing my messages right so you want to enable some functionality by which like contracts would just care about their inbox and like process message one do something that might lead them to create other messages then once that is complete process message to then process message three process message four and so on and in order to move from message one to message to to message three they do not need to depend on any other the execution of any other contracts so you felt like this this sort of construct is needed in the blockchain space and then the third thing that I gather is you failed the need for contracts to do atomic operations so so maybe maybe a

contract needs to withdraw money from a different contract and at the same time it needs to change data in a certain contract but that contract wants to ensure that both either both of these operations happen or none of them happen so the money gets withdrawn and the data gets written to two different contracts or none of them end up happening and so you felt like that these three things are needed so it's like a synchronous communication atomicity and the actor model and sort of this is what led you to build premiere yep and add to that so well there's two

things I'd add though that nails it pretty close also a scalability whenever you have sharding you have asynchronous messages between shards there hasn't there's very few starting well okay there's a couple charting schemes that have synchronous messages between chars but I think those are kind of crazy um so generally any messaging between shards shards themselves are act like an actor right so you have a blockchain as an actor and you have a list of incoming messages and they are put in a mailbox

and in a blockchain the mailbox is a block so you get a block and it has the messages and they're in etherium ran one at a time so you can see aetherium as a single actor as it stands now and then when you add multiple shards now you have multiple actors each shard is an actor um I didn't so what I was thinking was like well if this shards themselves are actors why don't we just move that down a level and make all contracts an actor right and it would be a more cohesive system so now programmers don't have to think in two models the otherwise you have two different models to think about

you have one model if contracts are talking to each other in a shard and then you have a different model or contracts talking to each other in different shards and I thought that would be really confusing so I thought we could simplify it just by having one one system aren't that what about like you know sometimes there are advantages to having systems that are like synchronous and atomic so like you know for example like why did the evm make like the design choices it did for example let's say you in in Definity you did want to solve the train and hotel problem and you wanted an execution to be atomic how would you

make that happen now when we don't have like atomicity between contract like in program execution yeah so that's this really good question and um it does get a little bit harder to do in the theory em so let's talk about wife hariom did it um a theorem was coming from the database world it was sort of like looking at it as a stored procedure so there um it's really easy to solve this you don't have to do your new special coding in Crimea or Definity it's a little bit harder to do it and the way you do it is sort of like a two-phase

lock now we don't have to implement a full two phase lock because we know everything at least within a shard is being executed correctly but what this means is so we send a message to a train company saying hey I'd like to reserve a train right and the train company will give us back a reference it says okay the the this is reserved do you want to confirm and then you do the same with the hotel and you get a confirm and then

once you get both the confirms you you confirm them both and you have them both reserved so that's the basis of the lock system and let's say if you sent you reserved a train and you get the confirm back and then you go to get the hotel and there's no room in the hotel you don't confirm with the train said you cancel so that's the the very high level description of like what it looks like to program uh yeah Adam is City on top of this does this mean then you end up having to

bake in some sort of like timing assumptions because like things have to time now at some time otherwise you might get into like endless - general problem situations oh it depends on several things whether you have to do bacon timing assumptions I would assume some contracts would yeah you would you would say I would like to reserve a train and you would get back a confirmed button that was valid for you know a thousand gas or something or meat you know a thousand ticks or one block or two blocks or something like that right mom so some amount of time and

after that it would be like yeah dropped uh-huh and now what about the you know the synchronicity versus a synchronicity side of things why don't be like you know things that makes JavaScript like kind of good especially for the web world is the fact that it's generally asynchronous but then it also leads into this like callback hell kind of situation that like people like hate how do you like em help improve the user developer experience on doing that and it is definitely a lot more complex for like developers to have to think through like asynchronous logic uh yeah totally

um and JavaScript okay just simple javascript is also probably the most widely deployed language one of the most widely deployed languages and developers have managed to use it fairly well and taking a page from JavaScript you at JavaScript ads and es6 adds a sink a wait so like primitives that sort of make a see you're gonna see easier to deal about makes it look more linear so that's the I think the simple way to do it is just provide better high level languages I see cool so going back

to the actor model basics now one of the things with an actor model is it usually like you know the idea is that you have multiple you're trying to run many contract or actors in parallel and let's say one contract one actor ends with sending a message to a sent a message to B but also C sends a message to B and it depends how it be execute depends on what order it received the message is in but what happens in the situation where on two different computers in one computer a was faster but in the other computer C was faster and now you have

now you introduced some level of non-determinism into the system where on these two different computers B is acting on messages in different orders so how do you resolve this situation because obviously in the boxing world we need absolute determinism yeah there's several ways to resolve this actually and the way I implemented in prime 'ya is I count how long a program runs according to how much gas it spent um so if you're familiar with the theory am gas can be spent in several ways one way is through computation the competition

so like doing opcodes another way is through using memory or another way is doing things so let's if we we only use the gas that went towards computation so the opcodes we only count that that should give us some measurement of time if the gas is the metering is correct or about correct and that's debatable are you designing us in premiere are you having different types of gas for like you know storage versus company are these storage gas different the computation gaps we've one of the nice

things are not nice so one of the things I always found a little bit weird about aetherium is it basically pegs the great storage costs to computation costs and you know I feel those two might need to fluctuate is this something that you're doing like keeping these separate or are they still like joined in one gas counter I still only keep track of the the gas that's used for competition computation as opposed to gas to cease your storage and whatnot but there's still only one gas count or you know a transaction now I agree that that might me be separated

out but I felt like it was simpler not to change that right now and deal with that probably at a later time so as it stands now it's still bundled together at a high level so I'm actually trying to get a sense of what premiere is right like so Crimea is not a virtual machine because it's also espousing that contracts ought to communicate with each other in a in a particular way right and that's that's functionality beyond the virtual machine so the virtual machine is like how a contract is executing but

so it's not just a virtual machine because it also involves this this design of how the communication or to happen between contracts so yeah so like the question becomes like what is prime eeeh right so that's real good question say it's definitely not a virtual machine or like in the implementation prime Mia the virtual machine is abstracted way so you can use other virtual machines with it you could use like just JavaScript or whatever also it just does not include knowledge about gas it doesn't know anything about gas it all Crimea is is a messaging system

between actors and we discussed actors briefly but to review they're just a a simple program that has a mailbox and it does something it can you can receive a message it can send messages and it can create new actors so those are the three things the actors can do that's the most basic description of the data I'd say oh this is cool so so actually the virtual machine piece is abstracted you could so you could you could have like aetherium virtual machines communicating in this actor style model and premiu can enable that but you could have wasum machines communicating in

this actor based model and try me I can enable that as well right so this so it's almost as if like you are building something to which which doesn't map to a name in conventional like technological systems like it doesn't it doesn't map really well to the name virtual machine it doesn't what you're building is not an operating system it's not a virtual machine it's like a model of communication yeah it's pretty I think that it is somewhat closely related to microkernels right this is like a very small layer that says how

programs can communicate and how programs can interact your operating system should keep programs you know their memory separated so the malicious program can't like take over another programs process right oh that's the that's the core the core proposition value of operating system that keeps the programs in line doesn't allow one program to use up all the resources of the computer exedra so it's kind of like an operating system in that sense it's kind of not as in it's a little bit higher level like operating systems only

went on run not usually on one CPU it'd be like an operating system that I had virtual machines built into it I guess yeah another like important design aspect of Crimea is along with the actor model is this object capabilities system that you have you know this Activa bonus is actually something that you know became somewhat popular in the OS world and then you're kind of like applying in here could you tell us a little bit about what object capabilities are and why you found it useful and important to implement them in Crimea oh yeah so

object capabilities have a long history in smart contracts I like before the blockchain one of the pioneers of object capabilities Mark Miller designed a language called Ealing that was sort of that had a lot to do with smart contracts they were thinking about small smart contracts and I think it was 90s early 2000s but long before the blockchain and that was along with Hal Finney and some other notable cypherpunks and the idea of an object

capability is a capability you have objects and they have some methods on it and a capability describes a transferable right form one or more operations on the given object so you can think of it in terms of like a key you can pass a key around and that gives you a right to open a lock or to perform the operation of opening off and you can copy that key and you can delegate that key to other people so I think it's a pretty good analogy for um for capabilities

and so why is this why do you prefer this over the more traditional form of access control which is act call access control lists why did you choose to go with this model instead as sort of just like yeah it was not for me a clear path I started out with the actor model he was my first step and um then I wanted I knew that I wanted to be able to build secure zones factors so I wanted to be able to use a program and I

wanted to be able to isolate the program from the global world you can't do this in aetherium today like if I deploy a contract any other contract in aetherium can always message it I cannot isolate it I can't protect it from the outside so I started with like okay that that is really important to me and the reason that's really important to me is I also want to enable extreme modularity I want programs to be extremely modular and reusable this is also taking a page from JavaScript world NPM has sometimes over overly ridiculous amount of modularity

in it I mean there's like five no op packages um on NPM I've actually used one before so you can't have any level of modularity in a high-security or in a platform that needs high security yeah your your modules if they're deployed is contracts all need to include code that prevents them or needs to have extra code to prevent them from being invoked by parties

aren't supposed to um so I wanted to provide at a system level provide system guarantees of who can communicate to you one way to do that is an access control list I honestly don't know how you could design a system like this with the ACL yeah I never really considered ACLs in depth yeah all these for this so you know I started from the point of view of looking at continual CS peak and communicating sequential processes and

from there moved more of the actor model and object capabilities but a CLS you need what ACL does instead of having a key the object themselves keeps a list of who can talk to it so that would be like me saying okay Sonny you can talk to me as opposed to you just having a reference to me and being able to talk to me if you have the reference kind of like I find you your phone number then I am able to talk to you right that's the capability exactly that's great great analogy um and so the central one of the largest problems with that

well okay in literature there's a lot of problems with it and all right I don't want to go into that too much because there's a longer complex history that Mark Miller is the guy to talk to him but the reason for me I didn't choose that implement that is added a lot of complexity object capabilities was a much simpler way to implement this and I thought provided a much cleaner yeah surface right yeah so we're actually using a like aqua capabilities model as well in the cosmos SDK and one of the things I think I what I noticed was the

default of a object capability system is to fail safely while the default in an access control list is to fail in a bad way and so for example I think the parody both the parody wallet bugs we're sort of a failure of access control yeah definitely like everyone's expecting every contract expected to implement its own access control list using these like modifiers like only owner and stuff like that and when you fail to do that then you allow anyone to the default was to allow anyone to like access functions of your wallet that you don't want to yeah that's like pretty crazy where we're dealing with money here in yeah I don't know a few months

back we did an episode with with our chain click Meredith and to me what Crimea is trying to do and parts of what our chain try to are trying to do look superficially similar right in in our chain also there's this there's this concept of that that I won't call them actors like there are there are these processes sending messages over channels and to me it feels like the the are chain concept of process maps to your concept of actor and your concept of the inbox for each actor maps to the are

chain concept of the channel is this is this correct or there is some fundamental difference between these two models okay so there are some differences so Greg's coming hmm he's looking at he's looking at his system is coming from the point of view of communicating sequential processes and it's like more formal it's a formal way of describing patterns of interaction in concurrent systems and yeah after model is a concurrent system so there are going to be a lot of similarities

between the two and that they probably have equivalents though I'm not I don't know enough about CSP to say 110 percent yeah there is that the equivalent Greg would probably say no or something I don't know um but yeah I was definitely I've hung out with Greg before and I think it's really cool I think my approach tends to be a little bit more engineering and he's a little bit are chains a little bit more coming at this from a theoretical informal point of view um but yeah I think it's great work still yep

so give us a sense of what is the current state of premier and unlike other things in with Definity premier is open source so developers can actually play with it yeah this is um well yeah this is part of the thing where I started writing premia before I before Definity uh I was sort of I started writing Crimea at the theory and foundation I'm so I was open to begin with and I should say like the rest of the affinities code is going to be open you're just going to wait till the test net launches and then at that

point it'll be open um so it's just like cleaning stuff up at this point the state of Crimea right now is it's being used in an internal test net for Definity so it's up and running seems to be working pretty good yep and you can it's on github no yeah the documentation is still lacking we have some Docs they just haven't been published but yet that we can expect that at the end of the summer yeah have you also been working on like higher-level languages so I mean obviously developers are probably not

gonna be writing like webassembly bytecode so have you been working on like you know subsets of Rost or c or something that can like compile like a premier flavored of rust or something like that yep definitely we've been working on rust and c and c++ so there there's a SDK and it provides a like header files for you so if you've looked at like what parody's done with a awasum and they're toriel's on how to get started in rust Definity will have something similar to that it'll be

pretty easy get started so we're targeting those C and C++ I think to start with and rust also ActionScript works but that's not a very full-featured language and we also have one engineer who is we're hearing on an internal implementation of Haskell they compiles to awesome which will be pretty cool Martin unfortunately we have come down come to the end of the hour I'm actually really looking forward to the definitive test net right so definite is coming up with all of these these new ideas right like including the random beacon

including your the premiere system climbing a model of communication and I'm really looking forward to being able to run an ode on Definity and play with it so yeah thank you for joining us today and walking us patiently through Crimea I think I finally understood Crimea after your explanation during the show today and to our listeners thank you so much for joining us as you know we release new episodes of epicentre every Tuesday or Wednesday you can subscribe to a show on iTunes SoundCloud or other podcast apps like stitcher for

iOS and Android and if you like to see videos you can check you can get the video version of this show at youtube.com slash epicenter Bitcoin recently we started a gated community in order to chat with our listeners so you can check that community out at epicenter door TV slash cater finally we love to have your reviews on Twitter or iTunes so please do live Leivers reviews there and we look forward to catch you next week thank you [Music] [Music]