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

Loading player…

PARSIQ Smart Triggers: Client-Side Blockchain Co-Routines - Anatoly Ressin

Ethereum DenverSat, Oct 9, 2021, 12:00 AM

This talk is from ETHDenver & ColoradoJam , the world’s largest Web3 BUIDLathon and Community Gathering. ETHDenver’s content is crypto and blockchain focused. Learn more: ethdenver.com Subscribe to our channel to learn more + connect on Twitter: https://twitter.com/EthereumDenver. Speaker: Anatoly Ressin, Parsiq This talk was recorded Friday, February 5th, 2021 ETHDenver 2021’s content themes included DeFi & Money Legos, NFTs & the Creator Economy, ColoradoJam & the Next Frontier of Statehood, Protocols & Interoperability, Open Source & Public Goods, The Ownership Economy & Digital Orgs, Usability Design & Adoption and Legal, Privacy & Identity. Industry experts also weighed in on topics like decentralization, privacy, identity, non-fungible tokens, scaling, governance, diversity, and arts and culture in blockchain technology. The 2021 event was February 5-12 and hosted virtually in 2021 with 5000+ blockchain enthusiasts, developers and community members from 80 countries and 50 U.S. states. 🔴 SUBSCRIBE ETHDenver’s YouTube https://www.youtube.com/channel/UCgz9NU06t_FkT0Py1Vadczw 💡 LEARN ETHDenver’s Official Website https://www.ethdenver.com/ 👋 CONNECT ETHDenver Twitter https://twitter.com/EthereumDenver 📖 READ ETHDenver News on Medium https://medium.com/ethdenver 🛍️ SHOP ETHDenver Official Merchandise bufficorn.com 💬 CHAT Telegram https://t.me/Ethdenver Discord https://discord.gg/AxFmNdCVnU 📱 FOLLOW LinkedIn https://www.linkedin.com/company/ethdenver Instagram https://www.instagram.com/ethdenver/ Facebook https://www.facebook.com/ETHDenver/

Transcript

Looks like we've got Parsec and Anatoly. Are we Are we ready to go? There you are. So, I want to do present some interesting theoretical things that are the very basis of our technology in Parsec. Because uh uh here what we what we actually do uh we monitor data from blockchains and various sources real time and allow users to perform data processing.

And always always we are asked how do we how do we uh Uh-huh. How do we process data in real time from such unreliable sources as uh as blockchains because there are there are some problems how to create how to create a properly rating system that needs to consume data that even is not final. And we proposed very interesting concepts. And we can speak about the generalized interoperability between system without finality. So, everybody everybody here is asking how to how to process non-final data, but we found how to process them correctly.

And even we proposing such a technology as smart triggers. And so, smart triggers they are our brand or trademark. And the real programmatic thing is a client-side blockchain in coroutines. But let's let's go through let's go through our concepts. And I would uh say that we are kind of we are kind of dealing with the same problems as Blocknative presented.

So, they are working with a mempool. But we are working not only with a mempool, we are working with that part of the blockchain that is not that is considered not final. The mempool itself is not final, obviously. But when we are speaking about for example proof-of-work blockchains or blockchains that have not instant finality, then we have kind of problems how to consume data and how to um organize uh um how to organize uh um calculations on top of it. And uh here and here I want to say that with by analyzing blockchain behavior, we found very interesting things that maybe even will be compatible with the quantum mechanics.

Because in both cases, we are working with a mysterious concept of now. What is What means now for blockchains and what means now for for quantum mechanics. In blockchains in blockchains uh often we have such a structure when blocks are stitched together. They are mined by miners, but there are situations when different miners simultaneously can produce a block that are attached to the same parent block. And we obtain a situation when nobody knows which uh which block will be uh included in the true history.

At the At this moment, we can say that we are in the superposition. And we have two different realities. In one reality, one transactions are packed. In different reality, other transactions are packed. Maybe those transactions are are the very same transactions, but maybe they are in different order.

