1

I am trying to run a Parity client and sync it with a Geth private blockchain. I was able to do it at first, but after adding "constantinopleBlock", "byzantiumBlock" and "petersburgBlock" to the genesis file of the Geth client, I couldn't get a valid genesis file for the Parity node.

I am using https://github.com/keorn/parity-spec to translate the genesis file, but Parity fails to start as it doesn't recognize the values "registrar", "eip150Transition" or "eip155Transition" for example. If I remove them, it fails to validate the first block of the Geth node.

This is the genesis file of the Geth node:

{
  "config": {
    "chainId": 1337,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip150Block": 0,
    "eip160Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0
  },
  "alloc"      : {},
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x100",
  "extraData"  : "",
  "gasLimit"   : "0x700000000",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

This is the translated genesis file for the Parity node:

{
  "name": "GethTranslation",
  "engine": {
    "Ethash": {
      "params": {
        "minimumDifficulty": "0x20000",
        "difficultyBoundDivisor": "0x800",
        "durationLimit": "0xd",
        "blockReward": "0x4563918244F40000",
        "registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
        "homesteadTransition": 0,
        "eip150Transition": 0,
        "eip155Transition": 0,
        "eip160Transition": 0,
        "eip161abcTransition": 0,
        "eip161dTransition": 0
      }
    }
  },
  "params": {
    "accountStartNonce": "0x0",
    "maximumExtraDataSize": "0x20",
    "minGasLimit": "0x1388",
    "networkID": 1337,
    "eip98Transition": 9223372036854775807,
    "gasLimitBoundDivisor": "0x400"
  },
  "genesis": {
    "seal": {
      "ethereum": {
        "nonce": "0x0000000000000042",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x100",
    "author": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "",
    "gasLimit": "0x700000000"
  },
  "accounts": {}
}

I am using: Parity-Ethereum/v2.2.7-stable-b00a21f39-20190115/x86_64-macos/rustc1.31.1

What would be the correct genesis file for Parity?

Thanks!

0

The converter put the eip*Transition properties into a wrong "params" object - it should look something like this:

{
  "name": "GethTranslation",
  "engine": {
    "Ethash": {
      "params": {
        "minimumDifficulty": "0x20000",
        "difficultyBoundDivisor": "0x800",
        "durationLimit": "0xd",
        "blockReward": "0x4563918244F40000",
        "homesteadTransition": 0
      }
    }
  },
  "params": {
    "accountStartNonce": "0x0",
    "maximumExtraDataSize": "0x20",
    "minGasLimit": "0x1388",
    "networkID": 1337,
    "eip98Transition": 9223372036854775807,
    "gasLimitBoundDivisor": "0x400",
    "registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
    "eip150Transition": 0,
    "eip155Transition": 0,
    "eip160Transition": 0,
    "eip161abcTransition": 0,
    "eip161dTransition": 0
  },
  "genesis": {
    "seal": {
      "ethereum": {
        "nonce": "0x0000000000000042",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x100",
    "author": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "",
    "gasLimit": "0x700000000"
  },
  "accounts": {}
}
  • 1
    I tried this and it doesn't fail when parsing the genesis file, but then it fails when validating the first block of the geth blockchain (which makes me think that the validation rules are different than the ones in Geth): Error: Error(Block(InvalidStateRoot(Mismatch { expected: 0x04238d32e40e39f5e5fc909d0cb10cd2c3c039cb71ccc3b070a5a165d87c1444, found: 0x077133d80c7edf74b256712f983d3f07dc16134ce7c1e487474f81439c7f4a06 })) ....... Bad block detected: Error(Block(InvalidStateRoot(Mismatch. – Patricio May 16 at 14:15
  • I did some research and managed to make a cross-client chain spec for Geth and Parity 2+. Try this, please github.com/ivandru/parity-geth-byzantium. – Ivan Andrusenko May 16 at 15:31
  • Thanks for your answer! Just tested it. As it is, both nodes launch and connect to each other. If I start the geth miner, the parity node imports the blocks. But if I add constantinopleBlock and petersburgBlock to the geth genesis file (which I need to have some Solidity 0.5.0 contracts) and I re run everything, the Parity node says that it found a bad block. I tried adding eips 1014, 1052 and 1283 to Parity but I get to the same result... – Patricio May 17 at 10:15

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.