rusty-blockparser icon indicating copy to clipboard operation
rusty-blockparser copied to clipboard

Dogechain Invalid merkle_root!

Open ashtenhamilton opened this issue 3 years ago • 1 comments

Using csvdump and the --verify flag, it exits on block 371337, with invalid merkle root.

thread 'main' panicked at 'Invalid merkle_root!
  -> expected: ee27b8fb782a5bfb99c975f0d4686440b9af9e16846603e5f2830e0b6fbf158a
  -> got: 6a1d288f71e99c37506b2e0c5b75fd352660a5907469a8a5904e4f8ea04b0a98

Checking the block in the cli reveals it does have the correct merkle root in my node. Any ideas what might have caused this?

"hash": "60323982f9c5ff1b5a954eac9dc1269352835f47c2c5222691d80f0d50dcf053",
  "confirmations": 3651247,
  "strippedsize": 1704,
  "size": 1704,
  "weight": 6816,
  "height": 371337,
  "version": 6422786,
  "versionHex": "00620102",
  "merkleroot": "ee27b8fb782a5bfb99c975f0d4686440b9af9e16846603e5f2830e0b6fbf158a",

ashtenhamilton avatar Dec 16 '21 10:12 ashtenhamilton

I have the same behavior on my end. After a little bit of research I stumbled across some Redid posts and Dogecoin got a major update at block 371337 (version 1.8 internally stored at version 6422786) https://www.reddit.com/r/dogecoin/comments/2dz78g/of_wolves_and_weasels_day_223_countdown_to_371337/ For some reason my blockchain parser keeps on parsing till block 1774315 but mostly with a transaction count of 0 or 1, even the block had much more transactions when I checked at https://dogeblocks.com/ Then it panics with the above invalid merkle root error.

After Block 371337 there are randomly Blocks with the prev. version 6422530 (e.g. blocks 371340, 371409, 371425, 371517, 371534 ...)

Blocks with version 6422786 have a nonce of 0 and gets always parsed with a tx count of 1

I think when they updated their version to 1.8 they switched to Aux-POW and changed the structure of the blocks somewhow, so the parser can't keep parsing as expected. https://en.bitcoin.it/wiki/Merged_mining_specification I'm not to familiar with the binary blockchain stuff, so if somebody could help, it would be much appreciated.

BennyOe avatar Jan 16 '22 18:01 BennyOe

I've implemented Merged Mining with cb29766. This will be in the next release after some more testing. The chain verification works as expected and also the total numbers of transaction match up:

$ ./target/release/rusty-blockparser -c dogecoin --verify simplestats
...
[17:17:35] INFO - parser: Done. Processed blocks up to height 4681924 in 25.12 minutes.
[17:17:35] INFO - simplestats: 

SimpleStats:
   -> valid blocks:             4681925
   -> total transactions:       95326007
   -> total tx inputs:          267441205
   -> total tx outputs:         280587224
   -> total tx fees:            137165368240.23857117 (13716536824023858049 units)
   -> total volume:             69232446509.71670532 (6923244650971670904 units)

   -> biggest value tx:         8394922269.31166649 (839492226931166550 units)
        seen in block #4315430, txid: 2e9cc7cb6305bbf8a5a203ce611201bf41ac870091497b46eaeb8b28f64e78aa

   -> biggest size tx:          99993 bytes
        seen in block #108535, txid: c55c186526651c199c65c038db1db515946ef04d0c698ea1b7d88fc37ffeb694

Averages:
   -> avg block size:           0.80 KiB
   -> avg time between blocks:  1.06 (minutes)
   -> avg txs per block:        20.36
   -> avg inputs per tx:        2.81
   -> avg outputs per tx:       2.94
   -> avg value per output:     246.74

Transaction Types:
   -> Pay2MultiSig: 923 (0.00%)
        first seen in block #3915633, txid: 1341449761132555e9761781ee8958800f9f81253a6a236ef2f2d4b7ec2c28cd

   -> OpReturn(""): 288028 (0.10%)
        first seen in block #1471, txid: 8e216579d779b660337d8e08ef25e5b854ee366c1262b8b81da01cafd05cdebf

   -> Pay2PublicKeyHash: 258719653 (92.21%)
        first seen in block #168, txid: 4418a8e4fc4180028babd401299f720206ea3afec2959e685091fae9e9d9fdd4

   -> Pay2PublicKey: 2763348 (0.98%)
        first seen in block #0, txid: 5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69

   -> Pay2ScriptHash: 18454538 (6.58%)
        first seen in block #31953, txid: e10855fa20e059a6143a960b3fa8aa9acb9a4aaff2c5b8dde21bfb51c1464947

   -> NotRecognised: 360734 (0.13%)
        first seen in block #9456, txid: 760d0595c89e94e772213d75430573f2dc406e184a138e33a367231c3e9e1bb5

gcarq avatar Apr 18 '23 18:04 gcarq

Published a new version (0.10.0) with cb29766

gcarq avatar Apr 19 '23 10:04 gcarq