And uh nobody actually knows in which order they they will be mined. But eventually eventually, thanks to probabilistic uh nature of miners competition, one of branches uh fades out. And only one branch continues to only one branch continues to work. So, and it is really It's really when one branch is abandoned and other continues as the main history, we can compare it with a collapse of wave functions in in quantum mechanics. Yet uh There is a interesting There is the interesting uh note that all of those realities could be treated as real.

Uh so, um But they are real, but they are mutually exclusive. So, uh Here we can say that the problem of reaching consensus uh both in both in quantum mechanics in and in blockchains can be reformulated in a form how to maintain consistent histories. How to how to have a history that uh is the same as my history as your history, and we can agree um on them. Uh but no, it is interesting that different consensus mechanisms they provide different strategies how to how to reach the consensus. The um uh Nakamoto consensus um prescribes all honest parties to select longest chain.

But even in this even in this situation, there is the problem because the information propagation speed is limited. It is limited by the speed of light. Uh and of course the speed of communications of our computers. And it means that even if in one space location one miner observes one chain as the longest chain, it's It doesn't mean that the same picture of the world is available to other miners. So, it means that miners can continue on different blocks.

And even they can create uh kind of not only single block forks, but they can continue continue those blocks. And we have interesting picture that those realities can evolve um simultaneously and be mutually exclusive. And even even in those cases, I I want to say that we are dealing not only with chain-based blockchains. We are covering blockchains that are as well DAG-based. But in every case, we have such situations that for example, if it's a chain-based uh histories, then then we have such a structure of such a structure of different realities that we need to process simultaneously.

And for example, if we are DAG-based in DAG-based systems, conflicts conflicting histories can appear as well. Yet in any case in any case, when we are dealing with events from different systems, we are linearizing these these events. And um It is interesting thing that the traditional blockchains could be compared to the Newton's global time when Newtonian physics where it is believed that there is a global time that works at simultaneously in all points in universe and the space is separate. But DAG-based systems, they could be compared with Einsteinian time where only uh causality between between events forms of the flow of the time. But in all of those cases, we have notion of local time of local time of of the observer who observes those uh, who observes those systems and the sequence of observations, they are always linear.

But, they are linear, but we want to say that they are as well hierarchical. They are hierarchical, uh, because what we observe, we actually observe conflicts between histories. And we at Parsec found a very nice way how to work, uh, with these uh, with these conflicts and be able even to apply stateful computations on top of them. Uh, we introduced a notion of weak oracles. Weak oracles and their implementation is hierarchical observables.

First First of all, first of all, uh, let's define what we call an oracle. Uh, about the oracle of type T, so, uh, we we are working with strongly-typed uh, streams of events. Uh, oracle of type T, we define as a data stream that possibly lacks underlying algorithm. It simply takes data from somewhere. We don't know from where.

And it, uh, delivers those data for for us. Uh, in most cases, this data is taken from the uh, reality and the absence of algorithm is, uh, kind of important, uh, important moment that we cannot rely that, uh, there is any algorithm. Of course, uh, oracles could be modeled with algorithmic data streams that generate numbers, for example, 1 2 3 4 5. But, uh, most most of observations are taken from reality where no algorithms is uh, algorithm uh, is believed to exist. Uh, this is our notion of oracle.

Uh, and now we, uh, define a notion of weak oracle. Or more specifically, N-weak oracle, where N is, uh, integer number. Uh, we say that the weak oracle is the same uh, as the normal data stream or normal oracle. And it produces stream of items of type T, yet it can withdraw up to N items from already generated sequence. Just imagine, uh, an oracle that, uh, gives you data.

1 2 3 4 5. Oh, stop. Oh, stop. I just made an error. Let rewind, uh, to rewind back, uh, three items and I will give you new items.

This is exactly what happens when you work with blockchains. And we just capture this, uh, we just capture this, uh, notion into weak oracle. And, uh, we say that, uh, if, uh, we have a weak oracle of type T and, uh, finality depth, it will with given finality depths, uh, then we can state that, uh, if N + K items are generated, then first K items are final. So, it means that, uh, if we are speaking about three-weak oracle sample, uh, let's let's speak about three-weak oracle. This is oracle that have a finality depth that is equal to three.

