RPC Methods
Transaction Methods
Testnet 122606
Section
RPC Methods
Documentation category
Type
Guide
Technical reference
Summary
Send transactions, retrieve receipts, and estimate gas.
Article Content
eth_sendRawTransaction
Submits a signed, serialized transaction to the network.
Params:
DATA— signed transaction in RLP-encoded hex format
import { JsonRpcProvider, Wallet, parseEther } from 'ethers'
const provider = new JsonRpcProvider('https://testnet.swssrpc.swss.io')
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider)
const tx = await wallet.sendTransaction({
to: '0xRecipient...',
value: parseEther('0.01'),
})
console.log('Hash:', tx.hash)
await tx.wait()
Result: string — 32-byte transaction hash
eth_getTransactionByHash
Returns the transaction matching a given hash.
{
"method": "eth_getTransactionByHash",
"params": ["0xabc...def"]
}
Result: Transaction object or null if not found
{
"hash": "0xabc...",
"from": "0xSender...",
"to": "0xRecipient...",
"value": "0x2386F26FC10000",
"gasPrice": "0x3B9ACA00",
"nonce": "0x5",
"blockNumber": "0x12D687"
}
eth_getTransactionReceipt
Returns the receipt of a transaction. Only available after the transaction has been included in a block.
{ "method": "eth_getTransactionReceipt", "params": ["0xabc...def"] }
Result: Receipt object
{
"transactionHash": "0xabc...",
"blockNumber": "0x12D687",
"status": "0x1",
"gasUsed": "0x5208",
"logs": []
}
status: "0x1" = success, "0x0" = reverted.
eth_estimateGas
Estimates the gas required for a transaction without broadcasting it.
{
"method": "eth_estimateGas",
"params": [{ "from": "0xSender...", "to": "0xRecipient...", "value": "0xDE0B6B3A7640000" }]
}
