How to call eth_sendRawTransaction method

Hi Team,

How can I call eth_sendRawTransaction method as it require signed transaction data as params.
From where & how to get this params can you help.

Thank You

1 Like

No one is responding in Live Chat.

why you deleted your post ?

Hey, calling eth_sendRawTransaction involves sending an already signed tx to a blockchain network. In order to get the signed transaction data, you will need create a transaction object, with details like the recipient’s address, the value you wish to send and the gas price details. Then you will need to sign that transaction with the private key of the sender’s account. You can use javascript libraries like ethers.js or web3.js in order to sign the transaction.
The result will be the signed tx data which you can use with the eth_sendRawTransaction method.

Can you share any working sample for - creating a transaction object
Looks like there are different versions available for creating a transaction - Legacy, eip 1559, eip 2930

You can check this tutorial on how to construct the transaction object, it is eip 1559, and instead of sending the transaction, with signer.sendTransaction, you will need to sign it using the signTransaction method, signer.signTransaction, in order to get the signed transaction data.

Thank You.

I used web3.eth.accounts.signTransaction() —> Got Signed Txn
Passed this Signed Txn to eth_sendRawTransaction RPC method
It got included in Block as well.

That’s great. Thanks for letting me know.

This topic was automatically closed after 30 days. New replies are no longer allowed.