Ethereum 2.0 POS Mining Tutorial: A step-by-step guide to staking on the Topaz testnet

Ethereum 2.0 POS Mining Tutorial: A step-by-step guide to staking on the Topaz testnet

introduction

Topaz, the first mainnet configuration testnet of Ethereum 2.0 released by Prysmatic Labs, one of the Ethereum 2.0 client building teams, was finally officially launched on April 15. The testnet is aimed at testing the Ethereum 2.0 Phase 0, that is, implementing the beacon chain and staking.

As early as January last year, Ethereum conducted an AMA [1] (Ask Me Anything) on ​​Reddit, which detailed the progress of Ethereum 2.0. At that time, it was expected that the official launch of Phase 0 would be in November 2019 or January 2020. However, it is now May 2020, and it is still in the testing phase of Phase 0, and the official launch time has not yet been determined. It can be seen that Ethereum is similar to other projects. The forecast of progress is too optimistic, and the estimated launch time can only be heard and counted for fun.

I participated in the staking of Prysmatic Labs' testnet in October last year, and submitted several issues in the official discord. The version at that time had many bugs. However, more than half a year later, I saw reports that their testnet has more than 25,000 validators participating, which is indeed more than I expected. I didn't expect that staking in the test phase would be so popular. It seems that the community is paying close attention to Ethereum 2.0. So I participated in this testnet with curiosity.

There were some pitfalls in the process of starting staking, which I will record here for your reference.

Without further ado, let’s get to the point.

Glossary

Let me first explain a few technical terms.

  1. PoS: Proof of Stake, in Chinese, is called "proof of rights and interests". This word may sound confusing at first, but it is actually very simple. It refers to the mining method of obtaining new tokens by locking tokens. The corresponding one is PoW-Proof of Work, which is the mining method of obtaining new tokens through calculation, such as Bitcoin.

  2. Staking: refers to the process of participating in block verification and obtaining new tokens in PoS.

  3. beacon chain: The beacon chain is the core of Eth2, it manages the coordination of validators and shards. The beacon chain is the source of truth, and all other aspects of Eth2 are launched from here.

  4. validator: After pledging ETH, the validator is responsible for proposing or attesting the block and earning income.

Preparation

1. Metamask

Metamask is an ETH wallet based on a browser plugin.

Official website: https://metamask.io/

Tutorial: http://bjiebtc.com/qianbao-metamask-shiyongjc/

Follow the tutorial until you have memorized the mnemonics and entered the main interface. Then click the network switch button above. The default is the main network. Here you need to switch to the Goerli test network, as shown below:

Switch to the Goerli test network

2. Host

It can be run on personal computers, local servers, and cloud servers. The official minimum configuration requirements are as follows:

  • Operating System: 64-bit Linux, Mac OS X, Windows

  • Processor: Intel Core i5–760 or AMD FX-8100 or higher

  • Memory: 4GB RAM

  • Storage space: 20GB available space SSD

  • Internet: Broadband connection

Be sure to meet this minimum requirement!

If you run the beacon chain client on a host with 1GB of RAM and 2GB of swap (tested last October), it will exit with an error after a certain period of time. Don't ask me how I know!

Since the operation must be kept online 24/7, it is recommended to rent a cloud server for staking. The configuration must be at least 2 cores and 4G.

Join Staking!

Refer to the official documentation: https://prylabs.net/participate

1. Download the code

Create any new directory and execute the following code after entering:

 git clone https://github.com/prysmaticlabs/prysm && cd ./prysm

Just wait until the download is complete.

2. Get the ETH needed for testing - GöETH

GöETH is the ETH used by the Goerli test network. Remember that the ETH on the test network has no value and is only used for testing. Click step 2 in the official document, and then click the METAMASK icon to connect to the wallet:

Connecting to metamask

A metamask pop-up window will appear, click Authorize. Next, you will be prompted that you need at least 32 GöETH to participate. Click Need GöETH and click Yes please in the pop-up window.

Get 32 ​​GöETH

3. Generate the validator’s key

Execute the following code to create an account

 ./prysm.sh validator accounts create

During the creation process, you will see INFO accounts: Enter a password: then enter the password and remember it. Then press Enter to successfully create the account. After completion, you will see the following characters. Copy the 0x... part.

 =======================Raw Transaction Data========================
0x.......
...........
...........
===================================================================

4. Send validator deposit

The copied content above contains the information of the validator account. Paste the content into the input box of step 3 in the official document, then click the make deposit button in step 5, and then confirm the transaction in the metamask pop-up window.

Paste the content you copied in the previous step here

Send deposit transaction

5. Run the beacon chain and validator client

The official documentation states this step before sending the validator deposit, but it doesn’t matter if it’s at the end.

Once verification begins, the beacon chain client and the validator client need to be online 24/7 to perform staking, otherwise they will be punished. Therefore, it is necessary to ensure that both processes continue to run after closing the terminal.

The common methods to keep the process running after closing the terminal are nohup or screen. Since the authenticator client needs to enter the password set when the account is created to continue, and nohup will exit the authenticator client because the password cannot be entered, screen is used here.

Open the client through screen

  1. Create and enter a new screen session:

 screen -S beacon_chain
  1. Run the beacon chain client

 ./prysm.sh beacon-chain
  1. After waiting for it to start running, press the shortcut keys CTRL+A+D to detach from the terminal. At this time, it will display [detached from xxxx.eth2test1beacon] and return to the original session. The beacon chain node will continue to run. If you want to return to the beacon chain session, use the -r parameter:

 screen -r beacon_chain

Open the validator client in the same way, create a new screen session and change step 2 to ./prysm.sh validator and enter the password.

If you forget the name of the screen session you created, run screen -ls to view all created screen sessions.

Precautions

  • There are three stages to start staking: 1. Initial sync: Like other blockchains, all historical blocks need to be synchronized at the beginning. The beacon chain process will take up a lot of memory, CPU and bandwidth resources at this stage. Taking the 2H4G cloud host of xx cloud as an example, the client starts with a synchronization speed of about 20 blocks/second, but after running for a period of time, it will slowly drop to 0.4 blocks/second. At this time, restarting the client will restore to the initial speed. It will take about 3-4 restarts to complete the synchronization. The overall time takes 2 hours to 12 hours depending on the host performance and network speed. If the validator client is turned on at this stage, it will be in a state of waiting for the beacon chain synchronization to complete. Therefore, you can temporarily ignore the validator client and wait until the synchronization is completed before turning it on to save resources.

    1. Waiting to become a validator: After the beacon chain is synchronized, open the validator client and enter the waiting queue. Validators in the waiting queue have no income. This process takes about 24 hours.

    2. Verify and earn revenue: After waiting, you will become a validator and be assigned to a specific shard to propose or attest. You can earn revenue by continuously completing proposals or attestations.

  • You can set up a swap area to increase virtual memory to prevent insufficient memory from causing errors in the beacon chain client, especially in the initial synchronization phase. For more information on how to increase swap, see: https://blog.csdn.net/blog_liuliang/article/details/80435134

refer to

  1. Ethereum 2.0 Reddit AMA


<<:  Live Preview | BTC halving night, come and witness history together!

>>:  Bitcoin miners earned about $413 million in April, up 8% from the previous month

Recommend

Palmistry to analyze your emotional state

Marriage was recognized by the social system at t...

Monero will hard fork at block height 1685555 on October 18

Monero has released a new version including a cor...

What does a mole on the cheekbone mean?

The zygomatic bone is located in the front of the...

Is it good to show gums when smiling? Woman's face showing gums when smiling

Teeth are based on the kidneys, which means that t...

Can Circle’s plan to become a federal bank help it win the stablecoin war?

Can Circle Win the Stablecoin Wars? Source: Decry...

What does a lonely person look like?

Human beings are social animals. We have family a...

What kind of face will make a man unlucky in marriage?

What kind of face will make a man unlucky in marr...

What does a mole on the instep mean?

Each of us may have one or several moles somewher...

Unhappy marriage and good career

Unhappy marriage and good career 1. Women with wh...

Analysis: Does a big nose bring good fortune?

In physiognomy, the nose represents the palace of...