CPU Payer (WAX only)
Free CPU for transactions with Alcor contracts on WAX.
On WAX, Alcor pays the CPU of transactions that interact with its contracts. The transaction starts with a
liquid.alcor::noop action authorized by liquid.alcor@bw; with ONLY_BILL_FIRST_AUTHORIZER, the chain bills the CPU
to that first authorizer instead of the user. The service only cosigns: the user still signs the transaction, and the
client pushes it.
The service runs on WAX only. Both endpoints take POST and allow any origin.
How it works
- Call Status to see whether the service is signing.
- Build the transaction with
liquid.alcor::noopas the first action, authorized byliquid.alcor@bw, followed by the user's actions. - The user signs the transaction.
- Send the serialized transaction to Cosign. The service checks it and returns its signature.
- Push the transaction with both signatures. The CPU is billed to
liquid.alcor.
Status
Whether the service is up and signing, and how much of its CPU is used.
POST https://wax.alcor.exchange/api/v2/cpu/status
Example
curl -X POST https://wax.alcor.exchange/api/v2/cpu/status{
"available": true,
"signing": true,
"throttled": false,
"cpu": {
"used": 2988810,
"max": "13859878911",
"percent": 0.0215
},
"lastCheck": 1792068283798
}Response fields
| Name | Type | Description |
|---|---|---|
| available | boolean | Whether the service answers |
| signing | boolean | false while throttled |
| throttled | boolean | CPU usage is above 70%: rate limits are halved |
| cpu.used | number | CPU used by liquid.alcor, microseconds |
| cpu.max | string | CPU available to liquid.alcor, microseconds |
| cpu.percent | number | CPU used, percent |
| lastCheck | number | Time of the last CPU check, unix milliseconds. CPU is checked every 2 minutes |
cpu and lastCheck are null until the first check.
Cosign
Checks a transaction and signs it as liquid.alcor@bw.
POST https://wax.alcor.exchange/api/v2/cpu/cosign
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| serializedTransaction | string | yes | The serialized transaction, hex-encoded |
Example
curl -X POST https://wax.alcor.exchange/api/v2/cpu/cosign \
-H "Content-Type: application/json" \
-d '{"serializedTransaction": "<hex>"}'Answers HTTP 201:
{
"signature": "SIG_K1_..."
}Checks
- The first action is
liquid.alcor::noop, authorized byliquid.alcor@bw. - Every other action is either an action of an allowed contract, or a
transferto one:alcordexmain(spot DEX),swap.alcor(AMM),otc.alcorandalcorotcswap(OTC),liquid.alcor. - The user is the first authorizer of the second action. Rate limits count per user account and per IP.
A transaction that fails a check, or goes over a limit, answers HTTP 400 with {"error": "<message>"}, for example:
First action must be noop from payerContract <account> is not allowedTransfer recipient <account> is not allowedHourly IP limit exceededDaily account limit exceeded
Rate limits
| Limit | Requests |
|---|---|
| Per IP, hourly | 500 |
| Per account, hourly | 300 |
| Per IP, daily | 5000 |
| Per account, daily | 2000 |
| All users, hourly | 10000 |
| All users, daily | 80000 |
While throttled (CPU usage above 70%), every limit except the global daily one is halved.