It means that, uh, it if this oracle produces items 1 2 3, it means that at this point, he can say, "Hmm, looks like, uh, this is not those are those are not correct items. I will generate over." And withdraws all those three items and produces four uh, two and then, because he didn't, uh, he he didn't, uh, returned more than three items, it means that he can uh, he can repeat this withdrawals as long as he want. Uh, even, uh, even he can return to his original sequence. He can say, "Uh, okay, maybe the original sequence was correct.

1 2 3 4." And exactly here, and exactly here, when three items, uh, above one was generated, it means that one is already final. It's already final and one will be never, uh, withdrawn by this oracle. And it means that, uh, this oracle can continue provide values 3 2 5 4 10. And as you see, our oracle is three-weak oracle and it means that, uh, his, uh, space where to where to uh, roll back is limited by these ones.

It means that three and two are now final and they are already uh, they are all already presented, uh, to the external system that can consume them, yet they can consume, uh, them, uh, if they want real finality. But, actually, what we allow programmers, we allow programmers to write programs in their normal style on top of those weak oracles. Uh, they can consume those, uh, numbers in even imperative way and think that they are always in a correct branch. And, uh, I want to say that there are several generalizations of weak oracle. So, first first of all, uh, it is, uh, quite simple generalization from fixed-depth oracle to geometric oracle that, uh, actually that actually can return back to as many steps as he want, but, uh, those steps for for the for rolling back, they are covered uh, they are covered by the geometric progression.

So, the, uh, probability of rolling back, uh, uh, to K steps is equal to P, uh, P times Q in power K, uh, where, uh, where we have a normalizing, uh, equation that sum of all probabilities is equal to one. And the probability P, uh, can be calculated from this, uh, from this, uh, equation. So, our oracle just parametrized by the type T and the, uh, base of the geometric sequence. This geometric oracle is perfect for describing, uh, proof of work. Blockchains like Bitcoin, like like current state of Ethereum.

So, uh, mm, I don't remember exact Q for Q parameter for them, but, uh, they are described very well uh, with a geometric oracle. And another type of, uh, another type of generalizations is natural oracle, when we are working not with discrete time, where we are working with processes that are continuous over time. And the probabilities of rolling back, uh, is calculated, uh, according to exponential distribution with parameter lambda. Uh, those as those are, uh, essentially not blockchains. And, uh, even, uh, it is a good question where exist systems that can behave like natural oracles, but our hypothesis is that our reality that our reality, our quantum reality could be described as natural oracle with some parameter lambda, uh, where, of course, uh, the it's a kind of param- parameter that controls a rollback.

And if, uh, somebody uh, remembers formula for from the school or from from the university, uh, we have 1 divided by by lambda, it's a, uh, mathematical expectation, mathematical expectation of how long uh, will be our time where, uh, where branches can can be switched. It means that, uh, 1 divided by lambda could be potentially uh, could be potentially a fundamental constant, uh, that, uh, constrains, uh, uh, quantum superposition time. Of course, uh, if we also consider relativistic effects. Yet, those are very interesting, uh, applications of this theory, but they are purely speculative and theoretical. Let's quantum physicists, uh, evaluate them.

We will, uh, use our abstractions on top of, uh, on top of blockchains. But, I I want to say that, uh, probably you see here that, for example, if Oracle produced this uh those numbers and then uh then presented us another numbers. Probably it looks like that those numbers is just the same numbers. So, uh we are observing competing branches. So, Oracle tried to Oracle tried to uh present us one branch, then another branch.

