For mining purposes one needs to generate a seed. I read some articles but still did not understand where this seed comes from. How is calculated, or what it is about? I found this on Ethereum wiki github:

def get_seedhash(block):
 s = '\x00' * 32
 for i in range(block.number // EPOCH_LENGTH):
     s = serialize_hash(sha3_256(s))
 return s

Can anyone explain this code to me please ?


Ethash divide hash calculation in epochs, with each epoch being 30000 blocks, all blocks in the same epoch start with the same seed.

For epoch 0 the seed is '\x00'*32 = '0x0000000000000000000000000000000000000000000000000000000000000000'.

For epoch N the seed will be the sha3 of the seed of the previous epoch N-1.

For example in epoch 1 the seed will be sha3('0x0000000000000000000000000000000000000000000000000000000000000000') = '0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563'.

  • So in an epoch there are 30.000 blocks? – Blnpwr Sep 30 '18 at 17:56
  • and is there any sources for reseraching? – Blnpwr Sep 30 '18 at 18:10
  • Yes, each epoch as 30,000 blocks. To research you can look at some clients implentations, like go-ethereum, cpp-ethereum or parity. – Ismael Sep 30 '18 at 18:20
  • Can we have a chat-room discussion? – Blnpwr Sep 30 '18 at 18:21
  • If you have any question you can ask here, when I've time I'd take a look. – Ismael Sep 30 '18 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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