> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_sendRawTransaction | Gnosis

> Gnosis Chain API method that allows submitting a signed transaction to the network. eth_sendRawTransaction on Gnosis via Chainstack.

Gnosis Chain API method that allows submitting a signed transaction to the network. Once a transaction is signed, you can use the `eth_sendRawTransaction` method to submit the signed transaction to the Gnosis Chain network for processing.

<Warning>
  Note that the interactive example in this page will not work, due to the fact that `eth_sendRawTransaction` is used to modify the state of the blockchain, it is not possible to duplicate the same request.
</Warning>

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

* `data` — the signed transaction. The serialized transaction data, which includes the transaction metadata such as the nonce, gas price, gas limit, recipient address, and data payload, as well as the digital signature generated using the private key associated with the address that is sending the transaction. Typically, signed with a library such as web3.py, web3.js, or ethers.js using the sender's private key.

## Response

* `result` — the unique hash identifying the transaction or the zero hash if the transaction is not available yet. The zero hash is a special value that represents an invalid or null hash.

## `eth_sendRawTransaction` code examples

The following examples demonstrate how to use Web3 libraries to make an ETH transfer on the Sepolia testnet.

<Note>
  **Additional libraries requirement**

  Note that web3.js requires installing two extra libraries:

  * [ethereumjs-tx](https://www.npmjs.com/package/@ethereumjs/tx)
  * [ethereumjs-common](https://www.npmjs.com/package/@ethereumjs/common)
</Note>

<CodeGroup>
  ```javascript web3.js theme={"system"}
  const Web3 = require("web3");
  const Tx = require('ethereumjs-tx').Transaction;
  const Common = require('ethereumjs-common').default;

  const NODE_URL = "CHAINSTACK_NODE_URL";
  const web3 = new Web3(NODE_URL);

  async function sendEth(value) {

      // Define the sender and receiver addresses, and the private key
      const sender = '0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a';
      const receiver = '0xe9ba4b4d84d7a3c80245514213b88d50ed937114';
      const privateKey = Buffer.from('1111111111111111111111111111111111111111111111111111111111111111', 'hex');

      // Define the gas limit
      const gasLimit = await web3.eth.estimateGas({
          from: sender,
          to: receiver,
      });

      // Get the transaction count for the sender address
      const nonce = await web3.eth.getTransactionCount(sender);

      // Define the transaction object
      const transactionObject = {
          to: receiver,
          gasPrice: web3.utils.toHex(web3.utils.toWei('50', 'gwei')),
          gasLimit: web3.utils.toHex(gasLimit),
          nonce: web3.utils.toHex(nonce),
          value: web3.utils.toHex(web3.utils.toWei(value, 'ether')),
      };

      // Define the chain configuration
      const common = Common.forCustomChain(
        'mainnet', {
            name: 'sepolia',
            networkId: 11155111,
            chainId: 11155111,
        },
        'petersburg',
    );

      // Create a new transaction object to sign 
      const tx = new Tx(transactionObject, {
          common
      });

      // Sign the transaction using the private key  
      const signedTx = tx.sign(privateKey);

      // Serialize the signed transaction and send it to the blockchain 
      const serializedTx = tx.serialize();
      const rawTransaction = '0x' + serializedTx.toString('hex');
      console.log(`Raw transaction: ${rawTransaction}\n`)

      try {
          console.log(`Sending transaction...`)
          const result = await web3.eth.sendSignedTransaction(rawTransaction);
          console.log(`Transaction hash: ${result.transactionHash}`);

      } catch (error) {
          console.error(error);
      }
  }

  sendEth("2");
  ```

  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  async function sendEth(value) {

    // Define the sender and receiver addresses, and the private key
  	const sender = '0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a';
    const receiver = '0xe9ba4b4d84d7a3c80245514213b88d50ed937114';
    const privateKey = '1111111111111111111111111111111111111111111111111111111111111111';
    
    // Define the gas limit
    const gasLimit = await provider.estimateGas({
      from: sender,
      to: receiver,
      value: ethers.parseEther(value),
    });

    // Get the transaction count for the sender address
    const nonce = await provider.getTransactionCount(sender);

    // Define the transaction object
    const transactionObject = {
      to: receiver,
      gasPrice: ethers.parseUnits('50', 'gwei'),
      gasLimit: gasLimit.toString(),
      nonce: nonce,
      value: ethers.parseEther(value),
    };

    // Sign the transaction using the private key  
    const wallet = new ethers.Wallet(privateKey, provider);
    console.log(`Sending transaction...`)
    
    const transaction = await wallet.sendTransaction(transactionObject);
    console.log('Transaction hash:', transaction.hash);
  }

  sendEth("2");
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3  
  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3(Web3.HTTPProvider(node_url)) 

  # Define the sender and receiver addresses, and the private key
  sender = '0x19e7e376e7c213b7e7e7e46cc70a5dd086daff2a' 
  receiver = '0xe9ba4b4d84d7a3c80245514213b88d50ed937114' 
  private_key = '1111111111111111111111111111111111111111111111111111111111111111'   

  # Estimate gas limit
  gas_limit = web3.eth.estimate_gas({
    'from': sender,
    'to': receiver
  })

  # Build the transaction object
  transaction = {
    'nonce': web3.eth.get_transaction_count(sender),
    'to': receiver,
    'value': web3.to_wei(1, 'ether'), # value to send 
    'gas': gas_limit,
    'gasPrice': web3.eth.gas_price,
    'chainId': web3.eth.chain_id
  }

  # Sign the transaction
  signed_tx = web3.eth.account.sign_transaction(transaction, private_key)
  print(f'Signed transaction: {signed_tx}')

  # Send the transaction
  print('Sending transaction...')
  tx_hash = web3.eth.send_raw_transaction(signed_tx.rawTransaction)
  print(f'Transaction hash: {web3.toHex(tx_hash)}')
  ```
</CodeGroup>

<Note>
  Note that you will need to edit the `sender`, `receiver`, and `privateKey` fields to be able to use this code.
</Note>

## Use case

One potential use case for `eth_sendRawTransaction` is to automatically swap ETH for a token when its price reaches a certain level. `eth_sendRawTransaction` will allow specifying custom transaction parameters, such as gas price or gas limit, to optimize the speed and cost of the transaction.

For instance, you could build a program monitoring the price of a specific token and execute a `swapExactETHForTokens` transaction when the token reaches a certain price level, it could use `eth_sendRawTransaction` to submit a raw transaction with a custom gas price and limit that are optimized for the current network conditions.


## OpenAPI

````yaml /openapi/gnosis_node_api/execute_transactions/eth_sendRawTransaction.json POST /512e720763b369ed620657f84d38d2af
openapi: 3.0.0
info:
  title: Upload
  version: 1.0.0
  description: This is an API for interacting with a Chainstack node.
servers:
  - url: https://nd-500-249-268.p2pify.com
security: []
paths:
  /512e720763b369ed620657f84d38d2af:
    post:
      tags:
        - upload
      summary: eth_sendRawTransaction
      operationId: sendRawTransaction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_sendRawTransaction
                params:
                  type: array
                  items:
                    anyOf:
                      - type: string
                        description: The signed transaction.
                  default:
                    - >-
                      0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675
      responses:
        '200':
          description: The transaction hash.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: object

````