Skip to content

andyguzmaneth/pir-from-scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PIR From Scratch

A ground-up, tutorial-style implementation of Private Information Retrieval (PIR) — motivated by the problem of reading Ethereum state without revealing what you're looking for.

The Problem

When you check your ETH balance, your wallet asks a remote server: "What is the state at address 0x1234...?"

The server now knows your address. This leaks:

  • That you own this address
  • When you're checking it (before a transaction, after news, etc.)
  • Patterns across queries over time

PIR is a cryptographic protocol that lets a client retrieve a database entry without the server learning which entry was fetched.

Learning Path

Work through these in order. Each chapter builds on the last.

Chapter Concept Key Insight
01 — Naive PIR Download everything The trivially correct solution. Sets the baseline.
02 — Two-Server PIR XOR secret sharing No crypto needed. Two non-colluding servers. Elegant.
03 — Single-Server PIR LWE-based (SimplePIR) One server. Needs lattice crypto. Real-world practical.
04 — Sharded PIR Slice + decoy queries How to handle heterogeneous databases efficiently.
05 — Ethereum Context Applied to chain state Connects to the sharded PIR proposal by Ali Atiia & Keewoo Lee.

Prerequisites

  • Python 3.10+
  • numpy (pip install numpy)
  • No other dependencies until chapter 03

Background Reading

Why This Repo Exists

This is a learning-by-building exercise. The goal is not production code — it's intuition. Each implementation is intentionally minimal and annotated.

If something breaks in an instructive way, that's the point.

About

Private Information Retrieval from scratch — 5-chapter tutorial building toward Ethereum state privacy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages