在" 7节点"来自JPMorgan Quorum github的安装example使用了这样的创世文件(" istanbul-genesus.json"):
{
"alloc": {
"0x0000000000000000000000000000000000000020": {
"code": "0x606060405236156100c45760e060020a60003504631290948581146100c9578063284d163c146100f957806342169e4814610130578063488099a6146101395780634fe437d514610154578063559c390c1461015d57806368bb8bb61461025d57806372a571fc146102c857806386c1ff681461036957806398ba676d146103a0578063a7771ee31461040b578063adfaa72e14610433578063cf5289851461044e578063de8fa43114610457578063e814d1c71461046d578063f4ab9adf14610494575b610002565b610548600435600160a060020a03331660009081526003602052604090205460ff16156100c45760018190555b50565b610548600435600160a060020a03331660009081526005602052604090205460ff16156100c4576004546001141561055e57610002565b61045b60025481565b61054a60043560056020526000908152604090205460ff1681565b61045b60015481565b61045b60043560006000600060006000600050600186038154811015610002579080526002027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630192505b60018301548110156105d75760018301805484916000918490811015610002576000918252602080832090910154835282810193909352604091820181205485825292869052205410801561023257506001805490840180548591600091859081101561000257906000526020600020900160005054815260208101919091526040016000205410155b156102555760018301805482908110156100025760009182526020909120015491505b6001016101a8565b610548600435602435600160a060020a03331660009081526003602052604081205460ff16156100c4578054839010156105e45780548084038101808355908290829080158290116105df576002028160020283600052602060002091820191016105df919061066b565b610548600435600160a060020a03331660009081526005602052604090205460ff16156100c457600160a060020a0381166000908152604090205460ff1615156100f65760406000819020805460ff191660019081179091556004805490910190558051600160a060020a038316815290517f1a4ce6942f7aa91856332e618fc90159f13a340611a308f5d7327ba0707e56859181900360200190a16100f6565b610548600435600160a060020a03331660009081526003602052604090205460ff16156100c4576002546001141561071457610002565b61045b600435602435600060006000600050600185038154811015610002579080526002027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630181509050806001016000508381548110156100025750825250602090200154919050565b61054a600435600160a060020a03811660009081526003602052604090205460ff165b919050565b61054a60043560036020526000908152604090205460ff1681565b61045b60045481565b6000545b60408051918252519081900360200190f35b61054a600435600160a060020a03811660009081526005602052604090205460ff1661042e565b610548600435600160a060020a03331660009081526003602052604090205460ff16156100c457600160a060020a03811660009081526003602052604090205460ff1615156100f65760406000818120600160a060020a0384169182905260036020908152815460ff1916600190811790925560028054909201909155825191825291517f0ad2eca75347acd5160276fe4b5dad46987e4ff4af9e574195e3e9bc15d7e0ff929181900390910190a16100f6565b005b604080519115158252519081900360200190f35b600160a060020a03811660009081526005602052604090205460ff16156100f65760406000819020805460ff19169055600480546000190190558051600160a060020a038316815290517f8cee3054364d6799f1c8962580ad61273d9d38ca1ff26516bd1ad23c099a60229181900360200190a16100f6565b509392505050565b505050505b60008054600019850190811015610002578382526002027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563016020819052604082205490925014156106b8578060010160005080548060010182818154818355818115116106a5578183600052602060002091820191016106a5919061068d565b50506002015b808211156106a157600181018054600080835591825260208220610665918101905b808211156106a1576000815560010161068d565b5090565b5050506000928352506020909120018290555b600082815260208281526040918290208054600101905581514381529081018490528151600160a060020a033316927f3d03ba7f4b5227cdb385f2610906e5bcee147171603ec40005b30915ad20e258928290030190a2505050565b600160a060020a03811660009081526003602052604090205460ff16156100f65760406000819020805460ff19169055600280546000190190558051600160a060020a038316815290517f183393fc5cffbfc7d03d623966b85f76b9430f42d3aada2ac3f3deabc78899e89181900360200190a16100f656",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000001": "0x02",
"0x0000000000000000000000000000000000000000000000000000000000000002": "0x03",
"0x29ecdbdf95c7f6ceec92d6150c697aa14abeb0f8595dd58d808842ea237d8494": "0x01",
"0x6aa118c6537572d8b515a9f9154be55a3377a8de7991cd23bf6e5ceb368688e3": "0x01",
"0x50793743212c6f01d326957d7069005b912f8215f10c7536be6b10782c6c44cd": "0x01",
"0x0000000000000000000000000000000000000000000000000000000000000004": "0x02",
"0xaca3b76ed4968740c3180dd7fa37f4aa229a2c758a848f53920e9ccb4c4bb74e": "0x01",
"0xd188ba2dc293670542c1befaf7678b0859e5354a0727d1188b2afb6f47fe24d1": "0x01"
},
"balance": "1000000000000000000000000000"
},
"0xed9d02e382b34818e88b88a309c7fe71e65f419d": {
"balance": "1000000000000000000000000000"
},
"0xca843569e3427144cead5e4d5999a3d0ccf92b8e": {
"balance": "1000000000000000000000000000"
},
"0x0fbdc686b912d7722dc86510934589e0aaf3b55a": {
"balance": "1000000000000000000000000000"
},
"0x9186eb3d20cbd1f5f992a950d808c4495153abd5": {
"balance": "1000000000000000000000000000"
},
"0x0638e1574728b6d862dd5d3a3e0942c3be47d996": {
"balance": "1000000000000000000000000000"
}
},
"coinbase": "0x0000000000000000000000000000000000000000",
"config": {
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"istanbul": {
"epoch": 30000,
"policy": 0
},
"isQuorum": true
},
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f897f893946571d97f340c8495b661a823f2c2145ca47d63c2948157d4437104e3b8df4451a85f7b2438ef6699ff94b131288f355bc27090e542ae0be213c20350b76794b912de287f9b047b4228436e94b5b78e3ee1617194d8dba507e85f116b1f7e231ca8525fc9008a696694e36cbeb565b061217930767886474e3cde903ac594f512a992f3fb749857d758ffda1330e590fa915e80c0",
"gasLimit": "0x47b760",
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"nonce": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}
因此,这个genesis文件显然包含地址0x00 ... 0020的合同二进制代码。
但是这份合同的源代码是什么?
我读过,在Quorum的旧版本中,这份合同是QuorumChain共识算法的投票合同。在最新版本中,他们删除了QuorumChain并添加了伊斯坦布尔BFT共识。所以这是新合同。
您无法在Quorum来源中找到其源代码。在消息来源中没有与此类似的合同(即使按大小)。
我在EVM mnemocode中反编译了这份合同,但原始资料来源会更有帮助。
P.S。
我问Quorum团队这个问题(通过他们的联系电子邮件) - 他们没有回复。
答案 0 :(得分:0)
可能是block_voting.sol。我90%肯定。
另外,我90%确定它是垃圾。伊斯坦布尔共识未使用该合同。
一些证据(使用radare2):
剪切"代码:"来自" istanbul-genesus.json"的内容,并粘贴到文本文件" istanbul-cintract.hex"。删除" 0x"前缀:" 606060405236156100c45760e060020a6 ...
通过" rax2"将其转换为二进制文件工具:
$ rax2 -s < ./istanbul-cintract.hex > ./istanbul-cintract.bin
用&#34; radare2&#34;将其拆开(如果没有安装,请安装&#34; evm&#34;体系结构包,$ r2pm install evm
)。有用的链接是Debugging EVM和Reversing EVM。
$ r2 -A -a evm ./istanbul-cintract.bin
Cannot set bits 64 to 'evm'
Cannot set bits 64 to 'evm'
-- some kind of jokes form radare2 here... dont panic
[0x00000000]> pdf > ./istanbul-cintract.asm
现在你得到了&#34; istanbul-cintract.asm&#34;。对它的一些分析:
0x00000014 6312909485 push4 0x12909485 ; it is "SELECTOR" of public function
; S:[0x12909485, FUNC_SELECTOR] //FUNC_SELECTOR - first 4 byte of transaction data
0x00000019 81 dup2 ; S:[FUNC_SELECTOR, 0x12909485, FUNC_SELECTOR]
0x0000001a 14 eq ; S:[(FUNC_SELECTOR == 0x12909485), FUNC_SELECTOR]
0x0000001b 6100c9 push2 0xc9 ; S:[0xc9, (FUNC_SELECTOR == 0x12909485), FUNC_SELECTOR]
0x0000001e 57 jumpi ; if (FUNC_SELECTOR == 0x12909485) goto 0xc9 address of bytecode
这是一个公共接口函数调用。如果函数选择器(事务数据的前4个字节)是0x12909485
,它会跳转到函数体上。在下面的文本中,我们可以找到剩余的公共函数选择器:
0x00000014 6312909485 push4 0x12909485
... etc, only selector push commands...
0x00000020 63284d163c push4 0x284d163c
0x0000002b 6342169e48 push4 0x42169e48
0x00000036 63488099a6 push4 0x488099a6
0x00000041 634fe437d5 push4 0x4fe437d5
0x0000004c 63559c390c push4 0x559c390c
0x00000057 6368bb8bb6 push4 0x68bb8bb6
0x00000062 6372a571fc push4 0x72a571fc
0x0000006d 6386c1ff68 push4 0x86c1ff68
0x00000078 6398ba676d push4 0x98ba676d
0x00000083 63a7771ee3 push4 0xa7771ee3
0x0000008e 63adfaa72e push4 0xadfaa72e
0x00000099 63cf528985 push4 0xcf528985
0x000000a4 63de8fa431 push4 0xde8fa431
0x000000af 63e814d1c7 push4 0xe814d1c7
0x000000ba 63f4ab9adf push4 0xf4ab9adf
作为最终证明此字节码与block_voting.sol具有相同的接口,请使用&#34; block_voting.sol&#34;中的签名重新计算选择器。并与字节码中找到的那些进行比较:
0x12909485 == web3.sha3("setVoteThreshold(uint256)").substr(0,10)
0x284d163c == web3.sha3("removeBlockMaker(address)").substr(0,10);
0x42169e48 == web3.sha3("voterCount()").substr(0,10);
0x488099a6 == web3.sha3("canCreateBlocks(address)").substr(0,10);
0x4fe437d5 == web3.sha3("voteThreshold()").substr(0,10);
0x559c390c == web3.sha3("getCanonHash(uint256)").substr(0,10);
0x68bb8bb6 == web3.sha3("vote(uint256,bytes32)").substr(0,10);
0x72a571fc == ??? not found...
0x86c1ff68 == web3.sha3("removeVoter(address)").substr(0,10);
0x98ba676d == web3.sha3("getEntry(uint256,uint256)").substr(0,10);
0xa7771ee3 == web3.sha3("isVoter(address)").substr(0,10);
0xadfaa72e == web3.sha3("canVote(address)").substr(0,10);
0xcf528985 == web3.sha3("blockMakerCount()").substr(0,10);
0xde8fa431 == web3.sha3("getSize()").substr(0,10);
0xe814d1c7 == web3.sha3("isBlockMaker(address)").substr(0,10);
0xf4ab9adf == web3.sha3("addVoter(address)").substr(0,10);
由你决定这是什么......