Zeeka saysAll blockchain cryptography lives in a finite field — integers mod a prime, where add, multiply, and invert always stay in range and wrap around.
Strip a blockchain down far enough and you reach a finite field: the integers 0…p−1 for some prime p, with arithmetic done mod p. Addition and multiplication wrap around, so results never grow out of a fixed size — which is exactly why keys, hashes, and signatures are fixed-length. The magic property is that every nonzero element has a multiplicative inverse, so you can "divide" in a field even though there are no fractions.
You rarely divide directly; instead you multiply by the inverse, found with Fermat's little theorem: a⁻¹ ≡ a^(p−2) mod p. Elliptic curves, hash functions, and zero-knowledge circuits all compute inside a field, so getting comfortable with modular add / multiply / invert is the prerequisite for everything that follows in this track.
Power-ups you unlock
A finite field GF(p) = the integers 0..p−1 with arithmetic mod a prime p
Every nonzero element has a multiplicative inverse (unlike plain integers)
Fermat: a⁻¹ ≡ a^(p−2) mod p — invert by exponentiating
Curves, hashes, and ZK circuits all compute inside a field
Wrapping (mod) is what keeps keys and signatures fixed-size
The Collision attacks — common mistakes
Using floating point — field math must be exact integer arithmetic
Forgetting to reduce mod p after every operation
Assuming division exists — you multiply by the modular inverse instead
Picking a non-prime modulus, so inverses stop existing
Boss battleCompute the modular inverse of 42 in GF(97) and verify 42 × inverse ≡ 1 (mod 97).
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>
const p = 97; // a small prime field GF(97)
const add = (a,b)=> (a+b) % p;
const mul = (a,b)=> (a*b) % p;
const pow = (a,e)=>{ let r=1; a%=p; while(e>0){ if(e&1) r=mul(r,a); a=mul(a,a); e>>=1; } return r; };
const inv = (a)=> pow(a, p-2); // Fermat: a^(p-2) ≡ a⁻¹ (mod p)
const a = 42, ai = inv(a);
document.getElementById('o').textContent = [
'field GF(' + p + ')',
'42 + 70 = ' + add(42,70) + ' (wraps mod ' + p + ')',
'42 × 70 = ' + mul(42,70),
'inverse of 42 = ' + ai + ' (= 42^(p-2) mod p)',
'check 42 × ' + ai + ' mod ' + p + ' = ' + mul(a,ai) + ' ← must be 1'
].join('\n');
</script></body></html>