Skip to content

Commit 04a76fb

Browse files
leanthebeanclaude
andcommitted
docs: emphasize the ~384-bit exponent and add per-signature hint table
In the Intuition section: highlight that the on-chain exponent m-2 is itself a ~384-bit number (~10^115) — the reason the MODEXP step is so costly — and add the 48-byte hint definition plus the per-signature hint-bytes / inverse-count table for a cold attestation. Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 86ddb84 commit 04a76fb

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

docs/hinted-p384-nitro-attestation.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ Take a tiny modulus `m = 7` and find the inverse of `b = 3`:
4949

5050
- **The hard way (what the contract used to do):** compute `inv = b^(m−2) mod m`
5151
(Fermat's little theorem) = `3^5 mod 7`. `3^5 = 243`, and `243 mod 7 = 5` — several
52-
multiplications to get there.
52+
multiplications to get there. In this toy example the exponent `m−2` is just `5`, but
53+
for real P-384 the modulus is a **384-bit** number, so the exponent `m−2` is *also*
54+
~384 bits — a value around 10¹¹⁵. Raising to a power *that* size is what makes the step
55+
so expensive (and it's why the curve is called *p384*).
5356
- **The easy way (checking a proposed answer):** someone hands you `inv = 5`. One
5457
multiply: `3 · 5 = 15`, `15 mod 7 = 1` ✓ — done.
5558

@@ -60,9 +63,9 @@ Take a tiny modulus `m = 7` and find the inverse of `b = 3`:
6063

6164
Now scale up: the real modulus is a 384-bit number, not 7.
6265

63-
- **Finding** the inverse (`b^(m−2)`) means raising to a 384-bit power — hundreds of
64-
big-number multiplications via the EVM's `MODEXP` precompile, which Fusaka made ~10×
65-
more expensive.
66+
- **Finding** the inverse (`b^(m−2)`) means raising to that ~384-bit exponent — hundreds
67+
of big-number multiplications via the EVM's `MODEXP` precompile, which Fusaka made ~10×
68+
more expensive. And a single signature verify does this ~570 times.
6669
- **Checking** a proposed inverse is still one big-number multiply — cheap, and Fusaka
6770
barely touches it.
6871

@@ -90,6 +93,20 @@ One P-384 signature verify needs ~570 of these inverses.
9093
machine) and sends them as a list in calldata; the contract pops them one at a time
9194
and checks each with a single multiply.
9295

96+
Each hint is a **48-byte number** (the inverse), and a verify needs ~570 of them, so the
97+
calldata is roughly 570 × 48 ≈ 27 KB per signature. A cold attestation has five such
98+
signatures:
99+
100+
| signature | hint bytes | inverses (÷ 48) |
101+
|---|---:|---:|
102+
| CA cert 1 | 27,456 | 572 |
103+
| CA cert 2 | 27,408 | 571 |
104+
| CA cert 3 | 27,408 | 571 |
105+
| client / leaf cert | 27,504 | 573 |
106+
| COSE document | 27,312 | 569 |
107+
108+
(§6 maps these five signatures to transactions; §7 has their gas.)
109+
93110
The list is just values back-to-back, consumed in order:
94111

95112
```

0 commit comments

Comments
 (0)