A historical archive and analysis tool for Ethereum smart contracts, with a focus on the 2015-2017 era when standards were still forming.
This is not a trading site, block explorer, or dashboard. It is a long-term preservation effort — part museum, part research terminal, part Wikipedia for Ethereum’s earliest code.
ethereumhistory/
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── page.tsx # Homepage
│ │ ├── contract/
│ │ │ └── [address]/ # Contract detail page
│ │ └── api/ # API routes
│ ├── components/ # React components
│ ├── lib/ # Utilities and DB queries
│ └── types/ # TypeScript types
├── pipeline/
│ └── similarity/ # Python bytecode analysis
│ ├── normalize.py # Bytecode normalization
│ ├── fingerprint.py # Fingerprint generation
│ ├── similarity.py # Similarity computation
│ ├── export.py # Export to PostgreSQL
│ └── main.py # CLI entry point
├── db/
│ └── schema.sql # Database schema
├── seeds/
│ ├── sample_contracts.json # Sample contract data
│ └── seed_database.sql # Seed SQL
└── README.md
cd ethereumhistory
npm install
cp .env.example .env.local
# Edit .env.local with your database URL
By default, if POSTGRES_URL is set the app will only use Postgres (and will not parse the large data/*.json files).
If you explicitly want JSON fallback even when Postgres is configured, set:
ALLOW_JSON_FALLBACK=1
docker compose up -d
The Docker database listens on localhost port 5433 (so it won’t conflict with an existing local Postgres on 5432).
This will create a local database and run:
db/schema.sqlnpm run db:import
If you need to re-run init scripts:
docker compose down -v
docker compose up -d
npm run dev
Open http://localhost:3000.
The similarity pipeline runs offline to precompute relationships between contracts.
cd pipeline
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
From JSON file:
python -m similarity.main --input ../seeds/sample_contracts.json --output ./results
From database:
export POSTGRES_URL="postgresql://..."
python -m similarity.main --from-db --output ./results
Custom thresholds:
python -m similarity.main --input contracts.json --threshold 0.7 --max-matches 5 --output ./results
bytecode_analysis.csv - Fingerprints for each contractcontract_similarity.csv - Pairwise similaritiescontract_similarity.jsonl - JSON Lines formatcontract_similarity.sql - SQL INSERT statementspsql "$POSTGRES_URL" -f results/contract_similarity.sql
Or use COPY:
COPY contract_similarity FROM 'results/contract_similarity.csv' WITH (FORMAT csv, HEADER true);
The similarity score is computed as:
similarity_score =
0.70 * jaccard(opcode_ngrams) # Primary: structural similarity
+ 0.20 * control_flow_similarity # Secondary: behavioral similarity
+ 0.10 * shape_similarity # Tertiary: size/complexity match
GET /api/contract/[address]Returns full contract data including analysis and similar contracts.
GET /api/search?q=[address]Quick lookup for an address.
GET /api/featuredReturns featured historical contracts for the homepage.
Key tables:
contracts - Core contract databytecode_analysis - Parsed bytecode metricscontract_similarity - Precomputed similaritiesdetected_patterns - Heuristic pattern detectionfunction_signatures - Known function selectorsethereum_eras - Historical era definitionsThe most valuable contribution is adding historical narratives to contracts. These require research and should be:
Pattern detection heuristics can always be improved. All heuristics should:
MIT
Ethereum has a history worth preserving.