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:
| Method | What it returns |
|---|---|
z_getstyxentries | The entries of one kind under a set of tags, or in a set of buckets |
z_getstyxepoch | One epoch's final entries of one kind |
z_getironwoodwitness | A note's authentication path, to spend it |
z_getironwoodnullifiers | Whether 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.
| Kind | Found by | Record | Bytes |
|---|---|---|---|
memo | Its tag. Every action has a memo, dummies included. | The memo record below | 193 |
first_contact | Its tag, in its recipient's bucket | The ML-KEM ciphertext, then its action's memo record | 1,281 |
backup | Its tag, from its wallet's self channel | The size class (one byte), then the sealed backup | 1,041 to 4,113 |
A memo record holds what a recipient needs to open the memo, and later to spend its note:
| Field | Bytes |
|---|---|
| The note commitment's x-coordinate, which keys the memo's encryption | 32 |
| The action's nullifier: the note's ρ, without which the recipient can't rebuild the note | 32 |
| The sealed note: the tagged memo after its tag | 121 |
The note's position in the Ironwood note commitment tree, a little-endian u64 | 8 |
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 | ||
|---|---|---|
kind | required | memo, first_contact or backup |
tags | optional | Up to 1,000 tags, each 16 bytes as 32 hex characters |
prefixes | optional | For 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) |
start | optional | The first height to search, 0 if absent |
end | optional | The last height to search: the tip if absent, 0 or above the tip |
The response:
| Field | |
|---|---|
kind | The kind |
entries | The 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. |
endHeight | The last height searched: the request's end, or the tip if that's lower or there's no end |
nextHeight | Present 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 | ||
|---|---|---|
kind | required | memo, first_contact or backup |
epoch | required | The epoch |
start | optional | A previous page's nextHeight. The epoch's first height if absent. |
The response has the kind and the epoch, and:
| Field | |
|---|---|
startHeight, endHeight | The epoch's first and last heights |
finalizedHeight | The node's last final height. Only entries up to it are returned. |
closed | Whether every block of the epoch is final, so its entries never change |
entries | The page's entries, as for z_getstyxentries |
nextHeight | Present 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 | ||
|---|---|---|
position | required | The note's position in the Ironwood note commitment tree, from its memo record |
height | optional | The 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 | ||
|---|---|---|
nullifiers | required | Up 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.