Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

InvalidStateRoot Error on private chain #2794

Closed
iFA88 opened this issue Oct 21, 2016 · 7 comments
Closed

InvalidStateRoot Error on private chain #2794

iFA88 opened this issue Oct 21, 2016 · 7 comments
Labels
Z1-question 🙋‍♀️ Issue is a question. Closer should answer.

Comments

@iFA88
Copy link

iFA88 commented Oct 21, 2016

Trying to setup a own chain with geth and parity.
I have successfully created for every client a genesis block below can you find the 0 block details. The hash are matching!
This 2 client is running on my debian VPS:

Welcome to the Geth JavaScript console!

instance: Parity//v1.4.0-unstable-5eca5f7-20161019/x86_64-linux-gnu/rustc1.12.0
coinbase: 0x0000000000000000000000000000000000000000
at block: 0 (Thu, 01 Jan 1970 01:00:00 CET)
 modules: eth:1.0 ethcore:1.0 net:1.0 personal:1.0 rpc:1.0 traces:1.0 web3:1.0

> web3.version
{
  api: "0.15.3",
  ethereum: "63",
  network: "33",
  node: "Parity//v1.4.0-unstable-5eca5f7-20161019/x86_64-linux-gnu/rustc1.12.0",
  whisper: undefined,
  getEthereum: function(callback),
  getNetwork: function(callback),
  getNode: function(callback),
  getWhisper: function(callback)
}
> eth.getBlock(0)
{
  author: "0x0000000000000000000000000000000000000000",
  difficulty: 0,
  extraData: "0x",
  gasLimit: 3141592,
  gasUsed: 0,
  hash: "0x9f9f6256eeead45bba8e66a8df6466614e783978db40a336af972520f08408a6",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x0000000000000000000000000000000000000000",
  number: 0,
  parentHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sealFields: ["0x00000000000000000000000000000000000000647572616c65787365646c6578", "0x00006d6f7264656e"],
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 504,
  stateRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  timestamp: 0,
  totalDifficulty: 0,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}

> exit
Welcome to the Geth JavaScript console!

instance: Geth/v1.5.0-unstable-6952fe3a/linux/go1.7
coinbase: 0x9f416263351ec106a1b5c2ddbea8ab91fce5ef24
at block: 8 (Fri, 21 Oct 2016 15:42:35 CEST)
 datadir: /mnt/ethads
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> web3.version
{
  api: "0.15.3",
  ethereum: "0x3f",
  network: "33",
  node: "Geth/v1.5.0-unstable-6952fe3a/linux/go1.7",
  whisper: undefined,
  getEthereum: function(callback),
  getNetwork: function(callback),
  getNode: function(callback),
  getWhisper: function(callback)
}
> eth.getBlock(0)
{
  difficulty: 0,
  extraData: "0x",
  gasLimit: 3141592,
  gasUsed: 0,
  hash: "0x9f9f6256eeead45bba8e66a8df6466614e783978db40a336af972520f08408a6",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x0000000000000000000000000000000000000000",
  mixHash: "0x00000000000000000000000000000000000000647572616c65787365646c6578",
  nonce: "0x00006d6f7264656e",
  number: 0,
  parentHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 504,
  stateRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  timestamp: 0,
  totalDifficulty: 0,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}

The connection is in every type enstablished and worked. (desktop geth -> vps geth, dekstop parity -> vps parity, desktop geth -> vps parity, dekstop parity -> vps geth)

I have mined few block with VPS geth native miner.

When i connect from my desktop PC with Parity TO VPS geth node, then I get this error:

2016-10-21 15:55:43  Stage 4 block verification failed for #1 (c3ab…2e9d)
Error: Block(InvalidStateRoot(Mismatch { expected: 624de0df944ced0f9ccbbd8426ab66fd7d14e58ac39bab5faeb13b9e17ebb561, found: 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 }))

When i connect from my desktop PC with Geth TO VPS geth or parity then works great.

Here is the #1 block:

> eth.getBlock(1)
{
  difficulty: 131072,
  extraData: "0xd583010500846765746885676f312e37856c696e7578",
  gasLimit: 3144658,
  gasUsed: 0,
  hash: "0x6be04af6bf11eda2ed8440180145b95e6ab8259166ea4ece4810e845ef9b8785",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xcfe6f15ee9f13da6cfe3fdd04a5435f4747f5331",
  mixHash: "0xa6fabd63f7ad8abfedd8398f7e338a6a0aebb09b4a592ca87ed76f5b906e5ba1",
  nonce: "0x6ccc879c6cfccad6",
  number: 1,
  parentHash: "0x9f9f6256eeead45bba8e66a8df6466614e783978db40a336af972520f08408a6",
  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 533,
  stateRoot: "0x94f7b9fa84b6d62dd8044a749b935cb5c9c950c83804c236998d1df6ba4eb1ba",
  timestamp: 1477059618,
  totalDifficulty: 131072,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}