We don't speak about their lens because we do not cover uh the policy on which Oracle selects the correct branch, but we say that Oracle has some meaning of correct branch that should be presented to mm uh to consumers. And that uh forms very interesting uh in in interpretation of weak oracles like a views to a hierarchical multiverses with the resource-bound branches. So, uh let's imagine uh our reality like a blockchain where eventually some branches are appearing, but according to some rule they are selected and only one branch uh is presented uh and continued. Uh but as well, those are purely speculative theory, let's uh come back to uh to uh to to our computer science things. Uh we found that our uh that our formalism generalizes very uh interesting and um mm important concepts from mm from practical programming.

Uh specifically specifically uh ability to switch between uh ability to switch between branches and forget uh and forget branches that are not actual. Uh they is this uh uh this type of functionality uh absolutely uh resembles and models very well promise cancellations. Promise cancellations that were uh proposed uh by several people, uh notably this is the library of Bluebird by Pet Cantonov. And a more interesting proposal, more consistent proposal that was proposed by Dominic De Nicola of Google. Uh he proposed how to incorporate cancellations into uh the core of the JavaScript.

So, uh we had a chance that the JavaScript itself will be equipped with a very uh essential primitive uh how to forget about those branches that are not needed. But uh TC39 rejected this proposal. It was a long battle uh for that. And uh you can Google about the proposal itself. But we found that uh our proposal of weak oracles uh it is kind of generalization of asynchronous iterators.

And really they need to be implemented within a language. No language for now no no language for now supports them. So, we decided to create our own uh our own language uh that uh allows to consume uh weak oracles uh mm uh to consume weak oracles like they are async iterators. So, you just can uh you you just can go through them, you can consume, you can filter, you can map them, you can do everything that you uh you you are used to to do with normal data streams. Yet every stateful variable in your program has a history.

And that history uh is maintained exactly in the form of the hierarchy that corresponds uh to the uh to the hierarchical nature of the source. So, if you consume data uh from blockchain uh it means and you uh and you create a calculations on top of uh uh on top of blockchain uh non-final blockchain part uh then at your at client side we are propagating non-finality to your to your program and you can think uh a uh you can think that you are always in a correct branch. It's a very good counterpart for the uh uh for the Solidity language. For example, if we treat Solidity language like a uh mm like a server-side language because uh blockchains are usually treated as the new backend backend of the new era applications. It and uh this means that the Solidity itself is a server-side language.

But the client-side language that really embraces the same concept of the blockchains and is able to consume even non-final part of the blockchains, it's not ready. Users uh are forced programmers are forced to uh consume those data and even to wait until this data will be final finalized to make some things uh so some notifications or some actions or uh they need to uh uh they need to create their own mechanisms how to maintain, how to uh manage those reorganizations. And we at Parsec believe that this is uh purely and uh accidental complexity that should should that should be removed from the programming. And uh even in those uh even in those mm scripts that uh written in our language uh so language is in very deep mm infancy. It is available in our portal uh and you uh can easily you can easily consume blockchain data, perform calculations on top of it.

But what we are working uh now on is the ability to uh deliver the entire context of the event to the to the client side. Uh we at Parsec created an Ethereum node instrumentation that allows firstly uh mm to obtain entire block traces with all the gas point timestamps because uh uh lot of programmers uh they are asking where how they can retrieve data from from the past, from the archive node, not at the block start but somewhere in the block middle. But we uh we implemented more interesting solution. We implemented an ability to ask any state at any gas point starting from the uh starting from the block beginning. You can easily uh with our instrumentation of archive node that uh is actually open source and you can download it or you can use our API that is available uh through our start starter pack.

Just uh uh just see our Parsec channel. mm And you can download, you can access this. uh And this allows us not only propagate events to to the client side but equip those events with the hierarchical time points at which block, at which transaction, at which gas point this uh this event was uh was created. And this allows us to ability to go back to our node and download uh information that will be uh uh that will be decided by the user logic. Uh no block trace uh on etherscan or uh other traces is able to predict which information you need.

Maybe you need uh for example uh Uniswap rate on given pair at given transaction. We can do it. We can do it and it means that when you are writing uh a script with uh within our system you are feeling yourself like you are in the same context in the very same context of the transaction that you are uh that you are processing. But you are processing them not inside uh the mm Solidity but outside. And you are processing uh it by Parsec.

