Buy — Signed Transaction
Legacy v0 flow for buying Energy with a signed TRON transaction — estimate TRX, generate a signed transfer, and create the order.
Legacy API. This page documents the v0 signed-transaction flow under the /v0/ base path. New integrations should use the current API. See Buy with Signed Transaction (v2).
The signed-transaction flow lets you buy Energy by paying TRX directly from your own wallet — no API key required, since the TRX transfer is signed with your private key. There are three steps:
Estimate TRX — calculate the TRX needed for the desired amount and rental duration.
Get a signed transaction — sign a TRX transfer to the TronSave fund address, either yourself or via the API.
Create an order — submit the signed transaction to place the buy order.
Before you start: make sure you have the wallet's private key and that the wallet holds enough TRX to cover the estimated cost.
The mainnet base URL is https://api.tronsave.io. For testing on the TRON Nile testnet, use https://api-dev.tronsave.io. See Environments.
Estimate TRX
POST
https://api.tronsave.io/v0/estimate-trx
https://api-dev.tronsave.io/v0/estimate-trx
Get Signed Transaction
POST
https://api.tronsave.io/v0/signed-tx
https://api-dev.tronsave.io/v0/signed-tx
Create Order
POST
https://api.tronsave.io/v0/buy-energy
https://api-dev.tronsave.io/v0/buy-energy
Step 1: Estimate TRX
Calculate the TRX needed for a given resource amount and rental duration. The response gives you the unit_price and the estimate_trx you must transfer in Step 2.
POST https://api.tronsave.io/v0/estimate-trx
Rate limit: 15 requests per 1 second.
Headers
Content-Type
application/json
Yes
Request params
amount
body
number
true
The number of resources
buy_energy_type
body
string, number
true
"FAST", "MEDIUM", "SLOW" or number:
-"FAST": If market ready to fill = 100%, FAST = MEDIUM. If the market ready to fill < 100%, FAST = MEDIUM + 10. If market ready to fill = 0%, FAST = SLOW + 20.
-"MEDIUM": The lowest price for the maximum market fill for this order. If market ready to fill = 0%, MEDIUM = SLOW + 10.
-"SLOW": The lowest price that can be set for this order.
-If the price is a number, the price unit is equal to SUN
duration_millisec
body
number
true
The duration of the bought resource, time unit is equal to millisecond.
request_address
body
string
false
The address of requester.
target_address
body
string
false
The address of receiver resource.
is_partial
body
boolean
false
Allow the order to be filled partially or not.
Request body example
Responses
unit_price
number
true
price in SUN of energy that fit with your buy_energy_type
duration_millisec
number
true
available_energy
number
true
total amount available energy on TronSave market that match with unit_price
estimate_trx
number
true
estimate total trx value will pay for buy all available_energy with price is unit_price in duration_millisec
Success
The estimate_trx value is returned in SUN (1 TRX = 1,000,000 SUN).
Error
This endpoint does not require an apikey header — the signed-transaction flow authenticates through the wallet-signed TRX transfer, so no authentication error applies here. A request with a missing or invalid field returns a 400 Bad Request whose message names the offending field:
Step 2: Get a signed transaction
You need a signed TRX transfer of estimate_trx SUN from the buyer's address to the TronSave fund address. You can build it yourself, or let the API do it.
TronSave fund address
This fund address is for testing purposes only on the TRON Nile network.
Option 1: Write your own function
Using tronWeb, build a sendTrx transfer for estimate_trx (from Step 1) and sign it with the buyer's private key:
BUYER_ADDRESSis the buyer's public address.PRIVATE_KEYis the buyer's private key.TRONSAVE_FUND_ADDRESSis the TronSave fund address shown above.
Option 2: Use the Get Signed Transaction API
POST https://api.tronsave.io/v0/signed-tx
Rate limit: 15 requests per 1 second.
Headers
Content-Type
application/json
Yes
Request params
address
body
string
true
The buyer's public address
private_key
body
string
true
The buyer's private key
estimate_trx
body
number
true
The amount of TRX to be paid is calculated in SUN. (estimate_trx from Step 1)
Request body example
Responses
Success
Error
No apikey header is required for this endpoint. A request with a missing or invalid field returns a 400 Bad Request whose message names the offending field:
Step 3: Create an order
Submit the signed transaction (from Step 2) together with the order parameters to place the Energy purchase.
POST https://api.tronsave.io/v0/buy-energy
Rate limit: 15 requests per 1 second.
Headers
Content-Type
application/json
Yes
This endpoint authenticates through the signed_tx you submit — the TRX payment is signed by your own wallet — so an apikey header is not required.
Request params
resource_type
string
true
"ENERGY"
unit_price
number
true
Price unit is equal to SUN.
allow_partial_fill
boolean
true
Allow the order to be filled partially or not
target_address
string
true
Resource receiving address
duration_millisec
number
true
The duration of the bought resource, time unit is equal to millisec.
tx_id
string
true
Transaction ID
signed_tx
SignedTransaction
true
Signed transaction, note that it is a JSON object (the signed_tx from Step 2)
only_create_when_fulfilled
Boolean
false
[true] => order only create when it can be fulfilled
[false] => order will create even it can not be fulfilled
Default value: false
max_price_accepted
Number
false
Only create order when the estimate price less than this value.
add_order_incomplete
Boolean
false
[true] => order only create when there has no same parameters order is not complete in order list
[false] => order will create even there has no same parameters order is not complete in order list
Default value: false
Request body example
Responses
Success
The message value is the order_id of the created order.
Error
This endpoint authenticates through the submitted signed_tx, so no apikey header and no authentication error apply. A request with a missing or invalid field returns a 400 Bad Request whose message names the offending field:
Request examples
The examples below show the full flow: estimate, sign the TRX transfer to the fund address, then create the order. Replace YOUR_TRON_ADDRESS, the private key, and the fund address as needed. Signing the TRX transfer (Step 2, Option 1) typically uses a TRON library; the cURL example uses the API (Step 2, Option 2) instead.
Next steps
Migrate to the current API: Buy with Signed Transaction (v2).
Glossary for Energy, Bandwidth, TRX, and SUN definitions.
Last updated