Formally Verifying the Ethereum 2.0 Phase 0 Specifications

https://media.consensys.net/formally-verifying-the-ethereum-2-0-phase-0-specifications-f7be0c179262?source=rss----3018c972aab8---4

An update from ConsenSys R&D on their effort to bring trustworthiness to the Beacon Chain and the core foundations of Eth2.

The Automated Verification team on ConsenSys R&D have been working on a formal specification and verification of the Beacon Chain for a few months. We are happy to report that lots of progress has been made and although not complete yet, we have managed to develop a solid and formally verified kernel of the Beacon Chain. For the first time, our work provides an unmatched level of trustworthiness to the core foundations of the Ethereum 2.0 infrastructure.

Methodology

Verification vs. Testing

We used the award-winning verification-aware programming language Dafny to write a (functional and logical) specification of each Beacon Chain function, an implementation of each function, and a that the implementation conforms to its specification. In other words, we have mathematically verified the absence of bugs. The implementations that we have eventually proved correct are based on the official Eth2.0 specifications with the caveat that we have fixed and reported some bugs and inconsistencies.

Our methodology is different to testing as we mathematically prove conformance of the functions to their specifications, for inputs. Testing cannot range over infinitely many inputs, and as a consequence can discover bugs but not prove the absence of bugs.

And the best thing is that we do not need to publish a paper nor to review the proofs. The proofs are part of the code base and written as programs. Yes, in Dafny, you can write a proof as a developer-friendly program. Also, the proofs are mechanically checked by a theorem prover, leaving no room for incomplete or flawed proofs.

Properties We Have Proved

The properties range from the absence of arithmetic under/overflows and index out of bounds, the conformance of each function to logical (first-order logic) pre/post-conditions ( merkelise example here), to more complex ones involving functions’ compositions. For example, we have the following property of the SSZ Serialise/Deserialise functions: for each object x, Deserialise(Serialise(x)) = x, i.e. deserialising a serialised object returns the original object. We have also established a number of invariants, and used them to prove that the core operations of the Beacon Chain and ForkChoice ( state_transition, on_block) actually build a chain of blocks: for any block b in the store, the ancestors of b form a finite totally ordered sequence leading to the genesis block, which is the main property of a blockchain!

The Benefits of Formal Verification

Any formal methodist would insist that verification is a security best practice. Here’s exactly how this methodology ensures a secure and trustworthy infrastructure for Ethereum 2.0.

Functional Specification

First, we have lifted the official Eth2.0 specifications to a formal logical and functional specification. For each function, we formally define what the function is expected to compute, not how. This provides language-agnostic developer-friendly reference specifications that can be used to develop more secure implementations, with less effort.

Modularity

Second, our specifications, implementations and proof architecture are . As a result, we can easily experiment with new implementations (e.g. optimisations) and check their impact on the overall system. Think of a clever hack to implement a function? Change the implementation and ask Dafny to check that it still conforms to its specification. If it does, the proofs of the components that use this function are not impacted.

Executability

Third, our implementations are executable. We can compile and run a Dafny program. Even better, you can automatically generate code in some popular programming languages like C#, Go (and soon Java) from the Dafny code. This can be used to complement existing code bases or to generate certified tests. The implementation to be tested can use our proved-correct functions to compute the expected result of a test and check it against its own result.

Everything in a Single Language

Last but not least, our code base is self-contained. It contains the specifications, implementations, documentations, and proofs, all in a single, readable, simple and semantically well-defined programming language.

Questions and Considerations

What about the soundness of the verification engine?

You might be wondering, “what if the Dafny compiler/verifier is buggy?” We actually know Dafny is buggy (dafny repo issues), but we do not rely on the absence of bugs in Dafny. We rely on Dafny (and its verification engine) to be . Soundness means that when Dafny reports that proofs are correct, they are indeed correct.

What if the specification we have written is not the right one?

In this case, we would prove conformance to a wrong requirement. Yes, this can happen and there is no silver bullet to fix this problem. However, as we mentioned before, Dafny is executable. This enables us to run the code and get some confidence that our specifications are the right ones. And our specifications are written in first-order logic with no room for dispute about the meaning, so if you notice a problem, let us know and we will fix it.

What if Dafny cannot prove that an implementation conforms to a specification?

This can happen, but in this case Dafny has some feedback mechanisms to help investigate what steps of a proof cannot be verified. And until now, we have always managed to build proofs that Dafny can automatically check.
We welcome your feedback, so please check out our eth2.0-dafny repository. We’ve been excited to watch Ethereum 2.0 development reach its recent testnet milestones, and we look forward to working with teams across the ecosystem to ensure the next phase of the network is built on a rock solid foundation.

Acknowledgement: Thanks to my teammates Joanne Fuller, Roberto Saltini (Automated Verification team), Nicolas Liochon, and to Avery Erwin for comments on a preliminary version of this post.

Read More About Ethereum 2.0

Originally published at https://consensys.net.


Formally Verifying the Ethereum 2.0 Phase 0 Specifications was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

The State of the Ethereum Network: 5 Years Running

https://media.consensys.net/the-state-of-the-ethereum-network-5-years-running-c9f546c7b0cd?source=rss----3018c972aab8---4

Looking back on the first five years of our ecosystem’s quest to upgrade the Internet.

  1. First, no one’s heard of you.
  2. Then they’ve heard of you but think you’re nuts.
  3. Then they understand your product, but think it has no opportunity.
  4. Then they view your product as a toy.
  5. Then they see it as an amazing toy.
  6. Then they start using it.
  7. Then they couldn’t imagine life without it.

–Morgan Housel, “When You Change the World and No One Notices”

No One’s Heard of You

Ethereum is now the most actively developed, most transacted upon blockchain network in the world. But five years ago today, when the genesis block was mined into existence and the network officially launched, few people outside of software engineering circles had heard of the Ethereum blockchain.

Ethereum: Bitcoin Plus Everything

In Goldman Sachs’ 2015 landmark report, “What If I Told You The Blockchain Could Disrupt Everything,” Ethereum was listed as a “startup.” Elsewhere it was described as a “group.” People were trying to understand what it was and exactly what made it different from Bitcoin, a digital cash system. At ConsenSys, we spent, and still spend, a good chunk of time explaining these differences. They can’t be emphasized enough:

  • Bitcoin is a single application of blockchain technology.
  • There are many different types of blockchains, with very different properties.
  • Ethereum is one type of blockchain.
  • Ethereum is open source and therefore owned by everyone.

If you want to know what blockchains mean for the future of human networks and the distribution of power, this tweetstorm from Naval Ravikant is a good place to start.

The Developer’s Blockchain

The Ethereum blockchain was built according to five design principles, outlined in Vitalik Buterin’s Ethereum White Paper:

  • Simplicity
  • Universality
  • Modularity
  • Agility
  • Non-discrimination and non-censorship

One way to think about it is, if someone asked you to build a machine that took these principles to their logical limit, you’d end up with a machine like Ethereum.

In their book Mastering Ethereum, Andreas Antonopoulos and Gavin Wood call Ethereum the “developer’s blockchain, built by developers for developers.” Developers generally prefer software that is open, usable, programmable, and powerful. Thousands and then hundreds of thousands of devs gravitated toward Ethereum because the source code is free, you can build on what others have built, the smart contracts are standardized and templatizable, and the possibilities are endless when you start interlocking contracts and plugging in different data feeds.

New decentralized applications (dapps) per month launched on the Ethereum blockchain.

State of the Dapps did a huge service to the ecosystem when it started digging into dapp contracts and fingerprinting GitHub repos, uncovering the frenzy of behind-the-scenes developer activity on Ethereum. When the New York Times published “Beyond the Bitcoin Bubble,” it felt like people were finally paying attention. Bitcoin was just the tip of the blockchain iceberg, and it was only a matter of time before the rest of the world followed the developers.

They Think You’re Nuts

The DAO

In 2016, the DAO hack, and the hard fork that followed, caught everyone’s attention. Some people thought this Ethereum thing was nuts. What happened, the press said, “raises philosophical questions about the viability of such systems.”

But developers said, “This is a rite of passage.”

The community got to work documenting known attacks and battle-testing smart contract libraries. While there has been no shortage of security incidents over the years, decentralized autonomous organizations are now a staple of the Ethereum ecosystem (Aragon, Moloch DAO, Legal DAO, Maker DAO), and hard forks are a proven model for upgrading the network’s protocol.

Positive Sum Thinking

Think about what else used to be “nuts” in our ecosystem:

  • Enterprises operating on a public network
  • Different blockchains working together

100-year-old firms like Ernst & Young are now using zero-knowledge proofs to develop private transaction solutions on the public Ethereum network. And they’re collaborating with a fleet of other organizations to push the Baseline Protocol forward and help enterprises onboard to mainnet.

Ethereum and Hyperledger, once perceived as rival DLT initiatives, are now fully integrated via Besu, Burrow, and Sawtooth. Even Fabric supports Ethereum smart contracts.

The maximalist, one-blockchain-to-rule-them-all thinking that characterized the early days of the cryptosphere has fallen away in favor of a grander vision of interoperating blockchain protocols. Over the past few months, we’ve seen a huge uptick in “wrapped bitcoin” -bitcoin represented as ERC-20 tokens on Ethereum that allow bitcoin holders to participate in the decentralized finance protocols that are not available on the Bitcoin network.

The point is, the positive sum thinking of early adopters that once seemed far-fetched and technically impossible is now more and more a reality. In the words of Jeff Bezos, “Invention requires a long-term willingness to be misunderstood.”

They Understand It But…

ICO Fever

In early 2018, the blockchain and Ethereum community was still reeling from the shock that 2017 had sent through the cryptosphere. The ICO boom of 2017 had initiated one of the greatest bull markets in Ethereum’s history on the backs of considerable speculation and unprecedented ERC-20 token launches. The boom demonstrated first-hand the power of the network effect opportunities at the core of blockchain technology. However, a number of countries-China, South Korea, Morocco, Colombia, Singapore, and many others-issued either bans or severe warnings to their citizens about bitcoin, ether, and other crypto assets.

