8000 GitHub - dirvine/easy_keys: 4-word mnemonic system for cryptocurrency address encoding with critical first-word dependency
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dirvine/easy_keys

Repository files navigation

Easy Keys

Exploring fun, creative, and human-friendly ways to memorize high-entropy data like passwords and crypto keys 🎨🎵🎮

Python 3.11+ License: MIT UV

🚀 Project Vision

Easy Keys is a research project investigating innovative approaches to help humans memorize high-entropy data (like cryptocurrency keys) in ways that are:

  • Fun & Engaging: Turn security into games, stories, and experiences
  • Multi-Sensory: Beyond just words - colors, sounds, movements, and more
  • Personally Meaningful: Adapt to individual learning styles
  • Scientifically Grounded: Based on cognitive science and memory research

🔑 Core Discovery: Critical First Word

Our initial 4-word mnemonic system demonstrates a critical insight: the first word is absolutely essential. Without the correct first word ("public" or "secret"), the remaining 3 words become completely meaningless.

✅ Valid:   public mountain river storm
❌ Invalid: secret mountain river storm  (wrong first word)
❌ Invalid: mountain river storm        (missing first word = meaningless)

🎨 Creative Encoding Systems

We've implemented multiple innovative encoding approaches:

🌈 Visual Systems

  • Color Grids: 4x4 grids of perceptually distinct colors
  • Geometric Patterns: Shapes, rotations, and spatial arrangements
  • Visual Stories: Comic-strip style narrative panels

🎵 Musical Systems

  • Melodies: Notes, octaves, and rhythms you can hum
  • Soundscapes: 3D environmental audio experiences
  • Chord Progressions: Emotional journeys through harmony

🏛️ Spatial & Movement

  • Memory Palaces: Virtual rooms with memorable objects
  • Dance Sequences: Body movements and gestures
  • Map Journeys: Real-world landmark navigation

🎮 Gamified Systems

  • RPG Quests: Heroes, battles, and epic rewards
  • Puzzle Games: Levels, challenges, and achievements
  • Leaderboards: Competitive stats and memorable plays

🌐 Multi-Modal Hybrids

  • Personalized Learning: Adapts to your cognitive style
  • Synesthetic Encoding: Cross-sensory experiences
  • Adaptive Systems: Learns from your performance

📊 What We've Learned

💡 Exciting Discoveries

  • Memory is Multi-Dimensional: Different people remember differently
  • Stories Beat Random: Narrative structures improve retention 10-100x
  • Fun Improves Security: Engaged users create stronger, more memorable keys
  • Multiple Pathways Help: Redundancy through different senses aids recall

⚠️ Current Limitations

  • Words Alone: Limited to ~11 bits per word, requiring many words for full entropy
  • Cultural Barriers: Word meanings vary across languages and cultures
  • Cognitive Load: 14+ words becomes challenging for most users
  • Static Nature: Words don't adapt to individual preferences

🔮 Future Explorations

We haven't yet explored but are excited about:

  • Voice Recognition: Unique vocal patterns and speech characteristics
  • Video Entropy: Facial expressions, gestures, and movement patterns
  • Biometric Integration: Combining memorable patterns with personal traits
  • AR/VR Experiences: Immersive 3D memory environments
  • Social Proof Systems: Distributed verification without central authority

🔬 Research Findings

  • Original 4-word system: Proves concept but limited coverage (~13% of address)
  • Perfect fidelity: 17 words required for 100% address representation
  • Optimized system: 14 words achieved (17.6% reduction)
  • Theoretical limit: 9-10 words identified (requires advanced encoding)
  • Alternative modalities: Visual/audio/spatial can encode 20-50 bits per element

See RESEARCH.md for optimization strategies and CREATIVE_ALTERNATIVES.md for non-word approaches.

🚀 Quick Start

Installation

# Install UV package manager (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and run
git clone https://github.com/dirvine/easy_keys.git
cd easy_keys
uv run python -m easy_keys --help

Try Creative Encoders

# Test all creative encoding systems
uv run python test_creative_encoders.py

# Or try individual encoders:
uv run python -m easy_keys.visual_encoder      # Color grids and patterns
uv run python -m easy_keys.musical_encoder     # Melodies and soundscapes
uv run python -m easy_keys.spatial_encoder     # Memory palaces and movements
uv run python -m easy_keys.gamified_encoder    # RPG quests and puzzles
uv run python -m easy_keys.multimodal_encoder  # Personalized combinations

