AlcorDocs

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

  1. Call Status to see whether the service is signing.
  2. Build the transaction with liquid.alcor::noop as the first action, authorized by liquid.alcor@bw, followed by the user's actions.
  3. The user signs the transaction.
  4. Send the serialized transaction to Cosign. The service checks it and returns its signature.
  5. 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

NameTypeDescription
availablebooleanWhether the service answers
signingbooleanfalse while throttled
throttledbooleanCPU usage is above 70%: rate limits are halved
cpu.usednumberCPU used by liquid.alcor, microseconds
cpu.maxstringCPU available to liquid.alcor, microseconds
cpu.percentnumberCPU used, percent
lastChecknumberTime 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

NameTypeRequiredDescription
serializedTransactionstringyesThe 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 by liquid.alcor@bw.
  • Every other action is either an action of an allowed contract, or a transfer to one: alcordexmain (spot DEX), swap.alcor (AMM), otc.alcor and alcorotcswap (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 payer
  • Contract <account> is not allowed
  • Transfer recipient <account> is not allowed
  • Hourly IP limit exceeded
  • Daily account limit exceeded

Rate limits

LimitRequests
Per IP, hourly500
Per account, hourly300
Per IP, daily5000
Per account, daily2000
All users, hourly10000
All users, daily80000

While throttled (CPU usage above 70%), every limit except the global daily one is halved.

On this page