When the glow of $1000+ ETH prices wore off and crypto winter descended, the industry began reconsidering the past year of ICOs and reckoning with its darker legacies. Fortune reported that nearly 50% of all ICO projects had already failed by February. The Verge published a sobering report on the mental health and despair of many South Korean millennials in the aftermath of the crypto bull market.

The creation of ERC-20 token contracts on Ethereum.

Today, there are over 160k ERC-20 token contracts on the Ethereum network. Many were created in early 2018 during the height of the ICO boom. In the last few months of this year, we have seen the creation of ERC-20 tokens begin to increase towards similar levels, yet without the price volatility we all experienced in late 2017 and early 2018.

“Ethereum Killers”

The ICO boom and its aftermath provided rich soil for a crop of new programmable blockchains, many of which positioned their technology as the replacement of Ethereum. The most notable of these “Ethereum killers” was EOS, which released a white paper in 2017.

The post-ICO marketing narratives of new blockchains focused largely on the shortcomings of Ethereum: scalability, privacy, UX, and utility. Some of these shortcomings were perceived, some real, and some exaggerated.

Altogether, the Ethereum ICO boom and aftermath had many understanding the technology, but still searching for compelling use cases and opportunities. One silver lining of the crypto boom and winter was that it spurred us to pay attention to lower-level and perhaps more revealing blockchain metrics beyond price and transaction volume: smart contract deployments, decentralization, and risk.

They Think It’s a Toy

On-Ramps and NFTs

As the Ethereum community developed new token standards like ERC-721, gaming and art emerged as fun onramps to the underlying blockchain technology. And it made sense: games have built-in micro-economies and collectibles, and digital art that was hashed to the blockchain was easily monetizable and provably authentic. Marketplaces like SuperRare popped up for digital artwork. People talked about “proof of taste.”

CryptoKitties

The viral sensation that first shock-loaded the Ethereum network was an unassuming dapp called CryptoKitties, a digital kittens trading game that seemed like a cross between Neopets and futures trading. In December 2017, total network requests more than doubled as prices for the CryptoKitties surged into the six figures. A taskforce of developers from MetaMask, Infura, Grid+, and Axiom Zen came together to optimize UX and explore longer-term scaling solutions to relieve the congestion. In collaborating, they realized something profound about Ethereum protocol development. As Alex Miller from Grid+ noted, “Everyone who owns ether is incentivized to make the system better.”

Daily Active Users (DAU) have followed a similar pattern as account growth. January 16, 2018 saw the most DAUs of any day in the last 5 years, with 723,085 unique addresses interacting on mainnet.

People also realized that gamers and artists were running businesses straight out of their Ethereum wallets. Devs had unlocked economic models where previously none had existed. They brought finance to gaming-now it was time to see if they could gamify finance.

They Think It’s an Amazing Toy

The Rise of DeFi

There’s an argument that all of Ethereum is decentralized finance (DeFi). At its core, the blockchain is maintained by a network of incentivized miners who continue spending resources in order to receive a decentralized currency as a reward. That accumulated currency is then sold to other people and enters into the ecosystem.

DeFi as it is more commonly understood, however-as a set of interconnected protocols that have the opportunity to supplant the traditional financial vehicles of today-emerged onto the scene in late 2017 with MakerDAO’s release of DAI. MakerDAO allowed ETH to be locked into the smart contract and the DAI stablecoin to be taken out as collateral. After that moment, the Ethereum DeFi ecosystem grew steadily, largely still dominated by MakerDAO.

Total ETH and WETH locked in DeFi protocols.

2019 was the year of DeFi, but its influence still remained constricted largely to the community of people who were already familiar with the technology and had been working in the ecosystem for some time. Many companies were building DeFi protocols, but overall, the UX felt rudimentary and the capabilities still fairly limited except for the most skilled DeFi users.

In the early months of 2019, the DeFi ecosystem was in many ways a sandbox, where Ethereum enthusiasts were road testing these open protocols and proving out the case for decentralized finance. In the aftermath of the 2018 bear market, ETH holders may have felt cautious about “putting their ETH to work” rather than HODLing in the hopes of another bull market.

Financial Primitives and Money Legos

Financial primitives are the basic decentralized financial capabilities and technologies that can be combined or built on top of by others in order to create more complex and/or specific applications. These financial primitives and the applications built on top function a bit like legos, to use a popular analogy. Money legos stacked on top of money legos stacked on top of more money legos creates an interwoven, interconnected financial structure that is both strong and customizable.

These money legos reached critical mass in late 2019, hurling us into 2020 and taking DeFi from the status of “amazing toy” to the early stages of a critical tool for reimagining our financial infrastructure.

They Start Using It

Software Eats Finance

Five years ago, it would have seemed outlandish to “move $15 trillion of global gross domestic product to open source programmable blockchains.” Now that seems like the only way to bring speed, resilience, transparency, and ultimately trust to our global financial system, which is still running on 30-year-old banking software.

Forward-thinking enterprises followed the developers and have been investing in Ethereum for years now. Our partnership with Microsoft starting in 2015 was one of our earliest efforts to help enterprises adopt blockchain tech via Ethereum Blockchain as a Service on Azure. The Enterprise Ethereum Alliance and Hyperledger have also become valuable environments for large institutions to actively collaborate, vet deployment options, and develop common enterprise standards.

The Institutional Herd

So who are the major players using Ethereum? It’s a long list. Trade finance giants. Agritech giants. 32 of the Forbes Blockchain 50 projects this year are built on Ethereum. Now, the powerhouses are moving in. The Depository Trust & Clearing Corporation, which processes around $2 quadrillion worth of transactions per year, recently announced an Ethereum-based prototype for digital asset management.

New initiatives are constantly sprouting up. In their final report last month, the EU Blockchain Observatory and Forum shared a crowdsourced blockchain initiative map that now charts over 700 initiatives worldwide.

The EU Blockchain Observatory and Forum’s Global Blockchain Initiative Map.

Some of these projects are still very exploratory. Three-hundred-year-old central banks, for example, won’t adopt blockchain-based payments systems overnight. But according to a recent paper from the Bank for International Settlements, 80% of these legacy institutions are actively researching central bank digital currency (CBDC). The incumbents are realizing that in a world with super apps, bundled services, and an increasingly digital economy, Ethereum is not just the infrastructure they need to do bigger business with one another, but their lifeline for serving the 21st-century customer.

Plug-and-Play Ethereum

Since the beginning, ConsenSys’ mission has been to build enough infrastructure and tooling to enable the rest of the world to keep building a new trust infrastructure alongside us. We often liken this process to building a rocket ship mid-flight. The stakes are incredibly high and there’s no stopping now.

Over the past year, we’ve been working hard to bring our products together into a full stack, integrated suite that makes Ethereum more plug-and-play than ever before, whether you’re a dapp team that needs API access to node infrastructure or a financial institution that is ready to optimize business processes and digitize financial instruments. With a layer 2 solution like the SKALE Network shaping up and Ethereum 2.0 on the horizon, we’re excited to see how new and improved usability and network performance unlocks developers, enterprises, and the next wave of super users.

They Can’t Imagine Life Without It

This chapter of the seven-step path to the big breakthrough is still being written and will unfold slowly but surely in the years to come. Innovation of this scale often can’t be measured in quarters or even years. However, we like to think that there are some users-and some major institutions-who already can’t imagine life without Ethereum.

Thank you all of you across the ecosystem for your support, enthusiasm, and tireless work these past five years. Upgrading our global infrastructure is no small feat, but it is a worthwhile and profoundly rewarding one. We can’t wait to see what this network looks like in another five years.

Some Recommended Resources for Exploring Ethereum

Originally published at https://consensys.net.


The State of the Ethereum Network: 5 Years Running was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Introducing the Deposit Launch Pad for Ethereum 2.0

https://media.consensys.net/introducing-the-deposit-launch-pad-for-ethereum-2-0-96eb2045a31b?source=rss----3018c972aab8---4

Codefi Activate and the Ethereum Foundation’s Eth2 Launch Pad, now in testnet phase, is designed for self-validators who intend to stake 32 ETH into Ethereum 2.0’s official deposit contract.

Like all great missions, launching the world computer of tomorrow requires a platform that guides, strengthens, and fuels its journey across the bounds of our digital space. Today, we are excited to announce the go-live of the Eth2 Launch Pad application, which marks the entry point for validators to commence their journey on the Eth2 chain. It’s time to get your testnet ETH ready!

Over the past few months, Codefi Activate and the Ethereum Foundation (EF) have been heads down to make it easier for users to stake and become a validator on Ethereum 2.0. The result of this effort is the Eth2 Launch Pad, an application designed to securely guide you through the process of generating your Eth2 key pairs and staking your 32ETH into the official deposit contract. The Launch Pad was designed for self-validators, that is, hobbyists who intend to run their own validator and are comfortable running commands in a terminal screen on their computer.

Initially, the Launch Pad will only be compatible with the Eth2 Medalla testnet , which is scheduled to go-live once the genesis threshold of 16,384 validators (524,288 ETH) is met. The testnet is designed to provide ample time to ensure the Beacon Chain functions without error. Following the testnet phase, the Eth2 Launch Pad will continue to act as an entry portal for validators to stake real ETH for the Mainnet.

In this post, we will provide a brief overview of the collaboration, some fun facts about the application, as well as the needs and design goals that the Eth2 Launch Pad fulfills.

We look forward to providing the community with ongoing educational fuel and software tools to catalyze participation in this next chapter.

https://medium.com/media/96226019f129913a8ef8ac874efa32d3/href

Joining Forces: A Background on the Collaboration

In 2019, we began digging into the Eth2 ecosystem to explore where Codefi Activate could add value to the roll out of Eth2 and fill existing communication gaps between the protocol builders, service providers and existing ETH holders with the approaching release of Phase 0. We have since focused our mission on developing educational resources and insights on Eth2 economics, as well as industry and validator research, the findings of which were recently released as the Eth2 staking ecosystem report .

