Get Contract Energy Statistics
1. Overview & Typical Use
Returns historical daily energy consumption statistics for a contract, including energy obtained from staking, energy burned via TRX, and energy provided by the contract deployer.
- Typical use: contract energy consumption trend analysis, evaluating contract operating costs, understanding energy source distribution.
- When not to use: to query daily contract analytics (energy, bandwidth, balance, etc.) use “Get Contract Daily Analytics List”.
2. Endpoint & Authentication
GET /api/onecontractenergystatistic
For Base URL and authentication, see Common Network & Authentication.
3. Request
Fields
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
address | string | Yes | — | Contract address (Base58, starts with T) |
start_timestamp | integer | No | — | Start time, millisecond timestamp |
end_timestamp | integer | No | — | End time, millisecond timestamp |
4. Response
Fields
Top-level
| Field | Type | Required | Description | Unit/Precision |
|---|---|---|---|---|
total | integer | Required | Number of data points | — |
totalEnergy | integer | Required | Total historical energy consumption | — |
data | array | Required | Daily energy statistics array | — |
data[] element
| Field | Type | Required | Description | Unit/Precision |
|---|---|---|---|---|
day | integer | Required | Date | millisecond timestamp |
total_energy | integer | Required | Total energy consumed on this day | — |
energy | integer | Required | Energy consumed from staking/freezing | — |
contract_supplied | integer | Required | Energy provided by the contract deployer | — |
trx | integer | Required | Energy consumed via TRX burning | — |
5. Errors
For HTTP status codes, see Common Errors. Key points for this endpoint:
- Address is not a contract: returns
200+data: [],total: 0. - Empty result is not an error: when the contract has no energy consumption records, an empty array is returned as a normal response.
Last updated on: