Eth 2.0 on a Pi by Mamy Ratsimbazafy (Devcon5)
Devcon·Fri, Oct 9, 2020, 12:00 AM
Speaker
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/eth-20-on-a-pi Throughout the years, one of the main complaints of blockchains and Ethereum has been how much energy it consumes to secure transactions. Thus, blockchain is often associated with energy waste in mainstream views. Eth 2.0 with its proof-of-stake consensus promises significantly improved energy consumption. It also brings back validation power to common hardware while proof-of-work increasingly requires interested parties to invest in specialized hardware, space and location. Let's dive together to see if the beacon chain holds those promises and run it on one of the most accessible hardware: the Raspberry Pi. Speaker(s): Mamy Ratsimbazafy Skill level: Beginner Track: Consensus layer Keywords: raspberry, 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
I'm Mohammed Simba's Effie I've been working on ephraim since two years ago and first on ephraim one and now if I am to and I'm part of terrorists the name is team so most of you know studies us for free things the messenger the web free browser and also the browser and the wallet on mobile but we're also involving in core infrastructure as we eat new challenges within the African ecosystem so the main one I will be talking today is a frame m2 so at first for this talk I had a big plan secret plan to come like Steve Jobs with the new iPhone and show you frm to on Raspberry Pi there's another one behind but this was revealed one month ago drains the inter up in Canada and all the Twitter sphere was all over the place with this plus what happened at the interrupt so instead of talking about that I want to take a step back and explain why this is important for Ephraim for blockchain and also for society so the real program today is while running on the PI is significant some experiments and outcomes feature and unknowns so the main focus will be on sustainability and energy consumption which one which was one of the main critic of blockchain and especially proof-of-work so without further ado if you were this morning at the introduction talk by photonic we talked about Byzantine fault tolerance and this paper from Lamport in 1982 which presented the Byzantine general problem which was about how to reach consensus between life if you all are generals of an you have to attack a city and maybe you have to communicate so that not half of you attack the city while half of the other retreat and you come to a strong decision despite spice maybe messenger dying or flee and one of the main advancement of Bitcoin was using proof of costly resources work to help solve this this general problem so here you have I suppose one of the first mail that introduced Satoshi's work with an example of attacking I don't know maybe your company through and trying to crack the crypto hashes and consulting many attackers for that the main point is that you need a lot of compute so a lot of energy to do that and to introduce more context I want to talk about externalities and also sustainability so externality is an economic term that explain that tells you it's a cost or benefit that affects a party who did not choose to incur that cost or benefit so to give you a concrete example suppose there is a factory somewhere that pumps in clean water and exhausts dirty water downstream people downstream didn't choose to have dirty water and they are not paid to clean it so this is a negative externality on the other hand a positive externality would be the same Factory is building a road where there were none before and all the villages and the city along those road benefits form much better transportation so this is a positivist analogy and sustainability I guess now everyone is familiar with the term so the idea is that it's meeting the needs of the present without compromising the ability of future generations to meet the needs how does that play in a frame so the public opinion is that a lot of the proof of work is a waste of energy and that's an issue there is this EU blockchain Observatory report that was sent to the European Commission that said that proof-of-work consumes as much energy per day as the country of Singapore it's not shown in the slide but they said that there are lots of work in progress to improve that and that thankfully the blockchain community is aware of the energy consumption and wants to tackle that another paper was in magazine nature and that said that blockchain may might contribute to global warming by 2 degrees Celsius the paper is the code behind the paper is actually public which is a very good thing and if you want you can check out how they arrive to those estimates you can also do your own you can criticize it put a PR or an issue but I'm not here to talk about if it's to degree or 1.5 or maybe one or maybe three I want it to be zero or maybe even negative like if we have more efficient carbon market with the blockchain another negative externality is the space used so this is an image of Iceland US Air Force Base that was completely transformed into a Bitcoin farm and I guess space today is at a premium with many country like Japan who are struggling to get space either for food or for people so just to not be always negative there are also positive externalities in the blockchain space so we have all these permissionless trustless decentralized transparent and so ship resistant that everyone knows but also who heard about formal verification before hearing about blockchain here Oh first one well blockchain is also driving all the innovation in formal verification for software formal verification has been used by Intel for example for the past 20 years for hardware but this is very new and thanks to blockchain that formal verification is used for software and there are others like game theory cryptography that are being driven by blockchain so now let's go back to a frame - if I am - we change is the proof of work the wasteful algorithm like the public may want to call it - ever itself so now we can run it on that something that can fit into my hand we go from a big data center to the small frame I've been running tests in the past Monza's on the raspberry pi 4 so this one is raspberry pi 3 and raspberry pi 4 was out in june i think a bit more powerful - gigabyte of ram i use the default distribution so that people can reproduce it and Nimbus Zoe for him to client called name becomes in the configuration I used was called minimal this is what we use for interrupts we also have a main net one I used minimal because unfortunately we're not yet at the stage we're missing a bit of extra step to get magnet for performance but I did try to make it harder than minimum so instead of interrupts which was using sixteen validators I use 192 which means 992 times 42 if state on this 64 shards eight slots per epoch so one thing is that you might think that minimal is really a dumbed down version but an epoch so if you're not aware of a freedom to terminology a slot is six second it's how fast we create new block on the blockchain and an epoch is a group of blocks a group of slots that make sense together and we will have special processing after each epoch so that brings each equal to 48 second instead of six minutes and so when I say processing is costly this is the lists of what we do justification finalization so this means making sure that the blockchain cannot go back in time cross-links rewards and penalties slashing validators inducing no new validators removing roles that are bad and updating balances also what I wanted to do was giving you very precise power consumption figures and it happened that I had the initiative electrical issue at home a week ago so about this fancy equipment but I couldn't use it because I needed a cable with a different electricity in and if electricity out so I'm sorry now for the actual demo this is output life from the Raspberry Pi that is behind you and it shows you it has been running for 40 minutes now and show you that first didn't crash and it's also running and you have the output of three nodes so it's a bit fast and this was a video backup that I used just in case the live demo didn't work now some key figures about running affion and Nimbus on the rest pi sorry pi maximum power consumption per draw is seven point six watts to give you an idea for a typical laptop nowadays it's about 30 watt so it's four to five times less power consumed and also a Raspberry Pi is about ten times slower than an entry-level CPU for a desktop so this means that and it runs into runs perfectly on this kind of CPU so if we can get to three times more performance we would be okay for maintenance and also if people were worrying because they are ten thousand if to stake and we didn't know what kind of hardware they needed well it's easy so in summary outcomes of those experiments it runs even and optimize on representative workloads you don't need the power plant in your backyard just to ensure that you always have electricity and you don't black out the wall district and we also have clear targets because has Danny said this morning the main blocker and most of the time is spent on cryptography and the cryptography that we use on a forum - is very young it was developed by Dan boney at Stanford but there is no either hardware or software optimization yet and everyone also a frame to team currently have an optimized and very young library but as the ecosystem mature it will get much better also there is an effort to standardize across many blockchain like a friend on C cash cycle Al Gore indefinite each network I guess one or two over I forget so varies an incentive across all blockchain to collaborate and get something really strong so bad so as I said we can run minimal we cannot run main net and well processing takes over six second maybe ten or something we need to get twice faster so ugly I'm sorry but if you want it to hit your home in the winter you will not be able to do it with proof of state so you will have to stay with Bitcoin or something else now some ideas I have for the future to optimize this the Raspberry Pi default distribution is run in 32-bit mode but cryptography in 64-bit is much faster we had no multi-threading yet even though this has four cores we only use one and as I said before we have an optimized crypto library like Bitcoin has for the curve called SEC P 256 k1 also at Nimbus even though we are one of the team targeting low-power devices there is an over team lodestar who's trying to run as a friend to on the browser on Chrome or Firefox so we also have huge challenges ahead so it's kind of a team effort also what's coming next Raspberry Pi 5 so maybe it's twice faster and we can sit and do nothing and for use cases for people I didn't expect actually to for people to run that on the Raspberry Pi maybe we will rent an instance like the rent WordPress today and people will be able to just launch some kind of always with a freedom installed and everything will be done for them and the consumption the CPU that would be rented would be just powerful enough to run Efram so regarding the unknowns for a freedom to performance in the future as I said verifying validators attestation is quite costly this is cryptography it's about 42 50% of the time spent in that if you read prismatic lab news from a week ago apparently if I spend 99% of a time on BLS signature and now it's only 20% so we can get lots of improvement another issue is when we scaled 100,000 validators we have an aggregation protocols in research we have no need to connect to every peer so a lot of optimizations where as well so for me is a big unknowns of phase one and phase two is the execution layer which is equivalent to EVM and what solidity compiles to I don't know how heavy it will be so key takeaways after this talk there are a couple of teams that have a vested interest to make a frame to as efficient as possible also it will be a significant upgrade in terms of carbon footprint so no one will be able to say anymore blockchain is wasting energy even though we we know that it's used for securing some so ship resistance permissionless and stuff the consensus layer is quite solid we need only just focus effort and the unknowns that I talked about natural radiation phase one and phase two thank you very much [Applause]
Automatic transcript — names and jargon may be misspelled.