For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_sendRawTransaction - Optimism

Example code for the eth_sendRawTransaction json-rpc method. Сomplete guide on how to use eth_sendRawTransaction json-rpc in GetBlock.io Web3 documentation.

This method submits a pre-signed transaction to the network. The transaction must be signed with the sender's private key before being submitted. On Optimism, transactions are processed quickly (~2 seconds) and benefit from significantly lower fees than Ethereum L1 due to the L2 rollup architecture. The method returns the transaction hash if successful, which can be used to track the transaction status. Note that Optimism transaction costs include both L2 execution costs and L1 data availability costs.

Parameters

Parameter
Type
Description
Required

signedTransactionData

DATA

The signed transaction data as a hexadecimal string.

Yes

Request Sample

curl --location 'https://go.getblock.us/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
   "jsonrpc": "2.0",
    method": "eth_sendRawTransaction",
  "params": [
    "0xf869018203e882520894f17f52151ebef6c7334fad080c5704d77216b732881bc16d674ec80000801ba02da1c48b670996dcb1f447ef9ef00b33033c48a4fe938f420bec3e56bfd24071a062e0aa78a81bf0290afbc3a9d8e9a068e6d74caa66c5e0fa8a46deaae96b0833"
  ],
    "id": "getblock.io"
}'
import axios from 'axios'
let data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
  "params": [
    "0xf869018203e882520894f17f52151ebef6c7334fad080c5704d77216b732881bc16d674ec80000801ba02da1c48b670996dcb1f447ef9ef00b33033c48a4fe938f420bec3e56bfd24071a062e0aa78a81bf0290afbc3a9d8e9a068e6d74caa66c5e0fa8a46deaae96b0833"
  ],
    "id": "getblock.io"
};

let config = {
  method: "post",
  maxBodyLength: Infinity,
  url: "https://go.getblock.us/<ACCESS_TOKEN>",
  headers: {
    "Content-Type": "application/json",
  },
  data: data,
};

axios
  .request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

Response

A successful response returns the following:

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
}

Response Parameters

  • id: A unique request identifier, matching the id sent in the request body.

  • jsonrpc: Specifies the use of JSON-RPC version 2.0.

  • result: The 32-byte transaction hash of the submitted transaction, or an error if the transaction failed.

Use Case

The eth_sendRawTransaction method is commonly used for:

  • Transaction broadcasting

  • Token transfers

  • Contract interactions

  • DApp transactions

Error handling

Status Code
Error Message
Cause

404

Not Found

Missing or invalid ACCESS_TOKEN.

-3200

max fee per gas less than block base fee

  • Invalid transaction

  • Insufficient funds

Integration with Web3

Using eth_sendRawTransaction enables developers to:

  • Build backend services that prepare and sign transactions in a secure environment

  • Trigger automated onchain actions from server scripts

Last updated

Was this helpful?