Shortly after DevCon V we connected with Carl Beekhuizen, who was leading the deposit Command-Line-Interface (CLI) effort at the Ethereum Foundation (EF). Beyond the code, Carl has also focused on the user experience of ETH holders becoming validators for the first time. Given our existing Eth2 research efforts and our experience with launching networks, collaborating with the EF and Deep Work Studio was a congruent next step to ensuring the launch of Phase 0 was built in a way that prioritized user experience, but also articulated associated risks and educational information for users to feel comfortable setting up their own Eth2 validators.

Over the past few months we have been hard at work researching, designing, and building the Eth2 Launch Pad and we’re excited to share the outputs of this effort with you!

The Eth2 Launch Pad was open-sourced during the Ethereal Summit on May 8th, allowing users to host the application locally. Since its initial release, it has been great to see immediate engagement and feedback from the community. We continue to encourage teams and users to provide feedback!

Fun Facts

  • The Eth2 Launch Pad mascot is Leslie the Rhino, named after the American computer scientist Leslie Lamport.
  • The Eth2 spec repo currently has 72 direct contributors.
  • The Eth2 deposit contract for the testnet will simulate the requirement to reach a Genesis threshold of 524,288 ETH staked or 16,384 validators

Getting to Genesis: A Brief Summary of Phase 0

Ethereum 2.0 will be released in phases, starting in 2020 with Phase 0. Phase 0 will launch the beacon chain, which is the component of the Ethereum 2.0 blockchain that implements the Proof of Stake consensus mechanism. The beacon chain will manage the registry of validators, who will begin attesting and proposing blocks.

In order for the beacon chain to launch its genesis block on mainnet, at least 524,288 ETH must be staked on the network, divided among a minimum of 16,384 validators to ensure sufficient security and decentralization. Reaching genesis will be simulated on the live Medalla testnet.

Each validator instance will require a deposit of 32 ETH to be added to the activation queue and begin attesting and proposing blocks on the beacon chain. Until withdrawals are enabled (at least after Phase 0), depositing ETH in the deposit contract is a one-way, non-reversible process.

What needs does the Eth2 Launch Pad fulfill?

Validators losing ETH = Eth2 losing validators

Simply put, if validators lose their ETH, Eth2 will lose validators. The process of depositing your ETH into the Eth2 deposit contract could result in multiple possible errors or attack vectors. These risks include losing your funds due to sending them to the wrong deposit contract address, falling prey to phishing attacks or someone stealing your private key and mnemonic phrase if generated and stored in an insecure manner. No one wants unhappy validators with lost or stolen funds!

To mitigate these risks, the Eth2 Launch Pad was designed as a front-end application designed to guide you through the process of generating your key pairs, depositing your ETH, and registering your validator on the Ethereum 2.0 beacon chain in the most secure way possible. The deposit interface will be hosted by the Ethereum Foundation.

During your journey through the Eth2 Launch Pad, you will:

  1. Learn about the risks and responsibilities of becoming a validator on Eth2
  2. Select how many validators instances you would like to run
  3. Securely generate the validator key pair and mnemonic phrase, via an offline CLI for each validator instance you would like to run
  4. Generate and upload the deposit data file(s) containing your validator public key(s) required to register your validator(s) upon completion of the Launch Pad
  5. Deposit 32 ETH per validator instance into the official deposit contract. This will be done through a trusted and verified access point hosted by the Ethereum Foundation.
Eth2 Launch Pad User Flow & Architecture Overview

Education

Before you start your journey as a validator, it is paramount that you are aware of your responsibilities, including the rewards of fulfilling your duties to provide uptime and behave honestly in the consensus process, as well as the risks and penalties of failing to do so. Because the initial deposit of ETH into the deposit contract is one-way until later development phases, outlining and understanding the trade-offs of participation and setting expectations is critical.

For this reason, the Launch Pad was designed to act as both a deposit application as well as an educational tool box and source of truth curated to educate future validators about:

Warning messages and explanatory sections introduce “deliberate friction” in the user experience to slow down users and ensure they take in all the critical context provided to them.

Key Pair Generation

Validators using the Launch Pad will be required to generate their mnemonic and validator key pairs, which will be used when validators are ready to launch their respective validator clients. The public key allows you to view your validator stats and activity, while your private validator key, which must remain online at all times, is used for voting and proposing blocks.

In the Launch Pad, validators will also generate a mnemonic phrase to generate their withdrawal keys. During Phase 2, this mnemonic phrase will enable you to generate the keys to your castle, which will allow you to withdraw your ETH deposit and accrued rewards.

The generation of the validator key pair and mnemonic phrase has been designed to be done via a CLI to enable this process to be done in a secure, offline environment.

We are thrilled to have helped pave the way for initial deposits on the Ethereum 2.0 test- and mainnet and are excited to see applications and client integrations develop alternative pathways to interact with the Eth2 deposit contract in the future. A special shoutout to Chris Battenfield and George Weiler for their development work on this effort.

Watch this space for some more exciting announcements from our team!

Written by Collin Myers and Mara Schmiedt.

More on this topic

Originally published at https://codefi.consensys.net on July 27, 2020.


Introducing the Deposit Launch Pad for Ethereum 2.0 was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Teku Ethereum 2.0 Client: Request for Proposals

https://media.consensys.net/teku-ethereum-2-0-client-request-for-proposals-35a65c41151e?source=rss----3018c972aab8---4

In preparation for launch, PegaSys Teku is now seeking an external security assessment of the Teku Ethereum 2.0 codebase.

View our security assessment RFP for Teku

PegaSys has been a huge supporter of Ethereum 2.0 development since its early days. On the one hand, we have R&D teams pushing back the boundaries on several fronts. On the other, we have created one of the leading Ethereum 2.0 client implementations, Teku.

Teku is written in Java, with an Apache 2 license, and is a full implementation of the Eth2 Phase 0 specification, the Proof of Stake beacon chain. Once the beacon chain is launched, holders of ETH will be able to lock up stakes and participate in securing the chain by running validators such as Teku, for which they will receive in-protocol staking rewards.

The launch of the Eth2 beacon chain is now only a small number of months away, and we are working hard to ensure that Teku will be production-ready in good time. Teku has already successfully participated in all three public Eth2 multi-client testnets to date, Witti, Schlesi and Altona, alongside client implementations from other teams.

As part of our preparations for launch, we are now seeking an external security assessment of the Teku codebase. The security of all Eth2 clients is paramount: downtime will cause stakers to lose stake through penalties; loss of keys can cause a loss of stake through being slashed. Maximum uptime, maximum correctness, and a high degree of security are vital.

If your team has experience in reviewing large Java codebases, distributed peer-to-peer systems such as blockchains, advanced cryptographic constructs such as BLS signatures, and has a first-class security background, then we would warmly invite you to respond to our RFP for a security assessment of Teku. In-depth knowledge of Ethereum 2.0 is not required, but could be an advantage.

Please see our Request for Proposals document for all the details and information on how to reply to the RFP. The closing date for responses is 23:59 UTC on Monday 3rd August 2020.

We look forward to hearing from you!

More on this topic

Originally published at https://consensys.net.


Teku Ethereum 2.0 Client: Request for Proposals was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Legions: A Tool for Ethereum Security Researchers

https://media.consensys.net/legions-a-tool-for-ethereum-security-researchers-e526cb84c505?source=rss----3018c972aab8---4

Legions is a handy toolkit for researchers poking around EVM nodes and smart contracts.

By Shayan Eskandari, Security Engineer at ConsenSys Diligence

Have ever thought about doing one of the following things from your terminal?

  • Poke around a public Ethereum node JSON RPC endpoints?
  • See if an Ethereum node is mining or not?
  • Read the storage of a smart contract? And maybe see how the storage changed between different block numbers?
  • Get the bytecode of a smart contract without going to etherscan?
  • List all ENS domains names owned by an address and their expiry dates?
  • List all the subdomains of an ENS domain name?

If so I have a tool for you, and it goes way beyond this functionality.

Legions

During a recent client engagement we felt the need for a tool to help us poke around some forks of Geth Nodes, and we realized there were no tools available to easily connect and query common endpoints for such nodes. Even though you can manage this with libraries like web3.js, they are more like a hammer, when what we needed was a scalpel.

I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail. (Law of the instrument)

-Abraham H. Maslow (1966). The Psychology of Science

So I began building a tool for that specific engagement. As the engagement went on, certain other tasks kept cropping up, such as simple Wei to Eth conversion, or more challenging tasks like reading the storage of a smart contract.

Is there anything better than a cool command-line interface?

Legions is now open-source and also available on Pypi Package manager.

Simply install the package for python 3.6+ and everything else should be easy to find with the interactive interface:

pip install legions
A demo of Legions’ main functionality

A few of my favorite features are as follow:

Node detection (getnodeinfo)

  • Detect the type of the Node, Chain, and Network
  • Peer Count, Listening, Synching, and Mining status

Web3 API enumeration (investigate)

  • Accounts. Read coinbase, and exposed accounts of the node.
  • Admin. Enumerates web3.admin endpoints.

ENS Queries (ens)

  • List Names owned by an address
  • List Subdomains of an address
  • Query individual names

Query at latest/specific block number (query)

  • Balance of an address
  • Block details
  • Bytecode of the smart contract
  • Read storage of the smart contract (default count=10 reads the first 10 slots)

Conversions (toWei, fromWei, keccak, toChecksumAddress, etc)

ENS tools

The best interface I’ve found to poke around Ethereum Name Service registrars is the app at app.ens.domains. But, I also wanted something in my terminal, and the ability to quickly look up which domains an address owns, when they expire (😈), and other details. Legion provides an easy interface to fetch this information:

A demo of Legions’ ENS functionality

What’s next

I would like to get feedback of the community:

Thinking about smart contract security? ConsenSys Diligence provides training, security spot checks, and smart contract auditing. Contact us.

