Is it possible to generate a raw transaction using pyethereum library taking inputs wallet json, password, along with transaction parameters?
My attempt below, I get the hex, when inputting hex into MyEtherWallet send from offline, it recognizes the amount and target address, but then gives 'Invalid format'. Hoping for a suggestion to debug this. Thanks!
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)
[EDIT] here is an example hex: [removed]
[EDIT2] Tried this on etherscan , and it worked! Not sure why it wasn't going through on MyEtherWallet.