Introduction

Styx is a way to make private payments on a Zcash-derived chain. Every payment is shielded, and its recipient finds it by a tag instead of scanning the chain. Every payment also carries a commitment to a program that its proof ran, which only the people the payment concerns can recognise.

This book describes Styx as it runs today on the Arctic testnet, from the code, and marks what isn't built yet. It's written first for people building on Styx: wallets, applications and program authors. Operators, the specification and the security model follow.

How to read the status lines

Every page opens with a status line. It says how far the thing the page describes has come:

StatusMeaning
On ArcticBuilt and running on the Arctic testnet.
Built, not deployedIn the code, but not running on Arctic.
PlannedDecided, not built.
UndecidedA design or an open question, with no decision yet.
ExperimentalResearch code, outside what Styx runs, and likely to change.

A page about several things marks each one where it describes it.

The format isn't final

Styx's transaction format is still a proposal, and the code says so. The bytes in this book are the ones Arctic accepts today. A later format may change them, and the book will change with it.

What's published

Binaries of the node, zakurad, and of the arctic command-line tool are published on the download page, with the files a node needs to join Arctic (Getting started). The source code isn't published yet. A page about code you can't build against yet, such as a library's API, says so in its status line.

Where the code lives

Styx is built from two code bases:

  • zakura-common, the libraries: the transaction format, its digests and fee rule, tagged memos, channels and the Zuring execution engine;
  • zakurad, the node, with its RPC, the arctic command-line tool and its wallet.

Each page lists the files it's written from, in a comment at its top.

What Styx is

Status: on Arctic.

Styx is a payment format with rules of its own, on a Zcash-derived chain run by the node zakurad. A Styx payment is shielded under Ironwood's rules. Ironwood is the shielded pool that the NU6.3 upgrade added, built on Orchard's design. A Styx payment differs from an ordinary Ironwood one in three ways.

  • Finding payments. Each output carries a tagged memo instead of Orchard's note ciphertexts. Its recipient asks a node for the tags it expects and opens only what comes back, so there is no trial decryption.
  • Channels. A sender and a recipient share a channel, set up once by a first contact: an ML-KEM-768 ciphertext that travels with the sender's first payment. Every later payment between them takes its tag and key from the channel.
  • Programs. Styx payments are proved with the Zuring execution engine. Next to the proof, a payment carries Δ, a hiding commitment to a program the proof ran. The payment's recipients can recognise the program; nobody else can.

A Styx transaction also splits its bytes in two. The kept bytes are the header, the actions with their memos, and the signatures; they stay on the chain. The witness is Δ and the proof. It comes last, weighs a sixteenth as much in the block limit (Fees and weight), and nodes may delete it once its block is below a checkpoint (Storage modes).

Where Styx sits on the chain

  • A Styx transaction is version 7, with version group 0xD22ED62E and the consensus branch ID 0xfa8c5f76.
  • Styx isn't a network upgrade. Its branch ID is valid from height 0 on every network; a custom testnet or Regtest may set a later height.
  • A Styx transaction carries at most one Zuring bundle, which shares Ironwood's note commitment tree, nullifiers and value pool. It may also carry transparent inputs and outputs, in v5's encoding.
  • The chain still accepts standard transactions, versions 1 to 6, under their own branch IDs. A coinbase transaction is never a Styx transaction.

The Arctic testnet

Status: on Arctic.

Arctic is the testnet that runs Styx. It's a configured Testnet with a genesis block of its own, and one operator produces its blocks. Its coins have no value.

  • Blocks. Proof of work is disabled. The operator signs and produces a block every 25 seconds, and every node rejects a block without the operator's signature. Fork choice is unchanged.
  • Upgrades. Every network upgrade from Overwinter through NU7 is active from height 1, and Styx from height 0.
  • Genesis. Arctic's genesis block was made for it, at 2026-11-24 15:31:45 UTC. Its hash is 0fafd46b890f69cfc38cea6972a3902bc65f37634d3eeaa748c197333f3cd9a6, and the network's magic bytes spell STYX.
  • Block times. From height 2, a block's time may be at most 90 minutes past the median of the previous 11 blocks' times.
  • Coinbases pay the operator, and mature after 100 blocks.
  • Verifying. Anyone can run a node that syncs from the operator and checks every block and transaction itself (zakurad on Arctic).
  • A faucet pays test coins to an address. To a Styx address it pays through a first contact, which opens a channel (Running a faucet).
  • An explorer shows Styx bundles: their tags, their first contacts, and whether a transaction's witness has been pruned (The explorer).

What it means for builders

  • Only the operator can extend the chain. A verifying node checks every rule; the one thing it takes on trust is that the operator's key is the one allowed to produce blocks.
  • Arctic may be relaunched, and has been once, to give it its own genesis. Treat its history as disposable.
  • Addresses on Arctic use Testnet encodings.

Getting started

Status: on Arctic. Binaries only: the source code isn't published yet.

Arctic's binaries come from its download page, as one archive per platform with a SHA256SUMS file:

ArchiveHolds
Linux, x86-64zakurad and arctic
macOS, Apple Siliconzakurad and arctic

zakurad is the Styx node. arctic is the command-line wallet, with a faucet and a load tester. Each archive also holds verifier.toml, a node configuration with Arctic's network table, Arctic's genesis.hex and checkpoints.txt, and the licenses.

Install

Check the archive you downloaded, unpack it, and put the two binaries on your PATH:

sha256sum --check --ignore-missing SHA256SUMS
tar xzf <archive>

The Linux binaries need x86-64 and glibc 2.31 or later. The macOS binaries need Apple Silicon and macOS 11.7 or later.

On macOS, check with shasum -a 256 --check --ignore-missing SHA256SUMS. The binaries aren't notarized, so if macOS won't run them, remove the quarantine flag your browser set: xattr -d com.apple.quarantine zakurad arctic.

zakurad --version prints 1.8.4, the version of the Zakura node it's built on.

Make a wallet

Point arctic at Arctic's public RPC, whose URL is on the download page, and make a wallet:

export ARCTIC_RPC=<public-rpc-url>
arctic wallet init --wallet alice.json

init prints the wallet's first address. Ask the faucet for test coins by posting that address to it, at the URL the download page gives:

curl --data '<address>' <faucet-url>/drip

The faucet pays through a first contact, which opens a channel to the address. Once the payment is in a block, a sync finds it:

arctic wallet sync --wallet alice.json
arctic wallet balance --wallet alice.json

The wallet covers sending, backups and restoring.

Run a verifier

A verifier checks every block and transaction itself, so its wallets don't have to trust the public RPC:

  1. Put genesis.hex and checkpoints.txt somewhere permanent, and write their absolute paths in verifier.toml, at genesis_block and checkpoints.

  2. Write the operator's P2P address, from the download page, in initial_testnet_peers.

  3. Start the node:

    zakurad -c verifier.toml start
    

Its RPC listener is on the same machine, on port 18332, and wants the node's cookie. So give arctic the listener's local URL with --rpc, and the cookie file with --rpc-cookie (zakurad on Arctic).

What's built and what's planned

Status: as of this book's last update. The format isn't final.

FeatureStatusPage
Styx transactions: version 7, their own branch ID from height 0On ArcticWhat Styx is
Tagged memos, found by tagOn ArcticTagged memos
Channels opened by ML-KEM-768 first contactsOn ArcticChannels
Bucketed first-contact tagsOn ArcticFirst contacts and buckets
Weight, and the fee rule with its byte termOn ArcticFees and weight
Wallet-state backupsOn ArcticA payment, end to end
The lookup RPCsOn ArcticThe lookup RPCs
The arctic wallet, with the no-op programOn ArcticThe wallet
Zuring proofs, with Δ in every paymentOn ArcticPrograms
Storage modes and checkpoint pruning (nothing is pruned yet: the checkpoint list holds only the genesis block)On ArcticStorage modes
The faucet and the explorerOn ArcticRunning a faucet, The explorer
Recognising programs in wallet syncPlannedRecognising a program
Stygian, a language for Zuring programsBuilt, not deployedStygian
One shape for every paymentPlannedA payment, end to end
Private retrieval of lookupsPlannedThe lookup RPCs
Pruned nodes serving each otherPlannedStorage modes
ContractsUndecidedContracts
Which KEM channels keep, and a post-quantum StyxUndecidedWhat's post-quantum
A language, an assembler, a sumcheck prover, program keys and certificatesExperimentalExperimental tools