More on this topic

Originally published at https://diligence.consensys.net on June 9, 2020.


Legions: A Tool for Ethereum Security Researchers was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Ethereum by the Numbers — June 2020

Ethereum by the Numbers — June 2020

The latest stats from the Ethereum blockchain ecosystem, including network growth, dapp adoption, developer activity, DeFi trends, and Eth2 progress.

Network

  • 8,035 (+584). Live mainnet nodes globally.
  • 103M+ (+4M). Total unique addresses.
  • 111.5M+. (+409k). Total ether supply.
  • 1,111,318. (+195k). Peak daily transactions in May.
  • 2,000. The number of transactions per second per chain that the SKALE network can support, which just launched on mainnet.
  • 56. The number of mining pools that produced 90%+ of all blocks on Ethereum.
The flow of funds from the 8 largest Ethereum mining pools, 2017–2020.

Dapps

  • V8. The version of MetaMask that’s rolling out, with a new UI, and additional features for devs.
  • Total decentralized applications on Ethereum.
  • 27. New Ethereum dapps launched in June.
  • 127k+. Transactions of dapp contracts over the past 24 hours.
  • 4,453. (+2,182). Daily active users of MakerDAO.
  • 20k+. (+7k). Bricks holders in r/FortNiteBR.

Developers

  • 12k+. (+1k) Total installs of Microsoft’s Blockchain Development Kit for Ethereum.
  • 5k+. (+500) Total installs of Diligence’s Solidity Visual Auditor extension for VS code.
  • (+121,818) Truffle Suite lifetime downloads.
  • 51k+. Number of GitHub repos that use the Web3.js library.
  • 18k+. Number of GitHub repos that use the ethers.js library.
  • $5.4M+ (+800k). Gitcoin’s gross marketplace value.
  • 7,567. Number of GitHub events that the Status team generated over last 30 days.

DeFi

A comparison of assets on the Compound platform.
  • 100%. (+10%). Liquidity index of USDC on Compound according to DeFi Score.
  • 32k+. (-9k). Total ETH locked in MakerDAO smart contracts.
  • $1.8B+. (+800M). Total USD value locked in DeFi.
  • 2.28%. DAI’s historical yield on Compound.
  • 4.1M+. Amount of COMP remaining, Compound’s governance token.

Explore our full DeFi analytics suite, Codefi Data.

Enterprise

  • 700+. The number of blockchain initiatives globally, according to a crowdsourced map.
  • $50 AUD. How much the World Bank raised using a blockchain platform for its Kangaroo bond due August 2020.
  • 1.5. The version of Hyperledger Besu that’s coming soon with new privacy upgrades.

Ethereum 2.0

  • 6. The number of participants in Codefi’s first batch for the Staking Pilot Program, including Binance, Crypto.com, and DARMA Capital.
  • 64. The number of shard chains that will run alongside the beacon chain.
  • 32. How much ETH validators must stake to the network to earn rewards (holders with less than 32 ETH can use a staking pool).
  • 1–4 MB/s. Total available data that Eth2 is expected to provide Ethereum.

Explore our Ethereum 2.0 glossary.

Food for Thought

  • 17%. How much The National Association of Counties estimates a decrease in revenues derived from sales taxes, gross receipts, and other charges as a consequence of COVID-19.
  • $248.7M. How much US taxpayers paid in 2015 to fund police misconduct settlement payouts.
  • 20+ days. How long settlement can take in the syndicated loans market.
  • $2 quadrillion. The value of transactions that the DTCC and its subsidiaries process per year in capital markets.

Want to Keep Up With Ethereum?

Subscribe to the ConsenSys newsletter.

Originally published at https://consensys.net.


Ethereum by the Numbers — June 2020 was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Major Financial Clearinghouse Is Exploring Ethereum for Digital Asset Management

https://media.consensys.net/major-financial-clearinghouse-is-exploring-ethereum-for-digital-asset-management-a0b8308e0c5e?source=rss----3018c972aab8---4

The Depository Trust & Clearing Corporation’s new prototype leverages the Ethereum blockchain to streamline capital markets activity.

The financial services industry has taken another step forward into blockchain-based digital assets with the Depository Trust & Clearing Corporation’s recent release of their Project Whitney Case Study. The platform, which uses Ethereum as its core technology, embraces a new approach to the representation of value in capital markets and signals an era of increased efficiency for financial services. Project Whitney was released in tandem with Project Ion, an accelerated settlement project that further explores shortening clearing and settlement cycles.

The DTCC’s latest initiative echoes work that has been taking place around the world for some time now. Major institutions have adopted Ethereum-based securities records and are actively exploring tokenized offerings. As an early example of such developments, the World Bank began in 2018 issuing bonds on its Bond-i blockchain platform, with the latest tranche being $50M AUD in August of 2019. ConsenSys’ own Codefi product suite has facilitated a significant and comparable volume of digital asset projects since launching in 2019.

Emerging Opportunities for the Pipework of US Securities Industry

The DTCC sits at the heart of US capital markets and has long been a driver of innovation. The corporation’s goal is to strengthen post-trade processes, provide efficient infrastructure, and support economies of scale, all while maintaining security. The Depository Trust Company (DTC), the corporation’s subsidiary, was founded in 1973 to address the rising volume of paperwork and resulting risks with the rapid increase of securities transactions in US capital markets at that time. The DTCC and its subsidiaries process nearly $2 quadrillion worth of transactions per year.

Some 50 years on, US capital markets and the DTCC are preparing for new fundamental shifts in the industry driven by the advent of digital assets. Project Whitney and Ion have the potential to finally achieve some long-pursued goals, such as shortened settlement cycles and automated compliance.

The Whitney Platform: Built on Ethereum

The Whitney Platform is a blockchain-based prototype that mints tokens and records asset transfers on the public Ethereum network, while maintaining an independent digital record of security ownership off-chain.

The platform is designed to solve for an array of pain points in private markets, from costly paper-based processes to fragmentary compliance. Some of its core capabilities include a digital and cryptographically-verifiable record of security ownership, as well as a dynamic rules engine working off-chain to permit authorized on-chain transactions and to ensure that issuers, broker dealers, and investors maintain compliance throughout the securities lifecycle.

Increasing Momentum for Digital Asset Adoption

DTCC’s move to announce Project Whitney follows increasing momentum in conventional and digital asset capital markets that has been building through 2018, 2019, and into 2020.

2018 saw JPMorgan Chase’s groundbreaking test of Quorum with the National Bank of Canada and the World Bank’s $81 million Bond-i in 2018 and second issuance in 2019. Last July, CapBridge Group, in partnership with ConsenSys, launched 1x, a first-of-its-kind security token exchange based and regulated in Singapore. In September, Santander announced the issuance of a $20M tokenized bond. Santander’s project was noteworthy because it was the first large issuance transacted entirely on the public Ethereum network.

Since then, several other financial institutions have adopted the Ethereum mainnet. French asset manager Mata Capital used ConsenSys Codefi’s asset management platform to tokenize €350M worth of property outside Paris.

Ethereum serves as the basis for 95% of digital asset issuance to date. The blockchain’s highly programmable design, native tokenization capabilities, and widely adopted token standards have made it an ideal platform for asset digitization. The DTCC’s project implements an ERC-20 compliant token standard. Security token standards such as ERC1400 also present opportunities for the DTCC to build additional features into tokens, such as inbuilt compliance, granular transfer controls, and the option to create different states with specific rights attached, directly on-chain, such as collateralization.

How the Whitney Platform Uses Ethereum

For Project Whitney, the DTCC selected the public Ethereum network and its ERC20 standard for minting tokens, as well as an off-chain Compliance Oracle and a backup independent stock record. For secondary trading, Project Whitney envisions a scenario where people trade either OTC or on an Alternative Trading System (ATS), and either in their own beneficial holder name or through a custodial model. In a custodial model, tokens are held in an omnibus account on an investor’s behalf, much like a street name.

Design Considerations: Public vs. Private Ethereum Networks

The Project Whitney case study notes that four key factors led the DTCC to select public Ethereum:

  • Observation of US private markets tokenization efforts to date
  • Access to open source tooling
  • Opportunity to test the enforcement of key operational processes off-chain
  • Desire to build hands-on technical acumen around public blockchain infrastructure

While the DTCC chose to work with the public Ethereum network, an alternative approach used by many clients to date would be to create a private instance of Ethereum. A private network enables users to achieve far higher performance on dimensions such as throughput and avoid the need for gas payments.

Technologies such as Hyperledger Besu and Quorum have emerged as default choices for enterprise-friendly Ethereum clients. The PegaSys suite, which was built by the team that developed Hyperledger Besu, allows enterprises to quickly spin up private Ethereum networks with advanced functionalities and 24/7 support services.

Private Ethereum networks are the basis for several high-profile blockchain consortia, such as komgo (stakeholders include Citi, Shell, BNP, and ING) and Covantis (stakeholders include ADM, Cargill, and Louis Dreyfus).

Furthermore, Ethereum 2.0, a major upgrade to the Ethereum public network, is slated to launch in 2020. Ethereum 2.0 will bring many performance benefits, including exponential scalability and transaction speed as a result of moving from a Proof of Work consensus algorithm to Proof of Stake.

What’s Next for Digital Asset Adoption

Project Whitney is another proof point that digital assets will lead the way to innovation in capital markets, for both operational efficiency and for increasing access to private markets for Main Street investors. With an all-in-one digital asset management platform like Codefi, incumbent financial institutions now have turnkey solutions for designing, issuing, and trading digital assets and securities.

Want to Keep Up With Ethereum?

Subscribe to our newsletter to get the latest Ethereum news, products, and resources straight to your inbox.

Originally published at https://consensys.net.


Major Financial Clearinghouse Is Exploring Ethereum for Digital Asset Management was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Ethereum JavaScript Libraries for Dapp Development: web3.js vs. ethers.js

https://media.consensys.net/ethereum-javascript-libraries-for-dapp-development-web3-js-vs-ethers-js-87d6a47c9bb7?source=rss----3018c972aab8---4

