diff --git a/README.md b/README.md index 48852cb..9c8b38c 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ Converts Geth proof of work chain spec e.g. ``` { - "nonce": "0x0000000000000042", - "timestamp": "0x0", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x0", - "gasLimit": "0x8000000", - "difficulty": "0x400", - "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x3333333333333333333333333333333333333333", - "alloc": { - "0000000000000000000000000000000000000001": {"balance": "1"}, - "0000000000000000000000000000000000000002": {"balance": "1"}, - "0000000000000000000000000000000000000003": {"balance": "1"}, - "0000000000000000000000000000000000000004": {"balance": "1"}, - "dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6": {"balance": "1606938044258990275541962092341162602522202993782792835301376"}, - "e4157b34ea9615cfbde6b4fda419828124b70c78": {"balance": "1606938044258990275541962092341162602522202993782792835301376"} - } + "nonce": "0x0000000000000000", + "timestamp": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "", + "gasLimit": "0x8000000", + "difficulty": "0x400", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x0000000000000000000000000000000000000000", + "alloc": { + "0000000000000000000000000000000000000001": {"balance": "1"}, + "0000000000000000000000000000000000000002": {"balance": "1"}, + "0000000000000000000000000000000000000003": {"balance": "1"}, + "0000000000000000000000000000000000000004": {"balance": "1"}, + "dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6": {"balance": "1606938044258990275541962092341162602522202993782792835301376"}, + "e4157b34ea9615cfbde6b4fda419828124b70c78": {"balance": "1606938044258990275541962092341162602522202993782792835301376"} + } } ``` to Parity one, which should enable the two to connect to each other. @@ -30,5 +30,8 @@ git clone https://github.com/keorn/parity-spec.git cd parity-spec cargo run -- geth-spec.json ``` +Where `geth-spec.json` is your Geth spec file. -The resulting spec can be then used in Parity with `parity --chain parity-spec.json`. +The resulting converted file will be printed to the console, then you can save it as json file (for example `parity-spec.json`). + +Finally it can be used in Parity with `parity --chain parity-spec.json`. diff --git a/example-geth.json b/example-geth.json index 64d4f79..6a1fccf 100644 --- a/example-geth.json +++ b/example-geth.json @@ -1,12 +1,12 @@ { - "nonce": "0x0000000000000042", + "nonce": "0x0000000000000000", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x0", + "extraData": "", "gasLimit": "0x8000000", "difficulty": "0x400", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x3333333333333333333333333333333333333333", + "coinbase": "0x0000000000000000000000000000000000000000", "alloc": { "0000000000000000000000000000000000000001": {"balance": "1"}, "0000000000000000000000000000000000000002": {"balance": "1"}, diff --git a/example-parity.json b/example-parity.json index 165f382..aaad134 100644 --- a/example-parity.json +++ b/example-parity.json @@ -3,11 +3,17 @@ "engine": { "Ethash": { "params": { - "gasLimitBoundDivisor": "0x400", "minimumDifficulty": "0x20000", "difficultyBoundDivisor": "0x800", "durationLimit": "0xd", - "blockReward": "0x4563918244F40000" + "blockReward": "0x4563918244F40000", + "registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2", + "homesteadTransition": 9223372036854775807, + "eip150Transition": 0, + "eip155Transition": 9223372036854775807, + "eip160Transition": 9223372036854775807, + "eip161abcTransition": 9223372036854775807, + "eip161dTransition": 9223372036854775807 } } }, @@ -15,20 +21,22 @@ "accountStartNonce": "0x0", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", - "networkID": "0x0" + "networkID": 0, + "eip98Transition": 9223372036854775807, + "gasLimitBoundDivisor": "0x400" }, "genesis": { "seal": { "ethereum": { - "nonce": "0x0000000000000042", + "nonce": "0x0000000000000000", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" } }, "difficulty": "0x400", - "author": "0x3333333333333333333333333333333333333333", + "author": "0x0000000000000000000000000000000000000000", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x0", + "extraData": "", "gasLimit": "0x8000000" }, "accounts": { diff --git a/src/main.rs b/src/main.rs index ed4d951..cbda602 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,7 +44,6 @@ struct GethSpec { #[derive(Serialize)] struct ParityEthash { - gasLimitBoundDivisor: String, minimumDifficulty: String, difficultyBoundDivisor: String, durationLimit: String, @@ -65,6 +64,7 @@ struct ParityParams { minGasLimit: String, networkID: u64, eip98Transition: u64, + gasLimitBoundDivisor: String, } #[derive(Serialize)] @@ -184,7 +184,6 @@ fn translate(geth_spec: GethSpec) -> ParitySpec { /// Construct Parity chain spec. let parity_ethash = ParityEthash { - gasLimitBoundDivisor: "0x400".into(), minimumDifficulty: "0x20000".into(), difficultyBoundDivisor: "0x800".into(), durationLimit: "0xd".into(), @@ -209,6 +208,7 @@ fn translate(geth_spec: GethSpec) -> ParitySpec { minGasLimit: "0x1388".into(), networkID: geth_config.chainId.unwrap_or_else(ask_network_id), eip98Transition: 9223372036854775807, + gasLimitBoundDivisor: "0x400".into(), }; let mut parity_seal = Map::new();