Basic Word-Based Usage

# Encode Ethereum address as public
uv run python -m easy_keys encode --type public --address 0x742d35Cc6cA6CE02036dBdE3e8Bf13f96Db9F141

# Encode Bitcoin address as secret  
uv run python -m easy_keys encode --type secret --address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

# Validate a mnemonic
uv run python -m easy_keys validate public mountain river storm

# Demonstrate first word criticality
uv run python -m easy_keys criticality mountain river storm

# Run system tests
uv run python -m easy_keys test --verbose

Example Creative Outputs

🎨 VISUAL: 4x4 Color Grid
[🟥][🟦][🟩][🟨]    "In the north: sunset, ocean, forest, sunshine"
[🟪][🟦][🟧][🟩]    "In the east: twilight, ocean, flame, forest"
[🟦][🌸][🟩][🟩]    "In the south: ocean, blossom, forest, forest"
[🟧][🟦][🟦][🟥]    "In the west: flame, ocean, ocean, sunset"

🎵 MUSICAL: Melody Sequence
Notes: C4 D5 E4 F5 G4 A5 B4 C5
Rhythm: ♩ ♪♪ ♩ ♬♬♬♬
Story: "ascending like sunrise → bouncing like a ball → wandering freely"

🏛️ SPATIAL: Memory Palace Journey
"In the kitchen, you see a large black dishwasher placed left.
 Leading to the garage with its tiny white bikes by the window..."

🎮 GAMIFIED: RPG Quest
"You are a Level 15 Rogue with earthquake technique
 Journey to the Underwater Palace, defeat the Giant Spider
 Face the Ancient Goblin - weakness: stealth!"

🌐 MULTI-MODAL: Personal Experience
"In a beach, discover a circle glowing with orange light.
 Hear syncopated violin filling you with mystery.
 The soft surface tastes bitter, guiding you west..."

🧮 How It Works

Algorithm Overview

  1. Address → Integer: Convert crypto address to numerical value
  2. Integer → Words: Map to 3 words from 16K+ dictionary (14 bits each)
  3. Checksum Calculation: checksum = (word2_index + word3_index + word4_index) % 2
  4. Parity Rule:
    • Even checksum (0) → requires "public" first word
    • Odd checksum (1) → requires "secret" first word
  5. Critical Dependency: Wrong first word = invalid mnemonic

Example Workflow

# 1. Encode
address = "0x742d35Cc6cA6CE02036dBdE3e8Bf13f96Db9F141"
mnemonic = encode_address(address, "public")
# → ["public", "mountain", "river", "storm"]

# 2. Validate checksum
checksum = calculate_checksum(["mountain", "river", "storm"])  # → 0 (even)
# Even checksum requires "public" first word ✅

# 3. Test wrong first word  
wrong_mnemonic = ["secret", "mountain", "river", "storm"]
# Checksum is still 0 (even) but "secret" requires odd → INVALID ❌

# 4. Decode
key_type, addr_int = decode_mnemonic(["public", "mountain", "river", "storm"])
# → ("public", 1234567890...)

📊 Supported Cryptocurrencies

  • Ethereum (ETH): Standard addresses (0x...)
  • Bitcoin (BTC): Legacy (1...), SegWit (3...), Bech32 (bc1...)

🛠 CLI Commands

encode - Convert address to mnemonic

uv run python -m easy_keys encode --type public --address 0x742d35Cc...

decode - Convert mnemonic to address info

uv run python -m easy_keys decode public mountain river storm

validate - Check mnemonic validity

uv run python -m easy_keys validate public mountain river storm --detailed

criticality - Demonstrate first word dependency

uv run python -m easy_keys criticality mountain river storm
# Shows which first word is required and why others fail

batch - Process multiple addresses

echo "0x742d35Cc6cA6CE02036dBdE3e8Bf13f96Db9F141" > addresses.txt
uv run python -m easy_keys batch --input-file addresses.txt --output-file results.txt

test - Run verification tests

uv run python -m easy_keys test --verbose

examples - Show usage examples

uv run python -m easy_keys examples

🔬 Proving First Word Criticality

The system includes built-in tests that prove the first word is critical:

# Test that demonstrates the critical dependency
uv run python -m easy_keys criticality ability absence academy