A technical guide to the differences between Web3.js and Ethers.js, the two most popular JavaScript libraries for interacting with the Ethereum blockchain and developing dapps.

Web3.js and ethers.js are JavaScript libraries that allow developers to interact with the Ethereum blockchain. They are both great libraries — either library will likely meet the needs of most Ethereum developers. This article is a comparison of web3.js and ethers.js, focusing on their similarities and differences, so that you can better understand the nuances of the libraries. It is written with the intent of educating developers to understand the tradeoffs between the two libraries to be able to make a decision of which library to use for their particular use case. This article includes resources that may be useful for those who are new to blockchain development or programming in general.

TL;DR: Both libraries work. For your use case, one library may be better for you.

Web3.js has a community of users and maintainers associated with the Ethereum Foundation. It has a good API reference. It has been around since 2015 and has seen extensive use by many projects. Due to this fact, the library has been the “go-to” in many “Build Your First dApp” tutorials.

Ethers.js is excellent because it is a small, compact library, with a large number of test cases. It has good “Getting Started” documentation, making it accessible to new users. “Simple” and “intuitive” are words that are often used by developers to describe their experience with ethers.js and the library has gained in popularity over the past two years, seeing increasing downloads and usage by projects.

What is web3.js?

The web3.js library is an open source JavaScript library (GNU Lesser General Public License version 3) built by the Ethereum Foundation, and it includes functions to communicate with an Ethereum node via the JavaScript Object Notation — Remote Procedure Call (JSON-RPC) protocol. In other words, it is a JavaScript library that allows a developer to interact with the Ethereum blockchain. Web3.js is currently on version 1.2.9, which is the version referenced in this article. Web3.js is made up of four modules.

What is a module?

In JavaScript, a module is code that has specific functionality within a larger program. Modules should be self-contained, so that if you remove a module from a library, program, or application, the overall library, program, or application should not stop working. For those who are familiar with python or java, you might be familiar with “Classes”, which are analogous to modules. For those who are new to JavaScript, FreeCodeCamp has a great explanation of JavaScript modules.

What modules make up web3.js?

Web3.js has a main class called web3. The bulk of the functionality of the library are found within this class. The five additional modules that make up web3js are:

  1. web3-eth
  2. web3-shh
  3. web3-bzz
  4. web3-net
  5. web3-utils

What does web3-eth do?

The web3-eth module contains functions that allow a user of web3.js to interact with the Ethereum blockchain. Specifically, these functions are able to interact with smart contracts, externally-owned accounts, nodes, mined blocks, and transactions. Three illustrative examples are shown below:

  • web3.eth.getBalance allows you to get the ETH balance of an address at a given block
  • web3.eth.signTransaction allows you to sign a transaction
  • web3.eth.sendSignedTransaction allows you to send a signed transaction to the Ethereum blockchain.

What does web3-shh do?

The web3-shh module allows you to interact with the Whisper protocol. Whisper is a messaging protocol, designed to broadcast messages easily and for low-level asynchronous communication. Two illustrative examples are shown below:

  • web3.shh.post posts a whisper message to the network
  • web3.shh.subscribe creates a subscription to incoming whisper messages

What does web3-bzz do?

The web3-bzz module allows you to interact with Swarm. Swarm is a decentralized storage platform and content distribution service-it can serve as a place to store files like images or videos for your decentralized application (dapp). Two illustrative examples are shown below:

  • web3.bzz.upload allows you to upload files and folders to Swarm
  • Web3.bzz.download allows you to download files and folders from Swarm

What does web3-net do?

The web3-net module allows you to interact with the network properties of an Ethereum node. Using web3-net will allow you to find out information about the node, with the .net following the protocol you are interested in getting information about (designated here with a *, representing the choice of web.eth.net, web3.shh.net, or web3.bzz.net). Two illustrative examples are shown below:

  • web3.*.net.getID returns the network ID
  • web3.* .net.getPeerCount returns the number of peers that the node is connected to

What does web3-utils do?

The web3-utils module provides you with utility functions that you can use within an Ethereum dapp as well as with other web3.js modules. A utility function is a reusable function to make writing code easier-which is common in JavaScript and other programming languages (see JavaScript: The Definitive Guide, 6th Edition by Dave Flanagan for a description of utility functions existing in the JQuery library of JavaScript). Web3-utils includes utility functions that convert numbers, verify if a value meets a certain condition, and search datasets. Three illustrative examples are shown below:

  • web3.utils.toWei converts Ether to Wei
  • web3.utils.hexToNumberString converts a hexadecimal value to a stringweb3.utils.isAddress checks if a given string is a valid Ethereum address.

What is ethers.js?

Ethers.js is a JavaScript library that allows developers to interact with the Ethereum blockchain. The library includes utility functions in JavaScript and TypeScript, and has all the capabilities of an Ethereum wallet. Ethers.js is currently on version 5.0.3. Ethers.js was created by Ethers and is open source via the MIT License.

Similar to web3.js, ethers.js has four modules which make up the application programming interface (API).

  1. Ethers.provider
  2. Ethers.contract
  3. Ethers.utils
  4. Ethers.wallets

What does ethers.provider do?

Ethers.provider allows you to abstract a connection to the Ethereum blockchain. It can be used for issuing queries and sending signed transactions that will change the state of the blockchain. Three illustrative examples are below:

  • ethers.providers.InfuraProvider allows you to connect to the Infura hosted network of Ethereum nodes
  • ethers.provider.getBalance will get you the ETH balance of an address or a block in the blockchain
  • ethers.provider.resolve will resolve an Ethereum Name Service (ENS) name passed in to an Ethereum address (via a Promise-if you are new to JavaScript, we would encourage you to read more about Promises, as they allow the return of data at some point in the future when it is computed).

A note: web3.js also has providers for this purpose — and they are in the web3 base module. Ethers.js and web3.js are organized quite differently, hence there is not always a clear mapping of module to module, even if the functionality of both libraries is very similar.

What does ethers.contract do?

Ethers.contract allows you to deploy and interact with smart contracts. Specifically, the functions in this module allow you to listen for events emitted from a smart contract, call functions provided by a smart contract, get information about smart contracts, and deploy smart contracts. Two illustrative examples are below:

What does ethers.utils do?

Ethers.utils provides utility functions for formatting data and processing user inputs. Ethers.utils works like web3-utils and makes building decentralized applications easier. Three examples are below:

  • ethers.utils.getContractAddress retrieves a smart contract address from the transaction used to deploy the smart contract
  • ethers.utils.computeAddress computes an address by passing the function the public or private key associated with the addressethers.utils.formatEther will format a passed in amount of Wei into a decimal string of Ether

What does ethers.wallet do?

Ethers.wallet provides some functionality that is different than the other modules we have discussed up to this point. Ethers.wallet allows you to connect to an existing wallet (an Ethereum address), create a new wallet, and sign transactions. Three examples:

  • ethers.wallet.createRandom will create a random new account.
  • ethers.wallet.sign will sign a transaction and returns the signed transaction as a hex string (via a Promise-if you are new to JavaScript, we would encourage you to read more about Promises, as they allow the return of data at some point in the future when it is computed).
  • ethers.wallet.getBalance will give us the ETH balance of a wallet address.

Web3.js has a similar package within the web3.eth module called web3.eth.accounts. However, in the documentation for this package, it is called out: “This package has NOT been audited and might potentially be unsafe. Take precautions to clear memory properly, store the private keys safely, and test transaction receiving and sending functionality properly before using in production!”

How should I determine whether to use web3.js or ethers.js in my decentralized application? What is the difference between the two?

First off, if you are creating a boilerplate application or completing a tutorial, use whatever that boilerplate or tutorial recommends-whether that is web3.js or ethers.js. That will make your life easier and flow better with the tutorial. Be sure to use the version of web3.js or ethers.js specified in the tutorial. There are a lot of tutorials out there that have not been updated, so do not assume that you can use the most up to date version of the library unless the tutorial specifies that.

If you are building an application from scratch and determining which library you want to use, we have adapted a software evaluation process that Andres Canal used in his article “ Using Quill,js to Build a WYSIWYG Editor for your Website “ to evaluate which text editor to use.

The following is a series of nine questions that you, the reader, should ask yourself as part of determining which library might be best for you, with some context and information to help you answer it.

1. How important is the popularity of the library?

To use Andres Canal’s definition:

“A popular project on Github means exactly what you expect it to. Namely, that there are lots of people questioning, contributing, and supporting it. This activity tends to result in more reliable software. You can check the popularity of any project by looking at how many stars it has, how many issues are opened, how many pull requests are pending, and how many contributors worked on the project.”

Web3.js has nearly 8,800 stars by the time of writing this blog, while ethers.js has almost 1,500. Web3.js is used by 51,300 repositories on GitHub, compared to 18,500 for ethers.js. Web3.js has been around longer, which is one of the reasons that web3.js is the more popular library.

2. How important is the maintenance of the library?

We want to use libraries that are updated frequently, so that bugs are squashed and new features are added. Though it is not perfect, looking at a month (or two) of commits, closed issues, active issues, and the number of maintainers over that time period can give a sense of the strengths and weaknesses of an open source project. This also reveals patterns of maintenance, giving some insight to the user of a library when updates and bug fixes are generally addressed, which can be used as a proxy metric for maintenance of the library. Look at the monthly pulse for the libraries ( web3.js / ethers.js) on GitHub to see the statistics.

The number of commits and closed issues completed by the single maintainer of ethers.js, Richard Moore, is impressive and he should be applauded. Web3.js has 12 maintainers, and three individuals completed almost all of those commits. There is not a clear winner here, but in choosing the library, being aware of these statistics can help you determine what matters most to you in terms of maintenance, and prioritize the library that meets your needs.

3. Who is responsible for the development of the library and how many projects use it?

