hg0088线上

hg0088线上page last updated: september 25, 2020

The beacon chain

The beacon chain is a new blockchain at the core of Eth2 that will ensure the whole network is in sync with the same data. In Eth2 this is a lot more difficult than it is today because the network will exist across many shards. This means rather than just one blockchain, Ethereum will become many blockchains all running in parallel. These shard chains are an important part of increasing the number of transactions Ethereum can handle per second.

hg0088线上it's the job of the beacon chain to make sure every shard has the most up-to-date data. it does this with the help of validators who communicate the state of shard chains to the beacon chain. a validator is someone who has staked 32eth in the network to take part in processing transactions, creating new blocks and earning staking rewards.

hg0088线上the beacon chain does all this by storing:

  • validator addresses
  • the state of each validator
  • block attestations
  • links to shards

hg0088线上how this works is best explained by following the lifecycle of a transaction in eth2.

How transactions work in Eth2

Shard to beacon communication

Validation

when you submit a transaction – like sending eth to someone – a validator will be responsible for adding your transaction to a shard block. validators are algorithmically chosen to propose new blocks.

hg0088线上the bigger your stake, the more often you'll be chosen to propose shard blocks. however 32eth is effectively the max, so having more than 32eth staked does not change the amount you are selected, but having less than 32 does.

Attestation

hg0088线上if a validator isn't chosen to propose a new shard block, they'll have to validate the proposal and confirm that everything looks as it should.

hg0088线上if a validator agrees with a block proposal they are "attesting" to it. this is like giving the block the "ok" before shipping it off to the beacon chain. it's the attestation that is recorded in the beacon chain, rather than the transaction itself.

at least 128 validators are required to attest to each shard block – this is known as a "committee".

by separating validators out into committees, the effort required to verify eth2 and propose shard blocks is massively reduced. it's this design that allows you to be a validator on a regular piece of hardware like a laptop. this is different to ethereum today where to produce blocks you need to run intense mining software. this will help ethereum become even more decentralized.

the committee has a time-frame in which to propose and validate a shard block. this is known as a "slot". only one valid block is created per slot. there are 32 slots in an "epoch". after each epoch, the committee is disbanded and reformed with different participants. this helps keep committees safe from bad actors.

hg0088线上new epochs occur every 6.4 minutes.

eth2 should have at least 64 shard chains to start with, so how are the 63 other chains going to know about your transaction? the beacon chain!

Rewards, penalties and finality

during each epoch, the beacon chain has to do all the record-keeping. this includes issuing rewards and penalties to validators, and finalising beacon blocks.

Rewards and penalties

once a new shard block proposal has enough attestations, a "crosslink" is created which confirms the inclusion of the block, and your transaction, in the beacon chain.

This is coming in Phase 1.

hg0088线上once there's a crosslink, the shard block proposer gets a reward in the form of more eth.

hg0088线上validators can also receive penalties if they've been bad actors. or even have their eth slashed completely.

hg0088线上you can be penalized for being offline, but not slashed. slashings are much more serious cryptographically provable malicious actions against the protocol. these are met with an ejection from the validator set and a harsher penalty.

Finality

hg0088线上once a block is ready for the beacon chain, it needs finality. it shouldn't be able to be reverted. the beacon chain uses a protocol known as casper (the friendly finality gadget) to finalise blocks.

hg0088线上casper uses cryptoeconomic incentives to discourage validators from reverting a block. you can make votes on non-canonical chains but if you equivocate (double vote or contradict yourself), you can be slashed.

when the beacon chain block has been finalised, the shard block is also considered finalised. other shards will then be able to read that data.

In summary

the beacon chain receives block attestations from shards and uses casper to ensure they are finalised.

prior to that, the shard blocks go through a proof-of-stake process:

  • proposed by a chosen validator in a committee
  • attested by the rest of the committee during an epoch "slot"
  • crosslinked with the beacon chain after enough attestations
  • finalised by Casper using cryptoeconomic incentives

and that's how eth2 stays in sync using the beacon chain.

Further reading

hg0088线上for more on the beacon chain: