Finite Fields - The Hidden Math Powering Blockchains

Finite Fields - The Hidden Math Powering Blockchains

Source: Dev.to

What is a finite field? ## Why blockchains care ## What’s a field element? ## Why the code looks the way it does ## What’s next Week 1: Finite Field Elements, the math quietly powering blockchains A few weeks ago, I promised a public build challenge: we’d explore blockchain from the ground up in Go, week by week, sharing insights, code, and the intuition behind it all. Here’s the first installment. Before elliptic curves, digital signatures, or zero-knowledge proofs, blockchains rely on something much more fundamental: finite fields. If this concept isn’t clear, cryptography feels like magic. If it is clear, everything else starts to click. A finite field works the same way, except: That last point is why primes matter so much in cryptography. Finite fields give us: Elliptic curves, ECDSA, Schnorr, all of it is built on top of this. If arithmetic isn’t perfectly predictable, cryptography collapses. A field element is just: a number that lives inside a finite field So “7” and “7 mod 19” are not the same thing mathematically. That’s exactly what my FieldElement type models: a value plus the field it belongs to. we make invalid math impossible to ignore. Errors show up early instead of silently breaking cryptographic logic later. That’s intentional. With finite fields in place, we’re ready to move up the stack: Check out the full Go implementation here: https://github.com/Caleb40/elliptic-curves-go This post is about understanding why the code exists, not just making it compile. If you want the next post to dive into inverses or elliptic curves themselves, drop a comment below. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse - The numbers only go from 0 to 11 - 9 + 5 doesn’t give 14, it gives 2 - That’s modular arithmetic - The “clock size” is a prime number - Every non-zero number has an inverse - Division is always possible - Deterministic math - No floating point errors - No rounding ambiguity - Guaranteed inverses (critical for signatures) - values always stay within the field - operations only happen between elements of the same field - Elliptic curve points - Point addition and scalar multiplication - Digital signatures