Web3.js is a project of the Ethereum Foundation, which is a non-profit organization dedicated to research and organization of protocol level development. Ethers.js was created to create “a complete, simple, and tiny library — it is a replacement for web3 and ethereum.js”. Developed by Richard Moore, ethers.js is powered by his work in creating and maintaining the library.

While some projects have publicly stated which library they use, we felt that showing the data would allow us to show that both are very popular. Check out the web3.js and the ethers.js dependency graphs to explore which library the projects you trust use, or, if they use / support both libraries.

4. How important is it that the library has tests?

If having pre-written tests are important for your project, ethers.js historically has been the winner. At the time of writing, Ethers.js previously had clear documentation of their tests on their Github for version 3.0 release, but that documentation has not yet been updated with the version 5.0 release. Web3.js lacks comparable testing documentation. If the testing documentation is updated in the upcoming weeks, ethers.js will maintain its position as having better tests and testing documentation. The jury is out as of today because it appears that the ethers.js testing suite has not been updated as of yet.

5. How important is the number of downloads of the library?

Because web3.js has been around longer, it has more downloads ( 14,703,432 as of May 20) than ethers.js ( 8,500,336 as of May 20), but when we look at weekly downloads, ethers.js ( 184,798 as of May 20) has surpassed web3.js ( 175,661 as of May 20) in downloads and is currently the more frequently downloaded library. Ethers.js has more downloads over the more recent timeframe, but web3.js has more downloads overall.

6. How important is web performance?

If web performance is very important to you, the assumption is that ethers.js is the more performative library. The ethers.js library claims to be 284 kb uncompressed, while on NPM it is listed at 3.5 MB unpacked. Web3.js which is at least an order of magnitude larger, at 10.6 MB unpacked. Given that ethers.js is smaller than web3.js, the line of thinking is that for application using ethers.js will have faster load time than the same application that would use web3.js instead. This is because whichever library is used, it will have been loaded along with other assets that are part of the web application. We have not tested the load time of identical applications that are identical except for using web3.js or ethers.js, so take this point with some skepticism. If those extra MB do make a difference in your application, ethers.js is the smaller library.

7. How important is the quality of the documentation?

Quality of documentation is a subjective measure, but one way to measure the quality of documentation is to read it and see how easily understandable the documentation is. Ideally, documentation is written so that a new user can grasp how to use the library. The documentation should also be organized to allow a more seasoned user to quickly find what they are looking for.

Web3.js has an extensive API reference that is incredibly useful. This is the strongest part of the documentation. The “Getting Started” material is short. An experienced user will likely enjoy this, but there is a lack of material for the new user of web3.js.

Ethers.js includes a “Getting Started” section, along with an expansive API reference. These are incredibly useful, and give ethers.js an advantage when compared to web3.js, particularly when it comes to newer developers in the Ethereum ecosystem. There are some incomplete sections within the documentation for ethers.js, which is not user friendly (parts of the Ethereum Basics section and the historically great “Cookbook” of common code samples that a developer would use is not up to date in 5.0 yet — you have to go back to the version 4.0 docs to find this incredibly useful section). Ethers.js also provides clear information about the advantages of using ethers.js.

Neither library has perfect documentation, so if documentation is important to you, spend some time exploring it to determine if there is enough information to allow you to implement the feature you are hoping to build.

8. How important is the overall usage of the library?

While web3.js has been around longer and therefore has more downloads and GitHub stars, ethers.js is rising in popularity. Ultimately, it’s up to you to determine which aspects of each library matter most for your use case.

9. How important is the license?

Depending on your specific use case, the open source software license may matter to you. Web3.js has an LGPLv3 license (as listed on NPM, but not on their GitHub repository) and ethers.js has an MIT license (as listed on their GitHub repository). More details on the licenses can be found by contacting a legal expert on this subject. However, Slava Todavchich provides an entertaining read on the subject in the article “ Understanding open-source and free software licensing.”

Conclusion

As we mentioned at the beginning, both libraries are capable of getting the job done. Ethers.js has gained in popularity over the past two years, seeing increasing downloads and usage by projects. Web3.js has been the standard historically, and still owns a lot of developer-share.

Stay tuned for Part II where we will publish a follow-up tutorial to show you how to connect to the Infura API and send a translation using web3.js and ethers.js. Huge thanks to Thomas Hay, Akua Nti, and Sean Brennan for their extensive contributions to this guide.

For more Web3 tutorials, check out the Infura Blog, ConsenSys Academy, and our blockchain development walkthroughs.

Originally published at https://blog.infura.io on July 2, 2020.


Ethereum JavaScript Libraries for Dapp Development: web3.js vs. ethers.js was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

ConsenSys Codefi Announces Ethereum 2.0 Staking Pilot Program With Six Members

https://media.consensys.net/consensys-codefi-announces-ethereum-2-0-staking-pilot-program-with-six-members-9db70abdfbc7?source=rss----3018c972aab8---4

Binance, Crypto.com, DARMA Capital, Huobi Wallet, Matrixport, and Trustology join Codefi Staking Pilot Program, gain early access to Ethereum 2.0 staking solution

ConsenSys Codefi is launching an Ethereum 2.0 staking-as-a-service platform with institutional functionality for exchanges, custodians, funds, wallets and other potential customers. Last week, Codefi revealed its first batch of Pilot Program participants, designed to incorporate feedback and feature requests while designing and building the Codefi Staking API ahead of the Ethereum 2.0 launch. Through the completion of the pilot program, partners gain a deeper understanding of Ethereum 2.0 and have the opportunity to be first to market in providing their customers with Ethereum 2.0 staking capabilities.

Codefi Staking’ is built on top of a trusted software stack built by ConsenSys. The mission is to provide a white-label institutional grade API, with easy and efficient access to the Ethereum 2.0 network to enable enterprises to safely and profitably engage with the next phase of Ethereum’s evolution.

Preparing for a Protocol Upgrade

With the first phase expected to launch in 2020, Ethereum 2.0 marks a long-anticipated upgrade to the Ethereum public mainnet. The launch of Ethereum 2.0 is especially significant compared to past upgrades because of the implementation of a Proof of Stake consensus mechanism, moving the network away from its existing Proof of Work architecture. With Proof of Stake, a network of validators effectively place a security deposit of 32 ETH in special accounts on the network, as a guarantee they will follow and enforce the network rules. Ethereum 2.0 will remain decentralized, and anyone willing to stake 32 ETH can become a validator (a minimum of 16,384 Validators staking 524,288 Eth are needed for Ethereum 2.0 to launch).

For people who hold ETH, Proof of Stake marks a more inclusive way to maintain the security of the Ethereum 2.0 network compared to Proof of Work, along with comparatively high rewards for participants. Yet for the average crypto enthusiast, staking can be complex; hence, platforms like exchanges, funds, and wallets offering staking will be differentiated from their competitors in lowering the barriers to participation in staking networks.

“Some of the risks associated with running your own validator include theft or loss of withdrawal keys, incorrect transfer of funds to the Eth 2 deposit contract, and not to mention hardware or internet connectivity failures which result in a loss of validator rewards. With ConsenSys Codefi, validator keys are held in a secure vault with online signing capability, and there will be multiple layers of gatekeepers validating transactions preventing unauthorized usage. We know the importance of onboarding as many validators to Ethereum 2.0, and for that reason have built a turnkey solution for enabling large exchanges and institutional crypto funds to have an always-on and dependable access point to stake the ETH they hold for their customers,” said Tim Lowe, Product Lead of Codefi Staking.

Codefi Staking Pilot Program

Binance, Crypto.com, DARMA Capital, Huobi Wallet, Matrixport, and Trustology are the first companies to join the Codefi Staking Pilot Program.

“With staking on Binance, users can receive staking rewards without needing to set up nodes, or worrying about minimum staking amounts, time lengths, or any catches. Users deserve the rewards that their coins can earn them. With the eventual launch of Ethereum 2.0, we are excited to support staking for all of our ETH holders on Binance,” said Changpeng Zhao (CZ), CEO at Binance.

“Ethereum’s upgrade to proof-of-stake will be a pivotal moment for both Ethereum and the Web 3.0 ecosystem. We look forward to teaming with ConsenSys as they support the technological progression and DARMA addresses the financial impact of ETH locked assets and rewards staking through staking-swaps and collateralization,” said James Slazas, CEO of DARMA Capital.

Alex Batlin, “We believe that ETH2.0 represents a step change for decentralised finance, both in terms of performance and scalability, that will spearhead the long awaited mass adoption, along with the opportunity to earn interest on ETH via staking. ETH2.0 brings to the forefront the need for bank-grade secure, but lightening fast, custody solutions. Thanks to our custom HSM firmware in HSM, we are able to lead the market in offering a fast and scalable custodial wallet solution both for investors looking to stake on ETH2.0, and for validators involved in staking operations.”

ConsenSys Codefi Offers Flexible Features and Services

Codefi Staking will offer direct API integration or a white-labeled UI, both providing detailed metrics and reporting whilst ensuring a minimum 99% uptime for validators confirming blocks on Ethereum 2.0. And importantly, there will be 24/7 support and a professional customer service team available.

Codefi Staking was built using PegaSys Teku , the Ethereum 2.0 client empowering businesses to stake on the next evolution of the Ethereum network. Written in Java and maintained by the same team behind Hyperledger Besu, Teku is making it easier to bring staking services to businesses. Codefi Staking will also support other Eth2 clients to maintain flexibility and 99% uptime for validators, as the development phases of Eth2 further develop.

Early Adopter Program

Codefi is accepting Early Adopter customers to partner with prior to the Ethereum 2.0 Beacon Chain launch. Early Adopters have an opportunity to stay ahead of the competition with a low-risk, low barrier-to-entry way to provide feedback on the service, as well as learn directly from Eth2 teams building the next generation of Ethereum and begin staking ETH.

Interested in joining the program? Fill out our Early Adopter signup form.

Originally published at https://consensys.net.


ConsenSys Codefi Announces Ethereum 2.0 Staking Pilot Program With Six Members was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

How to Fetch and Update Data From Ethereum With React and SWR

