当前位置:网站首页>Incentive mechanism of Ethereum eth
Incentive mechanism of Ethereum eth
2022-07-05 21:26:00 【Xiaopeng Linux】
Author's brief introduction : The third season of the New Star program for high-quality creators in cloud computing python Track TOP1 Alibaba cloud ACE Certified Senior Engineer
️ Personal home page : Xiao peng linux
Personal community : Xiao peng linux( Personal community ) Welcome to join !
Catalog
Gasoline that drives the program (Gas)
Besides buying mining machines 、 Connecting the ore pool 、 In addition to cash out , Has anyone ever paid attention to the reward mechanism of Ethereum ? |
Temporary bifurcation
Blockchain is a decentralized technology , All the miners in the world work at the same time , Excavate the blocks that meet the requirements independently . Because they work independently , It is possible that two independent miners have found two different blocks that meet the requirements , It's like this , go by the name of Temporary bifurcation . notes : The arrow pointing to a block indicates that it has saved the previous block Hash |
Both miners found the height 2 Block of , So whose one should be adopted ? So the tearing began , Blockchain is a snob , Only admit the longest chain , Who has the following blocks in yellow and green blocks first , Become the longest chain , Who will be admitted , Those who fail will be abandoned . In order to become the longest chain , Both miners desperately told more nodes about the blocks they had dug by broadcasting , And hope they can spread their blocks more widely , So that more miners can dig the next block under the block they dug out , Finally, let your block become part of the longest chain . However , There is only one winner , Winners write history , Losers will be abandoned , The transactions will be repackaged into later blocks . The following picture shows the victory of the green block , The yellow block becomes an orphan block , abandoned . |
This kind of thing is actually happening all the time , It's not uncommon . If the block is abandoned , What about the mining rewards included ? Compared with the special currency , Winner takes all , Losers have nothing , It's an empty game . The hearts of the miners who dug out the yellow block are breaking , He is crying ?. |
Uncle block (Uncle Block)
Ethereum has created a new term Uncle block (Uncle Block). To height 3 In terms of the block , The green block is his parent block . Although the yellow block failed , But at least it is also high 1 Sub blocks of the block , Brother block of green block . therefore , Height 3 The yellow block is called Uncle , That's how Uncle Kuai got its name . Be careful : The dotted line is only used to state the relationship , It does not mean that there is an actual connection . |
Orphan blocks that cannot be part of the main chain , If you are lucky enough to be passed by later blocks uncles When the fields are included in the blockchain, they become uncle blocks . If an orphan block is not taken in by any block , This orphan block will still be discarded , Will not enter the blockchain , That is to say, the orphan block will become a uncle block only after it is taken in . |
Ethereum's design is more human than bitcoin , Uncle pieces can also be rewarded , The miners no longer have to worry about being busy in vain . And if anyone takes in Uncle block in the future , There are additional rewards for blocks that have taken in Uncle blocks , Taking in Uncle blocks is also called containing uncle blocks . The following figure shows the height 3 The block of contains a uncle block , But Uncle block is just included , The trade in Shukuai will return to the trading pool , Waiting for repackaging . A block can contain at most 2 A piece of Uncle . |
Why is Ethereum designed like this ? Because the block time of Ethereum is 20 About seconds , Compared to bitcoin , It is more prone to temporary bifurcation and orphan blocks . And shorter block time , It also makes it more difficult for blocks to fully spread throughout the network , Especially for those miners with slow internet speed , This is a great injustice . In order to balance the interests of all parties , Just designed such a TERT block mechanism . The proportion of tertiary blocks in all excavated blocks is called Tertiary block rate , At present, the uncle block rate is 9.7% about . |
Data sources :The ethereum blockchain explorer
Gasoline that drives the program (Gas)
Ethereum is a decentralized platform for running smart contracts , Provides a Ethereum virtual machine (Ethereum Virtual Machine), abbreviation EVM, Developers can develop various applications on it . You can put this EVM Imagine your computer , It can run some Ethereum defined instructions . Unlike bitcoin's script engine , Ethereal EVM Very powerful , It's called “ Turing Complete ”. No matter what it is “ Turing Complete ”, You just need to know “ Turing Complete ” The virtual machine can implement circular statements , If there is a loop, there must be a little villain or unqualified programmer to create a dead loop , The computer is in a dead cycle, which is a big deal , Just restart , But Ethereum is decentralized ,EVM If the dead cycle , Can't restart . Is there any way to solve this problem ? unfortunately , This problem has been studied many years ago , It's called Turing shutdown problem (The Halting Problem), It has been proved that there is no way to detect whether the program will loop . Since it cannot be detected , Is there any other way to stop the dead cycle ? |
If you allow EVM Each instruction of the program on the consumes a little “ resources ”,“ resources ” Run out , Whether the program is finished or not , Will be forcibly terminated , It doesn't matter whether it's a dead cycle or not . The resources to be consumed when executing the program are called gasoline (Gas), Each instruction consumes a different amount of gasoline . |
Take a few examples :
|
The more complex the operation , Need to consume Gas The more , Just add a consumption to the program Gas Upper limit , It can prevent the program from dead circulation and cannot be stopped . meanwhile , Ethereum also gives the total consumption of programs contained in each block Gas Upper limit set , So as not to contain too many programs in the block , Affect some nodes with weak performance . Each block can consume Gas The upper limit can also be adjusted , It is up to the miners to vote , At present, it is 6725538Gas, That is to say, in the figure below GAS LIMIT part . |
Data sources :Ethereum Network Status
Gasoline is not free in real life , Not in Ethereum , You need to buy it in ether Gas. Each program will give how much ether they are willing to buy 1 The unit of Gas, This is known as The price of gasoline (Gas Price). |
Each program needs to be Gas The etheric currency paid can be calculated with the following formula : Gas cost = The consumption of Gas Number x Gas The price of You are willing to pay Gas The higher the price is. , The sooner your deal will be packed by miners , This is very similar to the transaction fee of bitcoin . |
Ethereum's block rewards
Uncle block and Gas, Let's move on to the core , Ethereum's reward mechanism . I've already said that , There are two kinds of blocks in Ethereum , Ordinary block and uncle block , We need to discuss the rewards of each block according to the situation . |
Ordinary block rewards :
|
I'll give you a reward : The reward calculation of Uncle block is a little complicated , Formula for : I'll give you a reward = ( Uncle block height + 8 - The height of the block containing the tertiary block ) * Ordinary block rewards / 8 |
Practice a
Ethereum block browser Ethereum Blocks Information, This browser can view the rewards of each block in detail . Let's take a look at a newly dug block 4222300, Because we see it on the main chain , So it's a normal block . |
Its reward consists of three parts : Fixed reward :5ETH Gas The total cost ( Some people also call it transaction fee ):0.281837168043699381ETH Reward for including two uncle blocks :5 * ( 1 / 32 ) * 2 = 0.3125ETH |
There is one caveat here , The original text in the official document is “an extra reward for including uncles as part of the block”, I am here 2015 When I first came into contact with Ethereum in, many online articles directly said “ Including uncle rewards ”, I mistakenly thought I was getting the same amount of reward as the reward for digging out these uncle pieces , It's the one in the picture above Uncles Reward:8.75ETH, This is wrong ,“ Including uncle rewards ” It refers to the reward of including uncle blocks into the blockchain , I hope you can avoid stepping into this pit . |
Let's see another uncle 0x1c2cbba0403f1079dcdb70e5971a87ce0fbc03d4572be30e2d17e4e4a0f136d5, Does it look awkward , Uncle block is not convenient to express with height , Because there are already main chain blocks at the same height , That's it . In fact, uncle block is also high , The height of the parent block of the tertiary block +1 Is the height of Uncle block . |
Direct substitution formula : ( 4222271 + 8 - 4222272 ) * 5 / 8 = 4.375ETH |
Conclusion
边栏推荐
- Wood board ISO 5660-1 heat release rate mapping test
- Mode - "Richter replacement principle"
- Zhang Lijun: penetrating uncertainty depends on four "invariants"
- sql常用语法记录
- selenium 查找b或p标签的内容
- Reading and writing operations of easyexcel
- 张丽俊:穿透不确定性要靠四个“不变”
- int GetMonth( ) const throw( ); What does throw () mean?
- ArcGIS栅格重采样方法介绍
- Problems encountered in office--
猜你喜欢
EN 438-7 laminated sheet products for building covering decoration - CE certification
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
Ethereum ETH的奖励机制
Talk about my fate with some programming languages
显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??
Deployment of Jenkins under win7
JMeter installation under win7
Golang (1) | from environmental preparation to quick start
The transformation based on vertx web sstore redis to realize the distributed session of vertx HTTP application
EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
随机推荐
ArcGIS\QGIS无插件加载(无偏移)MapBox高清影像图
Comprehensive optimization of event R & D workflow | Erda version 2.2 comes as "7"
示波器探头对测量带宽的影响
Sequence alignment
PostGIS installation geographic information extension
Introduction of ArcGIS grid resampling method
Arcgis\qgis no plug-in loading (no offset) mapbox HD image map
CLion配置visual studio(msvc)和JOM多核编译
R language [data management]
有些事情让感情无处安放
postgres 建立连接并删除记录
xlrd常见操作
Aitm2-0002 12s or 60s vertical combustion test
Objects in the list, sorted by a field
显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??
Teach yourself to train pytorch model to Caffe (2)
MySQL deep paging optimization with tens of millions of data, and online failure is rejected!
显示屏DIN 4102-1 Class B1防火测试要求
Viewrootimpl and windowmanagerservice notes
LeetCode_ Hash table_ Difficulties_ 149. Maximum number of points on the line