# Update contract energy limit

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/updateenergylimit

Updates the maximum energy limit for an existing smart contract.


Reference: https://www.alchemy.com/docs/chains/tron/tron-http-api-endpoints/tron-http-api-endpoints/update-contract-energy-limit

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/updateenergylimit \
  --header 'Content-Type: application/json' \
  --data '{
  "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
  "contract_address": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf",
  "origin_energy_limit": 30000000,
  "visible": true
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    owner_address: 'TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g',
    contract_address: 'TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf',
    origin_energy_limit: 30000000,
    visible: true
  })
};

fetch('https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/updateenergylimit', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/updateenergylimit"

payload = {
    "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
    "contract_address": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf",
    "origin_energy_limit": 30000000,
    "visible": True
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
```

### Go

```go
package main

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

func main() {

	url := "https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/updateenergylimit"

	payload := strings.NewReader("{\n  \"owner_address\": \"TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g\",\n  \"contract_address\": \"TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf\",\n  \"origin_energy_limit\": 30000000,\n  \"visible\": true\n}")

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

	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/updateenergylimit")
  .header("Content-Type", "application/json")
  .body("{\n  \"owner_address\": \"TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g\",\n  \"contract_address\": \"TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf\",\n  \"origin_energy_limit\": 30000000,\n  \"visible\": true\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://tron-mainnet.g.alchemy.com/v2/docs-demo/wallet/updateenergylimit");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"owner_address\": \"TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g\",\n  \"contract_address\": \"TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf\",\n  \"origin_energy_limit\": 30000000,\n  \"visible\": true\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /wallet/updateenergylimit
method: POST
operation:
  summary: Update contract energy limit
  description: |
    Updates the maximum energy limit for an existing smart contract.
  tags:
    - Tron HTTP API Endpoints
  security:
    - apiKey: []
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: object
          required:
            - owner_address
            - contract_address
            - origin_energy_limit
          properties:
            owner_address:
              type: string
              description: Base58 address of the contract owner.
              example: TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g
            contract_address:
              type: string
              description: Base58 address of the contract to update.
              example: TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf
            origin_energy_limit:
              type: integer
              description: New maximum energy limit.
              example: 30000000
            visible:
              type: boolean
              description: Indicates if addresses are base58 (true) or hex (false).
              example: true
  responses:
    '200':
      description: Unsigned transaction object for contract energy limit update.
      content:
        application/json:
          schema:
            type: object
            properties:
              visible:
                type: boolean
              txID:
                type: string
              raw_data:
                type: object
              raw_data_hex:
                type: string
          examples:
            response:
              value:
                visible: true
                txID: c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2b1a2c3d4e5f6a7b8
                raw_data:
                  contract:
                    - parameter:
                        value:
                          owner_address: TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g
                          contract_address: TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf
                          origin_energy_limit: 30000000
                        type_url: type.googleapis.com/protocol.UpdateEnergyLimitContract
                      type: UpdateEnergyLimitContract
                  ref_block_bytes: cdef
                  ref_block_hash: fedcba9876543210
                  expiration: 1762269500000
                  timestamp: 1762269400000
                raw_data_hex: 0a02cdef2208fedcba987654321040f0dad5faa4335a...
```