https://media.consensys.net/how-to-fetch-and-update-data-from-ethereum-with-react-and-swr-d53fc8775856?source=rss----3018c972aab8---4

Configure your dapp’s frontend so token balances and fund transfers update in your users’ Ethereum wallets.

Ethereum allows us to build decentralized applications (dapps). The main difference between a typical application and a dapp is that you don’t need to deploy a backend-at least as long as you take advantage of the other smart contracts deployed on the Ethereum mainnet.

Because of that, the frontend plays a major role. It is in charge of marshaling and unmarshaling the data from the smart contracts, handling the interactions with the wallet (hardware or software) and, as usual, managing the UX. Not only that, by design, a dapp uses JSON-RPC calls and it can open a socket connection to receive updates.

As you can see there are a few things to orchestrate but don’t worry, the ecosystem has matured quite a lot in the last few months.

Prerequisites

During this tutorial, I will assume you already have the the following:

A wallet to connect to a Geth node

The simplest approach is installing MetaMask so that you can use Infura infrastructure out of the box.

Some Ether in your account

When you are developing with Ethereum, I strongly advise you to switch to a testnet and use test Ether. If you need funds for testing purpose you can use a faucet e.g. https://faucet.rinkeby.io/

Basic understanding of React

I will guide you step by step but I will assume you know how React works (including hooks). If something seems unfamiliar consult the React documentation.

A working React playground

I wrote this tutorial with Typescript but just a few things are typed so with minimal changes you can use it as it is in Javascript as well. I used Parcel.js but feel free to use Create React App too or other web application bundler.

Connect to Ethereum Mainnet

Once you have MetaMask ready, we are going to use web3-react to handle the interaction with the network. It will give you quite a handy hook useWeb3React, which contains many useful utilities for playing with Ethereum.

yarn add @web3-react/core @web3-react/injected-connector

Then you need a Provider. A Provider abstracts a connection to the Ethereum blockchain, for issuing queries and sending signed state-changing transactions.

We will use Web3Provider from Ether.js.

It seems to already have a few libraries, but when interacting with Ethereum you need to translate Javascript data types to Solidity ones. And, you are also required to sign the transactions when you want to execute an action. Ether.js elegantly provide these functionalities.

yarn add @ethersproject/providers

notice: the above Ether.js package is the v5 currently in beta.

After that we are ready to jot down a minimal hello world to check if we have everything we need:

Jump to the original blog post to copy and paste the code.

If you did your homework you should have something like this:

Here what we did so far: GIT — step-1

How to Fetch Data from the Mainnet

I will use SWR to manage the data fetching.

This is what I want to achieve.

const { data: balance } = useSWR(["getBalance", account, "latest"])

Quite cool 🙂

Let’s unveil the trick! SWR means Stale-While-Revalidate, an HTTP cache invalidation strategy popularized by RFC 5861.

SWR first returns the data from cache (stale), then sends the fetch request (revalidate), and finally comes with the up-to-date data again.

SWR accepts a key and behind the scenes will manage to resolve

To do that SWR allows passing a fetcher capable of resolving the key by returning a promise. The hello world of SWR is based on REST API requests with a fetcher based on fetch API or Axios.

What is brilliant about SWR is that the only requirement to create a fetcher is it must return a promise.

So here is my first implementation of a fetcher for Ethereum:

const fetcher = (library) => (...args) => {
const [method, ...params] = args
console.log(method, params)
return library[method](...params)
}

As you can see, it is a partially applied function. In that way, I can inject the library ( my Web3Provider) when I configure the fetcher. Later, every time a key changes, the function can be resolved by returning the required promise.

Now I can create my <Balance/> component

export const Balance = () => {
const { account, library } = useWeb3React<Web3Provider>()
const { data: balance } = useSWR(['getBalance', account, 'latest'], {
fetcher: fetcher(library),
})
if(!balance) {
return <div>...</div>
}
return <div>Balance: {balance.toString()}</div>
}

The balance object returned is a BigNumber.

As you can see, the number is not formated and extremely large. This is because Solidity uses Integer up to 256 bits.

To display the number in a human readable format, the solution is using one of the aforementioned utilities from Ether.js utilities: formatEther(balance)

yarn install @ethersproject/units

Now that I can rework my <Balance/> component to handle and format the BitInt in a human readable form:

export const Balance = () => {
const { account, library } = useWeb3React<Web3Provider>()
const { data: balance } = useSWR(['getBalance', account, 'latest'], {
fetcher: fetcher(library),
})
if(!balance) {
return <div>...</div>
}
return <div>Ξ {parseFloat(formatEther(balance)).toPrecision(4)}</div>
}

this what we did so far: GIT step-2

How to Update the Data in Real-Time

SWR exposes a mutate function to update its internal cache.

const { data: balance, mutate } = useSWR(['getBalance', account, 'latest'], {
fetcher: fetcher(library),
})
const onClick = () => {
mutate(new BigNumber(10), false)
}

The mutate function is automatically bound to the key (e.g. [‘getBalance’, account, ‘latest’] from which it has been generated. It accepts two parameters. The new data and if a validation should be triggered. If it should, SWR will automatically use the fetcher to update the cache 💥

As anticipated, Solidity events give a tiny abstraction on top of the EVM’s logging functionality. Applications can subscribe and listen to these events through the RPC interface of an Ethereum client.

Ether.js has a simple API to subscribe to an event:

const { account, library } = useWeb3React<Web3Provider>() library.on("blockNumber", (blockNumber) => {   console.log({blockNumber})
})

Now let’s combine both approaches in the new <Balance/> component

Jump to the original blog post to copy and paste the code.

Initially, SWR will fetch the account balance, and then every time it receives a block event it will use mutate to trigger a re-fetch.

notice: We used mutate(undefined, true) because we can’t retrieve from the current event the actual balance we just trigger a re-fetch of the balance.

Below is quick demo with two Ethereum wallets that are exchanging some ETH.

Here what we did so far: GIT step-3

How to Interact With a Smart Contract

So far we illustrated the basics of using SWR and how to make a basic call via a Web3Provider. Let’s now discover how to interact with a smart contract.

Ether.js handles smart contract interaction using the Contract Application Binary Interface (ABI) ABI generated by the Solidity Compiler.

The Contract Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction.

For example, given the below simple smart contract:

pragma solidity ^0.5 .0;
contract Test {
constructor() public { b = hex"12345678901234567890123456789012"; }
event Event(uint indexed a, bytes32 b);
event Event2(uint indexed a, bytes32 b);
function foo(uint a) public { emit Event(a, b); }
bytes32 b;
}

this is the ABI generated

To use the ABIs, we can simply copy them directly into your code and import them where it is required. In this demo, we will use a standard ERC20 ABI because we want to retrieve the balances of two tokens: DAI and MKR.

Next step is creating the <TokenBalance/> component

Let’s zoom in. There are two main differences:

Key definition

The key, used by useSWR([address, ‘balanceOf’, account])), needs to start with an Ethereum address rather than a method. Because of that, the fetcher can recognize what we want to achieve and use the ABI.

Let’s refactor the fetcher accordingly:

Now we have a general-purpose fetcher capable of interacting with the JSON-RPC calls of Ethereum. 🙌

Log filters

The other aspect in <TokenBalance/> is how to listen for the ERC20 events. Ether.js provides a handy way to configure a filter based on the topics and name of the event. More info about what is a topic can be found in the Solidity docs.

const contract = new Contract(address, ERC20ABI, library.getSigner()) const fromMe = contract.filters.Transfer(account, null)

Once you have built a contract instance with the ABI, then you can pass the filter to the library instance.

Warning:

You could be tempted to use the amount in the ERC20 event directly to increase or decrease the balance.

Be aware of the dragon. When you setup the fetcher, you passed a clojure as callback to the on function, which contained the balance value at the time.

This could be fixed using a useRef but for the sake of simplicity let’s revalidate the cache to ensure the balances are fresh: mutate(undefined, true)

We now have all of the pieces required. The last bit is a bit of glue.

I configured a few constants in order to have a nice way to map my TokenBalance component to a list of tokens depending on the network where we are working:

Once we have the constants it’s easy to map the configured tokens to my <TokenList/> component:

export const TokenList = ({ chainId }) => {
return (
<>
{TOKENS_BY_NETWORK[chainId].map((token) => ( <TokenBalance key={token.address} {...token} />
))}
</>
)
}

All set! Now we have an Ethereum wallet that loads ether and token balances. And if the user sends or receives funds, the wallet UI is updated.

Here’s what we did so far: GIT step-4

Refactoring

Let’s move every component in a separated file and make the fetcher a globally available using SWRConfig provider.

With SWRConfig we can configure some options as always available, so that we can have a more convenient usage of SWR.

Here’s everything after the refactoring: GIT step-5

Wrap Up

SWR and Ether.js are two nice libraries to work with if you want to streamline your data fetching strategy with Ethereum dapp.

Key advantages

  • Declarative approach
  • Data always fresh via web sockets or SWR options
  • Avoid reinventing the wheel for state management with custom React context

If you use multiple smart contracts in your dapp and you liked this tutorial, I generalised the web3 fetcher into a small util: swr-eth (Stars are appreciated 👻)

