> ## Documentation Index
> Fetch the complete documentation index at: https://docs.confiroll.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payslips

> Generate encrypted, tamper-evident payslips for each cycle and anchor them on-chain with a single Merkle root.

Confiroll produces a **payslip** for every contractor in a pay cycle. Each payslip is
end-to-end encrypted to its contractor, so only that contractor can read it, and the whole
cycle is anchored on-chain with a single fingerprint, so every payslip is tamper-evident. The
documents stay encrypted and off-chain. Only a hash goes to the network.

## What you see

The Payslips screen lists your pay cycles, newest first, with an anchored badge on each cycle
that has been committed to the chain. Selecting a cycle expands its recipient list, its anchor
status, and a download control. A single **Anchor cycle** action commits the whole cycle at
once.

### Cycles list

| Column    | What it shows                                                                  |
| --------- | ------------------------------------------------------------------------------ |
| Cycle     | The pay cycle label, for example "August 2026".                                |
| Date      | When the cycle's payslips were generated.                                      |
| Headcount | The number of contractors with a payslip in this cycle.                        |
| Anchored  | Whether the cycle's fingerprint is committed on-chain, with the anchor status. |
| Download  | Pull the payslips for the cycle, or a single recipient's document.             |

## How it works

<Steps>
  <Step title="Generate payslips for a run">
    After a payroll run settles, generate the cycle's payslips. Each document is built for one
    contractor and encrypted to that contractor's public viewing key, so only the holder of the
    matching key can open it. Your amounts, read from your private ledger, populate each
    payslip on your device.
  </Step>

  <Step title="Anchor the cycle on-chain">
    Confiroll commits the whole cycle as a single Merkle root to the on-chain payslip anchor. It
    stores only that hash. It never writes the payslip contents and never writes an amount. This
    step costs you 0 XLM, because the fee is sponsored.
  </Step>

  <Step title="Contractors download and verify">
    Each contractor downloads their payslip, decrypts it locally with their own viewing key, and
    verifies it against the on-chain anchor. If the document matches the anchored fingerprint,
    it is authentic and unaltered.
  </Step>
</Steps>

## What is on-chain versus off-chain

<CardGroup cols={2}>
  <Card title="On-chain" icon="hashtag">
    One Merkle root per cycle: a single fingerprint that commits to every payslip in the cycle
    at once. No contents. No names. No amounts. Just a hash anyone can check against.
  </Card>

  <Card title="Off-chain" icon="lock">
    The payslip documents themselves, each end-to-end encrypted to its contractor. They stay
    encrypted at rest and are readable only by the contractor who holds the matching viewing
    key.
  </Card>
</CardGroup>

<Info>
  Anchoring is **tamper-evidence, not publication**. The anchor lets anyone confirm that a
  payslip has not changed since it was issued. It does not put the payslip, the contractor, or
  the amount on-chain. The figure stays inside the encrypted document, which never leaves the
  off-chain store in readable form.
</Info>

## One anchor for the whole cycle

Because the entire cycle is committed as a single Merkle root, anchoring costs the same whether
you pay 3 people or 300. You write one fingerprint per cycle, not one per payslip.

<Note>
  A Merkle root is a single hash that stands in for a whole set of documents. Each payslip sits
  in the tree, and the root at the top changes if any leaf changes. That is what makes one small
  on-chain write cover an entire headcount. See
  [Soroban contracts](/developers/contracts) on the Developers tab for the anchor's design.
</Note>

## Tamper-evidence explained

<Steps>
  <Step title="The fingerprint is fixed at issue time">
    When you anchor a cycle, the Merkle root is written to the chain and cannot be changed. It is
    a permanent commitment to exactly the payslips that existed at that moment.
  </Step>

  <Step title="Verification recomputes and compares">
    When a contractor verifies a payslip, their device recomputes the fingerprint from the
    document they hold and checks it against the anchored root on-chain.
  </Step>

  <Step title="Any change breaks the match">
    Alter a single character in a payslip and its recomputed fingerprint no longer matches the
    anchor. The verification fails, and the alteration is caught. An unaltered payslip always
    verifies.
  </Step>
</Steps>

## FAQ

<AccordionGroup>
  <Accordion title="Can anyone else read a contractor's payslip?">
    No. Each payslip is end-to-end encrypted to a single contractor's public viewing key. Only
    the contractor holding the matching key can decrypt and read it. Confiroll stores the
    encrypted document but cannot open it, and no other contractor or employer can either.
  </Accordion>

  <Accordion title="Does anchoring a cycle reveal the amounts?">
    No. Anchoring writes only a Merkle root, a single hash for the whole cycle. It never writes
    the payslip contents, the contractor identities, or any amount. The figures stay inside the
    encrypted documents, off-chain. The anchor proves the documents have not been tampered with,
    nothing more.
  </Accordion>

  <Accordion title="What happens if a payslip is altered?">
    Verification catches it. A contractor's device recomputes the fingerprint from the document
    and compares it to the on-chain anchor. If even one character changed, the fingerprints no
    longer match and verification fails. An unaltered payslip verifies cleanly against the
    anchor.
  </Accordion>

  <Accordion title="What does anchoring cost, and does headcount change it?">
    Anchoring a cycle costs you 0 XLM, because the fee is sponsored. Headcount does not change
    that, and it does not change the on-chain work either: the whole cycle commits as one Merkle
    root, so anchoring is a single write whether you pay 3 people or 300.
  </Accordion>
</AccordionGroup>
