gasrent

Articles

Home / Articles / Why rented energy can arrive short

Why rented energy can arrive short

A TRON delegation does not store energy. It stores sun, the small unit of TRX. The network turns that stake into energy and drops the fraction. An order for 65,000 can arrive as 64,999. A seller that delegates only whole TRX can be short by about one TRX of energy.

What the network stores

The stake on a DelegateResource contract is a whole number of sun. One TRX is 1,000,000 sun. Energy is computed from that stake, the network energy limit, and the network energy weight. java-tron does it in EnergyProcessor.calculateGlobalEnergyLimitV2: it multiplies the stake in TRX by TotalEnergyLimit / TotalEnergyWeight and keeps only the whole number. The dropped fraction is lost.

The same formula is in the TRON resource model and in the protocol notes on resources. A plain walk-through of delegation is How energy delegation works.

One sun short

If the seller rounds the stake down by one sun, the energy is one less than the order. 65,000 becomes 64,999. That is the usual miss from a seller that floors the stake. The gasrent pool rounds the stake up, so a pool fill matches the ordered energy.

A whole TRX short

Some sellers delegate only whole TRX and drop the fraction of a TRX. One TRX is about 10 energy at the current network ratio, so the miss can be up to that many energy. A measured fill has been short by 7. Adding one energy does not cover that seller.

What energy cover does

Turn energy cover on from Account. It applies to every energy order on the account, including orders placed with an API key.

Each order is increased by the energy one TRX produces, rounded up, plus one energy. At a ratio near 10 energy per TRX that addition is 11. The order sent to the seller is the larger amount. The price is the price of that larger amount. The extra energy is charged with it. The order response shows the volume you pay for.

Exact amount still means one size. With cover on, a seller that takes any amount is bought at the amount you entered plus the cover. A seller with fixed sizes stays on the size you entered.

At 4,000,000 energy there is no room to add more. The order stays at the maximum.

If the network ratio cannot be read, a price is not given and the order is not placed. Cover stays on, and the next request uses the ratio when it is available again.

Sellers with fixed sizes

Sellers that are on now take any whole number of energy inside the allowed range. One seller that is off, Tronbid, only sells fixed sizes. Energy cover leaves that seller on the size that was asked. The size is taken as delivered in full, and the price is the price of that size.

Where to turn it on

Open Account and save energy cover. A short note also appears on Buy energy while the setting is on. This article is linked from both places.

Turn it off the same way. New orders then use the amount you enter. An order already placed keeps the volume it was charged for.

More articles