Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bitcoin Wallet Course Module #2

Open
43 of 55 tasks
Extheoisah opened this issue Sep 13, 2024 · 0 comments
Open
43 of 55 tasks

Add Bitcoin Wallet Course Module #2

Extheoisah opened this issue Sep 13, 2024 · 0 comments
Labels
new course Add a new course with several modules and resources

Comments

@Extheoisah
Copy link
Member

Work In Progress

Course Title: Build a Bitcoin Wallet from Scratch
Modules:

  • Generating Private and Public Keys
  • Implementing Mnemonic Phrases (BIP39)
  • Hierarchical Deterministic Wallets (BIP32/BIP44) and Derivation Paths
  • Creating Bitcoin Addresses
  • Secure Storage of Private Keys
  • Building the Wallet Interface
  • Connecting to the Bitcoin Network
  • Retrieving and Parsing Blockchain Data
  • Transaction Creation and Signing
  • Broadcasting Transactions
  • Handling Incoming Transactions
  • Enhancing Wallet Security

1. Generating Private and Public Keys

Objective: Implement code to generate valid Bitcoin private keys and derive public keys.

Topics:

  • Secure random number generation
  • Using elliptic curve multiplication to derive public keys
  • Difference between compressed and uncompressed public keys

Resources:

Exercise:

  • Code Exercise: Write a function that generates a private key and derives the corresponding public key. Output both keys in hexadecimal format.

2. Implementing Mnemonic Phrases (BIP39)

Objective: Understand and implement mnemonic phrases for seed generation and wallet backup.

Topics:

  • What are mnemonic phrases and their importance
  • BIP39 standard for mnemonic code generation
  • Generating mnemonic phrases from entropy
  • Converting mnemonic phrases to a seed
  • Using optional passphrases for added security

Resources:

Exercise:

  • Code Exercise: Implement code to generate a mnemonic phrase using BIP39. Allow the user to input an optional passphrase. Convert the mnemonic phrase into a seed for use in an HD wallet.

3. Hierarchical Deterministic Wallets (BIP32/BIP44) and Derivation Paths

Objective: Implement HD wallets with proper derivation paths for organized key management.

Topics:

  • Understanding HD wallets and their advantages
  • BIP32 for hierarchical key generation
  • BIP44 standard for multi-account hierarchy
  • Implementing derivation paths
  • Hardened vs. non-hardened child keys
  • Integrating HD wallets with mnemonic seeds

Resources:

Exercise:

  • Code Exercise: Extend your wallet to implement an HD wallet using the seed from the mnemonic phrase. Follow BIP44 to define standard derivation paths and generate multiple accounts and addresses. Provide functionality to derive keys and addresses at various levels (account, change, address index).

4. Creating Bitcoin Addresses

Objective: Convert public keys into Bitcoin addresses.

Topics:

  • Hashing public keys with SHA-256 and RIPEMD-160
  • Understanding the Base58Check encoding scheme
  • Generating different types of addresses (P2PKH, P2SH, Bech32)

Resources:

Exercise:

  • Code Exercise: Implement code that takes a public key and produces a Bitcoin address using Base58Check encoding. Extend it to generate a Bech32 (SegWit) address.

5. Secure Storage of Private Keys

Objective: Implement secure methods for storing private keys.

Topics:

  • Importance of private key security
  • Encrypting private keys (e.g., using AES)
  • Storing keys in encrypted files or secure databases
  • Implementing passphrase protection

Resources:

Exercise:

  • Code Exercise: Extend your program to encrypt the mnemonic seed with a user-provided passphrase and store it securely. Include functionality to decrypt and load the seed when needed to derive keys and addresses.

6. Building the Wallet Interface

Objective: Create a user interface for interacting with your wallet.

Topics:

  • Designing a command-line or graphical interface
  • Displaying wallet information (addresses, balances)

Resources:

Exercise:

  • Code Exercise: Build a simple interface that allows users to unlock the wallet using their passphrase and view their bitcoin addresses.

7. Connecting to the Bitcoin Network

Objective: Enable your wallet to communicate with the Bitcoin network.

Topics:

  • Understanding how nodes interact in the network
  • Using APIs to access blockchain data (e.g., BlockCypher, Blockchain.info, mempool.space)
  • Optional: Running a Bitcoin full node and using JSON-RPC

Resources:

Exercise:

  • Code Exercise: Write code to connect to a blockchain API and fetch the current Bitcoin network statistics (e.g., latest block height).

8. Retrieving and Parsing Blockchain Data

Objective: Fetch and process blockchain data relevant to your wallet.

Topics:

  • Retrieving transaction history for your addresses
  • Understanding UTXOs (Unspent Transaction Outputs)
  • Parsing JSON data from APIs

Resources:

Exercise:

  • Code Exercise: Implement functionality to retrieve and display the balance and transaction history of your wallet addresses by parsing API responses.

9. Transaction Creation and Signing

Todo: refer to the transactions course and break these topics into smaller modules

Objective: Implement the ability to create and sign Bitcoin transactions.

Topics:

  • Constructing raw transactions
  • Selecting appropriate UTXOs and calculating change
  • Transaction fees estimation
  • Signing transactions using ECDSA

Resources:

Exercise:

  • Code Exercise: Write code to create a raw Bitcoin transaction sending funds from your wallet to another address. Implement the signing process and output the raw signed transaction in hexadecimal format.

10. Broadcasting Transactions

Objective: Send your signed transactions to the Bitcoin network.

Topics:

  • Using APIs or a full node to broadcast transactions
  • Verifying transaction propagation
  • Monitoring transaction confirmations

Resources:

Exercise:

  • Code Exercise: Implement functionality to broadcast your signed transaction to the Bitcoin network. Verify its status by checking for confirmations.

11. Handling Incoming Transactions

Objective: Update wallet state based on incoming transactions.

Topics:

  • Monitoring addresses for new transactions
  • Updating UTXO sets and wallet balances
  • Dealing with unconfirmed transactions

Resources:

Exercise:

  • Code Exercise: Write code that listens for incoming transactions to your wallet addresses and updates the balance and transaction history in real-time.

12. Enhancing Wallet Security

Objective: Implement advanced security features to protect user funds.

Topics:

  • Implementing multi-signature transactions

Resources:

Exercise:

  • Code Exercise: Add functionality for creating and signing multi-signature transactions

@Extheoisah Extheoisah added the new course Add a new course with several modules and resources label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new course Add a new course with several modules and resources
Projects
None yet
Development

No branches or pull requests

1 participant