是否可以使用pyethereum库生成一个原始事务,包括输入钱包json、密码以及事务参数?
在下面的尝试中,我得到了十六进制,当从离线将十六进制输入到MyEtherWallet发送时,它会识别数量和目标地址,但是会给出“无效格式”。希望有一个建议来调试这个。谢谢!
from ethereum import transactions, utils
from ethereum.tools.keys import decode_keystore_json
import rlp,json
def genTransactionHex(target,nonce,wallet_json,amount = 0, gasprice = 24000000000, startgas=21000):
priv_key = decode_keystore_json(wallet_json, raw_input("decode wallet:"))
#[nonce, gasprice, startgas, to, value, data, v, r, s]
tx = transactions.Transaction(nonce, gasprice, startgas, target, amount, "").sign(priv_key)
return rlp.encode(tx).encode('hex')
with open('wallet.json') as wallet_data:
wallet = json.load(wallet_data)
target = '0x67e5d173BE803Ca97687498CD3F892BFaB54d12C'
res=genTransactionHex(target, 0, wallet, 10000000000)编辑这里是一个十六进制示例:删除
EDIT2在以太扫描上尝试了这个,它成功了!不知道为什么它没有在MyEtherWallet上通过。
发布于 2017-06-07 01:57:54
您能粘贴一个要放到MyEtherWallet中的事务十六进制示例吗?那条蟒蛇应该能正常工作,所以我想知道有什么不对劲.
https://ethereum.stackexchange.com/questions/17370
复制相似问题