A payment, end to end

Status: on Arctic. One shape for every payment is planned.

A Styx payment is a version 7 transaction whose Zuring bundle spends notes and creates new ones. This page follows one from the sender's wallet to the recipient's.

The sender builds it

  1. Actions. The wallet picks the notes to spend and the outputs to create. Each action spends one note and creates one. A bundle has at least 2 actions, because a lone action would show a spend without an output, or the reverse; it has at most 64. Unused halves are dummies.
  2. Channels. For each output, the wallet takes the next payment number on its channel to the recipient. If it has no channel to that recipient yet, the payment opens one with a first contact.
  3. Memos. Each action gets a tagged memo: the channel's tag for that payment, then the note's plaintext, sealed under that payment's key.
  4. The proof. The Zuring proof shows that the bundle's actions follow Ironwood's rules, and runs the bundle's program in every action. Δ, the commitment to that program, goes next to the proof (Programs).
  5. Signatures. The wallet signs, and every signature covers Δ.
  6. The fee pays for the actions and the bytes (Fees and weight).

What it looks like on the chain

PartBytes
Header: version, version group, branch ID, lock time, expiry height20kept
Transaction type: 0, a payment1kept
Transparent inputs and outputs2 when there are nonekept
Number of Zuring bundles: 0 or 11kept
The bundle: its proof system and layout, the actions (265 bytes each), the first contacts (1,090 bytes each), flags, value balance, anchor, a 64-byte signature per action and a binding signature767 with 2 actions and no first contactskept
Backups1 when there are none; 1,057 or more eachkept
Δ768witness
The proof2,848, plus 2,528 per actionwitness

The witness comes last, so a parser can tell kept bytes from witness bytes without understanding either.

Three common payments, with two actions each:

PaymentKept bytesWitness bytesWeightFee, in zatoshis
On an open channel7928,67221,34410,000
Opening a channel: one first contact1,8828,67238,78420,000
Opening a channel, with a backup2,9398,67255,69625,000

The recipient finds it

The recipient knows its channels, so it knows the tags its next payments will carry. It asks a node for those tags, opens the memos that come back, and checks each note against its commitment on the chain. A new sender reaches it through a first contact, which it finds by looking up its address's bucket (First contacts and buckets).

Backups

A payment may carry a backup of the sender's wallet state, under a tag and a key from the wallet's self channel. Only the wallet's spending key can derive them. A wallet restored from its seed finds its backups by tag, and rebuilds its channels from them.

One shape for every payment (planned)

Today a first contact or a backup makes a payment heavier, and so tells it apart from one on an open channel. A planned format gives every payment one shape: two actions, a first-contact slot in every payment, the sender's record in the change memo in place of backups, and one fee. It isn't built.

Fees and weight

Status: on Arctic. A flat fee for every payment is planned.

Weight

A block is bounded by its weight, not its size. A kept byte weighs 16 and a witness byte weighs 1, and a block weighs at most 32,000,000. So a block keeps at most 2 MB, however much witness it carries, and its raw size is at most 32 MB. Only Styx transactions have witness bytes. Any other transaction weighs 16 times its size, so for blocks without Styx the weight limit is the old size limit.

A transaction's virtual size, vsize, is its weight divided by 16, rounded up. Fees and node policy count vsize, so a witness byte costs a sixteenth of a kept byte.

The fee

A Styx transaction pays

\[ \text{fee} = \text{5,000} \times \max\left(2,\ \text{logical actions},\ \left\lceil \frac{\text{vsize}}{700} \right\rceil\right) \text{ zatoshis}, \]

where the logical actions are ZIP 317's, counted on the transparent parts, plus the Zuring bundle's actions. It's ZIP 317's rule with a byte term, so first contacts and backups pay for their bytes. A node's mempool refuses a Styx transaction that pays less.

For the three common payments:

PaymentvsizeUnitsFee, in zatoshis
On an open channel1,334210,000
Opening a channel2,424420,000
Opening a channel, with a backup3,481525,000

A payment on an open channel pays for its two actions. A first contact's 1,090 kept bytes push the byte term past the action count.

A flat fee (planned)

With one shape for every payment, every payment would weigh the same and pay one fee, all of it checked by consensus. It isn't built.

Tagged memos

Status: on Arctic. Private retrieval is planned.

Every action of a Styx bundle, dummies included, carries a tagged memo of 137 bytes, in place of Orchard's note ciphertexts:

PartBytes
Tag16
The plaintext, sealed: lead (1), value (8), rseed (32), psi (32), delta_seed (32)105, plus a 16-byte authentication tag
  • The tag is what the recipient looks up. For the ith payment on a channel, it's the channel's tag for i, which is random to anyone who doesn't know the channel (Channels).
  • The plaintext is sealed with ChaCha20-Poly1305 under the key of payment i. The key also binds the note's commitment, so no two notes share a key.
  • delta_seed gives a recipient the seed of Δ's blinds, so it can recognise the payment's program (Recognising a program). A sender with nothing to share fills it with random bytes.
  • A dummy's memo is a random tag and random bytes. Only a recipient can tell a real memo from a dummy's.

No trial decryption

An Orchard wallet tries to decrypt every output on the chain. A Styx wallet derives the tags its payments will carry, and asks a node for them (The lookup RPCs). For each match the node returns a record of 193 bytes: the note's commitment, its action's nullifier, the sealed plaintext, and the note's position in the note commitment tree. The wallet opens the plaintext, recomputes the note's commitment from it and its own address, and rejects any mismatch.

Records are grouped in epochs of 10,000 blocks, about 69 hours. Once an epoch is final, its records never change.

What a node learns

Today a wallet asks for its tags in the clear, so the node that serves it learns which tags it asks for, and so which payments it finds. Private information retrieval would hide that. The fixed-size records and final epochs are there for it, but it isn't built.

Addresses

Status: on Arctic.

A Styx address is a Unified Address (ZIP 316) with two receivers:

  • an Orchard receiver, as in any Unified Address;
  • a channel receiver, at typecode 0xFFFA. It holds the recipient's ML-KEM-768 encapsulation key, 1,184 bytes, then one more byte for the width of its first-contact bucket when that's under 128 bits (First contacts and buckets).

0xFFFA is in the range ZIP 316 reserves for experiments, so a wallet that doesn't know it keeps the channel receiver as an unknown receiver. Addresses on Arctic use Testnet encodings.

Paying a Styx address

A payment to an address with a channel receiver must be a Styx transaction. Its recipient looks for its payments by tag, so a note paid to its Orchard receiver in a version 6 transaction is never found.

Where the keys come from

Each address has its own channel key pair, derived from the account's Orchard spending key sk and the address's index. The seed of ML-KEM-768's key generation (FIPS 203) is

d ‖ z = BLAKE2b-512("Styx_ChanKeyGen_", sk ‖ index),

with the index a 32-bit little-endian integer. A viewing key can't derive it. Viewing keys can be recovered from an address by anyone able to compute discrete logarithms; the spending key can't be, so the channel keys stay out of their reach. Only a wallet holding the spending key can add a channel receiver to an address.

Channels

Status: on Arctic.

A channel is a 32-byte secret K that a sender and a recipient share. A first contact sets it up once. Every later payment between them uses it, and no payment does its own key agreement.

