Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

EOS Source Code Analysis (1) Voting system

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Voting mechanism of EOS system

In the real world, we are all very familiar with the one-person-one-vote voting system, that is, one person can cast one vote.

In EOS's vote, one EOS corresponds to one vote, and each vote can be cast up to 30 times. In other words, you can vote for as many EOS as you have. These votes are all for each node, and the number of nodes cannot exceed 30. For example, if eosgalaxybp1 has 1000 EOS, then you can vote for 30 election nodes, and each election node can get 1000 votes for eosgalaxybp1. So, the more EOS you have, the more influential you are. The more votes cast for the same node at the same time, the higher the total score for that node. If a node gets the total number of votes in the top 21, it will become a super node.

How to become a campaign node

In the EOS block chain, the node is divided into full node (full node) and production node (block producer node referred to as bp), in which the production node is divided into super node (out-of-block node) and candidate node (non-out-of-block node), where the production node can become a candidate node. How to become a campaign node? you can become a campaign node through the following steps:

1. First of all, you need to create an EOS account. There are many ways to create an account:

1.1.Use EOS Account Creator service to create an EOS account

How to pay for https://support.otcbtc.com/hc/zh-cn/articles/360006929491- to create an EOS- account-this URL is about how to create an EOS account for a fee.

1.2.Create an account by cleos command

Cleos system newaccount [OPTIONS] creator name OwnerKey [ActiveKey], here shows how to use this command by creating an account v6v6v6v6v6v6

Cleos system newaccount v1v1v1v1v1v1 v6v6v6v6v6v6 EOS7yUve8ruhLeuXgKKDmPVpkAd7mwGoF8wBLTFrENLguKEXXPSTq EOS7yUve8ruhLeuXgKKDmPVpkAd7mwGoF8wBLTFrENLguKEXXPSTq

Stake-net "0.0010"-- stake-cpu "0.0010 EOS"-- buy-ram "2.000 EOS"-transfer

In this way, an account v6v6v6v6v6v6 has been created. It is important to note that

A) to create an account, you need to use the existing account creator to create it.

B) the memory purchased by parameters buy-ram should not be less than that of 3800bytes. The memory price can be checked through https://www.eosrp.io#calc. 3800 * price is the price of memory purchased here. Here I wrote 2.0000EOS.

C) the account name is 12 digits.

2. Register the account as producer

Cleos system regproducer account producer_key [url] [location] example:

Cleos system regproducer v6v6v6v6v6v6 EOS5QxBWBgjAzsHJyMFyvHHU7FHPAfFa96JRPZCJ1z7Z6TuYW1TDC "http://www.xxx.com"

3. Set up the profile of the campaign node

Modify the node's config.ini configuration file as follows

Producer-name = the name of the account created

Private-key = ["public-key", "private-key"]

Signature-provider=public-key=KEY:private-key

Run the Nodeos node through these three steps to become the election node, and you can query whether it is a bp node by using the following command

Cleos get table eosio eosio producers

How to vote for campaign nodes

To vote for a node, you need to mortgage the EOS first, and then vote. The number of votes is the number of EOS of the mortgage. The general process is as follows:

There are two ways to vote for the election node, the first is to vote through the wallet, for example, you can vote through the imtoken wallet, and the second way is to vote through the cleos command. Here is mainly about how to vote through the cleos command.

1. First, you need to unlock your wallet.

Cleos wallet unlock wallet password

2. Mortgage EOS

Before voting, the EOS needs to be mortgaged, and the mortgaged EOS is the number of votes cast.

Cleos system delegatebw [OPTIONS] from receiver stake_net_quantity stake_cpu_quantity

Stake_net_quantity and stake_cpu_quantity are the net of the mortgage and the EOS of cpu respectively, the sum of the two terms is the total EOS of the mortgage, and the EOS of an account mortgage is the number of votes.

How to check the EOS of an account mortgage?

You can view the account information by ordering the cleos get account account, which includes net bandwidth (staked and delegated) and cpu bandwidth (staked and delegated) to add these four items to the total EOS of an account mortgage.

3. Cancellation of mortgage EOS

How to recover the mortgaged EOS can be obtained by order.

Cleos system undelegatebw from receiver unstake_net_quantity unstake_cpu_quantity

After canceling the mortgage, the EOS of the mortgage will not be available for 3 days, and if it is fully recovered, no vote can be taken.

4. Vote for the node

Cleos system voteproducer prods [OPTIONS] voter producers...

Up to 30 producers

Example: v1v1v1v1v1v1 votes for v2v2v2v2v2v2 and v3v3v3v3v3v3

Cleos system voteproducer prods v1v1v1v1v1v1 v2v2v2v2v2v2 v3v3v3v3v3v3

The number of votes cast is the number of EOS mortgaged by v1v1v1v1v1v1.

It is important to note that when I run this command again to change the producers, then the vote cast by the voter will be cast for the new voter and the number of votes cast for the original producers will be recovered.

The node receives the reward

If the number of votes held by the election node reaches a certain proportion, you can receive the salary through the following order

Cleos system claimrewards owner

Proxy voting

The role of an agent is to make a choice and vote for others, without the need for a mortgage. When voting, we must first mortgage, and there are two choices to vote, only one can be chosen, and the two cannot exist at the same time. If you choose to vote, you will vote directly. If you choose an agent, your own mortgage is equivalent to a proxy mortgage, and then the agent chooses the node to vote.

An account that already acts as an agent cannot set up proxy voting.

1. Register as an agent

Cleos system regproxy [OPTIONS] proxy

2. Mortgage

Cleos system delegatebw [OPTIONS] from receiver stake_net_quantity stake_cpu_quantity

3. Principal-agent

Cleos system voteproducer proxy [OPTIONS] voter proxy

Note that proxy is used here.

4. Proxy voting

Cleos system voteproducer prods [OPTIONS] voter producers...

Note that prods is used here.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report