1

Since I am using web3 = Web3(HTTPProvider('https://mainnet.infura.io/root@123'))

That's why I have to use sendrawtransaction for ether transaction . Now what is the process of write sendrawtransaction in PYTHON ?

And if there is any other process of transaction using this Httpprovider in pythhon then please mention .

1

You may refer the official doc here.
It gives an example as follow,

>>> import rlp
>>> from ethereum.transactions import Transaction
>>> tx = Transaction(
    nonce=web3.eth.getTransactionCount(web3.eth.coinbase),
    gasprice=web3.eth.gasPrice,
    startgas=100000,
    to='0xd3cda913deb6f67967b99d67acdfa1712c293601',
    value=12345,
    data=b'',
)
>>> tx.sign(the_private_key_for_the_from_account)
>>> raw_tx = rlp.encode(tx)
>>> raw_tx_hex = web3.toHex(raw_tx)
>>> web3.eth.sendRawTransaction(raw_tx_hex)
'0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331'
1

If I understand you correctly, you're just trying to figure out how to send a transaction using web3.py. If so, something like this should work:

web3.eth.sendTransaction({
    'from': '0x...',
    'to': '0x...',
    'value': web3.toWei(1, 'ether'),
})
0

You can sign a transaction with pyethereum. See the pyethereum answer here: Create and sign OFFLINE raw transactions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.