Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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`.
6 changes: 3 additions & 3 deletions example-geth.json
Original file line number Diff line number Diff line change
@@ -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"},
Expand Down
20 changes: 14 additions & 6 deletions example-parity.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,40 @@
"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
}
}
},
"params": {
"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": {
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct GethSpec {

#[derive(Serialize)]
struct ParityEthash {
gasLimitBoundDivisor: String,
minimumDifficulty: String,
difficultyBoundDivisor: String,
durationLimit: String,
Expand All @@ -65,6 +64,7 @@ struct ParityParams {
minGasLimit: String,
networkID: u64,
eip98Transition: u64,
gasLimitBoundDivisor: String,
}

#[derive(Serialize)]
Expand Down Expand Up @@ -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(),
Expand All @@ -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();
Expand Down