# Submit Transaction

This Submit Transaction using this method.&#x20;

## API Specification

## Submit Transaction

<mark style="color:green;">`POST`</mark> `http://localhost:8889/wallet/submitTransaction`

Submit Transaction under the given instance.&#x20;

**Headers**

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| ChainId\* | String | ChainId     |

#### Request Body

| Name                                            | Type   | Description                                                           |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------- |
| to<mark style="color:red;">\*</mark>            | String | Contract Address                                                      |
| walletId<mark style="color:red;">\*</mark>      | String | The ID of the wallet                                                  |
| chainId<mark style="color:red;">\*</mark>       | String | Chain ID                                                              |
| params<mark style="color:red;">\*</mark>        | String | Additional parameters for the transaction                             |
| method<mark style="color:red;">\*</mark>        | String | The method for the transaction                                        |
| isContractTxn<mark style="color:red;">\*</mark> | String | Boolean - Indicates whether the transaction is a contract transaction |
| contractABI<mark style="color:red;">\*</mark>   | String | The Application Binary Interface (ABI) of the contract                |

{% tabs %}
{% tab title="200: OK SUCCESS" %}

```javascript
{
  "Status": "SUCCESS",
  "Message": "Signed and executed txn successfully",
  "Data": {
    "txHash": "0x6b9771a48a5536e891cc50f3b830911d7902f430412dc48fad2b3c72515f99bd"
  }
}
```

{% endtab %}

{% tab title="417: Expectation Failed wrong contract address" %}

```javascript
{
    "Status": "FAILURE",
    "Message": "error sending txn to contract : no contract code at given address",
    "Data": null
}
```

{% endtab %}

{% tab title="401: Unauthorized wrong wallet id" %}

```javascript
{
    "Status": "FAILURE",
    "Message": "Key not found",
    "Data": null
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might call this method using our official libraries, or via `curl`:

Here, contractABI need to be in json format

{% tabs %}
{% tab title="curl" %}

```bash
curl -X POST http://localhost:8889/wallet/submitTransaction \
-H "Content-Type: application/json" \
-H "ChainId: xxxx" \
-d '{
  "walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxx",
  "to": "0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx",
  "chainId": "xxxx",
  "method": "store",
  "params": [
    {
      "type": "uint256",
      "value": "35"
    }
  ],
  "isContractTxn": true,
  "contractABI": "[]"
}'
```

{% endtab %}

{% tab title="Node.js (Fetch)" %}

```javascript
const axios = require('axios');

const apiUrl = 'http://localhost:8889/wallet/submitTransaction';
const headers = {
  'Content-Type': 'application/json',
  'ChainId': 'xxxx',
};

const requestData = {
  walletId: 'effae2b6-3ee3-xxxxxxxxxxxxxxxxxx',
  to: '0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx',
  chainId: "xxxx",
  method: 'store',
  params: [
    {
      type: 'uint256',
      value: '35',
    },
  ],
  isContractTxn: true,
  contractABI: '[]',
};

axios.post(apiUrl, requestData, { headers })
  .then((response) => {
    console.log('Response:', response.data);
  })
  .catch((error) => {
    console.error('Error:', error);
  });

```

{% endtab %}

{% tab title="Python " %}

```python
import requests
import json

url = 'http://localhost:8889/wallet/submitTransaction'
headers = {
    'Content-Type': 'application/json',
    'ChainId': 'xxxx',
}

data = {
    "walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxx",
    "to": "0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx",
    "chainId": "xxxx",
    "method": "store",
    "params": [
        {
            "type": "uint256",
            "value": "35"
        }
    ],
    "isContractTxn": True,
    "contractABI": "[]"
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(f"Response: {response.json()}")

```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "http://localhost:8889/wallet/submitTransaction"
  method := "GET"

  payload := strings.NewReader(`{
  "walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxx",
  "to": "0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx",
  "chainId": "xxxx",
  "method": "store",
  "params": [
    {
      "type": "uint256",
      "value": "35"
    }
  ],
  "isContractTxn": true,
  "contractABI": "[]"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("ChainId", "xxxxxx")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}
