Gold Stack REST API
Automate resource purchases from a backend, a bot, or a dApp. Every response uses the same envelope: { "error": false, "message": "Success", "data": … }
Authentication
API key. Deposit USDT into your internal account — it is credited as GoldStack (GS) — and send the key on every request. Costs are deducted from the balance — no per-order on-chain fee.
# every authenticated call apikey: YOUR_API_KEY
Signed transaction. Fully self-custody: sign a TRX transfer yourself and submit it with the order. No API key needed.
Conventions
| Base URL | https://www.gulfbullionstack.tech/v2 |
| Balance unit | GS (1 GS = 1,000,000 minor) |
| Energy price unit | SUN (TRON's own) |
| Price unit | SUN per resource unit |
| Quoted for | a 3-day rental |
| Rate limit | 15 req/s (sell: 3) |
| Interactive spec | /openapi-docs |
Quick start — buy Energy
# 1. What will it cost? curl -X POST https://www.gulfbullionstack.tech/v2/estimate-buy-resource \ -H 'Content-Type: application/json' \ -d '{"resourceAmount": 131000, "durationSec": 3600, "unitPrice": "MEDIUM"}' # -> {"data": {"unitPrice": 36, "estimateCost": 4716000, "availableResource": 131000}} # 2. Place the order curl -X POST https://www.gulfbullionstack.tech/v2/buy-resource \ -H 'apikey: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "receiver": "TYOUR_TRON_ADDRESS_HERE", "resourceAmount": 131000, "durationSec": 3600, "unitPrice": "MEDIUM", "orderType": "NORMAL", "options": {"allowPartialFill": true} }' # 3. Check on it curl https://www.gulfbullionstack.tech/v2/order/<orderId> -H 'apikey: YOUR_API_KEY'
Endpoints
| Endpoint | Purpose | Auth |
|---|---|---|
| GET/v2/user-info | Balance, deposit address and memo | key |
| GET/v2/ledger | Every balance movement | key |
| POST/v2/estimate-buy-resource | Price an order before placing it | — |
| POST/v2/buy-resource | Create an order | key / signed |
| GET/v2/order/{id} | Order status and delegations | key |
| GET/v2/orders | Order history | key |
| POST/v2/cancel-order/{id} | Cancel and refund the remainder | key |
| POST/v2/extend-order | Extend a rental back to back | key |
| POST/v2/advise | Smart Sizing — what this address actually needs | — |
| GET/v2/price-radar | Is now a cheap moment to buy? | — |
| GET/v2/order-book | Live supply and pricing | — |
| GET/v2/market-stats | Platform-wide numbers | — |
| GET/v2/price-history | Order-book samples over time | — |
| POST/v2/claim-deposit | Credit a deposit by txid | key |
| POST/v2/stake | Freeze TRX into your pool | key |
| POST/v2/sell-resource | Configure your selling pool | key |
| POST/v2/unstake/{id} | Begin the unbonding period | key |
| POST/v2/early-unstake/{id} | Sell a stake at a discount, instantly | key |
| GET/v2/autobuy | List Auto Buy rules | key |
| POST/v2/autobuy | Create or update a rule | key |
| DEL/v2/autobuy/{id} | Delete a rule | key |
| GET/v2/autopilot | Pool Autopilot state and earnings | key |
| POST/v2/autopilot | Let the platform re-price your pool | key |
| GET/v2/webhooks | Endpoints and recent deliveries | key |
| POST/v2/webhooks | Register an endpoint (secret shown once) | key |
| DEL/v2/webhooks/{id} | Remove an endpoint | key |
Price tiers
| SLOW | Cheapest level on the book. May fill slowly, or only in part. |
| MEDIUM | Default. The clearing price for your full amount. |
| FAST | Biased to fill now: MEDIUM when the book covers you, +10 SUN on a partial book, SLOW +20 on an empty one. |
| 80 | Any number is a fixed price in SUN — full control. |
Order options
| allowPartialFill | Accept less than the full amount. |
| onlyCreateWhenFulfilled | Create only on a 100% instant fill. |
| maxPriceAccepted | Reject above this SUN price. |
| minResourceDelegateRequiredAmount | Minimum size from any single provider. |
| preventDuplicateIncompleteOrders | Skip if an identical order is still open. |
Self-custody purchase (signed transaction)
Estimate the cost, sign a TRX transfer of that amount to the platform wallet, then submit the signed transaction with the order. Nothing is held on your behalf.
const est = await post('/v2/estimate-buy-resource', { resourceAmount: 131000, durationSec: 3600, unitPrice: 'MEDIUM', }); // Sign a transfer of est.data.estimateCost SUN to the platform wallet const tx = await tronWeb.transactionBuilder.sendTrx( 'TPKWueqW3PYtRQywp8SuZbnuLJJ8Auq4Hy', est.data.estimateCost, myAddress, ); const signedTx = await tronWeb.trx.sign(tx); await post('/v2/buy-resource', { receiver: myAddress, resourceAmount: 131000, durationSec: 3600, unitPrice: est.data.unitPrice, signedTx, });
Safe retries
A request that times out leaves you guessing whether the order was placed. Send an Idempotency-Key and a retry returns the original result instead of buying twice. Reusing a key with a different body is rejected with 409, so a key collision can never silently overwrite an order.
# Both calls return the same orderId; only one order exists. curl -X POST https://www.gulfbullionstack.tech/v2/buy-resource -H 'apikey: YOUR_API_KEY' -H 'Idempotency-Key: order-2026-09-08-0001' -H 'Content-Type: application/json' -d '{"receiver":"TR7...","resourceAmount":131000,"durationSec":3600}'
Webhooks
Register an endpoint and stop polling. Events: order.created, order.filled, order.partially_filled, order.cancelled, order.expired, deposit.credited, pool.repriced. Events are queued in the same database transaction as the change they describe, so you never hear about something that was rolled back. Failures retry with exponential backoff over roughly six hours.
Every request is signed. Verify it before trusting the body:
# Header: X-GoldStack-Signature: t=<unix>,v1=<hex> import hmac, hashlib, time def verify(secret, body, header, tolerance=300): parts = dict(p.split('=', 1) for p in header.split(',')) if abs(time.time() - int(parts['t'])) > tolerance: return False # too old: someone is replaying it expected = hmac.new( secret.encode(), f"{parts['t']}.{body}".encode(), hashlib.sha256 ).hexdigest() return hmac.compare_digest(expected, parts['v1'])
Compare the signature over the raw request body, before any JSON parsing — re-serialising changes the bytes and the digest will not match.
Error codes
| HTTP | Code | Meaning |
|---|---|---|
| 400 | INVALID_PARAMS | A field failed validation. |
| 400 | INTERNAL_BALANCE_ACCOUNT_TOO_LOW | Not enough balance for this order. |
| 400 | CANNOT_FULFILLED | The book cannot fill it. Allow a partial fill or rest a PENDING order. |
| 400 | PRICE_EXCEED_MAX_PRICE_REQUIRED | Price is above your maxPriceAccepted. |
| 400 | MUST_BE_WAIT_PREVIOUS_ORDER_FILLED | An identical order is still incomplete. |
| 400 | TXID_ALREADY_USED | That deposit was already credited. |
| 409 | IDEMPOTENCY_KEY_REUSED | That key was already used with a different body. |
| 401 | API_KEY_REQUIRED | No apikey header was sent. |
| 401 | INVALID_API_KEY | The key is wrong or was rotated. |
| 429 | RATE_LIMIT | Back off exponentially and retry. |