Skip to content

Confidential payroll

View Markdown

Paying salaries on a public ledger is fast and cheap, but it publishes everyone’s pay to everyone: colleagues, competitors and anyone curious. Hiding the amounts fixes that, and creates a new problem. The tax authority, and often an auditor or a regulator, must still see every salary, and they shouldn’t have to take the employer’s word for it. An employer that reports a smaller number than it paid shouldn’t be able to.

This demo pays salaries as confidential notes: the chain stores the amount sealed, the employee can open their own payslip, and the tax authority can read every salary. A zero-knowledge proof makes the tax authority’s copy match the real amount.

Confidential payroll · step 1 / 6
Employerpays salaries

Waiting for the tax authority's key.

Pay run
carol's salarySECRETHIDDEN5,000████████
dave's salarySECRETHIDDEN4,200████████
each amount also encrypted to the tax key, as two 32-bit limbs
πissuance prooflimbs match each salary
Pay carol 5,000, but tell the tax authority
amount in the limbsCHEAT3,000
limbs ≠ salary: no issuance proof exists
Cardanoanyone can read it
registry: tax key PKPUBLIC0xeb3d…11fa
key possession proved on-chain
NoteLedger salary notes
owner carol · CPUBLIC0xddbe…f7ae
owner dave · CPUBLIC0x5070…e0d3
each note also carries: 2 limb ciphertexts for the tax key, and 2 sealed openings (payslip, tax copy)proof valid: the limbs encrypt each committed salary
Transfer
owner dave · CPUBLIC0x97bd…4843
owner carol (change) · CPUBLIC0x13e5…5765
proof valid: input = outputs, limbs match
no proof to verify: pay run refused, nothing minted
Carolemployee
viewing keySECRETHIDDEN0xfd35…a6a4████████
payslip opened from chainSECRETHIDDEN5,000████████
opening recomputes C: the payslip is genuine
sent to dave · change keptSECRETHIDDEN800 · 4,200████████
Tax authorityregistry auditor
secret keySECRETHIDDEN0x1340…aced████████
Salaries: the pay run's notes, spent or not
carol · pay runSECRETHIDDEN5,000████████
dave · pay runSECRETHIDDEN4,200████████
salary totals count these notes onlyAlso readable: notes made by spending
carol → daveSECRETHIDDEN800████████
carol · changeSECRETHIDDEN4,200████████
every amount proof-enforced; not added to the salary totals

1. Register the tax key

The tax authority publishes an encryption key in an on-chain registry, with a proof that it holds the matching secret key. The payroll ledger reads the key from there, so the employer can't pick its own.

2. Pay run

The employer pays carol 5,000 and dave 4,200 in one transaction. Each salary becomes a note: a commitment that hides the amount, the amount encrypted to the tax key in two 32-bit pieces ("limbs"), and two sealed copies of the opening. A zero-knowledge proof shows that the limbs add up to the committed amount. The ledger mints nothing without that proof.

3. Payslip

Carol scans the chain with her viewing key, a key that only opens notes sent to her. She decrypts her payslip and checks that it recomputes the commitment. Switch views: the public sees owners and commitments, never amounts.

4. Spend

Carol sends 800 to dave and keeps 4,200 as change. The transfer proof shows the amounts balance and that the new notes' limbs are encrypted to the tax key. She could also cash out 1,000 at the employer as a public amount.

5. Tax view

The tax authority decrypts the limbs straight from chain data. Salaries are the notes a pay run minted, counted even after they are spent. Notes minted by a transfer or cash-out are readable too, but they are the same money moving, so adding them would count carol's salary twice. Every note came with a proof, so these are the real amounts, not what the employer chose to report.

6. Try to under-report

The employer pays carol 5,000 but encrypts a smaller number to the tax authority. The limbs no longer match the committed salary, so no issuance proof exists and the pay run is refused. Drag the slider to 5,000 to make it honest again.

SECRET readable in this viewHIDDEN not readable in this viewPUBLIC on-chainHashes are illustrative.

With each pay run the employer proves “every salary note I’m creating hides some amount, and the copy of that amount encrypted to the tax authority’s registered key is the same amount”, without revealing any salary.

A salary note has three parts:

  • A commitment. A Pedersen commitment is a single curve point that hides a number, like a sealed envelope. Everyone can see it, nobody can read it, and nobody can later claim it held a different number. See Commitments & encryption.
  • The amount for the tax authority. The amount is encrypted with exponential ElGamal to the tax authority’s public key. Decrypting ElGamal ends in a search over small numbers, so the 64-bit amount is split into two 32-bit pieces, called limbs: amount = limb0 + 2³²·limb1. Each limb is encrypted separately.
  • Sealed openings. The opening is the amount plus the random blinding that hides it. It is encrypted once for the employee and once for the tax authority. Each reader decrypts their copy with a viewing key, a key that only reads notes and can’t spend them.

