eth_sendRawTransaction - 0g

This method submits a signed, serialized transaction to the network for inclusion. It is the only write method on a public endpoint: the transaction must be signed client-side before submission.

Parameters

ParameterTypeRequiredDescription
signedTransactionDatastringYes0x-prefixed RLP-encoded signed transaction

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
    "params": ["0x02f8b101808459682f008459682f0e830186a094..."],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'eth_sendRawTransaction',
    params: ['0x02f8b101808459682f008459682f0e830186a094...'],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'eth_sendRawTransaction',
        'params': ['0x02f8b101808459682f008459682f0e830186a094...'],
        'id': 'getblock.io'
    }
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "eth_sendRawTransaction",
            "params": ["0x02f8b101808459682f008459682f0e830186a094..."],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

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

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultstring32-byte transaction hash of the submitted transaction

Use Cases

  • Value Transfers: Broadcast a signed native 0G transfer
  • Contract Calls: Submit signed state-changing contract interactions
  • Contract Deployment: Broadcast signed deployment bytecode
  • Batch Submission: Push a queue of pre-signed transactions in nonce order

Error Handling

Error CodeMessageDescription
-32602Invalid paramsMalformed or non-hex signed transaction data
-32000Nonce too lowThe transaction nonce is below the account's current nonce
-32010Transaction rejectedThe transaction failed mempool validation
3Execution revertedThe transaction reverts on execution

Web3 Integration

ethers-example.js

javascriptimport { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

const tx = await wallet.sendTransaction({ to: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', value: ethers.parseEther('0.01') });
await tx.wait();

viem-example.js

javascriptimport { createPublicClient, http } from 'viem';

const client = createPublicClient({
  transport: http('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/')
});

const hash = await walletClient.sendRawTransaction({ serializedTransaction });