我想用csv格式刮掉整个ethereum区块链。为此,我通过vitalik:https://github.com/ethereum/research/blob/master/uncle_回归/块_数据泵_generator.py反向工程并扩展了这段代码
我的版本在这里:https://github.com/ankitchiplunkar/analyzeEthereum
问题是,我可以下载区块链,直到块2,675,000 (EIP 155硬叉),但在此之后,我得到以下错误:
>>> tempTxDictionary = tempTx.to_dict() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/******/anaconda2/envs/pyethapp/lib/python2.7/site-packages/ethereum/transactions.py", line 155, in to_dict d['sender'] = self.sender File "/home/******/anaconda2/envs/pyethapp/lib/python2.7/site-packages/ethereum/transactions.py", line 81, in sender raise InvalidTransaction("Invalid signature values!") ethereum.exceptions.InvalidTransaction: Invalid signature values!
仔细一看,我可以看到
tempTx.v = 37 or 38
黄纸上写着"v“应该是27或28 (方程式211)。pyethereum/transactions.py在EIP155之后读取块的方式有所不同。
我该怎么做才能解决这个问题?
PS:这里有一个更简单的方法来重新创建错误
import rlp from ethereum.blocks import BlockHeader from ethereum.transactions import Transaction from ethereum import utils import csv gethDumpFileName = 'geth.dump' f = open(gethDumpFileName) pos = 3561286829 # position of block 2,675,002 f.seek(pos) prefix = f.read(10) _typ, _len, _pos = rlp.codec.consume_length_prefix(prefix, 0) blkdata = prefix + f.read(_pos + _len - 10) header = rlp.decode(rlp.descend(blkdata, 0), BlockHeader) headerDictionary = header.to_dict() i = 0 tempTx = rlp.decode(rlp.descend(blkdata, 1, i), Transaction) tempTx.v = tempTx.v -10 tempTxDictionary = tempTx.to_dict()
发布于 2017-05-04 21:03:57
如果我没有误入歧途,这在EIP 155中是这样说的:
如果block.number >= FORK_BLKNUM和v= CHAIN_ID *2+ 35或v= CHAIN_ID *2+ 36,则在为签名或恢复目的计算事务的散列时,而不是仅散列前六个元素(即。N,汽油价格,起始价,to,value,data),散列9个元素,v由CHAIN_ID代替,r= 0,S=0。目前使用v= 27和v= 28的现有签名方案仍然有效,并继续按照与现在相同的规则运作。
所以,如果是chainId =1,那么v变成37或38,这是你看到的值。
https://ethereum.stackexchange.com/questions/15849
复制相似问题