# 使用签名交易 (Signed tx)

## [​Buy API (Postman)​](https://www.postman.com/tronsave/tronsave/folder/kuv179r/buy-with-signtx) <a href="#buy-api-postman" id="buy-api-postman"></a>

## **使用签名交易购买能源流程** <a href="#shi-yong-qian-ming-jiao-yi-gou-mai-neng-yuan-liu-cheng" id="shi-yong-qian-ming-jiao-yi-gou-mai-neng-yuan-liu-cheng"></a>

### **步骤 1：准备钱包和私钥** <a href="#bu-zhou-1-zhun-bei-qian-bao-he-si-yao" id="bu-zhou-1-zhun-bei-qian-bao-he-si-yao"></a>

1. 确保您可以访问用于交易的钱包私钥。
2. 确认钱包中有足够的TRX余额以执行交易。

### **步骤 2：估算所需的TRX** <a href="#bu-zhou-2-gu-suan-suo-xu-de-trx" id="bu-zhou-2-gu-suan-suo-xu-de-trx"></a>

* 使用估算[TRX API](/chinese/developer/buy-resources-v2/use-signed-transaction/estimate-trx.md)来计算所需的TRX，用于目标能源数量和租赁时长。

### **步骤 3：生成签名交易** <a href="#bu-zhou-3-sheng-cheng-qian-ming-jiao-yi" id="bu-zhou-3-sheng-cheng-qian-ming-jiao-yi"></a>

* [​**选项 1**：使用钱包私钥自行编写函数生成签名交易。​](/chinese/developer/buy-resources-v2/use-signed-transaction/get-signed-transaction.md#xuan-xiang-1-shi-yong-qian-bao-si-yao-zi-xing-bian-xie-han-shu-sheng-cheng-qian-ming-jiao-yi)
* [​**选项 2**：使用Tronsave的Get Signed Transaction API自动生成签名交易。​](/chinese/developer/buy-resources-v2/use-signed-transaction/get-signed-transaction.md#xuan-xiang-2-shi-yong-tronsave-de-get-signed-transaction-api-zi-dong-sheng-cheng-qian-ming-jiao-yi)

### **步骤 4：创建订单** 使用[创建订单 API](/chinese/developer/buy-resources-v2/use-signed-transaction/create-order.md)完成交易。 <a href="#bu-zhou-4-chuang-jian-ding-dan-shi-yong-chuang-jian-ding-dan-api-wan-cheng-jiao-yi" id="bu-zhou-4-chuang-jian-ding-dan-shi-yong-chuang-jian-ding-dan-api-wan-cheng-jiao-yi"></a>

* 提交签名交易的响应结果（如果使用API）或您自定义的签名交易。
* 包含估算的TRX数量和其他所需参数来创建能源购买订单。

## 测试用API列表 - Nile 测试网 <a href="#api-list-for-testing-tron-nile-testnet" id="api-list-for-testing-tron-nile-testnet"></a>

{% tabs %}
{% tab title="测试\_API" %}

* **获取估算 TRX:** <mark style="color:orange;">`POST`</mark> `https://api-dev.tronsave.io/v2/estimate-buy-resource`
* **获取已签名交易**: <mark style="color:orange;">`POST`</mark> `https://api-dev.tronsave.io/v2/signed-tx`
* **创建订单:** <mark style="color:orange;">`POST`</mark> `https://api-dev.tronsave.io/v2/buy-resource`
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tronsave.io/chinese/developer/buy-resources-v2/use-signed-transaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
