Skip to content

TRON Energy Lease ​

TRON Energy Lease lets users request energy for a receiver address, lock a quote, wait for a provider to fulfill the order, and receive a transaction ID when fulfillment is verified.

Customer API ​

Required scope:

text
tron:lease

Create a Quote ​

bash
curl -X POST https://my-gateway.mlc.workers.dev/v1/apps/tron/quote \
  -H "X-API-Key: sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "receiver": "TAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "energy": 65000,
    "duration_seconds": 3600
  }'

Create a Lease Order ​

bash
curl -X POST https://my-gateway.mlc.workers.dev/v1/apps/tron/lease \
  -H "X-API-Key: sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "receiver": "TAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "energy": 65000,
    "duration_seconds": 3600,
    "quote_id": "quote_xxx",
    "max_cost": 0.05
  }'

Initial response:

json
{
  "status": "pending",
  "order_id": "lease_xxx",
  "message": "Lease order accepted, waiting for provider fulfillment"
}

Query Orders ​

http
GET /v1/apps/tron/leases
GET /v1/apps/tron/leases/:id

Provider API ​

Energy providers use provider-key authentication and a separate route family:

text
/v1/provider/tron/leases/pending
/v1/provider/tron/leases/:id
/v1/provider/tron/leases/:id/accept
/v1/provider/tron/leases/:id/complete
/v1/provider/tron/leases/:id/fail

Providers should accept only orders they can fulfill within the requested duration and capacity.

Verification and Refunds ​

The platform records provider events, transaction IDs, verification payloads, completion timestamps, and refund state. If fulfillment fails or expires, the order can be refunded through the billing ledger.

Dynamic Pricing ​

TRON pricing should account for:

  • Requested energy.
  • Duration.
  • Provider capacity.
  • TRX burn pressure.
  • Current network conditions.
  • The customer's max_cost.

The quote API exists so customers can lock price expectations before creating a lease order.