nk, 32 bytes). It finds and decrypts the account’s
transaction records and notes. It can never spend. Sharing it is how a user proves their history to
someone they choose, without making it public.
What the viewing key reveals
Disclosure is all or nothing for that account:
nk opens its whole history, past and future. Treat a
shared viewing key as permanent.
Disclose to an auditor
- Derive
nkfor the account. See Transaction history. - Choose what to hand over:
- A report (
toComplianceReportorformatComplianceCsv): a snapshot. The auditor sees only what you exported, but must trust that you exported everything. - The viewing key itself: the auditor runs the scan on their own RPC and verifies against the chain. Nothing to trust, but they see the full history.
- A report (
- Send it over a private channel. Anyone who obtains
nkgains the same read access.
hexToBytes and passes it as viewingKeyNk to
scanTransactions.
Compliance on the protocol side
Separately from what a user discloses, the protocol screens activity:- Deposits carry a signed risk assessment that the program checks on chain.
- Withdrawals, swaps and payouts are screened before they are authorized. A refused recipient throws
payout.screening_refusedand nothing moves. - Every account registers its viewing key with Cloak before it spends.
createCloakdoes this automatically; the low-level API does it on the first call unless you setenforceViewingKeyRegistration: false.
Receiving keys are different
To receive a private send, a user shares theircloak_ address. It contains a public delivery
key that lets a sender seal a note to them. It does not grant read access to anything. Never confuse
it with nk.