Going Byzantine
Published in

Going Byzantine

ETH explained

DeFi in Eth 2.0 and migrations

a brief on the hot topic & implications for decentralized finance

When we wrote an in-depth guide to DeFi (Redefine 2020: A Primer), Eth2.0 was still a distant dream. A dream of blazing-fast, but still decentralized future built with spaceship cryptography, bringing scale to DeFi. Just two months later, it is still a dream, but the shining beacon in space has launched, Phase 0 is a go. On Dec 1, Beacon Chain was launched — the first in three major renovations geared towards Eth 2.0 that will span over the next two years. What it means for DeFi now and what to make of it for the long term? See in our brief.

Fact sheet

Timing: Ethereum 2.0 comes in 3 phases (see ethhub from background reading & see the table below)

1. Beacon Chain (BeaconScan)>
2. Shard Chains >
3. Docking (fully functional Shard Chains & full migration)

All things considered, migrations and implications for DeFi will only be relevant (and will take final shape) in a couple of years.

ETH 2.0 planned rollout phases
  1. App contracts: No application contracts on the Beacon Сhain, naturally. Only on shard chains.

    PSA: the following is about Phase 2, for which nothing is fixed yet.
  2. Tokens & Shards: ERC20 standard will be updated to allow tokens to exist on all shards. You can move ETH freely between shards, the same can and will be done with tokens.

    In a nutshell, the process goes like this:
    1 — You submit a transaction to the source shard, saying you want to transfer some ETH/ERC20 to a destination shard.
    2 — The source shard processes the transaction and issues a receipt on a beacon chain for an outgoing transfer.
    3 — The destination shard picks up that receipt and credits you with the same amount of ETH/ERC20.
  3. Dapps & Shards: Dapp developers will be able to choose the shard to deploy their contract. This means that the option of having the entire DeFi ecosystem deployed onto one shard (like it’s on Ethereum mainnet now) is always there, with all its drawbacks (slow & costly in gas). The question is, can we do better.
  4. Contracts & Shards: There’s a concept of “yanking”, an operation to move a contract from one shard to another. It can obviously only work with contracts with small enough state (not too much data to move). Contracts will define for themselves their yanking rules. One option is to allow any user to yank the contract to any shard of their choosing: if you want an atomic operation, just yank your Maker vault contract to the shard hosting the DAI/ETH Uniswap pair, and then do it.
  5. Transition: The current plan is that after Phase 2 is deployed, Eth1 will migrate to become a shard in Eth2. The transition will be mostly seamless, with all accounts and contracts just waking up on Eth2 one day, unchanged. Of course, clients and wallets will have to be updated (much like for other Eth1 hard forks, like Constantinople).
    *Under the hood, it’s more complicated, since Eth1.x has to build stateless clients before Eth1 can be migrated, but let’s not get into that.
Systemic visualization on Eth2.0 phases: Phase 0 — Beacon Chain — launched the PoS network with first shards coming with Phase 1. (Img credit: Trenton Van Epps)

Technical considerations

It’s too early to say anything for certain, as the stage of Eth2 that can host applications (Phase 2) is still a fair deal away, and isn’t locked in. In the absolute worst case, DeFi on Eth2 will work the same as DeFi on Eth1.

The current migration plan will just move everything into Eth2, the ecosystem will have to diverge from that point. For one thing, moving liquidity to Eth2 DeFi dapps will work the same as it is now between Eth1 dapps.

The current design discussions suggest that smart contract architectures optimal for sharded blockchain may be different. There likely won’t be natural atomic transactions between shards (there are some talks with unclear status), instead, there may be a shift to asynchronous (non-atomic) transactions and “yanking” contracts between shards. For applications, this means that the approach to contract architectures may change, making room to account for:
— compartmentalization of state for ease of yanking,
— mechanisms to use partial transactions and receipts,
— workarounds to account for lack of cross-shard atomicity.

Long atomic execution sequences (such as using flash loans to perform risk-free arbitrage between Uniswap-like exchanges) may leave us for good. There are three important use cases for atomic multi-contract transactions (possible only within one shard):

1. Using flash loans in complex deals;
2. Risk-free arbitrage;
3. UX-improving sequences, such as repaying a large loan on Maker and unlocking collateral in one transaction, using limited liquidity.

Yanking can be a niche solution to these, provided every contract required for a use case is small enough and idle enough to be available for yanking (or they already reside on the same shard). Generally, though, the first two use cases may fall out of fashion, and the third one will have to be worked around with architecting the user-side contracts in a yankable way.

We shouldn’t discard L2 solutions which continue rapid development, including non-custodial exchanges on zero-knowledge proofs, L2 chains on rollups, etc. By the time Phase 2 of Eth2 will be out, it is possible that all of the missing functionality for atomicity may move into cryptographically secured L2 networks attached to shards, preserving the existing modes of operations as they are.

Overall, Eth2 doesn’t (shouldn’t) break anything in DeFi, but may rather offer great excitement of much greater throughput, better security (with users running stateless nodes instead of going through central bottlenecks on their way to the blockchain), and maybe cooler use cases.

Img credits: 1, 2


Frankly, it’s too early to tell anything for sure with regards to the DeFi: only Phase 2 will have contracts, it’s not locked in, and it’s expected no earlier than 2022. But for now, we already do have some things to think about.


Smooth migration will preserve the existing DeFi ecosystem as is on the Eth1 shard, but new, Eth2-enhanced versions of the DeFi dapps may be deployed on different shards and have quick liquidity migrations. The immediate bonus is growth in throughput and possible reduction of gas prices, as the same amount of traffic will be a lower load on the network. Easily transferable tokens and moving smaller contracts between shards (“yanking”) will likely allow the network to balance loads between shards, better reacting to traffic spikes on particular contracts.

Food for thought

Atomic transactions, one of the most exciting properties of Ethereum contracts (enabling the notorious flash loans, for instance) will likely not work between shards, although workarounds may appear at a later time.
This can be sidestepped to an extent with contract yanking and putting a synergizing contract on the same shard, but these still are partial solutions, as not everything will be movable, and popular contracts may have to restrict yanking to provide a reasonable UX.

Background reading

Redefine 2020: A Primer. Where Decentralization Meets Finance
(CT promotion page, pdf)

Hot stuff

  1. Vitalik’s post on cross-shard DeFi composability (ethresearch, Oct ’19)
    + discussion in the same thread
  2. Vitalik’s post on cross-shard contract yanking (ethresearch, Oct ‘19)
  3. Docs on Ethhub, including Eth2 phases (ethhub)

Other relevant material




economics of tokenized systems, mechanism design, DLT, protocols

Recommended from Medium

Ethereum price ascending channel breakout possible if Bitcoin consolidates

+26.69% growth: How to Buy Beowulf (BWF) — A Step by Step Guide | Crypto Buying Tips


Crypto Trades Anticipated to Develop into Reportable by Platforms In 3 Years

Review of a meetup in Crypto Valley v1.2 — Vaduz, Liechtenstein


How You Can Benefit From Bitcoin Every Day

Sleepy Swiss town launches Tezos-backed Coronavirus aid program

Announcement on ZBG’s “Mid-Autumn Festival Contract Competition, Great Giveaway is waiting for you”

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


R&D at Byzantine.Solutions. Infovizard, research & design

More from Medium

Paywall Finance — The Future of Global Investment Summits

EPNS: A notification service to save your time and assets

An Introduction to CoinFresh

How to make people agree with you: Consensus! 🦾🤓