Wallet API

Live integration reference for QP wallet operations, DEX quote/execute, shard-gated transfers, and amount precision rules.

Precision & Amount Rules

  • QP precision: decimals = 8 (1 QP = 100,000,000 atoms).
  • Chain storage: balances are persisted in atomic units.
  • Wallet/DEX lot flow: quantity input is whole-token only by policy (fractional lot qty rejected).
  • USDT precision: micro-units (1 USDT = 1,000,000 micros).

Use integer arithmetic for quantities and base units for accounting. Avoid float math for ledger writes.

Core Endpoints (Live Node)

  • GET /balance/{address} → returns balance, balance_atoms, decimals.
  • GET /usdt/balance?address=... → USDT balance in display units.
  • POST /submitTransaction → shard-gated QP transfer.
  • GET /dex/quote?side=BUY|SELL&token=QP&qty=... → market quote (whole qty).
  • POST /dex/execute → executes signed BUY/SELL (whole qty, nonce-protected).
  • GET /dex/lastPrice, GET /dex/trades, GET /dex/state → market and analytics.

Canonical Signing

DEX signatures must hash the exact canonical message below using integer quantity:

DEX|SIDE|TOKEN|QTY|NONCE|ADDRESS

On-chain transfer signatures hash:

from|to|amount|nonce|data

`amount` is currently whole-token in wallet send flow; chain still stores resulting balances in 8-decimal atomic units.

Submit Transaction Example

curl -X POST https://qqp.io:8080/submitTransaction \
  -H "Content-Type: application/json" \
  -d '{
        "transaction": {
          "From": "<sender_pubhex>",
          "To": "<recipient_pubhex>",
          "Amount": 1250,
          "Nonce": 1760000000000,
          "Data": "memo",
          "Signature": "<ed25519_sig_hex>"
        },
        "shard": "<32_hex_shard_part_for_this_node>"
      }'

DEX Quote/Execute Notes

  • Lot model: first 5,000 QP lot, then 1,000-QP lots.
  • Step logic currently uses a constant +0.05% per lot.
  • DEX qty must be whole-token. Sending fractional qty returns validation error.
  • Swaps use swap fee only; transfers use gas only. Both settle in USDT.