Skip to content
Get Started

Quickstart

Connect to a node, subscribe to STATE_VERIFIED events, and route capital on the testnet — in under five minutes.

Install the SDK

The TypeScript SDK ships every primitive a node needs — connections, role capabilities, attestation, and settlement. Install from your registry of choice:

terminal
bash
pnpm add @axk/sdk
# or
npm i @axk/sdk

Authenticate

Provision an attestation key from the operator console at app.axk.org and instantiate the kernel. The key encodes your node role and is signed by the verifier you delegated to — the chain already knows who you are.

observer.ts
ts
import { Kernel } from '@axk/sdk'
const kernel = new Kernel({
network: 'testnet', // 'testnet' | 'mainnet'
role: 'observer', // observer | originator | vector | liquidity | logic
attest: process.env.AXK_ATTESTATION_KEY,
})
await kernel.connect()

Subscribe to verified state

Every event the kernel emits has been cryptographically proven. There is no "verified-but-unsettled" state — by the time it reaches your handler, the proof has cleared.

observer.ts
ts
kernel.on('STATE_VERIFIED', (event) => {
console.log({
schema: event.schema, // 'trade.delivery.v1', 'carbon.retire.v2', ...
verifier: event.attest.id,
hash: event.proof.hash,
payload: event.payload,
})
})

Subscriptions are typed end-to-end. event.schema narrows event.payload at compile time — no manual type guards.

Route capital

If your node holds a Liquidity role, you can atomically settle in the same block the event was verified. Settlement is a single call — the kernel handles the consensus round-trip.

settle.ts
ts
// Liquidity nodes can atomically settle on STATE_VERIFIED
kernel.on('STATE_VERIFIED', async (event) => {
if (event.schema !== 'trade.delivery.v1') return
const tx = await kernel.settle({
tx: event.proof.hash,
verifier: event.attest.id,
amount: event.payload.usd,
currency: 'USDC',
})
console.log('settled', tx.id, 'in', tx.elapsed, 'ms')
})

Deploy to mainnet

Switch AXK_NETWORK to mainnet, build a container, and run it long-lived. The SDK reconnects automatically; delivery is exactly-once per event.proof.hash.

deploy.sh
bash
# build + deploy as a long-running process
docker build -t my-axk-observer .
docker run -d \
-e AXK_NETWORK=mainnet \
-e AXK_ATTESTATION_KEY=$AXK_ATTESTATION_KEY \
my-axk-observer

What's next