4

What was the first Homestead mined block?

1,150,000 was planned if someone can confirm? https://ethereum.stackexchange.com/a/1834/264

can one see that its a homestead block by some property? https://etherchain.org/block/1150000

0

1 Answer 1

6

Answer to your first question

1,150,000.

From Go Ethereum - params/util.go:

var (
    TestNetHomesteadBlock = big.NewInt(494000)  // testnet homestead block
    MainNetHomesteadBlock = big.NewInt(1150000) // mainnet homestead block
)


Answer to your second question

Homestead Difficulty Adjustment

You can try checking for the the difficulty adjustment algorithm changes from the Homestead block onwards. From EIP 2:

  1. Change the difficulty adjustment algorithm from the current formula:

    block_diff = parent_diff + parent_diff // 2048 *
      (1 if block_timestamp - parent_timestamp < 13 else -1) + 
      int(2**((block.number // 100000) - 2))
    

    (where the + int(2**((block.number // 100000) - 2)) represents the exponential difficulty adjustment component)

    to

    block_diff = parent_diff + parent_diff // 2048 * 
      max(1 - (block_timestamp - parent_timestamp) // 10, -99) + 
      int(2**((block.number // 100000) - 2))
    

    , where // is the integer division operator, eg. 6 // 2 = 3, 7 // 2 = 3, 8 // 2 = 4.

    The minDifficulty still defines the minimum difficulty allowed and no adjustment may take it below this.


Contract Creation Gas Cost Change

You could also search for a contract creation transaction where the gas cost has increased from 21000 to 53000. From EIP 2:

  1. The gas cost for creating contracts via a transaction is increased from 21000 to 53000, ie. if you send a transaction and the to address is the empty string, the initial gas subtracted is 53000 plus the gas cost of the tx data, rather than 21000 as is currently the case. Contract creation from a contract using the CREATE opcode is unaffected.



Testing For The Homestead Difficulty Adjustment Change

I've use the following geth JavaScript code to test whether the calculated difficulty matches the Frontier formula or the Homestead formula:

function testDifficultyAdjustment(fromBlock, toBlock) {
  var i;

  for (i = fromBlock; i <= toBlock; i++) {
    var parentBlock = eth.getBlock(i-1);
    var thisBlock = eth.getBlock(i);

    var frontierDiffAdj = parseInt(parentBlock.difficulty) + parseInt(Math.floor(parentBlock.difficulty / 2048)) * ((thisBlock.timestamp - parentBlock.timestamp) < 13 ? 1 : -1) + Math.pow(2, (Math.floor(i / 100000) - 2));
    var frontierMatches = (thisBlock.difficulty == frontierDiffAdj) ? " = " : "<> ";

    var homesteadDiffAdj = parseInt(parentBlock.difficulty) + parseInt(Math.floor(parentBlock.difficulty / 2048)) * Math.max(1 - Math.floor((thisBlock.timestamp - parentBlock.timestamp)/10), -99) + Math.pow(2, (Math.floor(i / 100000) - 2));
    var homesteadMatches = (thisBlock.difficulty == homesteadDiffAdj) ? " = " : "<> ";

    console.log("#" + i + " Act: " + thisBlock.difficulty + " Front.: " + frontierMatches + frontierDiffAdj + " Home.: " + homesteadMatches + homesteadDiffAdj);
  }
}

testDifficultyAdjustment(1149980, 1150020);

And here are the results - the Frontier formula matches < 1150000 and the Homestead formula matches >= 1150000:

#1149980 Act: 20463191314070 Front.:  = 20463191314070 Home.: <> 20413207944965
#1149981 Act: 20473183107215 Front.:  = 20473183107215 Home.: <> 20463191314582
#1149982 Act: 20463186436288 Front.:  = 20463186436288 Home.: <> 20443193093410
#1149983 Act: 20453194646548 Front.:  = 20453194646548 Home.:  = 20453194646548
#1149984 Act: 20443207735612 Front.:  = 20443207735612 Home.:  = 20443207735612
#1149985 Act: 20453189771151 Front.:  = 20453189771151 Home.:  = 20453189771151
#1149986 Act: 20463176680730 Front.:  = 20463176680730 Home.:  = 20463176680730
#1149987 Act: 20453184895754 Front.:  = 20453184895754 Home.: <> 20443193110266
#1149988 Act: 20463171802953 Front.:  = 20463171802953 Home.:  = 20463171802953
#1149989 Act: 20473163586571 Front.:  = 20473163586571 Home.:  = 20473163586571
#1149990 Act: 20463166925176 Front.:  = 20463166925176 Home.: <> 20393190291827
#1149991 Act: 20473158706413 Front.:  = 20473158706413 Home.:  = 20473158706413
#1149992 Act: 20463162047401 Front.:  = 20463162047401 Home.:  = 20463162047401
#1149993 Act: 20473153826256 Front.:  = 20473153826256 Home.:  = 20473153826256
#1149994 Act: 20483150483909 Front.:  = 20483150483909 Home.:  = 20483150483909
#1149995 Act: 20493152022743 Front.:  = 20493152022743 Home.:  = 20493152022743
#1149996 Act: 20483145601369 Front.:  = 20483145601369 Home.:  = 20483145601369
#1149997 Act: 20493147137819 Front.:  = 20493147137819 Home.:  = 20493147137819
#1149998 Act: 20503153557831 Front.:  = 20503153557831 Home.: <> 20493147138331
#1149999 Act: 20513164863791 Front.:  = 20513164863791 Home.:  = 20513164863791
#1150000 Act: 20473100089179 Front.: <> 20503148670522 Home.:  = 20473100089179
#1150001 Act: 20483096720593 Front.:  = 20483096720593 Home.:  = 20483096720593
#1150002 Act: 20493098233175 Front.:  = 20493098233175 Home.:  = 20493098233175
#1150003 Act: 20503104629308 Front.:  = 20503104629308 Home.:  = 20503104629308
#1150004 Act: 20483082066706 Front.: <> 20493093348263 Home.:  = 20483082066706
#1150005 Act: 20453077552473 Front.: <> 20473080562303 Home.:  = 20453077552473
#1150006 Act: 20453077552985 Front.: <> 20443090698712 Home.:  = 20453077552985
#1150007 Act: 20413130136405 Front.: <> 20443090699224 Home.:  = 20413130136405
#1150008 Act: 20413130136917 Front.: <> 20423097485616 Home.:  = 20413130136917
#1150009 Act: 20423097486128 Front.:  = 20423097486128 Home.:  = 20423097486128
#1150010 Act: 20423097486640 Front.: <> 20413125271071 Home.:  = 20423097486640
#1150011 Act: 20433069702721 Front.:  = 20433069702721 Home.:  = 20433069702721
#1150012 Act: 20443046788048 Front.:  = 20443046788048 Home.:  = 20443046788048
#1150013 Act: 20443046788560 Front.: <> 20453028744999 Home.:  = 20443046788560
#1150014 Act: 20453028745511 Front.:  = 20453028745511 Home.:  = 20453028745511
#1150015 Act: 20463015576465 Front.:  = 20463015576465 Home.:  = 20463015576465
#1150016 Act: 20473007283801 Front.:  = 20473007283801 Home.:  = 20473007283801
#1150017 Act: 20463010698726 Front.:  = 20463010698726 Home.:  = 20463010698726
#1150018 Act: 20443027290354 Front.: <> 20453018994796 Home.:  = 20443027290354
#1150019 Act: 20413081450109 Front.: <> 20433045343947 Home.:  = 20413081450109
#1150020 Act: 20413081450621 Front.: <> 20403114125695 Home.:  = 20413081450621
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.