# Building Ethereum 2.0 On Substrate by Wei Tang (Devcon5)

- Channel: [Devcon](https://streameth.org/devcon)
- Date: 2020-10-09
- Duration: 13:04
- Topics: blockchain, smart contracts, distributed ledger, ethereum
- Watch: https://streameth.org/watch/yt-A9KNNS_uxpM
- YouTube: https://www.youtube.com/watch?v=A9KNNS_uxpM

## Description

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on IPFS and more.
https://archive.devcon.org/archive/watch/5/building-ethereum-20-on-substrate

Wei Tang presents Building Ethereum 2.0 on Substrate.

Speaker(s): Wei Tang
Skill level: Advanced
Track: Consensus layer
Keywords: substrate, eth2, technical

Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum
Learn more about devcon: https://www.devcon.org/
Learn more about ethereum: https://ethereum.org/ 

Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. 
Devcon 5 was held in Osaka, Japan on Oct 8 - 11, 2019.
Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

## Transcript

so so my talk is about building the serum to pan around sharp subject so before I go into the talk--i Short Introduction open e I'm Rita I'm a Caldwell for I party technology and I work on assume and assume two one zero so we really want to lean this talk talk about how we got involved in to improve on zero and some quite hard license we learned in the process so so like our journey for eastern 2.0 is really about building a generic blockchain framework because we i party revealed a lot of blog chance and we really want to make sure we don't write too many duplicate code so the first thing I remember for the ich10r was a hybrid Casper I tell him we were experimenting with building having a generic engine design in our party serum plant so we have support for finality and a real size support for custom fortress rules so in that case adding the hybrid Casper FFG turns out to be quite relatively easy task so we had a working hybrid class for implementation quite early and it actually works so but later it comes to the second freeze which is we decided to build a separate block chain for assume two one zero so for us we move to the beacon subtree runtime so for the epic has furthers really some performance issues and we had to abandon that so to create a separate block transfer into one zero and what I mean by beacon substituent runtime is basically P Kanchan Isis up six runtime so I really want to go into the like some of the details of how we think the pic and Chang can work on subsequent time but before that probably a really short introduction about the selfie runtime so subtree diesel engine to build locations and we figure out that there are two magazines that every blockchain need it's basically consensus and stata execution it's really hard to generate the consciousness part because different consciousness can require different like entirely different structures like some consensus need finality some candidates don't need finality some concerns need to just needs a pass plural Sun and other probably need to like to refer back to a lot of previous block I know so some consensus need to have a lot of accelerated data some doesn't really need that and also we have those vast majority of different focused on Ice Road just really hard to generalize but we have some helpers and the second part is still execution so we figure out we probably can generate the scale execution part and we just call it run time so we have a current our current set to run time Pisa has has some fixed seems like we have a definition of block we have something like an extrinsic which includes what we all know called transactions or and other parties information six which includes things like timestamp service guide and we also have this item which is similar to logs in Sturm and we have a definition of runtime external T's basically how the runtime talk reached outside world so we have all these things and they have some defense structures and once in brief ones who figure out is how how we can reuse those structures and make it working for building our assumed 2.0 client because if we can do that then we kind a lot of the sub-tree contract and guide something for free like so networking world's the subject light client particle so what we end up doing is we create a wafer block this is basically says that we create a separate block definition this block definition we call it viper block follows selphie definition of what a block is basically easier set the fund structure and we also have to like unmodified beacon block and for each beacon block we make sure that there is a unique corresponding Weaver block so in that case even become blog you can always generate generate a waiver block but you might need some passed flock that hang it may not be so trivial but but it should be in Siri possible to generate a wafer block we also have a Reaper state which also is a Viper structure on top of the beacon state and this for per wafer state follows substrate definition and this is basically a marquetry and this particle tree also has a definition in subject and what we do and that marco tree make is it's different it's currently different than what is defined assumed to burn 0 so what we do we define our child tree and this tree structure is exactly the same as the pecan tree structure this is like a working library can use on subject so we define child tree and in this country will follow exactly what the beacon block is and we store the actual beacon state in the weber state so there's there's always a child tree which has the exact same route of the beacon state and we wet it with some other states probably some cash or other information that we need so to look into the actual thing it will be like this exist is a sandra beacon block we have the slow definition block root state route block body and the signature seems like that and for the subtree block we basically make it like this so you can say some of some of the items are exactly the same as ice Wally's found a beacon block so you should you're so unique corresponding and for stuff that doesn't have a definition that these constants is sub sick for example the slot and the signature which is food identities which because is in the header is obviously ball no matter your fluke and or light clad and the last thing we need to care about is this state route because I mean in the end we need to verify this this block structure the issue is in even if there's a unique correspondence the signature is to a beacon beacon block signature so it doesn't verify this state route but instead it verifies a beacon block state route so in that case we need to find a way to make sure that we have also our fallacy so how do we do that but basically it's stuff showing here but we basically create a second TD structure that creates the proof so an additional the state proof that goes from the beacon salute into the subject state routes the wafer blocks a route that we need and we're doing this so this is or about reusability so let me create this waiver block and we create a consensus engine in subject returns and just directly practice plug it into subject and evil work with the rights of the political base so we can get like a separate networking and also the subject like land component for free and that will be working on a sort of a zero so we unit has some obstacles that's why so the issue is we try to do too early of this thing in the specification process issue is either time the specification is still trending a lot and that creates a little problem for us because for each new release we are basically rewriting everything and that kind of slow down the process quite a little bit we still lack a little bit primitives we have the child mark of tree structure but we currently don't have a binary marquetry child tree setup so assessing that is we are adding the POS works on on the run time like by itself but the issue is if we don't get it at new primitives OPRS will be too slow for production use so that's also some primitives we need to add and because we are kind of not too fast on that the current plans is we build a way to to like to plant setup so basically we have the suffix runtime plant during place but we still want to catch up with the rest of the team so what we plan to do is we want to build a beacon court and we want to plug their beacon Kong in the future we want to plug this we can come into the Southfield runtime but currently we are also building users we can call to build a subject to build a easy improvement zero current without sub to runtime but we are still trying to use a limited set of sub components so that we can reuse things and not read too much and later still use it it's pecan come we want to appeal the footprint amount of on top weight so these two two to plan setup is basically one way south to run time and another is not and we didn't ruin the interrobang site but I try to hack hack it at home and it's mostly works last mass so so basically we are talking about writing generic clans and for a museum to one zero so in the beginning we have fabric as per which I'm fortunate we need to abandon because of performance issues and later we decided to build beacon Chen I'm subject runtime using what is called a wiper block in this way we can reuse all of a lot of the sub tree components and our current plan is to build a bo clients basically the first client is for without sub to run time to catch up with the magnetic Elise and the rest of team schedule and another receptor runtime so we can continue to explore building our very generic block chain framework for magazine so that's all thank you [Applause]