The proof ties the first two together. Without it, an employer could commit to 5,000 and encrypt 3,000 for the tax authority. With it, the ledger refuses to mint a salary note unless the limbs recombine to the committed amount. The openings are a convenience for readers: anyone who opens one checks it against the commitment, so a wrong opening is detected, not trusted.

ValueEmployerEmployeeTax authorityPublic
Each salary amountKnows itTheir own, from their payslipEvery one, from the limbsHidden, until it’s cashed out (see below)
Blinding (the random part of the commitment)Knows itTheir own, from their payslipFrom its copy of the openingHidden
Employee’s viewing keyNoYesNoNo
Tax authority’s secret keyNoNoYesNo
Note owner (the employee’s key hash)YesYesYesPublic
Commitment, limb ciphertexts, sealed openingsYesYesYesPublic, but unreadable
Issuance proofYesYesYesPublic
Tax authority’s public keyYesYesYesPublic, in the registry

Owners are public in this demo, so the transfer graph (who paid whom) is visible. The amounts are not, with one exception: cashing out. A cash-out pays a public amount, so cashing out a whole payslip publishes the salary it held. A partial cash-out shows that the note held at least the amount cashed out. Transfers between notes reveal no amounts.

  1. Register the tax key. The tax authority publishes its keys in an on-chain registry, with zero-knowledge proofs that it holds the matching secret keys. The payroll ledger reads the key from the registry, so the employer can’t substitute one it controls.
  2. Pay run. The employer builds one note per salary, one or two salaries per transaction, and proves the limb relation for each. The ledger validator verifies the proof against the commitments and limbs in the new notes’ datums and the key in the registry.
  3. Payslips. Each employee scans the chain with their viewing key, opens their note and checks that the opening recomputes the commitment. A note that is theirs but won’t open is reported, not ignored.
  4. Spend. An employee can transfer part of a salary to a colleague, or cash out at the employer for a public amount. Both are proved: the amounts balance, and every new note’s limbs are encrypted to the current tax key.
  5. Tax view. The tax authority decrypts the limbs of every salary note: the notes minted by pay runs, found in the ledger’s mint history, including ones already spent. It totals those per employee. It skips notes minted by a transfer or cash-out, whose transaction spent an existing note: those are the same salary moving, including change, and counting them would count a salary twice. It can still read their amounts. Each amount is proof-enforced.

This is the demo’s NoteIssueProof simplified to a single salary. The demo version handles one or two notes per pay run with @CircuitParam arrays, and keeps the limb relation in a shared AuditLimbs helper.

SalaryNoteProof.java
import org.zeroj.circuit.annotation.*;
import org.zeroj.circuit.lib.zk.ZkElGamal;
import org.zeroj.circuit.lib.zk.ZkElGamalPublicKey;
import org.zeroj.circuit.lib.zk.ZkPedersenCommitment;
import java.math.BigInteger;
@ZKCircuit(name = "salary-note", version = 1)
public class SalaryNoteProof {
private static final BigInteger TWO_32 = BigInteger.ONE.shiftLeft(32);
@Prove
void prove(ZkContext zk,
@Public ZkField noteU, @Public ZkField noteV, // the note's commitment
@Public ZkField pkU, @Public ZkField pkV, // the tax key, from the registry
@Public @FixedSize(8) ZkArray<ZkField> audit, // limb 0 then limb 1: A.u, A.v, B.u, B.v
@Secret @UInt(bits = 64) ZkUInt amount,
@Secret @UInt(bits = 252) ZkUInt blinding,
@Secret @UInt(bits = 32) ZkUInt limb0,
@Secret @UInt(bits = 32) ZkUInt limb1,
@Secret @UInt(bits = 252) ZkUInt k0,
@Secret @UInt(bits = 252) ZkUInt k1) {
// The note's commitment opens to (amount, blinding)
ZkPedersenCommitment.commit(zk, amount, blinding).assertAffineEquals(zk, noteU, noteV);
// The two 32-bit limbs recombine to the same amount
limb0.asField().add(limb1.asField().mul(zk.constant(TWO_32))).assertEqual(amount.asField());
// Each limb is an ElGamal encryption to the tax key, matching the public ciphertexts
var taxKey = ZkElGamalPublicKey.fromVerifierFixedPublic(zk, pkU, pkV);
ZkElGamal.encrypt(zk, limb0, k0, taxKey)
.assertAffineEquals(zk, audit.get(0), audit.get(1), audit.get(2), audit.get(3));
ZkElGamal.encrypt(zk, limb1, k1, taxKey)
.assertAffineEquals(zk, audit.get(4), audit.get(5), audit.get(6), audit.get(7));
}
}