And uh actually we are equipping uh our mm uh Uh, our events with uh those time points and it allows us to say that we actually implement a a client side blockchain coroutines. Just a couple of uh words about the form how we deliver how we deliver our product. Uh, we have a portal uh that uh that allows you to uh write scripts in our language for uh even uh or even um those who cannot code, you can create you can create uh scripts by using our wizards, but uh we are actually targeting developers. We are actually targeting developers and we ask developers to build uh to to to to try uh our technologies and uh move together uh with us. So, uh here we have a instrumentations of all nodes.

We uh we provide such instrumentations that allow us to time travel uh through the history of all um of all blockchains. Uh it's a Bitcoin, it's a full node of Ethereum uh and even we have a very good um indexes about all the smart contracts, their creation time, their creates, destructions, and all those things are available through uh through our API. Uh and you can consume it. Uh we work with such uh interesting projects and we are preparing instrumentation of the Solana node. Uh it will be very interesting because our language very well suited for uh writing logic for for Solana and maybe uh we will have more deep integration with uh Solana with with than with other nodes.

Uh yet most uh interesting thing for the observability now happens on the Ethereum. And we uh we provide an API. And you if you want you can work uh on top of uh our uh API, but uh we as well uh working on the community version, so you don't need um use our portal in any case, just for those who want to rapidly prototype and don't want to host their own nodes. Uh uh the portal is for you. Uh and uh but for those who want to try uh our technology on premise, we are creating parsing demon uh that is uh connected to uh all those nodes.

Uh and you can manage uh their scripts written in our language. And they will constantly monitor all the activity uh in the in those blockchains and allow you to express your uh smart triggers, we call them smart triggers. Uh with uh with that notion of weak oracles under the hood, but you don't need uh you actually don't need to to understand all those technologies, you just uh write what you what you want. And uh we uh so soon uh uh we will uh provide a standalone uh administrator application uh for for a while it is available only through our portal, the similar interface, but it will be as well uh available um available uh through the self-hosted Node.js application.

And just uh about the language itself, the language is very very simple. Uh it allows you uh it uh resembles uh LINQ um by Anders Hejlsberg from C#, that allows you to perform uh select SQL-like operations on top of uh data streams and data collections, but uh we are proposing those uh operations on top of weak oracles that are connected to blockchains. So, you can easily filter with where condition, you can select uh and you can perform uh aggregations, you can calculate everything that you want uh all the turnovers um different market pressures, and what uh what we as well uh what we as well uh implemented, we implemented uh connections with third-party APIs, that it means that you are not only uh creating a script that is able to consume blockchain data, it uh you are able to mix data streams, you can easily attach risk scoring data, you can easily attach market data, mix all those things uh and deliver to every uh every channel that you want. So, we have a various uh transports how to deliver those uh things. And and for for programmatic uh things, uh we have a process statement that is very simple, it's not even Turing complete.

Uh it allows you to create branches, analyze conditions, emit new events downstream. And most powerful things, you can use a state. You can use a state that is protected uh by the uh our weak oracle logic, and you will be able to monitor the state uh either through notifications or through database uh uh that uh that maintains the state, so you will have a information about historical values of those states and the current best uh state. Uh best known state uh that corresponds to the current best state of the blockchain. That is actually that is actually what I wanted to present.

I've I'm asking you to visit our channel in Slack uh on the East Denver um and try to and try to download our starter pack uh that will allow you to try um to try our API and implement very interesting applications. Let's Let's go together. Cool. Can everybody hear me okay? Can you hear me?

Yeah. Yeah. Thank you so much, man. It was really great to to see you and I I actually love your graphics. I mean, that was probably I mean, if for for as much work as people put into things, that seemed like a lot of work, but it seemed really authentic.

So, thank you for that. We really appreciate it. Thank you.

Automatic transcript — names and jargon may be misspelled.