Home / Developers

Developer guide

Run your own ARKTHRO network in a few minutes, send transactions from the command line, and read the chain over HTTP.

Quick start

You need Node.js 20 or newer. The node has no other dependencies.

i
The code is open source (Apache-2.0) at github.com/ryanpaulpillas/arkthro-chain. Clone it, then run the commands below inside the arkthro-chain folder.
1. Create a local network with 4 validators
npm run devnet:init
2. Start all 4 nodes (ports 26601–26604)
npm run devnet
3. Optional: generate demo payments between test wallets
npm run demo

Then open http://127.0.0.1:26601/ for the explorer. To start over with a fresh chain, stop the nodes and delete the devnet folder.

Command-line wallet

Every command talks to http://127.0.0.1:26601 unless you pass --rpc <url>.

CommandWhat it does
keygen --out <file> [--type ml-dsa-87|ml-dsa-65|slh-dsa-256s|slh-dsa-128s|ed25519]Creates a new wallet key file and prints its address. Post-quantum ML-DSA-87 by default; slh-dsa-256s for vaults. slh-dsa-128s is hash-based post-quantum (FIPS 205), for savings and cold storage. Refuses to overwrite an existing file.
address --key <file>Prints the address of a key file.
faucet <address>Requests 100 test ARKTH (once per address per minute).
balance <address>Shows the balance and how many payments the address has sent.
send --key <file> --to <address> --amount <n>Signs and sends a transfer. Optional --fee and --memo.
pq-commit --key <old> --new-key <new>Locks in the post-quantum key an account will migrate to. Only a hash is published. Do it before the sunset height.
migrate --key <old> --new-key <new>Moves a whole account to a different post-quantum key (from Ed25519, or rotating between post-quantum types), signed by both; the old key is locked.
statusShows the network's status as JSON.
node --config <file>Runs a node (see Run a node).
Example session
node src/cli.js keygen --out alice.json
node src/cli.js faucet cyd6d31527a963ed81c29ca6a9ae2c99f3151240a0
node src/cli.js send --key alice.json --to cy215c8813ef511a64ade1cd46d2d5dd0a54c7cb90 \
  --amount 25.5 --memo "first transfer"
node src/cli.js balance cyd6d31527a963ed81c29ca6a9ae2c99f3151240a0
!
A key file contains your private key. Anyone with the file controls the funds, so never share it or commit it to a repository.

HTTP API

Every node serves a JSON API. Amounts are strings in the smallest unit (1 ARKTH = 1018). Responses include access-control-allow-origin: *, so web pages can call it directly.

RequestReturns
GET /statusNetwork ID, height, validators, supply, consensus step, peers.
GET /genesisThe genesis settings: coin, block time, fees, validators, initial balances.
GET /blocks?limit=10Summaries of the latest blocks (max 100).
GET /blocks/{height} · /blocks/latestA full block with its transactions and commit certificate.
GET /txs?limit=10The latest confirmed transactions.
GET /txs/{hash}One transaction, pending or confirmed.
GET /accounts/{address}Balance, nonce, next nonce to use, transaction count.
GET /accounts/{address}/txs?limit=25The address's transaction history, newest first.
POST /txsSubmits a signed transaction. Returns {"hash": "…"}.
POST /faucetBody {"address": "ar…"}. Testnet only.
GET /accounts/{address}
curl http://127.0.0.1:26601/accounts/cyb60f279e56e7eae91338b7772d12b9c4fb9d4b40

{
  "address": "cyb60f279e56e7eae91338b7772d12b9c4fb9d4b40",
  "balance": "185136700000000000000",
  "balanceFormatted": "185.1367 ARKTH",
  "nonce": 2333,
  "pendingNonce": 2333,
  "txCount": 4635,
  "validator": false
}
GET /status (shortened)
{
  "chainId": "arkthro-devnet-1",
  "coin": { "name": "ARKTHRO", "symbol": "ARKTHRO", "decimals": 18 },
  "height": 7374,
  "quorum": 3,
  "supply": "500000000 ARKTH",
  "maxSupply": "500000000 ARKTH",
  "txCount": 9502,
  "consensus": { "height": 7375, "round": 0, "step": "wait", "lockedRound": -1 }
}

Transaction format

The signature covers every other field, serialized as JSON with keys sorted alphabetically and no spaces.

{
  "type": "transfer",
  "chainId": "arkthro-devnet-1",
  "from": "<sender public key, 64 hex characters>",
  "to": "cy215c8813ef511a64ade1cd46d2d5dd0a54c7cb90",
  "amount": "25500000000000000000",
  "fee": "100000000000000",
  "nonce": 0,
  "memo": "first transfer",
  "signature": "<signature by the sender's key, in hex>"
}

Keys are strings: Ed25519 public keys are 64 hex characters; post-quantum keys carry a label, e.g. mldsa87: or slhdsa256s:, followed by the key in hex. Addresses are ar + 64 hex characters. A migration looks like this:

{
  "type": "migrate",
  "chainId": "arkthro-devnet-1",
  "from": "<old Ed25519 public key>",
  "to": "mldsa87:<new ML-DSA-87 public key>",
  "fee": "100000000000000",
  "nonce": 0,
  "signature": "<signed by the old key>",
  "pqSignature": "<same bytes, signed by the new key>"
}
  • nonce must equal the sender's current nonce (use pendingNonce from GET /accounts).
  • fee must be at least the network minimum (minFee in /genesis).
  • Unknown fields are rejected.

Signing in code

The node's own modules can build and sign transactions for you:

import { createTransfer } from './src/tx.js';
import { parseAmount } from './src/coin.js';

const tx = createTransfer({
  chainId: 'arkthro-devnet-1',
  privateKey: wallet.privateKey,          // from your key file
  to: 'cy215c8813ef511a64ade1cd46d2d5dd0a54c7cb90',
  amount: parseAmount('25.5', 18),
  fee: 100000000000000n,                  // 0.0001 ARKTH
  nonce: account.pendingNonce,            // from GET /accounts/{address}
});

await fetch('http://127.0.0.1:26601/txs', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify(tx),
});

Run a node

A node is configured with a small JSON file. Leave out validatorKey to run a full node that follows the chain without voting.

node-1.json
{
  "genesis": "genesis.json",
  "dataDir": "data/node-1",
  "host": "127.0.0.1",
  "port": 26601,
  "peers": ["http://127.0.0.1:26602", "http://127.0.0.1:26603", "http://127.0.0.1:26604"],
  "validatorKey": "keys/validator-1.json",
  "faucetKey": "keys/faucet.json",
  "faucetAmount": "100"
}
node src/cli.js node --config devnet/node-1.json
i
Becoming a validator on a shared network isn't open yet: today the validator list is fixed in the genesis file. Staking-based validator changes are on the roadmap.

Tests

npm test

33 automated tests cover transfers, post-quantum keys (ML-DSA-87/65, SLH-DSA-256s/128s), key rotation, algorithm retirement, block size limits, migration and migration commitments (including an attacker holding a stolen old key), replay and overspend protection, spam limits, the supply cap, forged and under-signed blocks, restart from disk, and consensus with an offline validator, two offline validators, 20% message loss, and a proposer that sends different blocks to different validators.