Every public input comes from data the validator can see: the commitment and the limbs from the new note’s datum, and the key from the registry entry. The blinding is a full 252-bit secret, and each limb uses its own fresh 252-bit randomness, as the ElGamal profile requires.

The demo’s transfer proof (note-transfer) adds the balance rule, input = output 1 + output 2, with ZkPedersen.assertBalanced, and the same limb relation for both new notes.

The demo deploys one NoteLedger multi-validator for payroll, with token SAL and proved issuance switched on. In this mode the plain Issue redeemer is refused, so SAL can’t be minted without a proof. A ProvedIssue must:

  • carry a NoteIssueProof that verifies over the new notes’ commitments, the registry key and their limbs, taken from the transaction itself;
  • use pairwise-distinct handles A across every limb ciphertext in the transaction, which catches exact reuse of encryption randomness within the transaction (reused randomness would reveal the difference between two limbs);
  • place each note at the ledger’s exact address, with the exact datum shape and exactly one token;
  • be signed by the employer.

Transfers and cash-outs use the same ledger’s Transfer and Redeem paths, also proved, and require the note owner’s signature.

Transaction (demo)Circuit sizeScript budget (steps)Fee
Pay run, one salary15,890 constraints50.5% (JuLC VM)—
Pay run, two salaries31,773 constraints71.3% (Yaci DevKit)1.111 ADA
Transfer34,184 constraints75.8% (Yaci DevKit)1.163 ADA
Cash-out18,366 constraints57.8% (Yaci DevKit)0.984 ADA

Budgets are shares of the per-transaction step limit, from zeroj-usecases ADR-0007 (r3). Fees were measured on Yaci DevKit with mainnet protocol parameters after the demo’s fee optimization (commit 814b2f0). They were measured before ZeroJ PRs #85 and #86 lowered the cost of the on-chain Groth16 verifier, so ZeroJ 0.1.0-pre13 and later should come in somewhat lower.

A valid proof is not authorization. The ledger also checks the employer’s signature, the owner’s signature on spends, the registry reference input and the exact output shape. See Application security.

  • Supply is still trusted. The proof stops the employer under-reporting what it pays. It doesn’t stop the employer paying salaries that don’t exist, or paying nobody. Payroll truth outside the chain is still the employer’s.
  • Cashing out reveals amounts. The cash-out amount is public. Cashing out a whole note publishes its amount, which for a fresh payslip is the salary. A partial cash-out bounds it from below.
  • Openings are only length-checked on-chain. A validator can’t decrypt a sealed opening, so a garbage payslip is accepted. The employee sees an unopenable note, and should treat that as evidence against the sender. The tax authority’s amount comes from the proved limbs, so it is unaffected.
  • The tax key is trusted for confidentiality. Whoever holds the tax authority’s secret key reads every salary, past and future. Key rotation stops new notes using a retired key, but doesn’t hide old ones.
  • Demo custody. The demo server holds every wallet’s spending and viewing keys and the tax authority’s secrets, and scans the chain for everyone. Its API is the operator’s view, so the privacy described here holds against chain and mempool observers, not against the demo server. A real deployment scans inside each user’s own wallet and never ships viewing keys to a server.
  • Unreviewed assumptions. The confidential-note profile’s assumptions A1–A3 (ZeroJ ADR-0055) and the demo’s protocol haven’t had external review.
  • Trusted setup. The demo uses a single-party development setup, so whoever ran it could forge proofs. Production keys need a multi-party ceremony (Trusted setup, explained).
  • Not audited. This is a blueprint of a protocol pattern, not a production payroll system.

The demo is the Confidential payroll tab of the pedersen-commitments app in zeroj-usecases. With Yaci DevKit running (see Run the demos):

Terminal window
./demo.sh pedersen
# opens http://localhost:8093; choose "Confidential payroll"

To run it without Docker, use Java 25 and ./gradlew -p pedersen-commitments bootRun -PwithFrontend from the repository root.

The first start runs development setups for every circuit and takes several minutes; later starts reuse the cached keys. In the payroll tab, pay a salary, open payslips, transfer and cash out, and watch the tax authority’s table fill in. Then try the cheats: under-report a salary (no proof exists), send a garbage payslip (unopenable for the employee, still readable by the tax authority) and use the tax authority’s key after a rotation (refused).