Testnets

奇偶校驗 Ropsten 測試網分叉以阻止 296151?

  • January 17, 2017

我在 296151 區塊(UTC 時間 1 月 6 日晚上 11:14)看到了 Ropsten 測試網中的分叉。這是預期的嗎?

我的本地 Parity 節點 (Parity/v1.4.7-beta-f2058bd-20161227/x86_64-macos/rustc1.13.0) 顯示塊雜湊 0x779e9f9…:

> web3.eth.getBlock(296151)
{ author: '0x18e79a47d8a58bef5aaecbba85ea1420649c64a8',
 difficulty: { [String: '219610162'] s: 1, e: 8, c: [ 219610162 ] },
 extraData: '0xd5830104078650617269747986312e31342e30826d61',
 gasLimit: 4707788,
 gasUsed: 348478,
 hash: '0x779e9f9558143be43f3eeb58ad1aa7764a03cf7f1bda4d1c29c2e1244d5e606f',
 logsBloom: '...',
 miner: '0x18e79a47d8a58bef5aaecbba85ea1420649c64a8',
 mixHash: '0xbbb4c781b116ea5cc9cd7dd0a74f2464111cbfa3ed46bdd55cf31b774491f5ad',
 nonce: '0x0b4ee2bdab75890e',
 number: 296151,
 parentHash: '0x39df9773206e47b6555531ee0829dd91d1c91e4dad705688ddee9e6d6a94cd32',
 receiptsRoot: '0xf25f318553e87dff90cf96ace80ed47f624b44ead13400709cd19fc24f24cdb5',
 sealFields:
  [ '0xbbb4c781b116ea5cc9cd7dd0a74f2464111cbfa3ed46bdd55cf31b774491f5ad',
    '0x0b4ee2bdab75890e' ],
 sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
 size: 2185,
 stateRoot: '0x934a68c88a3ca2fea112fb08ef2055c9f1ea8310926de3da98cdb51d69ebad3b',
 timestamp: 1483741759,
 totalDifficulty: { [String: '70295938324374'] s: 1, e: 13, c: [ 70295938324374 ] },
 transactions:
  [ '0x2297defea0253c438c4c7a2d399f60fbdf3c647f9dbd2a558165612251030eb6',
    '0x4542e0daaceda8be6039ec135aad5c45cd2026e17884a6d10fec6a9338dc1d77',
    '0x699761a22a793862eacc5c6f80fee7f0bbef318f8eaf756f40a50edf85755a77',
    '0x7173c6479087a3365ebd412e6ef871b40f5ef1269e42fae265e3cf701aeffcb3',
    '0xc68d9b6d271ac294fbc1f86a703f3cbbfe57020ec4087256893565556de74a30',
    '0xd331437b8862ae97f04468f2fe4af54277299501c5deaeeaeaa5fe9184d4b07d',
    '0x3fb032b0c385eba35130e9d55acafaea6a075d91e7c496181435bad49d312ace',
    '0x7e3e3f41526d453165c2dd4c58e9aa5d6e83398d6ad08a316b6017b4f834c0ac',
    '0xbc3f4a530c26dd9c4cad7803347e33d7add544d56a6abcca538703bc1e4d2663',
    '0x676fb70068c62c9f652ceb5475f96f7ca8efe702b0eb97b0e2dfedd2c53b60f5',
    '0xb12084f5f78ad1e6e388aee22d01cc5015f743da30270c5da99000ca316e6c7b',
    '0x38250f96bf25d98b4f9d54d281f7489f42843a4fafba22acb79db741018e58f1',
    '0x66cc9fdc8645ab142ecb425cbb130f5c153e89c827a87f8f536c46ab60598351',
    '0x5c776d9fadc2f07d4742c5fe6daf41a2997596ec15fee17c60a4da1651daf167' ],
 transactionsRoot: '0x7717f5770efde5508bbe97f306e5897e58741a15777460c888e4b40b6c599d56',
 uncles: [] }

但是https://testnet.etherscan.io/block/296151顯示了具有相同父級的不同塊:

Height:           296151
TimeStamp:        5 days 14 mins ago (Jan-06-2017 11:14:41 PM +UTC)
Transactions:     0 transactions and 0 contract internal transactions in this block
Hash:             0xb3fe6d6ba7bfa04a9e8c295033e603d617b7dd1c4244f0f70997de0492b7e4c7
Parent Hash:      0x39df9773206e47b6555531ee0829dd91d1c91e4dad705688ddee9e6d6a94cd32
Sha3Uncles:       0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
Mined By:         0x817562f86cee143236962249453ae54e2b530140 IN 2784 secs
Difficulty:       209,505,820
Total Difficulty: 70,295,928,220,032
Size:             526 bytes
Gas Limit:        4,716,988
Gas Used:         0
Nonce:            0x4880dcc18186c893
Block Reward:     5 Ether
Uncles Reward:    0
Extra Data:       Get forked! (Hex:0x47657420666f726b656421)

注意不同的塊雜湊和“獲取分叉!” extraData 中的消息。

Infura 顯示與 etherscan.io 相同的塊:

curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["296151",false],"id":0}' https://testnet.infura.io/<apikeyXXX>
"result" : {
  "transactionsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "totalDifficulty" : "0x3fef0bd4a980",
  "size" : "0x20e",
  "parentHash" : "0x39df9773206e47b6555531ee0829dd91d1c91e4dad705688ddee9e6d6a94cd32",
  "mixHash" : "0x4196dda6dde22c62fbe95160b300935589f2eb5b19826cf01b559b0f7023125d",
  "extraData" : "0x47657420666f726b656421",
  "difficulty" : "0xc7cce1c",
  "hash" : "0xb3fe6d6ba7bfa04a9e8c295033e603d617b7dd1c4244f0f70997de0492b7e4c7",
  "number" : "0x484d7",
  "stateRoot" : "0x263abade588bbce1bc9dcc62f203d3b31c75474145942d88ba4bc2582862c884",
  "miner" : "0x817562f86cee143236962249453ae54e2b530140",
  "transactions" : [],
  "sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "gasUsed" : "0x0",
  "gasLimit" : "0x47f9bc",
  "logsBloom" : "...",
  "timestamp" : "0x587024e1",
  "uncles" : [],
  "receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "nonce" : "0x4880dcc18186c893"
},

編輯 2016 年 1 月 12 日:

我的本地節點顯示最新的塊是:

> web3.eth.getBlock('latest')
{
author: '0x919eb73b9d4d306188b12874f3efdccb6cdcd1b8',
difficulty: { [String: '11274423'] s: 1, e: 7, c: [ 11274423 ] },
extraData: '0xd783010502846765746887676f312e372e33856c696e7578',
gasLimit: 4712388,
gasUsed: 43104,
hash: '0xc30c5b3874d718de2a4d902f8a971cee4c4b0c0072e6c084c74efd83762efb31',
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
miner: '0x919eb73b9d4d306188b12874f3efdccb6cdcd1b8',
mixHash: '0x9b8167fc2e675f65294c09acd2ef7e48a8467814fb05217260c0df6735ce050b',
nonce: '0x5c8934db7ca0c3da',
number: 304548,
parentHash: '0x890f0b9e8960872a0708c0b4a7310b77088ef6e1b31c8538132427bfeadc8e38',
receiptsRoot: '0x60879c208751b2693f21cdb42430e39534e09dc69885d583579211338d0fba12',
sealFields:
[ '0x9b8167fc2e675f65294c09acd2ef7e48a8467814fb05217260c0df6735ce050b',
  '0x5c8934db7ca0c3da' ],
sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
size: 861,
stateRoot: '0x2bd997576e784437838f33b0d14474468af0f2ae7d48946b281aa843b83f35ae',
timestamp: 1483922649,
totalDifficulty: { [String: '70669121674025'] s: 1, e: 13, c: [ 70669121674025 ] },
transactions:
[ '0x4fabc7fbd712666527522c985b618fea7be25c5507b066393f258632b65ad5e2',
  '0x22d0cd3abcaad4c221b8f92e74c359bb22ce7d78fb52bb28a356738a8c8db488' ],
transactionsRoot: '0x5f3992b1d9e0cc84bee3b3b876fd87adce1de81b09b74800b107f569f40c4485',
uncles: []
}

它已經卡在這個街區很長一段時間了。時間戳轉換2017-01-09T00:44:09.000Z為大約 3 天前。

編輯 2016 年 1 月 12 日:

我將奇偶校驗更新為 master 的最新送出 (Parity/v1.6.0-unstable-887e5f7-20170112/x86_64-macos/rustc1‌​.13.0) 並從頭開始重新同步。現在我得到了“主”鏈:

> web3.eth.getBlock(296151).hash
'0xb3fe6d6ba7bfa04a9e8c295033e603d617b7dd1c4244f0f70997de0492b7e4c7'

因此,geth 監控節點似乎首先導入了與上面報告的相同的節點:

Jan 06 23:29:21 geth-testnet: I0106 22:29:21.064938 core/blockchain.go:1073] imported 1 blocks,    14 txs (  0.348 Mg) in  19.168ms (18.180 Mg/s). #296151 [779e9f95…]

一個雜湊0x779e9f9558143be43f3eeb58ad1aa7764a03cf7f1bda4d1c29c2e1244d5e606f

然後,稍後:

Jan 07 03:01:22 geth-testnet: I0107 02:01:22.283970 core/blockchain.go:1073] imported 1 blocks,     0 txs (  0.000 Mg) in   3.660ms ( 0.000 Mg/s). #297061 [3f857e90…] 
Jan 07 03:01:33 geth-testnet: I0107 02:01:33.483050 core/blockchain.go:1073] imported 192 blocks,     0 txs (  0.000 Mg) in 395.052ms ( 0.000 Mg/s). #296342 [b3fe6d6b… / 0086e376…] 
Jan 07 03:01:35 geth-testnet: I0107 02:01:35.155511 core/blockchain.go:1073] imported 576 blocks,     0 txs (  0.000 Mg) in 948.451ms ( 0.000 Mg/s). #296918 [cf88cd25… / e11de460…] 
Jan 07 03:01:36 geth-testnet: I0107 02:01:36.089260 core/blockchain.go:1073] imported 134 blocks,     0 txs (  0.000 Mg) in 929.458ms ( 0.000 Mg/s). #297052 [a8cfdb90… / 07022b4a…] 
Jan 07 03:01:39 geth-testnet: I0107 02:01:39.327721 core/blockchain.go:1073] imported 1 blocks,     0 txs (  0.000 Mg) in   3.956ms ( 0.000 Mg/s). #297053 [06757b24…]  

首先導入了 192 個塊,以 結尾296342,因此似乎從 重組296150,這似乎是一致的。所以在 1 月 7 日 03:01,似乎執行了 51% 的攻擊,推出了 902 個區塊(給予或接受)。

由於 Parity 預設啟用了 64 塊修剪,因此如果不從頭開始重新同步,它們將無法重新組織到“canon”鏈,從而將它們留在另一個鏈上。

引用自:https://ethereum.stackexchange.com/questions/11334