> For the complete documentation index, see [llms.txt](https://docs.luganodes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luganodes.com/tron-energy/energy-rental-api/rental-lifecycle.md).

# Rental lifecycle

The 10-second window, the queue, statuses and how every rental ends.

A rental delegates energy to the [receiver](https://docs.luganodes.com/tron-energy/glossary.md) for one transaction. For the calls in order, follow the [Quickstart](https://docs.luganodes.com/tron-energy/energy-rental-api/quickstart.md).

## The 10-second window

Each rental gives the receiver energy for a fixed 10 seconds, starting from the moment our delegation is confirmed on chain. `starts_at` and `expires_at` in the response show the exact window. Sign the transaction before you create the rental, and broadcast as soon as the rental is `active` so the transaction lands before `expires_at`. After the window the energy is reclaimed.

If you broadcast after `expires_at`, the transaction has no delegated energy: TRON burns TRX from the sending address for the shortfall, or the transaction fails if the address holds none. Create a new rental and broadcast as soon as it is `active`.

## Queued requests

A `201` means the energy is delegated and the rental is already `active`. The API returns `202` when it accepts a request and the energy cannot be delegated at once. The response carries:

| Field                    | Meaning                                  |
| ------------------------ | ---------------------------------------- |
| `estimated_wait_seconds` | Expected wait before energy is delegated |
| `queue_position`         | Position in the queue                    |
| `serve_by`               | Latest time the rental can be served     |

* Queued rentals are served first in, first out. Energy is delegated automatically when it frees up, with no new call needed.
* Set `max_wait_seconds` on the request to cap the wait. The default is 300 seconds.
* A rental still waiting at `serve_by` ends as `expired`.
* When the estimated wait is longer than `max_wait_seconds`, or no energy is available, the request returns `503 CAPACITY_EXHAUSTED` in place of `202`.
* Both addresses are screened and the transfer is simulated again before delegation.
* Poll [`GET /v1/rentals/{id}`](https://docs.luganodes.com/tron-energy/energy-rental-api/get-a-rental.md) every 2 to 5 seconds. Each poll returns a fresh `estimated_wait_seconds`.

{% hint style="warning" %}
By default TronWeb and most TRON libraries set a transaction to expire 60 seconds after it is built. A transaction signed before a queued rental becomes `active` can expire before you broadcast it. Sign with a longer expiration, or sign again once the rental is `active`.
{% endhint %}

## Rental statuses

| Status      | Meaning                                                                                                      | Final |
| ----------- | ------------------------------------------------------------------------------------------------------------ | ----- |
| `pending`   | Queued (`waiting_for_energy`) or delegation sent and awaiting its block (`confirming`). See `pending_reason` | No    |
| `active`    | Energy is on the receiver until `expires_at`. Broadcast now                                                  | No    |
| `reclaimed` | Window closed and the energy was reclaimed. `energy_used` is final and `reclaim_tx` records the reclaim      | Yes   |
| `failed`    | The delegation or the re-check of a queued rental was unsuccessful. See `failure_reason`                     | Yes   |
| `expired`   | The rental reached `serve_by` while still in the queue                                                       | Yes   |

Every rental ends as `reclaimed`, `failed` or `expired`. Stop polling once a rental reaches one of them.

## One rental per address

Each address can hold one `pending` or `active` rental at a time. While it is in progress, a second request returns `409 ACTIVE_RENTAL_EXISTS` with the existing `rental_id`; once it ends, a new request is a new rental.

## Sizing a rental

In `transaction` mode we simulate each transfer and delegate the energy it needs, plus 5%. Send with a single signature and an empty memo: a multi-signature transaction and a memo each carry a separate 1 TRX fee. [How TRON fees work](https://docs.luganodes.com/tron-energy/how-tron-fees-work.md) gives the energy and bandwidth a USDT transfer needs, [Estimate energy](https://docs.luganodes.com/tron-energy/energy-rental-api/estimate-energy.md) returns live figures for a specific transfer, and [`GET /v1/accounts/{address}`](https://docs.luganodes.com/tron-energy/energy-rental-api/check-an-address.md) shows the free bandwidth an address has left.

Set the transaction's `fee_limit` high enough for the transfer's full energy, even though the energy is delegated. TRON caps the energy a contract call can use at `fee_limit` divided by the energy price, so a lower limit fails with `OUT_OF_ENERGY` ([TRON developer docs](https://developers.tron.network/docs/set-feelimit)). At 100 sun per unit of energy, a USDT transfer needs more than 6.43 TRX to an existing holder and more than 13.03 TRX to a new holder. The Quickstart sets 30 TRX.

## Next steps

* [Create a rental](https://docs.luganodes.com/tron-energy/energy-rental-api/create-a-rental.md): the request, every response and retry behaviour.
* [Get a rental](https://docs.luganodes.com/tron-energy/energy-rental-api/get-a-rental.md): poll the status and read the on-chain record.
