> For the complete documentation index, see [llms.txt](https://valargroup.gitbook.io/shielded-vote-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://valargroup.gitbook.io/shielded-vote-docs/circuit-components/overview.md).

# Overview

The three ZKPs in Shielded Vote are built from reusable circuit components (gadgets). Many are adapted from the Orchard circuit specification; others are new to the governance protocol.

## Components from Orchard (reused or adapted)

| Component                                                                                                                                                     | Used in        | Notes                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ---------------------------------------------------------- |
| [Note Commitment Integrity](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/note-commitment-integrity.md)         | ZKP #1         | Standard Orchard NoteCommit                                |
| [Nullifier Derivation](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/nullifier-derivation.md)                   | ZKP #1         | Standard Orchard DeriveNullifier                           |
| [Merkle Tree Membership](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/merkle-tree-membership.md)               | ZKP #1, #2, #3 | Adapted to use Poseidon; conditional skip for padded notes |
| [Diversified Address Integrity](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/diversified-address-integrity.md) | ZKP #1         | Standard Orchard ivk check                                 |
| [Spend Authority](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/spend-authority.md)                             | ZKP #1, #2     | Standard SpendAuthSig rerandomization                      |

## New components

| Component                                                                                                                                                     | Used in        | Notes                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ----------------------------------------------------------- |
| [Rho Binding](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/rho-binding.md)                                     | ZKP #1         | Binds signed note to delegated notes and round              |
| [Governance Nullifier](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/governance-nullifier.md)                   | ZKP #1         | Domain-separated nullifier for double-delegation prevention |
| [VAN Nullifier](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/van-nullifier.md)                                 | ZKP #2         | Nullifier for Vote Authority Notes                          |
| [Share Nullifier](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/share-nullifier.md)                             | ZKP #3         | Nullifier for individual vote shares                        |
| [Proposal Authority Decrement](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/proposal-authority-decrement.md)   | ZKP #2         | Bitmask decrement for proposal permissions                  |
| [Shares Range Check](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/shares-range-check.md)                       | ZKP #2         | Range proof for each share value                            |
| [El Gamal Encryption Integrity](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/el-gamal-encryption-integrity.md) | ZKP #2         | Proves valid El Gamal ciphertext construction               |
| [Shares Hash Integrity](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/shares-hash-integrity.md)                 | ZKP #2, #3     | Flat hash over 16 encrypted shares                          |
| [Vote Commitment Integrity](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/vote-commitment-integrity.md)         | ZKP #2, #3     | Hash of domain tag + shares hash + proposal + decision      |
| [Domain Tag Separation](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/domain-tag-separation.md)                 | ZKP #1, #2, #3 | Prevents VAN/VC collision in shared tree                    |

## Infrastructure

| Component                                                                                                                               | Used in | Notes                                                              |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------ |
| [Poseidon Hash](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/poseidon-hash.md)           | All     | Used throughout for commitments, nullifiers, and Merkle tree nodes |
| [IMT Non-Membership](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/imt-non-membership.md) | ZKP #1  | Exclusion proof against the nullifier IMT                          |
| [Ballot Scaling](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/ballot-scaling.md)         | ZKP #1  | Floor-division of zatoshi balance into ballot count                |

## Implementation note: range checks via 10-bit lookup

All range checks in the circuit use a **10-bit lookup table** (`LookupRangeCheckConfig<K=10>`), which decomposes a value into 10-bit words. This means the table can only directly enforce bit-widths that are multiples of 10 (10, 20, 30, …).

To enforce an exact N-bit range where N is not a multiple of 10, the circuit **pre-multiplies the value by `2^(k - N)`** (where `k` is the smallest multiple of 10 ≥ N) before passing it to the range check. This left-shift ensures any value ≥ 2^N overflows the k-bit window and fails the lookup.

For example, to check that `x < 2^26`:

1. Compute `x_shifted = x * 2^4` (since 30 is the next multiple of 10 above 26)
2. Range-check `x_shifted` with 3 words × 10 bits = 30 bits

If `x ≥ 2^26`, then `x * 2^4 ≥ 2^30`, which exceeds the 30-bit range and fails. This pattern is used in [Ballot Scaling](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/ballot-scaling.md) and [Shares Range Check](https://github.com/z-cale/shielded-vote-book/blob/main/circuits/shielded_vote_book/circuits/shares-range-check.md).