# Output shows:
# ✅ Required first word: secret
# ✅ Checksum: 1 (odd)
# 🧪 Testing all possible first words:
#   ✅ 'secret' + words → VALID
#   ❌ 'public' + words → INVALID (Checksum mismatch)
#   ❌ 'invalid' + words → INVALID (must be 'public' or 'secret')

⚠️ Security Warning

🚨 EDUCATIONAL PURPOSE ONLY 🚨

  • Never use with real private keys in production
  • This is a simplified encoding scheme, not cryptographically secure
  • Real applications should use established standards like BIP39
  • Always validate inputs and sanitize outputs
  • No network transmission of sensitive data

🧪 Testing

Run the comprehensive test suite:

# Unit tests
uv run python -m pytest tests/ -v

# Integration tests with coverage
uv run python -m pytest tests/ --cov=easy_keys --cov-report=html

# Built-in system tests
uv run python -m easy_keys test --verbose

🏗 Development

Project Structure

easy_keys/
├── easy_keys/                    # Main package
│   ├── cli.py                   # Command-line interface
│   ├── encoder.py               # Core encoding logic
│   ├── validator.py             # Validation algorithms
│   ├── dictionary.py            # Word dictionary management
│   ├── crypto_utils.py          # Address utilities
│   ├── perfect_encoder.py       # 17-word perfect fidelity
│   ├── optimal_encoder.py       # 14-word optimized system
│   ├── hybrid_encoder.py        # Hybrid optimization attempts
│   ├── optimized_encoder.py     # Optimization strategies
│   ├── radical_optimizer.py     # Advanced compression research
│   └── theoretical_limits.py    # Mathematical limits analysis
├── tests/                       # Comprehensive tests
├── data/                        # Word dictionary files
├── examples/                    # Usage examples
├── RESEARCH.md                  # Optimization research
└── SPECIFICATION.md             # Technical specification

Requirements

  • Python 3.11+
  • UV package manager
  • Dependencies: cryptography, base58, click

📈 Performance & Achievements

Current System (4 words - demonstration)

  • Encoding speed: 1000+ addresses/second
  • Dictionary size: 2,048 words (11 bits each)
  • Address coverage: 33 bits (~13% of address)
  • Memory usage: Minimal (<1MB)

Optimized Systems (full research)

  • Perfect fidelity: 17 words (100% address coverage)
  • Optimized system: 14 words (17.6% reduction)
  • Theoretical minimum: 9-10 words (identified)
  • All systems maintain: Critical first word property

📋 Examples

Real Cryptocurrency Addresses

# Ethereum examples
uv run python -m easy_keys encode --type public --address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
uv run python -m easy_keys encode --type secret --address 0x742d35Cc6cA6CE02036dBdE3e8Bf13f96Db9F141

# Bitcoin examples  
uv run python -m easy_keys encode --type public --address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
uv run python -m easy_keys encode --type secret --address bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass: uv run python -m pytest
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details.

🔗 Links

🎓 Academic & Research Interest

This project explores:

  • Cognitive Science: How humans best memorize high-entropy data
  • Multi-Modal Learning: Leveraging different sensory pathways
  • Gamification: Making sec 6874 urity fun and engaging
  • Decentralized Systems: Human-memorable keys without central authorities
  • Future Interfaces: Voice, video, AR/VR for key management

Perfect for research in cryptography, HCI, cognitive science, and security UX.

🌟 Join the Exploration!

We believe the future of secure, decentralized systems depends on making them genuinely human-friendly. This means:

  • Moving beyond words to embrace how humans naturally remember
  • Making security joyful rather than a chore
  • Personalizing to individual strengths and preferences
  • Building resilience through multiple memory pathways
  • Keeping it decentralized - your keys, your control

What's Next?

  • 🎤 Voice Integration: Unique vocal patterns for key generation
  • 📹 Video Entropy: Facial expressions and gesture recognition
  • 🥽 AR/VR Experiences: Immersive memory palaces
  • 🧬 Biometric Fusion: Combining memorable with measurable
  • 🌐 Social Verification: Distributed trust without centralization

💭 Final Thoughts

Security doesn't have to be boring. By combining art, music, games, and science, we can create systems that are both mathematically secure and genuinely delightful to use.

The journey from 17 words to 14 was just the beginning. The real adventure is discovering how many different ways humans can reliably remember high-entropy data - and having fun while doing it!


Remember: The first word is critical... but the future might be a color, a melody, or even a dance! 🎨🎵🕺

About

4-word mnemonic system for cryptocurrency address encoding with critical first-word dependency

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0