惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园_首页
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
G
Google Developers Blog
Last Week in AI
Last Week in AI

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Bitcoin’s Secret Math: Modular Arithmetic & Finite Fields
Muhammad Ade · 2026-05-15 · via DEV Community

Of the major problems Bitcoin set out to solve, one was the risk of centralization — and that’s part of what has made it one of the quickest growing currency today. Another was the issue of security.
Both of these are deeply tied to cryptography — the science of securing information using mathematical algorithms.
At the heart of the cryptography that powers Bitcoin are modular arithmetic and finite field.

Modular Arithmetic

Simpler than it sounds, it’s something you already use every day whenever you read a clock.

Modular arithmetic deals with the remainder left after division.

An analog clock never shows 13, 14, or 30. It counts from 1 to 12, then wraps back around. A digital clock goes up to 24, but if your clock reads 23:00 and you want to convert it to a 12-hour format, you apply modulo 12. Here’s the idea: numbers wrap around once they hit a limit. In this case: 23 mod 12 = 11 So, 23:00 becomes 11 PM.

No matter how large the number gets, modulo arithmetic always brings it back within a fixed range. Bitcoin leans on this heavily — the specific modulus it uses is a 256-bit prime number: p = 2²⁵⁶ − 2³² − 977, chosen for both its size and its mathematical properties. Every arithmetic operation in Bitcoin's cryptography runs against this prime, ensuring results stay within a predictable, bounded space.

Finite Fields

A finite field is a set with a finite number of elements that supports four operations — addition, subtraction, multiplication, and division (except by zero) — while always producing a result that still remains within the set.
This property is known as closure.
For example, if your finite field is {0, 1, 2, 3, 4, 5, 6} (a field of order 7), then:

3 + 5 = 8 → 8 mod 7 = 1  ✅ (still inside the set)
6 * 3 = 18 → 18 mod 7 = 4  ✅ (still inside the set)

Enter fullscreen mode Exit fullscreen mode

But there’s one important condition: the number of elements in the field must be a prime number, or a power of a prime.
This guarantees that every element (aside from zero) has a multiplicative inverse, which makes division possible without breaking out of the field.

In Bitcoin's case, the finite field has exactly p elements — that same 256-bit prime — giving it an astronomically large but still finite and well-structured space to operate in. Division inside this field works through something called Fermat's Little Theorem: instead of dividing by a, Bitcoin computes a^(p−2) mod p, which gives the same result while staying entirely within the field.

Why does Bitcoin care?

Bitcoin’s security is built on elliptic curve cryptography — a branch of cryptography where private keys, public keys, and signatures are generated through mathematical operations on points on a curve. The specific curve Bitcoin uses is called secp256k1, defined by the equation y² = x³ + 7, and all point operations on it happen inside the finite field described above.

The challenge is that, without boundaries, these operations would produce numbers that grow astronomically large, very quickly.

Finite fields solve this problem. By performing elliptic curve operations inside a finite field using modular arithmetic, Bitcoin keeps every result bounded within a fixed range. A private key is simply a random integer between 1 and the curve's order n — another large prime, close in size to p. The corresponding public key is derived by multiplying a fixed starting point G (the generator point) by that private key, entirely using modular arithmetic.

In practice, this means the numbers never grow beyond a fixed size (256 bits for bitcoin), making the cryptography both secure and computationally feasible.

Finite fields are a major reason Bitcoin’s cryptography can actually work efficiently in the real world.