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

Transactions

Build, decode, sign, and broadcast transactions using regtest.

beginner5 days

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

./sign-in

On this page

Learning objectives

  • Decode the fields of a Bitcoin transaction
  • Explain sighashes and what a signature commits to
  • Create and broadcast a simple regtest payment

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
Bitcoin transactionraw transactionsighashcreaterawtransaction

Step 1 // Required reading

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

  • bookMastering Bitcoin

    Ch. 6: Transactions

Interactive lab // Decoding Bitcoin

Open these Bitcoin Dev Project modules and tools before (or alongside) the graded lab. Capture evidence from the interactive path — do not only skim Pull.

  • Decoding Bitcoin: Transaction lifecycle

    Interactive module - walk creation → confirmation before the lab.

  • Decoding Bitcoin: Transaction decoder

    Paste a raw hex or explorer tx and label vin/vout/fee fields.

  • Decoding Bitcoin: Transaction exercises

    Classroom-style exercises - complete at least one graded path.

Reflection prompts

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

Lab // Decode + regtest send

Complete Steps 2–3. Use Decoding Bitcoin's transaction decoder on a sample or regtest tx, then create and broadcast a simple payment on local regtest.

evidence required

  • ·Screenshot or notes from the Decoding Bitcoin transaction decoder with labeled vin/vout/fee
  • ·getrawtransaction <txid> true JSON (or equivalent) from your regtest send
  • ·One sentence on what you observed vs expected
  • ·Link to the Decoding exercise or module section you completed
  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.

A Bitcoin transaction moves value by consuming UTXOs and creating new ones. Wallets, Lightning channels, and exchanges eventually serialize to this structure.

Complete Step 1 // Required reading in the study plan above, then continue here.

Step 2 — Core idea: fields, fees, sighash

If you cannot read a raw transaction, debugging stuck payments, wrong fees, or bad scripts becomes guesswork.

Analogy: A signed instruction — “Take these coins (inputs) and lock them under these new conditions (outputs).” Miners include it in a block; nodes verify signatures and rules.

Core fields:

  • version
  • inputs: previous txid + vout, scriptSig/witness, sequence
  • outputs: value + scriptPubKey
  • locktime

SegWit moves signatures into the witness, changing fee measurement to weight/vbytes.

Loading diagram…

Build, sign, broadcast, then wait for confirmations.

A signature commits to a sighash — a digest of (parts of) the transaction. Finalize amounts and outputs before signing; PSBT exists for multi-party construction. Most wallets commit to all inputs and outputs so the signed tx cannot be altered meaningfully.

const feeSats = Math.ceil(feeRateSatPerVb * vsize);
// Fee = sum(inputs) − sum(outputs)

SegWit txs are priced by weight / vbytes, not legacy serialized size alone.

Always compute fees explicitly

If outputs exceed inputs, nodes reject the transaction. If you under-fund fees in a busy mempool, the tx may sit forever.

Done when: You can label vin, vout, and fee on a decoded tx and explain why post-sign edits break signatures.

Step 3 — Try it: decode + send (lab)

Walk the Decoding Bitcoin lifecycle and decoder modules. Then on regtest:

bitcoin-cli -regtest generatetoaddress 101 "$(bitcoin-cli -regtest getnewaddress)"
TXID=$(bitcoin-cli -regtest sendtoaddress "$(bitcoin-cli -regtest getnewaddress)" 0.5)
bitcoin-cli -regtest getrawtransaction "$TXID" true

Identify vin/vout, fees, and scripts. Trace which UTXOs were consumed and which new locks were created. Optional drills: transaction exercises.

Common mistakes

  • Changing outputs after signing (invalidates signatures)
  • Mixing mainnet txids into regtest experiments
  • Forgetting change outputs

Done when: Lab evidence (decoder notes + getrawtransaction JSON + observation sentence) is complete.

Next lesson

Bitcoin Script — the language that defines how outputs can be unlocked.

further reading

  • docsBitcoin Core RPC, createrawtransaction
  • toolBitcoin Optech: Transaction sizes

review // club

Review club

Practice on real Bitcoin OSS changes tied to this chapter. Read the diff, use the checklist, and optionally paste your review comment URL in your lab notes.

  • rust-bitcoin serialization PRs

    Review a rust-bitcoin PR touching transaction or script encoding and check test coverage.

    pr review
    consensus encodingtests
    40 min·intermediateopen on GitHub
review checklist
  1. Does the change solve the stated problem?
  2. Are edge cases and rollout behavior covered?
  3. Are tests or test vectors included?
  4. Is the diff minimal and clearly explained?

More repos and GFIs on /discover and /issues.

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

prevBlocks & ChainnextBitcoin Script

On this page

Press Shift + ? for keyboard shortcuts.

Press R to research on Bitcoin Search.

No questions yet — be the first to ask.