Qwai Get the wallet

Build on Qwai.

READ

A plain JSON API.

Every node answers over HTTPS. No key, no sign-up. Any website may call it.

API reference

GET https://rpc.qwai.io/api/status
GET https://rpc.qwai.io/api/account/<address>
GET https://rpc.qwai.io/api/tx/<id>
GET https://rpc.qwai.io/api/dex/tokens

POST https://rpc.qwai.io/api/query
{ "contract": "<address>", "input": "<hex>" }
SIGN

The wallet is already there.

Qwail gives every page window.qwail. Your site asks; the user approves; the wallet signs and sends. Your code never touches a key.

const { address } = await window.qwail.connect();

const result = await window.qwail.signAndSend({
  kind: 'call',
  contract: '<address>',
  input: '<hex>',
  value: '1.5',
});
// { id, ok, output, created }
CONTRACTS

Rust in, RISC-V out.

A contract is an ordinary Rust program compiled for RISC-V. It can store data, hold and send QWAI, emit events, and call other contracts. Every instruction is metered, and a failed call undoes everything it did.

#![no_std]
#![no_main]
use contract_sdk as chain;

fn main() {
    let who = chain::caller();
    let sent = chain::value();
    chain::storage_set(&chain::hash(&who), &sent.to_le_bytes());
    chain::emit(&who);
}

chain::entry!(main);

What contracts get from the chain.

Storage

Keyed values in the chain's state tree, private to each contract.

Coins

Receive QWAI with a call, hold it, send it.

Events

Records any app can read back, filtered by contract or subject.

Calls

Call other contracts, and check exactly which program they run.