> ## Documentation Index
> Fetch the complete documentation index at: https://gasdocs-zh.gasstation.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 预估费用

> 预估 TRON Energy 费用，支持普通代币转账及合约调用资源预估

> [!NOTE]
>
> 当前接口仅预估 TRON Energy 费用，不包含 Net（带宽）费用。
>
> 支持以下预估场景：
>
> * 普通代币转账：不传 `amount` 和 `data`；
> * 合约调用交易：传入 ABI 编码后的 `data` hex 数据。

#### 请求参数数据结构

**receive\_address** `string` *required*

资源接收地址
\[!NOTE] 请确保 receive\_address 持有contract\_address对应代币，否则矿工费预估失败。

**address\_to** `string` *required*

转账到账地址，用于预估矿工费。

> [!NOTE]
>
> * 普通代币转账场景：`address_to` 为实际收款地址。
> * 合约调用交易场景：`address_to` 为合约地址，且需与 `contract_address` 保持一致。

**contract\_address** `string` *required*

合约地址，用于预估矿工费。

**service\_charge\_type** `string` *required*

租赁周期code :请求order/price接口返回分钟 小时 天 不同时间的费用code。
示例：10分钟:10010, 1小时:20001, 1天:30001

**amount** `string`

合约调用金额

> [!NOTE]
>
> 用于合约预估场景时，amount 表示本次合约调用关联的金额.普通转账预估场景可不传。

**data** `string`

合约调用 data，由 ABI 编码构建出的 16 进制数据。

> [!NOTE]
>
> data 非空时，接口会将其作为合约交易传入进行资源预估；普通转账预估场景可不传。

#### 响应参数数据结构

**object**

**contract\_address** `string`

合约地址

**address\_to** `string`

转账到账地址

**receive\_address** `string`

资源接收地址

**amount** `decimal`

订单金额

**energy\_amount** `decimal`

能量费用

**active\_amount** `decimal`

激活费用

**energy\_num** `integer`

能量数

**energy\_price** `decimal`

能量单价

**service\_charge\_type** `string`

服务费code

```curl cURL theme={null}
curl -X GET \
'https://openapi.gasstation.ai/api/tron/gas/estimate?app_id=49e9c57da66788e5178c8fec2905067b&data=lgy/X0LwFTE/03yBGP0PIGgzZMY+KFzlOFAo0SZkChygmN8RnV+y1tTEbjTAR2SD04xSX+r9FKWqIaATxev6yQ=='
```

```json theme={null}
{
    "code": 0,
    "msg": "Success",
    "data": {
        "contract_address": "TED4rvM5VAG8kzKULTb7GXXY6ph9aTwjt3",
        "address_to": "TE4Smnqa4cWiKZdmjzD64peEqLFqk213HS",
        "receive_address": "TXxtczsXf1EYgWEbwSxwC85iMfdv6CGNRa",
        "amount": "1.216000",
        "energy_amount": "1.216000",
        "active_amount": "0",
        "energy_num": 32000,
        "energy_price": "38.00000001",
        "service_charge_type": "10010"
    }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.