728x90
github: https://github.com/ethereum/go-ethereum
GitHub - ethereum/go-ethereum: Official Go implementation of the Ethereum protocol
Official Go implementation of the Ethereum protocol - GitHub - ethereum/go-ethereum: Official Go implementation of the Ethereum protocol
github.com
소스위치
consensus/ethash/consensus.go
설명
- 하드포크가 일어난 지점에서 리워드를 어떻게 변경 시켰는지 해당 부분에서 확인할 수 있습니다.
- 블록 생성시 리워드가 5 -> 3 -> 2로 줄어들었던 것이 확인됩니다. (math/big을 import 하여 18승을 표현하였습니다)
- 엉클블록의 최대 개수는 2개 입니다.
- allowedFutureBlockTimeSeconds 는 다음 블록이 생성될 때 최대 15초 내에 생성되야 함을 확인할 수 있습니다. 이 아래보다 더 빨리 생성되는 경우가 많이 생기면 난이도가 조절 됩니다.
- 현재 이더리움 2.0에서는 PoW -> PoS로 변경되어 ethash(이대시) 알고리즘은 더 이상 사용되지는 않습니다.
import (
"errors"
"fmt"
"math/big"
...
)
...
// Ethash proof-of-work protocol constants.
var (
FrontierBlockReward = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
ByzantiumBlockReward = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
ConstantinopleBlockReward = big.NewInt(2e+18) // Block reward in wei for successfully mining a block upward from Constantinople
maxUncles = 2 // Maximum number of uncles allowed in a single block
allowedFutureBlockTimeSeconds = int64(15) // Max seconds from current time allowed for blocks, before they're considered future blocks
// calcDifficultyEip5133 is the difficulty adjustment algorithm as specified by EIP 5133.
// It offsets the bomb a total of 11.4M blocks.
// Specification EIP-5133: https://eips.ethereum.org/EIPS/eip-5133
calcDifficultyEip5133 = makeDifficultyCalculator(big.NewInt(11_400_000))
// calcDifficultyEip4345 is the difficulty adjustment algorithm as specified by EIP 4345.
// It offsets the bomb a total of 10.7M blocks.
// Specification EIP-4345: https://eips.ethereum.org/EIPS/eip-4345
calcDifficultyEip4345 = makeDifficultyCalculator(big.NewInt(10_700_000))
// calcDifficultyEip3554 is the difficulty adjustment algorithm as specified by EIP 3554.
// It offsets the bomb a total of 9.7M blocks.
// Specification EIP-3554: https://eips.ethereum.org/EIPS/eip-3554
calcDifficultyEip3554 = makeDifficultyCalculator(big.NewInt(9700000))
// calcDifficultyEip2384 is the difficulty adjustment algorithm as specified by EIP 2384.
// It offsets the bomb 4M blocks from Constantinople, so in total 9M blocks.
// Specification EIP-2384: https://eips.ethereum.org/EIPS/eip-2384
calcDifficultyEip2384 = makeDifficultyCalculator(big.NewInt(9000000))
// calcDifficultyConstantinople is the difficulty adjustment algorithm for Constantinople.
// It returns the difficulty that a new block should have when created at time given the
// parent block's time and difficulty. The calculation uses the Byzantium rules, but with
// bomb offset 5M.
// Specification EIP-1234: https://eips.ethereum.org/EIPS/eip-1234
calcDifficultyConstantinople = makeDifficultyCalculator(big.NewInt(5000000))
// calcDifficultyByzantium is the difficulty adjustment algorithm. It returns
// the difficulty that a new block should have when created at time given the
// parent block's time and difficulty. The calculation uses the Byzantium rules.
// Specification EIP-649: https://eips.ethereum.org/EIPS/eip-649
calcDifficultyByzantium = makeDifficultyCalculator(big.NewInt(3000000))
)
...
728x90
'IT > Blockchain' 카테고리의 다른 글
Mastering Ethereum - Chapter 1: What is Ethereum? (0) | 2023.07.30 |
---|---|
이중 지불 문제 방지 및 이전의 디지털 통화 (0) | 2023.07.29 |
go-ethereum 코드 분석(2) - 연산자 (0) | 2023.07.09 |
블록체인 초보자를 위한 단계별 가이드 (번역-1) (0) | 2023.07.09 |
[리먼 브라더스 사태] 2008년 9월 15일, 세계 금융시장을 공포로 몰아넣다 (1) | 2023.06.04 |