# eth_sendRawTransaction - Mantle

> Example code for the eth_sendRawTransaction JSON-RPC method. Complete guide on how to use eth_sendRawTransaction JSON-RPC in GetBlock Web3 documentation.

This method creates a new message call transaction or contract creation for signed transactions on the Mantle network.

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| signedTransactionData | string | The signed transaction data (hex encoded) |

### Request

#### cURL

#### curl

```bash
curl --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": ["0xf86c0a8502540be400825208944bbeeb066ed09b7aed07bf39eee0460dfa261520880de0b6b3a7640000801ca0f3ae..."],
    "id": "getblock.io"
}'
```

#### JavaScript (axios)

#### sendRawTransaction.js

```javascript
import axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
    "params": ["0xf86c0a8502540be400825208944bbeeb066ed09b7aed07bf39eee0460dfa261520880de0b6b3a7640000801ca0f3ae..."],
    "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

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

#### Python (requests)

#### send_raw_transaction.py

```python
import requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = json.dumps({
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
    "params": ["0xf86c0a8502540be400825208944bbeeb066ed09b7aed07bf39eee0460dfa261520880de0b6b3a7640000801ca0f3ae..."],
    "id": "getblock.io"
})

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)
```

#### Rust (reqwest)

#### main.rs

```rust
use reqwest::header;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header(header::CONTENT_TYPE, "application/json")
        .body(r#"{
            "jsonrpc": "2.0",
            "method": "eth_sendRawTransaction",
            "params": ["0xf86c0a8502540be400825208944bbeeb066ed09b7aed07bf39eee0460dfa261520880de0b6b3a7640000801ca0f3ae..."],
            "id": "getblock.io"
        }"#)
        .send()
        .await?;
    
    println!("{}", response.text().await?);
    Ok(())
}
```

### Response

#### response.json

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

### Response Parameters

| Field | Type | Description |
| --- | --- | --- |
| jsonrpc | string | JSON-RPC protocol version ("2.0") |
| id | string | Request identifier matching the request |
| result | string | Transaction hash (32 bytes) |

### Use Case

The `eth_sendRawTransaction` method is essential for:

* Submitting signed transactions
* Token transfers on Mantle
* Smart contract interactions
* DeFi protocol transactions
* NFT minting and transfers
* Batch transaction submission

### Error Handling

| Status Code | Error Message | Cause |
| --- | --- | --- |
| 403 | Forbidden | Missing or invalid ACCESS-TOKEN |
| -32000 | Nonce too low | Transaction nonce already used |
| -32000 | Insufficient funds | Not enough MNT for gas |
| -32000 | Gas price too low | Gas price below minimum |

### Web3 Integration

#### Ethers.js

#### ethers.js

```javascript
import { ethers } from 'ethers';

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

const tx = await wallet.sendTransaction({
    to: '0xD85498dbEaEB1Df24BE52eED4F52eAc2Fbd56245',
    value: ethers.parseEther('0.1')
});
console.log('Transaction hash:', tx.hash);
```

#### Viem

#### viem.js

```javascript
import { createWalletClient, http, parseEther } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { mantle } from 'viem/chains';

const account = privateKeyToAccount('0xYOUR_PRIVATE_KEY');

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

const hash = await client.sendTransaction({
    to: '0xD85498dbEaEB1Df24BE52eED4F52eAc2Fbd56245',
    value: parseEther('0.1')
});
console.log('Transaction hash:', hash);
```
