Skip to content

Time lost by miners validating blocks that they spend mining an empty block.

License

Notifications You must be signed in to change notification settings

kulpreet/stratum-miners-time-lost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stratum Listener

I want to listen to various mining pool messages to figure out how long do mining pools mine empty blocks or wait to build a block that they can start mining.

How

This repo has a small python client to listen to stratum messages from various mining pools.

Stratum Messages

Stratum sends mining.notify messages that include previous block.

We want to decipher two pieces of timing information from these messages:

  1. What is the delay between a block mined by a pool and other pools switching to mining the next block?
  2. How long do miners potentially mine empty blocks?

The first information is hard to figure as the timestamp in the block header has a little bit of leeway.

However, if miners switch to an empty block and then a block non-empty merkle_branch, then we know we know how long miners mined an empty block for.

Here is an example of an empty block being mined:

{"id":null,"method":"mining.notify","params":["68fccbf2e","95b10b5d6288d7c7f568c65400c3c75a1b8ba130000236510000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4b030bdc09fabe6d6dd7f73a7f69e03ae8d0203261d252a511b2031b5df90054b3bb6751a325dedad20100000000000000","2ebfcc8f062f736c7573682f0000000004e756622a000000001976a9147c154ed1dc59609e3d26abb2df2ea3d587cd8c4188ac00000000000000002c6a4c2952534b424c4f434b3a9889bced22e7d99657b7c94939de0e322e7655f4b990fe55ac6da31600289aff0000000000000000296a4c266a24b9e11b6d122e0ce89b16dc8548767d326ed2d0407eb91a6ce00f1ae51d499038402765f70000000000000000266a24aa21a9ed80646cf543d0097c56587cd886dc98c7504163952f62fca2527bb8e70c2a5ec300000000",["6005a73586a1fd538946fa987f6d12e239513aa0df9d27f096aa2b57f3e1cb04","b40aea844402ce67c59d54c57d968f2ce6b606d9e783e6c36c7c12ec21deca2f","06f4dc3f74fdd6e9d369e6bf6f6313e28b807e7f19b1a4323465fd871b630943","8672bac49ce3c75a9adb02d654ef3720b779a675409547c95e579f394370d47c","7eb01380eb24b05296b2c5d280178df077391c93795e50d631b3955b8e185b71","2cf2ff3bf187e0ade21c09734e9e54480cbab9e035ef1f519aaf616b0b149748","f2746aede98d05f5c874ca4d388675c58e54ee97d3a7847a3e873c1250f8bc74","dbc2411a6e67a7d1f1bfe26d330f33d654078759422644da07ea767754a8b578","bf05558030e051e92b2430450e22bb07f22dd60dc8eebcf58ff4778c5ad6fafe","86b7e15229f447a59e61c81a82bb31051e39f42edc42ba9a198454d625de24c6","7cf2fdb6160bdf21f172ef07283a4ad651f79ccaeb8a5c7
d5e39e0e1e10c61f8","bcef309f00ed16fbdab45de88a8175a7f04cf6782864f92fbf115eb7ec898c0e"],"20000000","171007ea","5f4d0e3c",false]}

{"id":null,"method":"mining.notify","params":["68fcf6663","49b258dd5a6ffef89ee39a7eff359c12e3f452200005c0e20000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1f030cdc09","6366cf8f062f736c7573682f000000000240be4025000000001976a9147c154ed1dc59609e3d26abb2df2ea3d587cd8c4188ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf900000000",[],"20000000","171007ea","5f4d0e4d",true]}

{"id":null,"method":"mining.notify","params":["68fcf98af","49b258dd5a6ffef89ee39a7eff359c12e3f452200005c0e20000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4b030cdc09fabe6d6dd7f73a7f69e03ae8d0203261d252a511b2031b5df90054b3bb6751a325dedad20100000000000000","af98cf8f062f736c7573682f000000000438dccb28000000001976a9147c154ed1dc59609e3d26abb2df2ea3d587cd8c4188ac00000000000000002c6a4c2952534b424c4f434b3a777309413bd20a5b09b7c6758491df8b24761e8fb990fe55ac6da31700289b000000000000000000296a4c266a24b9e11b6d122e0ce89b16dc8548767d326ed2d0407eb91a6ce00f1ae51d499038402765f70000000000000000266a24aa21a9eda40a1aec067bca0321cb917954a2771569a30312cac6b0ca5d49769471fc0ba300000000",["6005a73586a1fd538946fa987f6d12e239513aa0df9d27f096aa2b57f3e1cb04","590a30526148160920b996df85fba5143749fdd3fe5b99e26aa6269a7966f8c2","447653419b2a8705022064f8a8d49047972db7cfe1ac33aa5232fe6d0c900400","6933c9b00a10fb02049eac8ebcd19377f45060527da4f5511daf929c036f654f","a6eaa911f16bcade6f6888a2f78f04586db50c2657127af14fa951cacc5ab483","188e63773cb867baa6b84d186fbd6cc560f5edb140a040c2ed40920d129f6249","54d4d5d2d7f3ff70647da36bd4f56d5339866ba41cb9141418ee76626b3a9ffb","51bf062e37625a623584103026968ae0a2ead11764871361b725cd06662895d7","5cdd465c2ff01d824166d74446bf70a103b5103debe99ece0413a5070fc49022","5f59f94dba67b680db2c5047e5414effc3f5d0c02de8c1a75335bfe070bf0dec","7303769d61a0be2110991ae113572fba6a8cf7bbb25f4acba3394905949473d7","e2c3d364c98c8b65b2d1ed9c199b6fafb8414a0731833d6bc7013eaf1fea0e72"],"20000000","171007ea","5f4d0e4f",false]}

This message is sent so that miners can construct their own block hash that they can mine for.

If we receive messages from a pool X at timestamp ti, then we know that the pool started mining a block on top of xxxb at ti minus some latency.

Also, from the block header timestamp we know at what time the block was successfully mined.

t0, xxxa
t0, xxxa
t0, xxxa
.
.
.
ti_1, xxxa
ti, xxxb
ti+1, xxxb
.
.
.

About

Time lost by miners validating blocks that they spend mining an empty block.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages