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.