> This page is for Taurus PROTECT, version v3.42.
> For other versions, use one of these documentation indexes:
> - v3.58 (default): https://taurushq.ferndocs.com/protect-capital/v3.58/llms.txt
> - v3.56: https://taurushq.ferndocs.com/protect-capital/v3.56/llms.txt
> - v3.54: https://taurushq.ferndocs.com/protect-capital/v3.54/llms.txt
> - v3.52: https://taurushq.ferndocs.com/protect-capital/v3.52/llms.txt
> - v3.50: https://taurushq.ferndocs.com/protect-capital/v3.50/llms.txt
> - v3.48: https://taurushq.ferndocs.com/protect-capital/v3.48/llms.txt
> - v3.46: https://taurushq.ferndocs.com/protect-capital/v3.46/llms.txt
> - v3.44: https://taurushq.ferndocs.com/protect-capital/v3.44/llms.txt
> - v3.42: https://taurushq.ferndocs.com/protect-capital/v3.42/llms.txt
> - v3.40: https://taurushq.ferndocs.com/protect-capital/v3.40/llms.txt
> - v3.38: https://taurushq.ferndocs.com/protect-capital/v3.38/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://taurushq.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://taurushq.ferndocs.com/_mcp/server.

# Execute an EVM call

POST https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/{id}/evm/call
Content-Type: application/json

This endpoint executes a read-only call on an EVM contract.

### Contract Instance ID

The contract instance ID in the path parameter can be obtained by querying the [contract instances info](https://docs.taurushq.com/protect-capital/reference/contractinstanceservice_getcontractinstancesinfo) endpoint:

```
GET /api/rest/v1/capital/contract-instances/info?address=<contract_address>&limit=10
```

### Request Body Parameters

1. `fromAddressID` (uint64): (optional) the id of the caller address
2. `data` (string): ABI encoded method ID and parameters. This is the encoded function call data that will be executed by the EVM.

### ABI Encoded Method ID and Parameters

The `data` parameter follows the ABI encoding specification. For more details, see:
[https://docs.soliditylang.org/en/latest/abi-spec.html](https://docs.soliditylang.org/en/latest/abi-spec.html)

**Example:** Calling balanceOf(address) function

* **Function:** balanceOf(address)
* **Address:** 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae

### Encoded Data Breakdown

1. **Function signature**:
   ```
   balanceOf(address)
   ```

2. **Function selector** (first 4 bytes of keccak256 hash of "balanceOf(address)"):
   ```
   0x70a08231
   ```

3. **Address parameter** (Take the argument of the function (in this case: the address) -> 32 bytes, padded):
   ```
   000000000000000000000000de0b295669a9fd93d5f28d9ec85e40f4cb697bae
   ```

4. **Call data** (Concatenate the results to get the complete encoded call data):
   ```
   0x70a08231000000000000000000000000de0b295669a9fd93d5f28d9ec85e40f4cb697bae
   ```

Reference: https://taurushq.ferndocs.com/protect-capital/reference/capital/contracts-evm-instance/call-evm

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `id` (string, required) — Contract instance ID

### Body (application/json)

This endpoint expects a ContractInstanceServiceCallEVMBody.

- `fromAddressID` (string, optional) — Address ID of source address.
- `data` (string, optional) — ABI encoded method ID and parameters.

## Response

### 200

A successful response.

- `data` (string, optional) — Raw call result (encoded).

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "data": "string"
}
```

**SDK Code**

```python
import requests

url = "https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://your-protect-instance.example.com/api/rest/v1/capital/contract-instances/id/evm/call")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```