Opening a channel

The sender encapsulates to the recipient's ML-KEM-768 key, which it reads from the address's channel receiver. The ciphertext, 1,088 bytes, travels with the sender's first payment as its first contact. Both ends then compute

K = BLAKE2b-256("Styx_ChannelSec_", ss ‖ ek ‖ ct)

from the shared secret ss, the encapsulation key ek and the ciphertext ct, so K is bound to the whole exchange.

What a channel derives

The sender numbers its payments on the channel i = 0, 1, 2, …, and derives, for each:

WhatDerivation
The memo's tagthe first 16 bytes of BLAKE2b-256("Styx_MemoTag____", K ‖ i)
The memo's keyBLAKE2b-256("Styx_MemoKey____", K ‖ i ‖ cmx), for the note's commitment cmx

and once for the channel:

WhatDerivation
The Δ keykΔ = BLAKE2b-256("Styx_DeltaKey___", K)

Integers are 64-bit little-endian. Binding cmx makes every memo key single-use, even if a sender reuses an index; after opening a memo, the recipient recomputes cmx and rejects a mismatch. The Δ key lets the recipient of a bundle's designated output derive the seed of Δ's blinds itself (Recognising a program).

The self channel

A wallet also keeps a channel to itself, K = BLAKE2b-256("Styx_SelfChannel", sk) for its spending key sk. Change goes over it, and so do backups. Backup n has the tag made of the first 16 bytes of BLAKE2b-256("Styx_BackupTag__", K ‖ n), and is sealed under BLAKE2b-256("Styx_BackupKey__", K ‖ n).

Who can follow a channel

Only the channel's two ends know K. Its tags look random to anyone else, so an observer can't tell that two payments share a channel. The sender knows every tag it will use; the recipient learns of each payment by looking up the next tag.

First contacts and buckets

Status: on Arctic.

A first contact opens a channel. It's the ML-KEM-768 ciphertext of the sender's first payment to an address, carried in the bundle with the index of the action it belongs to: 1,090 bytes. The recipient doesn't know the channel yet, so it can't derive the payment's tag. Buckets let it find the payment anyway.

Tags and buckets

Every encapsulation key ek has a whole first-contact tag: the first 16 bytes of BLAKE2b-256("Styx_FirstTag___", ek). An address names a bucket width k, from 0 to 128 bits, and its bucket is the first k bits of that tag. A first contact's tag is the bucket's k bits, followed by the rest of the channel's tag for payment 0, which only the channel's two ends know.

The recipient looks up its bucket: every first contact whose tag starts with its k bits. It tests each one it finds:

  1. decapsulate, and derive the channel's K;
  2. check that the tag agrees with the key's whole first-contact tag up to some bit, and with the channel's tag for payment 0 after it;
  3. open the memo as payment 0.

ML-KEM rejects implicitly: a ciphertext made for another key decapsulates to an unrelated secret, so its memo doesn't open.

Choosing the width

  • k = 128 files every first contact to the address under one tag. The recipient finds them with one lookup, but so can anyone who holds the address, who learns how many first contacts it got, and when.
  • k = 0 files every first contact on the chain in one bucket. Nobody can tell which are for the address, and the recipient tests all of them.
  • Widths in between trade one for the other.

The width decides only where the recipient looks. A wallet accepts a first contact filed at any width, so a wallet restored from its seed doesn't need to know the widths its addresses carried. Arctic's wallet uses k = 0 unless told otherwise (--bucket-bits).

Cost

A first contact adds 1,090 kept bytes to a payment. So opening a channel costs 20,000 zatoshis, where a payment on an open channel costs 10,000 (Fees and weight). A node's record of a first contact is 1,281 bytes: the ciphertext, and its action's memo record.

The wallet

Status: on Arctic, as the arctic binary. The wallet runs only the no-op program, and its sync doesn't recognise programs yet. Its library's source isn't published yet.

arctic wallet is a Styx wallet on the command line. It keeps its seed and state in one file, finds its payments through a node's lookup RPCs, and pays through Styx. Its logic is the arctic-wallet crate, which another wallet will be able to use as a library once its source is published.

Commands

CommandWhat it does
arctic wallet init --wallet <file>Creates a wallet file with a new 32-byte seed, and prints address 0. --seed-hex gives a seed of 32 to 252 bytes instead. --bucket-bits sets its addresses' bucket width, 0 by default (First contacts and buckets).
arctic wallet address --wallet <file>Prints the next unused address, or with --index the address at that index.
arctic wallet sync --wallet <file>Finds the wallet's new channels and notes, and which of its notes are spent.
arctic wallet balance --wallet <file>Prints the spendable balance and every note.
arctic wallet send --wallet <file> --to <address> --amount <zatoshis>Pays an address with a channel receiver. --backup makes the payment carry a backup.
arctic wallet restore --wallet <file> --seed-hex <seed>Recreates a wallet file from its seed: its newest backup, then a sync. --bucket-bits sets the width it looks for first contacts with.

Each command prints JSON, apart from address, which prints the address. There's no receive command: a wallet receives by syncing.

--rpc, or the ARCTIC_RPC environment variable, gives the node's JSON-RPC URL. By default it's a node on the same machine, on port 18332.

A node's RPC listener requires the node's cookie unless its config sets rpc.enable_cookie_auth = false, and it closes the connection on a call without it. --rpc-cookie, or ARCTIC_RPC_COOKIE, gives the wallet the cookie file: .cookie in the node's rpc.cookie_dir, by default the zakura folder of the cache directory of the user the node runs as. The cookie goes as HTTP Basic credentials, so send it only to a node on the same machine, or over HTTPS.

The wallet file holds the seed, in hex, and the wallet's state: its channels, counters and notes. Keep it private. The seed spends the funds, and the channel secrets find every payment, though without the seed they can't spend them.

A first session

arctic wallet init --wallet alice.json
arctic wallet sync --wallet alice.json
arctic wallet balance --wallet alice.json
arctic wallet send --wallet alice.json --to <address> --amount 100000

init prints address 0. Give it to whoever pays you, Arctic's faucet included: the faucet pays from transparent funds, with a first contact that opens a channel to the address. Once the payment is in a block, sync finds it, and balance shows it. send prints the transaction ID, the fee, and whether the payment carried a backup.

What a sync does

A sync looks things up in rounds. Each round asks for:

  • first contacts in the buckets of the addresses up to 10 past the last one used. A bucket holds other recipients' first contacts too, so the wallet tests each one: it decapsulates, checks the tag against the channel that gives, and opens the memo as the channel's first payment. Each one that's the wallet's opens a receive channel.
  • memos under the next 10 payment tags of every receive channel, and of the self channel, which holds the wallet's change.

It repeats while a round finds something, since a payment moves its channel's window and a first contact opens a channel. Each memo must open under its payment's key and carry a note whose commitment is its action's. Anything else is counted as rejected. Then the sync asks which of the wallet's notes the chain has spent, by their nullifiers.

Every sync reads the last 100 blocks below the previous sync's height again, forgetting what it found there first. That's the deepest reorg a node accepts, so a reorg can't leave stale notes or channels behind.

The sync prints:

FieldMeaning
notes_foundNotes the wallet didn't have, change included
channels_openedChannels other wallets opened to this one that it didn't know
rejectedEntries under the wallet's tags that didn't open: someone else's, or tampered with
others_in_bucketsFirst contacts in the wallet's buckets for other recipients: the cover a bucket gives
newly_spentNotes the chain now shows spent
synced_heightThe height the wallet is synced to
balanceThe spendable balance

Sending