And finally, here is the full GIT repo: ( https://github.com/aboutlo/swr-eth-tutorial).

Get More Ethereum Tutorials Straight to Your Inbox

Subscribe to our newsletter for the latest Ethereum developer tools, pro tips, and more.

Originally published at https://consensys.net.


How to Fetch and Update Data From Ethereum With React and SWR was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Tutorial: Query Your Ethereum 2.0 Validator Balance With the Infura API

https://media.consensys.net/tutorial-query-your-ethereum-2-0-validator-balance-with-the-infura-api-e6d36d400195?source=rss----3018c972aab8---4

How to query validator balances programmatically with the Infura Eth 2.0 Beacon Chain API.

Every day is bringing us closer to the genesis of Ethereum 2.0 Phase 0. Major multi-client testnet efforts are well underway with the current witti testnet and the upcoming altona testnet. Interest and participation in staking on these testnets continues to rise, with over 65% of all respondents planning to stake their ETH, according to a new Ethereum 2.0 Report.

One of the most basic needs for those staking on ETH 2.0 will be monitoring the balance of their validators. It is crucial to know if they are accruing the rewards that are expected. Of course there are several great block explorers available where you can see this information, but in this post, we will show how you can query it programmatically with the Infura ETH 2.0 Beacon Chain API.

The ability to query your balance programmatically is important because it enables you to easily take action on the data. You might want to write a program that monitors the balance and sends you a text message if it unexpectedly drops!

Let’s take a look how to accomplish this in a simple typescript program.

First we will import the axios library and create an HTTP client with some basic defaults, loading our Infura project ID from an environment variable:

import axios from 'axios'; 
const instance = axios.create({ 
baseURL: 'https://witti.infura.io/',
auth: {
username: process.env.INFURA_PROJECT_ID,
password: '',
},
});

We define some helpful constants related to the basic parameters of the network. The first two will help us calculate the current epoch, and the last helps us convert a gwei balance to the more familiar eth unit:

const SECONDS_PER_SLOT = 12; 
const SLOTS_PER_EPOCH = 32;
const GWEI_PER_ETH = 1000000000;

Then we will query the genesis for the network, and use it to calculate the current epoch:

(async () => { 
let response = await instance.get('node/genesis_time')
const genesisTime = response.data;
  const now = Math.floor(Date.now() / 1000) 
const currentEpoch = Math.floor((now - genesisTime) / (SECONDS_PER_SLOT * SLOTS_PER_EPOCH))

Using that, we can then query for the current balance of a validator (here using the public key of the highest balance validator on the network at time of writing):

   response = await instance.post('beacon/validators', {
epoch: currentEpoch.toString(),
pubkeys: ["0xb0bfa93603f81ecaf3c450b793e71f7372822cd2002534364493e4e497fb5df16d252ae2fdc6bbc0e74d849f918db393"], });
 const balanceGwei = response.data[0].balance; 
const balance = balanceGwei / GWEI_PER_ETH;
 console.log(`You have ${balance} Ξ2.0`); 
})();

When we run the full program, we will see an output like:

You have 32.500178823 Ξ2.0

Now we can expand the program to do something useful with the information!

For convenience, here is the full program in one snippet:

import axios from 'axios'; 
const instance = axios.create({ 
baseURL: 'https://witti.infura.io/',
auth: {
username: process.env.INFURA_PROJECT_ID,
password: '',
},
});
const SECONDS_PER_SLOT = 12; 
const SLOTS_PER_EPOCH = 32;
const GWEI_PER_ETH = 1000000000;
(async () => { 
let response = await instance.get('node/genesis_time')
const genesisTime = response.data;
  const now = Math.floor(Date.now() / 1000) 
const currentEpoch = Math.floor((now - genesisTime) / (SECONDS_PER_SLOT * SLOTS_PER_EPOCH))
  response = await instance.post('beacon/validators', {
epoch: currentEpoch.toString(),
pubkeys: ["0xb0bfa93603f81ecaf3c450b793e71f7372822cd2002534364493e4e497fb5df16d252ae2fdc6bbc0e74d849f918db393"],
});
  const balanceGwei = response.data[0].balance; 
const balance = balanceGwei / GWEI_PER_ETH;
  console.log(`You have ${balance} Ξ2.0`); 
})();

In preparation for the launch of Ethereum 2.0, we’ve planned a limited time private beta release of Infura’s Eth2 Beacon Chain API. If you would like access, apply now and register your interest. Documentation will be sent out directly to users who are accepted into the beta.

We greatly value all our testers. It’s your feedback that will help us refine our Eth2 Beacon Chain API, ensuring that the final product is as relevant and performant as possible, before making it more widely available.

Get Started With Infura

Start using Infura’s Ethereum API to develop on Web 3.0.

Originally published at https://blog.infura.io on June 12, 2020.


Tutorial: Query Your Ethereum 2.0 Validator Balance With the Infura API was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

Infographic: Benefits of Blockchain in the Financial Services Industry

https://media.consensys.net/infographic-benefits-of-blockchain-in-the-financial-services-industry-1024e81033de?source=rss----3018c972aab8---4

From tokenization to consortium networks, here’s an overview of how blockchain technology is improving operational efficiency and reducing risk in financial services.

Over the past few years, blockchain technology has been adopted by an increasing number of major financial institutions seeking to streamline business processes, launch trusted business networks, and create and manage digital assets. Here’s an overview of current pain points and inefficiencies in the financial services industry and how blockchain technology is saving and unlocking capital across use cases as wide-ranging as asset management and payment settlement. For a comprehensive introduction, visit blockchain in financial services.

“Blockchain is no longer a buzzword. Major governments, central banks, and financial powerhouses are seriously investing in blockchain business cases and recognizing that the tide is already turning.” –Joe Lubin, CEO of ConsenSys and Co-Founder of Ethereum

Get blockchain explainers straight to your inbox.

Subscribe to the ConsenSys newsletter to get our latest blockchain intros, webinars, products, and more.

Originally published at https://consensys.net.


Infographic: Benefits of Blockchain in the Financial Services Industry was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.

What Happens to My ETH on Ethereum 2.0?

https://media.consensys.net/what-happens-to-my-eth-on-ethereum-2-0-ef54523dd93?source=rss----3018c972aab8---4

Ethereum 2.0 is launching in 2020. And no, you don’t need to do anything with the ETH you’ve bought over the years.

In 2020, the first phase of the Ethereum 2.0 network will go live. Called Phase 0, this initial evolution of the 2.0 network will launch the beacon chain and enable the Proof of Stake consensus mechanism.

The whole blockchain ecosystem, and Ethereum in particular, has evolved considerably in its early years, with a lively history of hard forks, airdrops, ICOs, wrapped tokens, and token migrations. Reasonably, even the short history of this technology can be confusing to ether holders who simply wish to know what, if anything, they need to do to ensure their crypto is safe and where it should be.

With an eye towards the launch of Ethereum 2.0, therefore, the natural questions for most ETH holders are: what happens to the ether I have bought over the years on the current Ethereum blockchain? Do I need to worry about a hard fork, or will I need to manage a token migration? Does it matter if my ether is on an exchange like Coinbase or in a hardware wallet like Ledger?

For most ETH holders — i.e. the HODLers, the dapp users, the traders — the answers are: No, you don’t need to do anything. No, there won’t be a hard fork or a migration. No, it does not matter if your ether is on an exchange or not.

For ETH holders who are interested in staking, there is an opportunity to be more active with your ETH in this first stage of the Ethereum 2.0 rollout.

ETH on Ethereum 2.0

Ethereum 2.0 will go live in phases: Phase 0, Phase 1 (including Phase 1.5), Phase 2, and beyond. Phase 0 is going live in 2020, and will initiate the Proof of Stake mechanism. It is during Phase 0 that ETH holders who are interested in staking will be able to do so (more details below). For ETH holders who are not interested in staking, however, the upcoming launch of Ethereum 2.0 will not significantly impact their interactions with blockchain dapps, exchanges, or services.

ETH holders only need to start paying attention at Phase 1.5 (which is part of Phase 1), which is likely to arrive at least a year after Phase 0. During Phase 1, the Ethereum blockchain will be partitioned into 64 shard chains that run alongside one another. This will significantly increase the scalability and throughput of the future Ethereum mainnet (see our Ethereum 2.0 FAQ or What is Proof of Stake? blog posts for more information about sharding).

Phase 1.5 is part of Phase 1, but is specifically named because it marks the moment when Ethereum 1.0 merges with Ethereum 2.0. Specifically, the Ethereum 1.0 chain will become one of the 64 shards that make up Ethereum 2.0. This means that the entire data history will be preserved.

For ETH holders, this means no particular action is needed to “transfer” ETH from the 1.0 to the 2.0 chain. Ethereum 1.0 will simply become part of the 2.0 chain (“simply,” referring to the effort of the end user — not to the extraordinary protocol development work going into this transition), meaning ETH holders can continue using (or HODLing) their ETH just as they were before — but on a chain that is more secure and scalable than they’re used to.

ETH Holders and Staking on Ethereum 2.0

As previously stated, the ETH holders who are interested only in holding, trading, or using their ETH on dapps do not have to actively do anything to prepare for Ethereum 2.0. For ETH holders who are interested in staking on the new Ethereum 2.0 network, however, there is an opportunity for involvement starting at Phase 0 instead of waiting for Phase 1.5.

Staking is the process by which validators commit ETH to the Ethereum 2.0 blockchain in order to propose and attest new blocks into existence. To become a full validator on Ethereum 2.0, ETH holders must stake 32 ETH by depositing the funds into the official deposit contract that has been developed by the Ethereum Foundation.

ETH holders who wish to stake do not need to stake during Phase 0: they can join the network as a validator whenever they wish. However — unlike other ETH holders who have to wait until Phase 1.5 to see their ETH on the Ethereum 2.0 chain — validators can commit their funds to the blockchain starting at genesis. The incentive is the potential for higher block rewards.

There are many opportunities for people with ETH to begin staking on the Ethereum 2.0 network and earn rewards. To become a full validator, they must stake 32 ETH in the deposit contract, generate deposit keys, and then run their own client. Clients such as PegaSys Teku offer this opportunity for businesses. If they do not wish to run their own client, they can offload the technical requirement by depositing 32 ETH to a staking service such as Codefi Activate, which will then manage the validator node. Lastly, if ETH holders do not have 32 ETH, they may join a staking pool and combine their funds with other people to reach 32 ETH.

Download the Ethereum 2.0 Staking Report

Download our latest ecosystem report about the future of staking on Ethereum.

Originally published at https://consensys.net.


What Happens to My ETH on Ethereum 2.0? was originally published in ConsenSys Media on Medium, where people are continuing the conversation by highlighting and responding to this story.