首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用具有奇偶性的转换的geth成因文件的成因块失配

使用具有奇偶性的转换的geth成因文件的成因块失配
EN

Ethereum用户
提问于 2017-07-20 17:12:18
回答 2查看 1.6K关注 0票数 3

我尝试将geth成因文件转换为奇偶校验格式,以便使奇偶校验节点加入已有的geth支持的私有块链,但我得到了一个“创世纪块不匹配”错误:

代码语言:javascript
复制
New peer 0 (protocol: 63, network: 42424242, difficulty: Some(11315973291), latest:4a8e…fcf2, genesis:96d0…b2e1, snapshot:None)
Peer 0 genesis hash mismatch (ours: 31cf…08ea, theirs: 96d0…b2e1)

而在另一边:

代码语言:javascript
复制
Adding p2p peer                          id=1e6033fe00282624 name=Parity/v1.6.8-beta-c...                                            addr=10.0.0.4:43516 peers=3
Ethereum peer connected                  id=1e6033fe00282624 conn=inbound name=Parity/v1.6.8-beta-c396229-20170608/x86_64-linux-gnu/rustc1.17.0
Ethereum handshake failed                id=1e6033fe00282624 conn=inbound err="Genesis block mismatch - 31cf7371d7c8d8ca (!= 96d001c8c6564893)"
Removing p2p peer                        id=1e6033fe00282624 conn=inbound duration=60.389ms  peers=2 req=true  err="disconnect requested"

原始geth成因文件是:

代码语言:javascript
复制
{
  "alloc": {
    "ad94486b5005418dbb46a77eb2fd0c8046bfb858": {
      "balance": "1000000000000000000000000000000"
    }
  },
  "config": {
    "homesteadBlock": 0,
    "chainId": 42424242,
    "eip155Block": 0,
    "eip158Block": 0
  },
  "nonce": "0x0000000000000042",
  "difficulty": "0x6666",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "timestamp": "0x00",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
  "gasLimit": "0x4c4b40"
}

我手动将该文件转换为奇偶校验格式(基于这些示例https://github.com/5chdn/crossclient-chainspec):

代码语言:javascript
复制
{
    "name": "CrossClient",
    "dataDir": "CrossClient",
    "engine": {
        "Ethash": {
            "params": {
                "gasLimitBoundDivisor": "0x0400",
                "minimumDifficulty": "0x020000",
                "difficultyBoundDivisor": "0x0800",
                "durationLimit": "0x0d",
                "blockReward": "0x4563918244F40000",
                "registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
                "homesteadTransition": 0,
                "eip150Transition": 0,
                "eip155Transition": 10,
                "eip160Transition": 10,
                "eip161abcTransition": 10,
                "eip161dTransition": 10
            }
        }
    },
    "params": {
        "accountStartNonce": "0x0",
        "maximumExtraDataSize": "0x20",
        "minGasLimit": "0x1388",
        "networkID" : "0x28757B2"
    },
    "genesis": {
        "seal": {
            "ethereum": {
                "nonce": "0x0000000000000042",
                "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
            }
        },
        "difficulty": "0x6666",
        "author": "0x0000000000000000000000000000000000000000",
        "timestamp": "0x00",
        "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
        "gasLimit": "0x4c4b40"
    },
    "accounts": {
        "ad94486b5005418dbb46a77eb2fd0c8046bfb858": { "balance": "1", "nonce": "0", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }
    }
}

有人能看到我做错了什么吗?

另外,有人能确切地告诉我成因散列是如何计算的吗?

我忘记提到我已经尝试过https://github.com/keorn/parity-spec/在这两种格式之间进行转换,但是它要求geth为"eip150Block“有一个uint值,而在geth中,我没有它的值,因此假定为null (无叉)。

EN

回答 2

Ethereum用户

回答已采纳

发布于 2017-07-21 14:04:34

最后,我成功地编写了一个工作奇偶链规范:

代码语言:javascript
复制
{
  "name": "GethTranslation",
  "engine": {
    "Ethash": {
      "params": {
        "gasLimitBoundDivisor": "0x400",
        "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": 42424242,
    "eip98Transition": 9223372036854775807
  },
  "genesis": {
    "seal": {
      "ethereum": {
        "nonce": "0x0000000000000042",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x6666",
    "author": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
    "gasLimit": "0x4c4b40"
  },
  "accounts": {
    "ad94486b5005418dbb46a77eb2fd0c8046bfb858": {
      "balance": "1000000000000000000000000000000"
    }
  }
}

不同之处在于“*转换”元素,这些元素指定分叉何时(如果有的话)会引入某个区块链更改。这些需要在Geth和奇偶之间同步,它们都有不同的缺省值。

票数 0
EN

Ethereum用户

发布于 2017-07-20 18:23:24

我还没看过你手工制作的链表.但我的建议是,从长远来看,为了节省时间(并阻止其他人手工完成),需要使用翻译工具来帮助你。

链接到的存储库的自述文件中,在另请参阅部分下,有一个指向keorn翻译工具的链接,该工具将转换Geth ->奇偶校验:

https://github.com/keorn/parity-spec

票数 3
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/21687

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档