Feedback
Sign in./start

Site navigation

Theme

Learn

  • Roadmaps

Build

  • Projects
  • Developer Tools

Contribute

  • Open Source Projects
  • Issues
  • Reviews
  • First Contribution
  • BountiesSoon
  • Feedback

Prove

  • Builders

Ecosystem

  • Partners
  • Get Funded↗
  • HackathonsSoon
Sign in./start-building

Become an Open Source Builder. Learn. Build. Contribute. Prove.

Feedback welcome — open a GitHub issue.

Learn

RoadmapsStart Building

Build

ProjectsDeveloper Tools

Contribute

Open Source ProjectsIssuesReviewsFirst ContributionSupportFeedback

Prove

Builders Directory

Account

Sign in

Legal

PrivacyTermsCredits

© 2026 Pull // code MIT · curriculum CC BY-SA 4.0

PrivacyTermsCredits

lesson // bitcoin

Bitcoin Libraries

Use modern libraries for keys, addresses, and transaction construction.

intermediate6 days

Public lesson — sign in to track progress on this roadmap.

./sign-in

On this page

Learning objectives

  • Choose appropriate libraries for JS and Rust stacks
  • Generate addresses and inspect transactions programmatically
  • Avoid common footguns when wrapping consensus logic

study // plan

Lessons are primers. Start with Step 1 (required reading) when present, then follow the numbered steps in the article. Depth comes from primary sources, labs, reflection, and evidence.

Research on Bitcoin Search
bitcoinjs-librust-bitcoinBDKBitcoin Dev Kit

Step 1 // Required reading

Complete these before the numbered steps in the lesson body. Links are listed here once — not repeated below.

  • docsbitcoinjs-lib

    JS stack - keys, addresses, and transaction construction.

  • docsrust-bitcoin

    Rust stack - consensus types and serialization primitives.

Reflection prompts

  1. Explain Bitcoin Libraries to a teammate without jargon - what problem does it solve?
  2. What would break in production if you misunderstood Bitcoin Libraries?
  3. Which BIP, book chapter, or Core doc is authoritative here, and what did you verify?

Lab // Network + address in a library

Complete Steps 2–3. In JS or Rust, generate a regtest address (or print network params) with a maintained library. Never use mainnet keys for the lab.

evidence required

  • ·Code snippet or terminal output showing a regtest address or network object
  • ·Which library and version you used
  • ·One sentence on why you would not hand-roll Bech32 / sighash
  1. 01

    Worked mental model

    Re-read the diagrams in this lesson once out loud in plain language. If you cannot explain the flow to a friend without jargon, pause and revisit the Mastering Bitcoin / Mastering Lightning chapters linked in Resources. Chapter references are intentional, not decorative.

  2. 02

    Hands-on habit

    Every protocol idea should be paired with one local experiment. That habit turns reading into builder instinct.

    1. Reproduce the happy path on regtest (or Polar for Lightning)
    2. Break it on purpose (wrong fee, expired invoice, offline peer)
    3. Write down what error you saw and which layer produced it (wallet, node, mempool, peer)
  3. 03

    Glossary check

    Pick three terms from this lesson and define them in one sentence each without opening notes. Weak definitions mean the lesson is not finished yet.

  4. 04

    Resource order

    Use Resources in order: narrative book chapter first, then BIP/BOLT for precision, then implementation docs for commands. Jumping straight to RPC flags without the mental model creates brittle knowledge.

You should not hand-roll Base58, Bech32, or sighash code. Use maintained libraries that track consensus and address standards.

Complete Step 1 // Required reading in the study plan above (skim both READMEs; go deep on the stack you will use). This opens Development.

Step 2 — Core idea: pick a stack, pin versions

A one-character encoding bug can burn funds. Libraries encapsulate years of edge cases — version bytes, witness quirks, taproot tweaks.

Analogy: Power tools with safety guards. You still need skill, but you should not forge your own circular saw blade from scrap metal.

NeedJavaScriptRust
Primitivesbitcoinjs-lib, @scure/btc-signerrust-bitcoin
Wallet engineoften custom + indexersBDK
secp256k1noble / bitcoin-secp…secp256k1 / libsecp

Loading diagram…

Apps compose libraries for keys, tx building, and signing workflows.
// Prefer well-reviewed packages; pin versions; read changelogs on upgrades
import * as bitcoin from "bitcoinjs-lib";
const network = bitcoin.networks.regtest;
# Rust sketch
cargo add bitcoin

Pin and audit upgrades

Consensus-adjacent upgrades can change defaults. Pin versions, read release notes, and run vectors/tests before production deploys.

Done when: You can name your primary library and what you still should not DIY.

Step 3 — Try it: address or network object (lab)

Generate a regtest address (or print network params) with your chosen library. Paste output or a short code snippet. Note library + version.

Common mistakes

  • Copy-pasting random npm snippets that use deprecated address APIs
  • Mixing mainnet and regtest network objects
  • Using non-audited “crypto helper” packages for key material

Done when: Lab evidence (output + library/version + DIY sentence) is complete.

Next lesson

Wallet Architecture — HD keys, watch-only vs signing, and backups.

further reading

  • docsBDK documentation

    Wallet engine on top of rust-bitcoin - optional depth this lesson.

progress // sign in

Reading is public. Sign in to mark lessons complete, sync across devices, and unlock your roadmap.

./sign-in-to-track

discussion

Discussion

prevMining & ConsensusnextWallet Architecture

On this page

Press Shift + ? for keyboard shortcuts.

Press R to research on Bitcoin Search.

No questions yet — be the first to ask.