ryanwold.net

A civic-minded citizen seeking the singularity

Back to Entries

Building a crypto wallet (as an exercise)

idea
Date: 2024-01-28
Tags: crypto wallet bitcoin

! Designing a Bitcoin wallet in Elixir would be a fascinating project, leveraging Elixir's strengths such as fault tolerance, scalability, and functional programming. Let's outline a potential design for such a wallet, including its features and the order of development with a focus on test-driven development (TDD).

Core Features of the Bitcoin Wallet Mnemonic Phrase Generation (BIP39): Generate a secure and random mnemonic phrase for wallet recovery. Seed Generation: Convert the mnemonic phrase into a seed. HD Wallet Implementation (BIP32/BIP44): Create a hierarchical deterministic wallet allowing for organized and secure key management. Address Generation: Generate Bitcoin addresses for receiving transactions. Transaction Creation: Create and sign transactions. Transaction Broadcast: Send signed transactions to the Bitcoin network. Balance Check and Transaction History: Check wallet balance and view transaction history. Multi-Signature Support: Enable transactions that require multiple signatures. Security Features: Implement security features like encryption of private keys. User-Friendly Interface: A simple and intuitive interface for users to interact with their wallet. Blockchain Synchronization: Option to sync with the Bitcoin blockchain for transaction verification. Development Approach with TDD Phase 1: Project Setup and Basic Wallet Structure

Task 1: Set up the Elixir project environment with necessary dependencies. Test 1: Ensure the environment is correctly configured with a simple "Hello World" test. Phase 2: Mnemonic Phrase and Seed Generation

Task 2: Implement mnemonic phrase generation following BIP39. Test 2: Test the randomness and validity of the mnemonic phrases generated. Task 3: Implement seed generation from the mnemonic. Test 3: Test seed generation ensuring deterministic output for the same mnemonic. Phase 3: HD Wallet Key Management

Task 4: Implement master key generation from the seed. Test 4: Validate master key generation. Task 5: Implement hierarchical key derivation. Test 5: Test child key derivation and ensure compliance with BIP32/BIP44.

By Ryan Wold · © 2024–2026 Ryan Wold

Licensed CC BY-NC 4.0. AI training requires a license — machine-readable terms.

Enjoyed this? — any BSV wallet, HandCash, or plain old dollars.

Leave a tip

Tips go directly to a Bitcoin SV address I control — peer to peer, no platform in between. A few thousand satoshis is a fraction of a cent; it's the gesture that counts.

From any BSV wallet

Scan the QR code with your wallet's camera, or copy the address.

177DwUfSTW8RkFBJzYYcgr1YB8ngbhTYAc

With HandCash or any paymail wallet

Paymail is an email-style address for Bitcoin wallets. Send any amount to afomi@handcash.io

First time using Bitcoin? Yours Wallet is an open-source browser extension wallet, and HandCash is an easy mobile wallet — either takes a minute to set up.

Prefer regular money? Support via OpenCollective.