---
title: sendTransaction
slug: api/sendtransaction
createdAt: 2022-12-06T18:10:45.000Z
---

{
  "id": "_kyt_qzL4_KYxmQzRVQYn",
  "data": {
    "url": "{{ENVIRONMENT}}",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "{\n\t\"jsonrpc\":\"2.0\",\n\t\"method\":\"eth_sendTransaction\",\n\t\"params\":[{\n\t\t\"from\": \"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\n\t\t\"to\": \"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\n\t\t\"gas\": \"0x76c0\",\n\t\t\"gasPrice\": \"0x9184e72a000\",\n\t\t\"value\": \"0x9184e72a\",\n\t\t\"data\": \"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"\n\t}],\n\t\"id\":1\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "<p>Creates new message call transaction or a contract creation, if the data field contains code.</p>\n<p><strong>Parameters</strong></p>\n<p><code>Object</code> - The transaction object</p>\n<p><code>from</code>: <code>DATA</code>, 20 Bytes - The address the transaction is send from.</p>\n<p><code>to</code>: <code>DATA</code>, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.</p>\n<p><code>gas</code>: <code>QUANTITY</code> - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.</p>\n<p><code>gasPrice</code>: <code>QUANTITY</code> - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas</p>\n<p><code>value</code>: <code>QUANTITY</code> - (optional) Integer of the value sent with this transaction</p>\n<p><code>data</code>: <code>DATA</code> - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI</p>\n<p><code>nonce</code>: <code>QUANTITY</code> - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.</p>\n<pre><code>params: [{\r\n  \"from\": \" 0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\r\n  \"to\": \" 0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\r\n  \"gas\": \"0x76c0\", // 30400\r\n  \"gasPrice\": \"0x9184e72a000\", // 10000000000000\r\n  \"value\": \"0x9184e72a\", // 2441406250\r\n  \"data\": \"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"\r\n}]\n</code></pre>\n<p><strong>Returns</strong></p>\n<p><code>DATA</code>, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.</p>\n<p>Use <code>eth_getTransactionReceipt</code> to get the contract address, after the transaction was mined, when you created a contract.</p>",
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{ENVIRONMENT}} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{ENVIRONMENT}}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{ENVIRONMENT}}\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{ENVIRONMENT}}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": ""
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}