eth_sendRawTransaction
Submits a pre-signed transaction for broadcast to Boba Network.
Why Boba Network? Build on the Hybrid Compute L2 enabling smart contracts to access AI models and Web2 APIs natively with HybridCompute 2.0 for native AI/API access, $70M ecosystem funding, OP Stack compatibility, and two-way offchain integration.
Use Cases#
The eth_sendRawTransaction method is essential for:
- Broadcasting transactions - Submit signed transactions to the network
- Wallet operations - Send native tokens and interact with contracts
- DeFi operations - Execute swaps, provide liquidity for AI-powered dApps, Web2 API integration, enterprise blockchain solutions, and offchain computation
- Batch operations - Submit multiple transactions efficiently
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
signedTransactionData | DATA | Yes | The signed transaction data (RLP encoded) |
Request#
{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xf86c..."],
"id": 1
}
Returns#
| Type | Description |
|---|---|
DATA | 32-byte transaction hash |
Response#
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x..."
}
Code Examples#
- cURL
- JavaScript
- Python
- Go
curl -X POST https://api-boba-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xf86c808504a817c80082520894..."],
"id": 1
}'
import { JsonRpcProvider, Wallet, parseEther } from 'ethers';
const provider = new JsonRpcProvider('https://api-boba-mainnet.n.dwellir.com/YOUR_API_KEY');
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider);
// Send native tokens
async function sendTransaction(to, value) {
const tx = await wallet.sendTransaction({
to: to,
value: parseEther(value)
});
console.log('Transaction hash:', tx.hash);
// Wait for confirmation
const receipt = await tx.wait();
console.log('Confirmed in block:', receipt.blockNumber);
return receipt;
}
// Send to contract
async function sendContractTransaction(contract, method, args, value = '0') {
const tx = await contract[method](...args, {
value: parseEther(value)
});
return await tx.wait();
}
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-boba-mainnet.n.dwellir.com/YOUR_API_KEY'))
def send_transaction(private_key, to, value_in_ether):
account = w3.eth.account.from_key(private_key)
# Build transaction
tx = {
'nonce': w3.eth.get_transaction_count(account.address),
'to': to,
'value': w3.to_wei(value_in_ether, 'ether'),
'gas': 21000,
'gasPrice': w3.eth.gas_price,
'chainId': w3.eth.chain_id
}
# Sign transaction
signed_tx = account.sign_transaction(tx)
# Send transaction
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
print(f'Transaction hash: {tx_hash.hex()}')
# Wait for confirmation
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f'Confirmed in block: {receipt["blockNumber"]}')
return receipt
package main
import (
"context"
"crypto/ecdsa"
"fmt"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
client, err := ethclient.Dial("https://api-boba-mainnet.n.dwellir.com/YOUR_API_KEY")
if err != nil {
log.Fatal(err)
}
privateKey, err := crypto.HexToECDSA("YOUR_PRIVATE_KEY")
if err != nil {
log.Fatal(err)
}
publicKey := privateKey.Public()
publicKeyECDSA, _ := publicKey.(*ecdsa.PublicKey)
fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)
nonce, _ := client.PendingNonceAt(context.Background(), fromAddress)
value := big.NewInt(1000000000000000000)
gasLimit := uint64(21000)
gasPrice, _ := client.SuggestGasPrice(context.Background())
toAddress := common.HexToAddress("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb")
tx := types.NewTransaction(nonce, toAddress, value, gasLimit, gasPrice, nil)
chainID, _ := client.NetworkID(context.Background())
signedTx, _ := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey)
err = client.SendTransaction(context.Background(), signedTx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Transaction hash: %s\n", signedTx.Hash().Hex())
}
Error Handling#
| Error Code | Message | Description |
|---|---|---|
| -32000 | Nonce too low | Transaction nonce already used |
| -32000 | Insufficient funds | Account has insufficient balance |
| -32000 | Gas too low | Gas limit insufficient |
| -32000 | Replacement underpriced | Gas price too low for replacement |
Related Methods#
eth_estimateGas- Estimate gas requiredeth_gasPrice- Get current gas priceeth_getTransactionReceipt- Get transaction result