geth genesis.json:

{
    "nonce": "0x00006d6f7264656e",
    "difficulty": "0x00000",
    "mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x",
    "gasLimit": "0x2FEFD8",
    "alloc": {
    }
}

Parity genesis.json:

{
    "name": "ethads",
    "engine": {
            "Null": null
    },
    "params": {
            "accountStartNonce": "0x0",
            "maximumExtraDataSize": "0x20",
            "minGasLimit": "0x1388",
            "networkID" : "0x21"
    },
    "genesis": {
            "seal": {
                    "ethereum": {
                            "nonce": "0x00006d6f7264656e",
                            "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
                    }
            },
            "difficulty": "0x00000",
            "author": "0x0000000000000000000000000000000000000000",
            "timestamp": "0x00",
            "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "extraData": "0x",
            "gasLimit": "0x2fefd8"
    },
    "accounts": {
    }
}

If anyone need more info ask them.

@arkpar
Copy link
Collaborator

arkpar commented Oct 21, 2016

You probably need built-in accounts in the spec for a contract to run properly. Try adding these:
https://github.com/ethcore/parity/blob/master/ethcore/res/ethereum/frontier_test.json#L37-L41

@iFA88
Copy link
Author

iFA88 commented Oct 21, 2016

i dont run any contract, i dont need them.

@rphmeier
Copy link
Contributor

rphmeier commented Oct 21, 2016

@iFA88 That's fine, but geth will include them as accounts in their state trie and your state trie will mismatch (notice that the error has "found" root of 56e8... -- that's sha3("").)

If you want geth and parity to work together then you'll have to include them.

@rphmeier rphmeier added the Z1-question 🙋‍♀️ Issue is a question. Closer should answer. label Oct 21, 2016
@iFA88
Copy link
Author

iFA88 commented Oct 21, 2016

i use now this parity genesis.json :

{
    "name": "ethads",
    "engine": {
        "Ethash": {
            "params": {
                "gasLimitBoundDivisor": "0x0400",
                "minimumDifficulty": "0x020000",
                "difficultyBoundDivisor": "0x0800",
                "durationLimit": "0x0d",
                "blockReward": "0x4563918244F40000"
            }
        }
    },
    "params": {
        "accountStartNonce": "0x0",
        "maximumExtraDataSize": "0x20",
        "minGasLimit": "0x1388",
        "networkID" : "0x21"
    },
    "genesis": {
        "seal": {
            "ethereum": {
                "nonce": "0x00006d6f7264656e",
                "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
            }
        },
        "difficulty": "0x00000",
        "author": "0x0000000000000000000000000000000000000000",
        "timestamp": "0x00",
        "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "extraData": "0x",
        "gasLimit": "0x2fefd8"
    },
    "accounts": {
        "0000000000000000000000000000000000000001": { "balance": "1", "nonce": "0", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
        "0000000000000000000000000000000000000002": { "balance": "1", "nonce": "0", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
        "0000000000000000000000000000000000000003": { "balance": "1", "nonce": "0", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
        "0000000000000000000000000000000000000004": { "balance": "1", "nonce": "0", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
    }
}

but i got different hash like geth :/

Can anyone help me which parameter should i use to make the same genesis block as on geth?

@iFA88
Copy link
Author

iFA88 commented Oct 21, 2016

Its working perfectly with this parity genesis.json:

{
    "name": "ethads",
    "engine": {
        "Ethash": {
            "params": {
                "gasLimitBoundDivisor": "0x0400",
                "minimumDifficulty": "0x020000",
                "difficultyBoundDivisor": "0x0800",
                "durationLimit": "0x0d",
                "blockReward": "0x4563918244F40000"
            }
        }
    },
    "params": {
        "accountStartNonce": "0x0",
        "maximumExtraDataSize": "0x20",
        "minGasLimit": "0x1388",
        "networkID" : "0x21"
    },
    "genesis": {
        "seal": {
            "ethereum": {
                "nonce": "0x00006d6f7264656e",
                "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
            }
        },
        "difficulty": "0x00000",
        "author": "0x0000000000000000000000000000000000000000",
        "timestamp": "0x00",
        "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "extraData": "0x",
        "gasLimit": "0x2fefd8"
    },
    "accounts": {
    }
}

Thanks for support!

@achillesss
Copy link

@iFA88 Hi, i've met the same problem with 'InvalidStateRoot' Error in geth & parity cross-client syncing, and i tried both your geth and parity genesis block file, but the error seems still there.

can you give me some suggestions on solving this problem?

@iFA88
Copy link
Author

iFA88 commented Sep 22, 2017

@achillesss Hi! Sadly I don't remember what was the exact problem. But I know you need the builtin accounts with 1 wei. If you don't has it, then the contracts with these calls would be thrown.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z1-question 🙋‍♀️ Issue is a question. Closer should answer.
Projects
None yet
Development

No branches or pull requests

4 participants