send pays only an address with a channel receiver. It:

  1. uses the channel it opened to the address before, at the channel's next index, or opens one with a first contact;
  2. spends the largest spendable notes first, as few as cover the amount and the fee;
  3. always adds change on its self channel, so every payment has at least two actions;
  4. runs the no-op program, which every plain payment runs, so a payment doesn't show which wallet made it;
  5. expires 40 blocks after the next block.

The notes it spends stay pending until the chain shows them spent. If the payment expires instead, a sync releases them. A pending note doesn't count in the balance.

A payment that opens a channel always carries a backup that already holds the new channel, so the newest backup on the chain holds every channel the wallet has opened. Other payments carry one only with --backup. For a payment that spends one or two notes:

PaymentFee (zatoshis)
On an open channel10,000
On an open channel, with --backup20,000
Opening a channel, with its backup25,000

Spending more notes adds actions, and with them proof bytes and fee (Fees and weight).

Backups

A wallet restored from its seed can find again, by tag:

  • the channels others opened to it, through its addresses' buckets;
  • the payments on them;
  • its change, on its self channel.

It can't find the channels it opened itself: their secrets came from fresh randomness. A backup holds those, with the next index on each, and the wallet's address and change counters, so no index is used twice.

Backup n is filed under the self channel's backup tag n, and sealed under its backup key n (Channels). Its plaintext is, with integers little-endian:

FieldBytes
Version (1)1
The next address index4
The next change index8
The number of channels2
Each channel: the recipient's address, the channel's secret, its next index43 + 32 + 8

It's padded with zeros to the smallest size class that holds it, 1 to 4 KiB, so its size shows only roughly how many channels the wallet has opened. A bigger backup costs more:

BackupChannels it holdsFee of a payment that opens a channel
1 KiBup to 1225,000
2 KiBup to 2435,000
3 KiBup to 3640,000
4 KiBup to 4950,000

A wallet that has opened 49 channels can't open another: the backup wouldn't fit.

Restoring

restore looks up backups under the self channel's backup tags, 10 at a time, until a window finds none. It takes the newest backup's channels and counters, then syncs. A wallet that never opened a channel needs no backup, and loses nothing without one.

The restored wallet resumes each of its channels at the index its newest backup recorded. Payments on an open channel carry no backup unless sent with --backup.

--bucket-bits on restore is the width the wallet looks for first contacts with, and gives new addresses. A bucket of width k holds every bucket of a greater width that starts with its bits, so the default, 0, finds first contacts to addresses of any width.

As a library

A sync asks for what it needs through one interface, MemoRetrieval: entries by tag, first contacts by bucket, and whether nullifiers are spent. Today a node's plain lookup implements it. Private information retrieval would implement the same interface, over the same fixed-size records (The lookup RPCs).

The lookup RPCs

Status: on Arctic. Private information retrieval is planned.

A Styx wallet doesn't scan blocks. It derives the tags it expects, asks a node for the entries under them, and asks which of its nullifiers are spent. Four JSON-RPC methods serve it:

MethodWhat it returns
z_getstyxentriesThe entries of one kind under a set of tags, or in a set of buckets
z_getstyxepochOne epoch's final entries of one kind
z_getironwoodwitnessA note's authentication path, to spend it
z_getironwoodnullifiersWhether nullifiers are spent

Each takes one object of named fields, and requests carry Content-Type: application/json.

Entries

There are three kinds of entry. Each kind's records have a fixed size, so that private retrieval could serve them later.

KindFound byRecordBytes
memoIts tag. Every action has a memo, dummies included.The memo record below193
first_contactIts tag, in its recipient's bucketThe ML-KEM ciphertext, then its action's memo record1,281
backupIts tag, from its wallet's self channelThe size class (one byte), then the sealed backup1,041 to 4,113

A memo record holds what a recipient needs to open the memo, and later to spend its note:

FieldBytes
The note commitment's x-coordinate, which keys the memo's encryption32
The action's nullifier: the note's ρ, without which the recipient can't rebuild the note32
The sealed note: the tagged memo after its tag121
The note's position in the Ironwood note commitment tree, a little-endian u648

A position of all ones means the node doesn't know it.

Entries are grouped in epochs of 10,000 blocks, about 69 hours: epoch e is the 10,000 heights from e × 10,000. Once an epoch is final, its entries never change.

z_getstyxentries

The best chain's entries of one kind under a set of tags or tag prefixes, in chain order.

Field
kindrequiredmemo, first_contact or backup
tagsoptionalUp to 1,000 tags, each 16 bytes as 32 hex characters
prefixesoptionalFor first_contact only: up to 1,000 buckets, each its bytes in hex, /, then its width in bits, with zeros past the width (c070/12, or /0 for every tag)
startoptionalThe first height to search, 0 if absent
endoptionalThe last height to search: the tip if absent, 0 or above the tip

The response:

Field
kindThe kind
entriesThe entries, in chain order. Each has its tag, its block's height, its transaction's txIndex in the block, its index in the transaction (its action's for memos and first contacts, its own for backups), and its record in hex.
endHeightThe last height searched: the request's end, or the tip if that's lower or there's no end
nextHeightPresent when the page ended early: the next request's start

A page ends at the end of the height where its records reach 4 MiB. Without a nextHeight, the entries are all those from start to endHeight. An entry under several of the tags and prefixes comes once.

To read past one page and still cover one range of heights, pass the first page's endHeight as end in every later request.

For example, every first contact on the chain:

curl -s -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","id":1,"method":"z_getstyxentries","params":[{"kind":"first_contact","prefixes":["/0"],"start":0}]}' 127.0.0.1:18332

z_getstyxepoch

One page of an epoch's final entries of one kind, in chain order. It's for a server that builds a database once per epoch, such as one for private retrieval.

Field
kindrequiredmemo, first_contact or backup
epochrequiredThe epoch
startoptionalA previous page's nextHeight. The epoch's first height if absent.

The response has the kind and the epoch, and:

Field
startHeight, endHeightThe epoch's first and last heights
finalizedHeightThe node's last final height. Only entries up to it are returned.
closedWhether every block of the epoch is final, so its entries never change
entriesThe page's entries, as for z_getstyxentries
nextHeightPresent when the page didn't reach the epoch's last final height: the next request's start

z_getironwoodwitness

A note's authentication path, to spend it.

Field
positionrequiredThe note's position in the Ironwood note commitment tree, from its memo record
heightoptionalThe height whose tree the path leads to the root of: the tip if absent

The response has the position and the height, the tree's root, the anchor to spend against, and the path: 32 sibling nodes, leaf level first. The root and nodes are field elements in their canonical 32-byte encoding, in hex.

Every note a transaction spends needs a path to the same root, so ask for all of them at one height. A path costs the node about one hash per note of the note's subtree of 216 leaves.

z_getironwoodnullifiers

Field
nullifiersrequiredUp to 1,000 nullifiers, each 32 bytes as 64 hex characters

The response's nullifiers gives each one's nullifier and whether the best chain has spent it, in request order.

What the node learns

The node sees every tag, bucket, position and nullifier a wallet asks for. It can tell which entries the wallet finds, link one wallet's lookups together, and see when its notes are spent. Use a node you run, or one you trust with that.

Private information retrieval would hide which records a wallet reads. The fixed-size records and final epochs are there for it, but it isn't built.

Programs

Status: on Arctic: every payment runs a program and carries Δ. Wallets use only the no-op program so far. The Rust API's source isn't published yet.

Every Styx payment runs a program. The Zuring execution engine proves, in the payment's one proof, that the bundle follows Ironwood's rules and that the program held in every action. The payment carries Δ, a hiding commitment to the program. The chain checks every payment's proof with one verifying key, whatever program it ran, so it learns that the proof is valid, not which program ran.

A wallet that wants nothing more runs the no-op program, which every plain payment shares. A payment that runs it can't be told from another wallet's.

What a program sees

A program runs once in each action of the bundle, dummies included, and sees only its own action. It reads nine values from the action, its ports, and any private inputs the prover gives it:

PortValue
VOldThe spent note's value
VNewThe output note's value
GdOldX, PkdOldXThe spent note's address, its owner's: the x-coordinates of gd and pkd
GdNewX, PkdNewXThe output note's address, its recipient's, in the same way
AkXThe x-coordinate of ak: the spender's account, the same for all its addresses
PsiOldψ of the spent note: the program's state coming in
PsiNewψ of the output note: the program's state going out

A note's ψ travels in its memo (Tagged memos), so a program can choose an output's ψ and read the spent note's: state carried from note to note.

If the program fails in any action, the payment can't be proved.

What a program can do

A program is a sequence of operations on four registers, R0 to R3, which start at zero. In Rust it's built with orchard::zuring::Asm:

OperationWhat it does
set(r, e)Rr ← the expression e
assert_zero(e)Requires e = 0
assert_le(e, bound), assert_ge(e, bound)Requires e ≤ bound, or e ≥ bound, for 64-bit values
assert_nonneg(e)Requires 0 ≤ e < 270: for 64-bit operands, e ≥ 0
range(e, words, taps)Requires 0 ≤ e < 210·words, writing running sums into registers on the way
member(e, list), not_member(e, list)Requires e to be in, or not in, a list of constants
mul(r)Rr ← R0·R1
iszero(r)Rr ← 1 if R0 = 0, else 0
cmpbit()R3 ← 1 if R0 ≥ 0, else 0, for R0 strictly between −264 and 264
product(list, r)Rr ← the product of R0 − a over the list: zero exactly when R0 is in it
input(r)Rr ← the next private input
hash(domain, target)Hashes the final R0 and R1 with Sinsemilla in domain. With a target, requires the hash to equal it, unless the final R2 is zero.

An expression is a constant, plus multiples of registers, of one port, and of R0·R1. c(v), r(i) and port(p) make the terms, which add, subtract, and multiply by constants. Values are elements of Pallas's base field.

A program has a fixed size budget. Asm::finish returns the program, or the first operation that didn't fit.

For example, a program that requires every output of the bundle, change included, to be at most 100,000,000 zatoshis:

#![allow(unused)]
fn main() {
use orchard::zuring::{port, Asm, Port};

let mut asm = Asm::new();
asm.assert_le(port(Port::VNew.index()), 100_000_000);
let program = asm.finish()?;
}

Paying with a program

The Styx builder takes the program when it builds the transaction:

#![allow(unused)]
fn main() {
let built = builder.build(
    rng,
    &program,
    |_metadata, actions| ActionInputs::none(actions),
    &[spend_authorizing_key],
    &TransparentSigningSet::new(),
)?;
}

The closure returns the private inputs, as ActionInputs: none(actions) for a program that reads none, same(actions, inputs) for the same inputs on every action, or per_action(vectors) for one vector per action. Actions are shuffled, so the metadata says which action holds which spend and output.

Before proving, the builder checks that the program holds on every action. check_action(program, ports, inputs) runs that check on one action's values without proving, for tests. The builder computes Δ before signing: Δ's digest is part of the transaction ID, so the signatures cover the program's commitment, and nobody can swap it.

Who a program binds

The spender chooses each payment's program. Nothing on the chain says which program an address's funds must run, so a program binds the spender only towards those who check it: the payment's recipients, who can recognise the program. A recipient who recognises it knows every action of the bundle met its requirements: that the payment carries an invoice's amount and reference, for example.

Rules on an account's own funds, such as a spending cap or a list of payees, need the chain to enforce a program for an address. That's what contracts would do, and they're undecided.

Writing programs

  • The Rust API above.
  • Stygian, a language that compiles to it. Built, not deployed.
  • The experimental tools, for a different machine.

Recognising a program

Status: on Arctic for the format: every payment carries Δ, with blinds from the channel. Recognition in wallet sync is planned.

A payment's Δ is its program's commitment under blinds. Whoever knows the blinds and the program can check that Δ commits to that program. Without the blinds, Δ hides it.

Where the blinds come from

A bundle's blinds come from one 32-byte seed. Which recipients get the seed is up to the sender:

  • The designated output's recipient derives the seed itself. The designated output is the first action, in the bundle's order, whose output was built on a channel. Its seed is BLAKE2b-256("Zuring_DSeedChan", kΔ ‖ i ‖ cmx), with kΔ the channel's Δ key (Channels), i the payment's index on the channel as a 64-bit little-endian integer, and cmx the output's note commitment. The sender derives the same seed, so it never travels.
  • Other outputs carry the seed in their memo's delta_seed slot if they were built with share_program, the last argument of the builder's add_zuring_output. Otherwise the slot is random.
  • A bundle with no output on a channel has a random seed, and nobody can recognise its program.

Change goes on the sender's self channel, and actions are shuffled, so the designated output may be the change. A sender that wants a recipient to recognise the program sets share_program on that recipient's output.

Recognising

With the seed, a recipient:

  1. derives the blinds, DeltaBlinds::from_seed(&seed);
  2. strips them from Δ, strip(vk, &delta, &blinds), which leaves the program's commitment without blinds;
  3. compares that with program_commitment(vk, &program) for each program it expects.

A match means every action of the bundle ran that program. A program with other parameters is another program, with another commitment.

Δ is in the transaction, which the recipient can fetch by the height and index its memo's entry gives (The lookup RPCs). A node that has pruned the witness keeps Δ's digest instead (Storage modes). The recipient then computes Δ for each program it expects, commit_program(vk, &program, &blinds), and compares digests.

Who can recognise

Δ hides the program from anyone without the seed: the chain, nodes, and the bundle's other recipients. Whoever holds the seed can test any program it can guess, so the seed goes only to recipients the sender chooses, sealed in their memos.

Status

The functions are in the orchard crate's zuring module, whose source isn't published yet. The wallet's sync doesn't use them yet: it pays with the no-op program, and it doesn't check what other wallets' payments ran.

Stygian

Status: built, not deployed, and not published yet.

Stygian is a language for programs. A Stygian file is Python with a few keywords. Compiling it gives a module of the Zuring IR, a text format with the program's tests built in. The back end, the zuring-ir tool, checks the module, assembles it into a program for Styx's engine, and runs its tests on an interpreter and on the assembled program, which must agree.

A program

This one counts a note's payments in its ψ. Change that stays at the address carries the count forward, one more each time, up to a limit, and payments that leave are capped:

# coding: stygian

home = Address(41, 31)
payee = Address(21, 11)

PARAM ACCOUNT      : Field   SUCH AS 777
PARAM CAP          : Amount  SUCH AS 2_0000_0000
PARAM MAX_PAYMENTS : U[10]   SUCH AS 3

STATE payments     : U[10]   SUCH AS 0, 2, 1
                             BUT NOT 3 ON 1

CONTEXT spender        SUCH AS 777
CONTEXT spent.address  SUCH AS home
CONTEXT spent.value    SUCH AS 5_0000_0000
CONTEXT output.value   SUCH AS 4_0000_0000, 3_0000_0000, 1_0000_0000
                       BUT NOT 3_0000_0000 ON 2
CONTEXT output.address SUCH AS home, home, payee

REQUIRE spender == ACCOUNT

with output.address == spent.address:
    REQUIRE payments < MAX_PAYMENTS
    STATE_OUT payments + 1
with output.address != spent.address:
    REQUIRE output.value <= CAP
FINISH
  • PARAM declares the program's parameters. Each set of parameters makes a different program.
  • STATE declares a field of ψ, and STATE_OUT sets the output's.
  • SUCH AS gives test values, one per test row, and BUT NOT makes a failing test: BUT NOT 3 ON 1 says row 1 must fail with payments set to 3. CONTEXT gives the ports' test values.
  • with gates what's inside it: it binds only where the condition holds.

The count is per note, since ψ is chosen by whoever makes the note. Like every program today, it binds the spender only towards the recipients who recognise it (Who a program binds).

Running it

From the stygian folder of the zuring_ir crate:

python3 -m stygian compile examples/payment_count.zr    # the IR, on stdout
python3 -m stygian test examples/payment_count.zr       # its tests
python3 -m stygian build examples/payment_count.zr      # assemble it
python3 -m stygian transform examples/payment_count.zr  # the Python it becomes

test, build and the sinsemilla fixtures call the zuring-ir tool. Point ZURING_IR at it, or put it on the PATH. The tool works on IR files directly too: fmt, digest, check, build, list, test, and hash for test values.

The language

Declarations

DeclarationWhat it declares
PARAM NAME : Type SUCH AS …A parameter. PARAM NAME[n] declares an array, NAME.0 to NAME.(n-1).
DECLARE name : Type SUCH AS … BUT NOT …A private input, read once
STATE name : U[bits] SUCH AS … BUT NOT …A field of ψ, of 10 to 60 bits in whole 10-bit words
CONTEXT path SUCH AS … BUT NOT …Test values for a port

Types are Field, Bool, Amount (64 bits), Height (32 bits), U[n] (1 to 64 bits), Enum[A, B, …] (each name a constant, from 0), and Address, a pair of field elements (Address(gd, pkd) makes a test address). The ports are spent.value, output.value, spent.address, output.address (each address with .gd and .pkd), spender (the x-coordinate of ak), psi_old and psi_new.

Statements

StatementMeaning
REQUIRE conditionHolds wherever the gates around it are on
LET name = expressionSet under gates; it keeps its earlier value where they're off
with condition:, with !condition:A gate: what's inside binds only where it's on
ACCEPTInside a gate, an accepting path. If there are any, exactly one is on.
REJECTInside a gate, the gate must be off. At the top level, the end of the paths.
STATE_OUT a, b, …ψ of the output note: these fields, packed as STATE lays them out
FINISHThe end

Expressions

  • +, - and * work in the field.
  • == and != compare anything, addresses included. <, <=, > and >= compare integers whose range is known: values, amounts, integer inputs and state, parameters, and sums, differences and products of them. Field values such as hashes and keys don't compare; cast(x, bits) gives one a range, checked.
  • &, | and ! combine conditions. Python binds & and | tighter than comparisons, so a comparison next to them needs parentheses: (a == b) & c.
  • a IN list and a NOT IN list work at the top of a REQUIRE, LET or with, and isin(a, list) and notin(a, list) anywhere. Lists hold constants.
  • Is(x, NAME) tests an enum, select(c, a, b) picks a value, and sinsemilla(domain, a, b) == target checks a hash, in a REQUIRE, at most once.

Python's own if, and, or, not and in don't work on circuit values: they would decide at compile time. Plain Python around them does work: fixtures, loops, helper functions.

The corpus

The corpus has seven programs, each with its tests:

ProgramWhat it requires
limits.zrThe output's value is between a minimum and a maximum
fee_cap.zrThe spent value minus the output's is at most a fee cap
min_share.zrThe output keeps at least a fixed share of the spent value
tiered.zrThe output's value is under a limit picked by two lists of recipients
invoice.zrThe payment pays an amount to a merchant, and a private id and salt hash to the invoice
escrow.zrThe payment pays an agent, or the spender knows the secret that hashes to a release value
vault.zrPer-withdrawal and lifetime caps and a withdrawal count in ψ, with change staying home

vault.zr doesn't assemble yet: the compiler runs out of registers. Rules on an account's own funds, like the vault's or examples/capped_payees.zr's, bind the spender only once the chain enforces programs (Contracts).

Contracts

Status: undecided. Nothing is built.

A contract would bind a program to an address: every payment that spends the address's funds would have to run it, and the binding would stay hidden. Styx doesn't have contracts.

What Styx has instead

Today the spender chooses each payment's program, and the chain checks only that the proof is valid. A program binds the spender only towards the recipients who recognise it. That covers what a payment shows its recipients: an invoice's amount and reference, an escrow's release, a share of the value.

It doesn't cover rules on an account's own funds, such as a spending cap, a list of payees, or a vault's withdrawal limits. The account's key can spend without the program, by running another one.

Why it's hard

If nodes checked every spend from an address against a fixed program, or a fixed commitment to one, everyone would see which program that is: every node is a verifier. A hidden binding has to be proved inside the payment's proof. Several designs are under study, and none is decided.

Experimental tools

Status: experimental, and not published yet. None of these run in Styx payments, and they may change or disappear.

These tools are for a virtual machine for hidden programs, not for the engine that proves today's Styx payments (Programs). A proof of a run shows that the machine followed a program, which a commitment names and the proof doesn't show. A run is proved one step at a time, and each step's proof is checked against the step before.

The machine has eight registers, g0 to g7, a memory of field elements kept apart from its code, and an output word. In each step it reads an input word and, from the prover, private words and hints.

ToolWhat it is
zuring-langA small typed language, its interpreter, and its compiler to the machine's assembly
The assemblerzuring-asm, the machine's assembler and disassembler
The sumcheck back endA second prover for the machine, built on sumcheck arguments
Program keys and certificatesNaming a program, and a proved run in a file anyone can check

None of them is published yet. Each is a Rust crate, with its own command-line tool where it has one.

zuring-lang

Status: experimental, and not published yet. zuring-lang and .zl are working names.

A small typed language for the virtual machine. A program is Rust-like functions over field, bool, the integers u8 to u64, and arrays of them:

static PRICES: [u64; 8] = [120, 75, 300, 42, 90, 15, 250, 60];

fn main() {
    let budget = input() as u64;
    let mut spent: u64 = 0;
    for i in 0..8 {
        if spent + PRICES[i] <= budget {
            spent = spent + PRICES[i];
        }
    }
    output(spent);
}

Integers are checked: an operation whose result leaves its type fails the run.

Built-inWhat it does
input()The step's input word
page()The page cell
secret()A private word, which the prover gives with the step's input word
hint(e)e's value, computed outside the proof: the program has to check it
output(e)Sets the output word
assert(e)Fails the run unless e holds
wait()Ends the step: the run goes on with the next step's input word

An integer / or % takes its quotient and remainder as hints, so a run's hints are its hints, its secrets and its divisions, in order.

Running it

The interpreter is the language's reference. It gives a run's output, or the check that failed and its line, and the hints the compiled code will take. The compiler turns a program into the machine's assembly, and vm checks that the compiled program, run with those hints, agrees with the interpreter.

CommandWhat it does
zuring-lang check <file>Parses and checks the program
zuring-lang run <file>Runs it on the interpreter
zuring-lang asm <file>Compiles it, and prints the assembly
zuring-lang vm <file>Compiles it, and runs it on the machine
zuring-lang prove <file>Compiles it, and proves its run
zuring-lang play <file>Runs a program that waits a step at a time, reading each step's input word and private words from the terminal. With --prove, it proves each step before the next.

--x sets the input word and --secret gives the next private word, once per word. --fuel bounds the statements and loop iterations a run may take, --depth the calls at once, and --steps the steps vm runs.

The assembler

Status: experimental, and not published yet.

zuring-asm reads assembly for the virtual machine and gives its image: the code the machine runs and the data that is a run's starting memory. It also disassembles code back into assembly. Styx's own engine is programmed through a Rust API instead (Programs).

Assembly

A line holds an optional label (name:), an instruction or a directive, and an optional comment from ; or #.

  • Registers are g0 to g7. By convention at is g7, the pseudo-instructions' scratch register, ra is g6, the return address, and sp is g5, the stack pointer.
  • Expressions are computed in the field: integers in decimal or hex, labels, .equ names and ., the current address, with +, -, *, << and parentheses. Labels in .text are code addresses and in .data memory addresses, each from 1: the machine keeps code and data apart.
  • Terms. Most instructions take a term: an expression over at most two registers, with at most one product of them. So set g1, 3*g2 + g4 - 7 and load g3, [g2 + 4*g1 + 16] are one instruction each.

The instructions, with T a term:

InstructionWhat it does
set d, Td ← T
inv d, Td ← 1/T; a fault if T is 0
eqz d, Td ← 1 if T = 0, else 0
split d, Td ← T / 64, rounded down, with the remainder left to the prover
limb TA fault unless T < 64: the end of a range check
pow5 d, Td ← T5
load d, [T], store s, [T]Reads or writes memory at address T
ladd d, t, [T], lmul d, t, [T]d ← t + the memory at T, or t times it
bnz T, L, bz T, LJumps to L if T is nonzero, or zero
jalr d, Td ← the next address, then jumps to T
in d, in d, 1d ← the step's input word, or the page cell
hint dd ← the step's next hint
out TThe output word ← T
assert TA fault unless T = 0
haltStops

Pseudo-instructions include nop, mov, neg, addi, subi, muli, jmp, call, ret, beqz, bnez, beq, bne, push, pop, and range s, n, which checks that s < 2n. The directives are .text, .data, .word, .zero, .equ, .rept … .endr, .k (the size a program is built for), .step (the end of a step), .loc, .inst (a raw entry) and .live (the registers live after a jump through a register).

The assembler packs instructions: an instruction whose value only the next one reads goes into that one's term. --no-pack turns it off. Labels, and every instruction after a branch or a jump, start a new entry, so a label always names an entry: write jump targets as labels.

An example

N! by recursion, with a stack from address STACK up:

.equ N, 5
.equ STACK, 160

        const g7, STACK         ; the stack pointer
        const g5, 1
        const g0, N
        jalr  g6, g3, fact      ; a call: g3 is 0
        out   g1
        halt
fact:   bnz   g0, recurse
        const g1, 1
        jalr  g2, g6, 0         ; return
recurse:
        store g6, [g7]          ; push the return address, then the argument
        add   g7, g7, g5
        store g0, [g7]
        add   g7, g7, g5
        sub   g0, g0, g5
        jalr  g6, g3, fact
        sub   g7, g7, g5        ; pop them
        load  g0, [g7]
        sub   g7, g7, g5
        load  g6, [g7]
        mul   g1, g1, g0
        jalr  g2, g6, 0

It uses the machine's older three-register forms, const, add, sub, mul and jalr d, s, e, which the assembler still takes.

Running it

CommandWhat it does
zuring-asm check <file>Assembles the file: its size, or its errors
zuring-asm list <file>Each entry's address, words and source line
zuring-asm dis <file>The code, disassembled into assembly that gives it again
zuring-asm run <file>Runs it to the halt: the output, or the fault and its line
zuring-asm prove <file>Proves its run

--x gives every step's input word (step gives each step its number), --xs a file of input words, one a step, --hints a file of hints, and --steps the most steps to run.

The sumcheck back end

Status: experimental, and not published yet.

zuring-sumcheck is a second prover for the virtual machine. It keeps the machine, its assembly and its tools, and proves each step with sumcheck arguments instead of halo2. Its proofs are zero-knowledge, and its commitments are hiding Pedersen commitments on Vesta, opened with an inner-product argument, so it needs no trusted setup, like the engine in Styx payments.

It's a library:

ModuleWhat it does
stepProves one step of a run
zkThe verifier, written once, run in the clear or under zero knowledge
certProgram keys and certificates

Programs that run on the machine run on either prover unchanged. Styx payments don't use it.

Program keys and certificates

Status: experimental, and not published yet.

A certificate is a run of the virtual machine, proved step by step with the sumcheck back end, in a file anyone can check without learning the program.

Program keys

A program key (.zkey) names what was run:

  • the commitments to the program and to its starting memory, made once with blinds from a seed;
  • the starting state, and how to read a step's output word;
  • the seed itself, if it's public, so that anyone with the program can rebuild the key.

The key's hash is the program's id. A publisher may sign the id.

Certificates

A certificate (.zcert) holds:

  1. a header: the program id, the claimant, a nonce for the run, the time and a beacon, then the key, if it's embedded;
  2. a record for each step, as each step is proved;
  3. a seal.

Every step's proof starts from the header's hash, so a certificate can't be passed off as another claimant's. A step's starting and ending states are committed, not shown: a verifier learns only each step's output word.

Integers are little-endian. A field element is its canonical 32-byte encoding, and a point its 32-byte compressed one. A reader refuses any other encoding.

zakurad on Arctic

Status: on Arctic.

zakurad is the Styx node. Arctic has two kinds of node:

  • A verifier syncs from the operator over P2P and checks every block and transaction against the full consensus rules, the operator's block signature included. It never produces blocks, and it doesn't need to trust the operator's RPC answers. The release's verifier.toml configures one.
  • The operator produces Arctic's blocks.

Every node shares one network table, and that table is the chain's identity: keep it identical on every node, apart from the paths of the genesis and checkpoint files.

Running a verifier

  1. Unpack the release (Getting started). Its verifier.toml holds Arctic's network table, with the block signer's public key and the lockbox address filled in.

  2. Put genesis.hex and checkpoints.txt somewhere permanent, and write their absolute paths in verifier.toml, at genesis_block and checkpoints.

  3. Write the operator's P2P address in initial_testnet_peers.

  4. Start the node:

    zakurad -c verifier.toml start
    

The node syncs the blocks the checkpoint list names by their hashes, validates every block above the last one in full, and follows the operator's tip. It rejects any block not signed by block_signer.

Ports

ListenerAs shipped
P2P0.0.0.0:18333
RPC127.0.0.1:18332 on a verifier, cookie-authenticated, as zakurad's default is. On the operator, the public listener, with TLS and without a cookie.
Admin RPCoperator only: 127.0.0.1:18331, every method, cookie-authenticated, loopback only

On a network with a block signer, the public RPC listener doesn't offer getblocktemplate, submitblock or submitsolution.

A cookie-authenticated listener closes the connection on a call without the node's cookie. The node writes the cookie to .cookie in rpc.cookie_dir, by default the zakura folder of the cache directory of the user it runs as. The arctic CLI sends it with --rpc-cookie (The wallet).

Settings the default config leaves out

The generated default configuration doesn't list these. Arctic's configs set the ones they need.

SettingWhat it does
mining.block_interval_secondsOn a network with a block signer, produce and sign a block this often. Unset, the node produces none.
mining.block_signing_key_fileThe file holding the ed25519 secret key that signs produced blocks. Its public key must be the network's block_signer.
mining.block_max_weightThe largest weight of the block templates this node builds. Unset, the consensus limit; a larger value is capped at it.
rpc.admin_listen_addrA loopback listener with every method, cookie-authenticated, in plaintext.
rpc.tlsTLS for the main RPC listener: a certificate chain and its key.

The operator

Arctic has one operator. Only the holder of the block signer's key can extend Arctic, and that key's file must be readable only by the node's user.

Storage modes and checkpoints

Status: on Arctic. Nothing is pruned yet: Arctic's checkpoint list holds only its genesis block. Pruned nodes serving each other is planned.

A node checks every Zuring proof when its block arrives. After that, it doesn't need to keep the proof to stay a full node. state.storage_mode chooses what it keeps:

ModeKeepsCan't serve
archiveeverything—
standard, the defaultevery transaction; but for blocks at or below the latest checkpoint, only the digests of their Zuring witnesses (Δ and the proof)those blocks and transactions in raw form
prunedas standard, and it also deletes old raw transaction bytes outside a retention windowraw history outside the window

Pruning is one-way: a node won't reopen its database in a mode that keeps more. To go back, sync again from genesis.

What a pruned transaction keeps

A pruned Styx transaction keeps its txid, its authorizing digest, its signature hashes, its weight and its lookup entries. Only Δ and the proof go, each replaced by its 32-byte digest. A payment on an open channel shrinks from 9,464 bytes to 856. Wallets sync and spend through a pruned node as through an archive.

Serving pruned history

  • A node advertises only the blocks it holds in full. A peer that asks for a pruned block gets notfound, and fetches it from an archive.
  • getblock and getrawtransaction at verbosity 0 refuse pruned blocks and transactions. At higher verbosity, a transaction reports witnessPruned.
  • An archive keeps everything, so anyone can check pruned history without trusting checkpoints. Arctic's operator runs as one.

Checkpoints

A checkpoint list names block hashes that a new node syncs up to by hash, without checking their proofs or signatures; it validates every block above the last one in full. Arctic's list, checkpoints.txt, is taken more than 1,000 blocks below the tip, with a checkpoint at least every 400 blocks. The zakura-checkpoints tool extends it.

Checkpoints change how a node syncs, not which blocks are valid. A node that syncs by checkpoint trusts the list for the history below it, and an archive is how anyone can check that history.

The RPC

Status: On Arctic.

The node's JSON-RPC: the public listener and the operator's admin listener, the Styx lookup methods, and the methods Styx changes: getblock and getrawtransaction refuse pruned data in raw form and report witnessPruned, and getblocktemplate fills blocks by weight. The full reference will be generated from the node's OpenRPC table, which rpc.discover also serves.

This page is an outline: the chapter isn't written yet.

The explorer

Status: On Arctic.

Arctic has a block explorer that shows Styx bundles: each action's tag, the first contacts, the witness or the note that it was pruned, and a check of the transaction's weight and fee. Its address will be added here.

This page is an outline: the chapter isn't written yet.

Running a faucet

Status: On Arctic.

arctic faucet serve pays test coins to whoever posts an address to /drip. A transparent address gets a plain payment; a Styx address gets a payment that opens a channel to it with a first contact. It limits how often an address can ask and how many payments go in a block.

This page is an outline: the chapter isn't written yet.

The transaction

Status: On Arctic. The format isn't final.

The byte layout of a Styx transaction and its Zuring bundle, field by field; how parsing separates kept bytes from witness bytes; and the pruned form a node stores.

This page is an outline: the chapter isn't written yet.

Digests and signature hashes

Status: On Arctic. The format isn't final.

The txid and the authorizing commitment, the bundle's effecting and authorizing digests, Δ's digest, and the signature hashes, with every personalization. Signatures cover Δ.

This page is an outline: the chapter isn't written yet.

Consensus rules

Status: On Arctic.

The rules a Styx transaction and a block must meet: the branch ID, the action bounds, no Styx coinbases, the Zuring verifying key, the block weight limit, and how Zuring actions count against block action limits.

This page is an outline: the chapter isn't written yet.

Channel and key derivations

Status: On Arctic. The format isn't final.

Every derivation, with its personalization: channel key pairs from the spending key, the channel secret, tags, memo keys, the Δ key, the self channel, backups, first-contact tags and buckets, and the channel receiver's encoding.

This page is an outline: the chapter isn't written yet.

Arctic's network parameters

Status: On Arctic.

Arctic's network table: its name, magic, genesis block, activation heights, block signing, block times and coinbase maturity.

This page is an outline: the chapter isn't written yet.

Test vectors

Status: On Arctic.

Pinned vectors for the channel derivations, the transaction's encodings and digests, and Δ, for checking another implementation.

This page is an outline: the chapter isn't written yet.

Threat model and assumptions

Status: On Arctic.

What a Styx payment shows and to whom: the chain sees a payment's size and fee but not its amounts, parties or program; an observer can't link payments on one channel; a node serving lookups learns which tags a wallet asks for. The assumptions underneath: discrete logarithms for proofs, commitments and signatures; the KEM for channels; BLAKE2b and ChaCha20-Poly1305.

This page is an outline: the chapter isn't written yet.

What's post-quantum

Status: Undecided.

Styx's proofs, commitments and signatures rest on discrete logarithms, so they aren't post-quantum. Channel keys come from the spending key, never from a viewing key, which a quantum computer could recover from an address. Note delivery uses a KEM, ML-KEM-768 today; which KEM Styx keeps is undecided. A fully post-quantum Styx is a design, not a plan.

This page is an outline: the chapter isn't written yet.

Limits

Status: On Arctic.

What Styx doesn't do today: Arctic has one block producer; a node serving lookups sees which tags a wallet asks for; a payment that opens a channel is heavier than one that doesn't, and so can be told apart; a node that syncs by checkpoint trusts the list for the history below it; and the transaction format isn't final.

This page is an outline: the chapter isn't written yet.

Glossary

Status: follows the rest of the book.

Action. One spend and one output of a Zuring bundle, with its tagged memo. A bundle has 2 to 64; unused halves are dummies.

Archive. A node in archive storage mode, which keeps every transaction's witness. See Storage modes.

Arctic. The testnet that runs Styx. See The Arctic testnet.

Backup. A sealed copy of a wallet's state, carried by one of its payments and found by a tag from its self channel.

Bucket. The first k bits of an encapsulation key's first-contact tag, named by an address. First contacts to the address are filed in it. See First contacts and buckets.

Channel. A secret K shared by a sender and a recipient, from which every payment between them takes its tag and key. See Channels.

Checkpoint. A block hash that new nodes sync up to without checking the proofs below it.

Designated output. The output of a bundle whose recipient derives the seed of Δ's blinds from its channel.

Δ (delta). A hiding commitment to the program a Zuring proof ran, carried next to the proof. See Programs.

Dummy. An action, or half of one, that spends or creates nothing of value. Its memo is random bytes.

Epoch. 10,000 blocks of lookup records. A final epoch's records never change.

First contact. The ML-KEM-768 ciphertext that opens a channel, carried with the sender's first payment to an address.

Ironwood. The shielded pool that the NU6.3 upgrade added, built on Orchard's design. Styx bundles follow its rules and share its note commitment tree, nullifiers and value pool.

Kept bytes. The bytes of a transaction that stay on the chain: everything but the witness. A kept byte weighs 16.

ML-KEM-768. The key encapsulation mechanism of FIPS 203 that Styx's first contacts use today.

Program. What a Zuring proof runs in every action of its bundle. Its recipients can recognise it; the chain can't.

Self channel. A wallet's channel to itself, for change and backups.

Styx. The payment format this book describes, and the rules for it.

Tag. The first 16 bytes of a tagged memo, or a backup's tag: what a wallet looks up.

Tagged memo. The 137 bytes every action carries in place of Orchard's note ciphertexts: a tag, then the note's sealed plaintext. See Tagged memos.

vsize. A transaction's weight divided by 16, rounded up. Fees count it.

Weight. 16 times a transaction's kept bytes, plus its witness bytes. A block weighs at most 32,000,000.

Witness. Δ and the proof: the last bytes of a Styx transaction. A witness byte weighs 1, and nodes may delete the witness once its block is below a checkpoint.

zakurad. The Styx node.

Zuring. The execution engine whose proofs Styx bundles carry.

Design decisions

Status: On Arctic for the decisions built; others as marked.

The decisions behind Styx, one line each with what they rule out: tags instead of trial decryption; channels opened once by a KEM instead of key agreement per output; the witness last, weighted a sixteenth; pruning below checkpoints instead of aggregating proofs; buckets for first contacts; Δ's blinds from the channel.

This page is an outline: the chapter isn't written yet.

Roadmap

Status: Planned and undecided, as marked.

What's planned: one shape for every payment, private retrieval of lookups, and pruned nodes serving each other. What's undecided: contracts, the KEM Styx keeps, and a post-quantum Styx.

This page is an outline: the chapter isn't written yet.