<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Timmy Bagwells on Medium]]></title>
        <description><![CDATA[Stories by Timmy Bagwells on Medium]]></description>
        <link>https://medium.com/@bagwells?source=rss-2c1054d0fabe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_1aRyWosYclXEiw-Nq5-Hw.jpeg</url>
            <title>Stories by Timmy Bagwells on Medium</title>
            <link>https://medium.com/@bagwells?source=rss-2c1054d0fabe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:34:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bagwells/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Rust’s Integer Literals: A Bitcoin Developer’s Cure for Number Blindness.]]></title>
            <link>https://medium.com/@bagwells/rusts-integer-literals-a-bitcoin-developer-s-cure-for-number-blindness-e76676d8311f?source=rss-2c1054d0fabe------2</link>
            <guid isPermaLink="false">https://medium.com/p/e76676d8311f</guid>
            <category><![CDATA[bitcoin-development]]></category>
            <category><![CDATA[rust-for-bitcoin]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[rust-programming-language]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Timmy Bagwells]]></dc:creator>
            <pubDate>Mon, 25 May 2026 13:16:09 GMT</pubDate>
            <atom:updated>2026-05-25T13:16:09.120Z</atom:updated>
            <content:encoded><![CDATA[<p>You’re not bad at reading numbers. You’re just not using the right format.</p><p>There’s a moment every Bitcoin developer knows. You’re staring at a constant like this:</p><pre>const MAX_SUPPLY: u64 = 2100000000000000; //21 Million Btc in sats</pre><p>And you count the Zeroes, count again, then count a third time just to be sure you’ve not made an error. <br>That moment of friction isn’t a personal failing but a formatting problem. Rust gives the tools to fix it entirely.</p><h3>The Human Brain Wasn’t Built for Long Numbers</h3><p>Cognitive psychology has a term for it: <strong>subitizing</strong>; the ability to instantly recognize quantity without counting. Humans are good at it up to about 4 to 5 items. Beyond that, we chunk. That’s why phone numbers are formatted into components: Country code—+1, Area/region code—(234) and the subscriber number—5678901 merged together as +1 (234) 567-8901 and not 12345678901. The groupings aren&#39;t arbitrary; they match how our working memory processes sequences.</p><p>When you write raw integers in code especially in Bitcoin, where amounts live in satoshis and constants span 15+ digits, you’re forcing every reader to do mental chunking from scratch, every single time. Rust’s integer literal system lets you put that chunk directly into the source code.</p><h3>The Underscore: A Comma That Compiles</h3><p>The most immediately useful tool is the underscore separator “_”. Rust ignores it completely at compile time. It exists purely for the human reading the code. You can place it anywhere in a number, as many times as you like. You can read the full rules in the <a href="https://doc.rust-lang.org/reference/tokens.html#integer-literals">Rust reference on integer literals</a>.</p><pre>// What the compiler sees either way: 2100000000000000<br>const MAX_SUPPLY_SATS: u64 = 2100000000000000;    // how many zeros again?<br>const MAX_SUPPLY_SATS: u64 = 2_100_000_000_000_000; // 2.1 quadrillion: obvious</pre><p>For Bitcoin specifically, where everything is denominated in satoshis (1 BTC = 100,000,000 satoshis), this is not a minor convenience. It’s the difference between a constant you verify once and trust, and one you silently second-guess every time you pass it to a function.</p><p>Consider the block subsidy schedule:</p><pre>// First halving era — 50 BTC per block<br>const INITIAL_SUBSIDY: u64 = 5_000_000_000; // 50 BTC — readable as &quot;5 billion sats&quot;<br><br>// Halving interval<br>const HALVING_INTERVAL: u32 = 210_000; // 210 thousand blocks — matches every BIP and textbook<br><br>// Dust threshold<br>const DUST_LIMIT: u64 = 546; // small enough — no separator needed</pre><h3>Grouping by Meaning, Not Just by Three</h3><p>Here’s what makes underscore separators more powerful than a comma convention: you choose the grouping based on what the number <em>means</em>, not a fixed rule.</p><p>Satoshi amounts have a natural split at the BTC boundary: 8 decimal places.</p><pre>// Group as (BTC amount) _ (satoshi fraction)<br>const FEE_RATE: u64  =         1_000; // 1,000 sats — a flat fee<br>const ONE_BTC:  u64  = 1_0000_0000;   // 1 BTC — split at the decimal point<br>const TEN_BTC:  u64  = 10_0000_0000;  // 10 BTC — same pattern</pre><p>In Bitcoin development, your numbers carry meaning, satoshi boundaries, bit positions, block intervals. Your grouping should carry that meaning too.</p><h3>A Before/After: Bitcoin Transaction Constants</h3><p>Here’s the same set of constants written both ways. This is the kind of code that lives at the top of a transaction parsing module and gets read dozens of times:</p><p><strong>Before; technically correct, mentally exhausting:</strong></p><pre>const MAX_BLOCK_WEIGHT: u32 = 4000000;<br>const MAX_BLOCK_SIGOPS: u32 = 80000;<br>const COINBASE_MATURITY: u32 = 100;<br>const MAX_SUPPLY_SATS: u64 = 2100000000000000;<br>const INITIAL_BLOCK_REWARD: u64 = 5000000000;<br>const HALVING_INTERVAL: u32 = 210000;<br>const SEGWIT_MARKER: u8 = 0;<br>const SEGWIT_FLAG: u8 = 1;</pre><p><strong>After; same values, readable at a glance:</strong></p><pre>const MAX_BLOCK_WEIGHT:     u32 = 4_000_000;            // 4 million weight units<br>const MAX_BLOCK_SIGOPS:     u32 = 80_000;               // 80 thousand<br>const COINBASE_MATURITY:    u32 = 100;                  // 100 blocks<br>const MAX_SUPPLY_SATS:      u64 = 2_100_000_000_000_000; // 21M BTC<br>const INITIAL_BLOCK_REWARD: u64 = 50_000_000_00;        // 50 BTC in sats<br>const HALVING_INTERVAL:     u32 = 210_000;              // 210k blocks<br>const SEGWIT_MARKER:         u8 = 0x00;                 // matches BIP-141<br>const SEGWIT_FLAG:           u8 = 0x01;                 // matches BIP-141</pre><p>The logic is identical. The cognitive load is not.</p><p>Use the format that makes the number obvious at a glance, and you stop paying the cost of counting zeros forever.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e76676d8311f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Bitcoin Core from Source in 2026: No More install_db4.sh, Hello CMake]]></title>
            <link>https://medium.com/@bagwells/building-bitcoin-core-from-source-in-2026-no-more-install-db4-sh-hello-cmake-357053f635a7?source=rss-2c1054d0fabe------2</link>
            <guid isPermaLink="false">https://medium.com/p/357053f635a7</guid>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Timmy Bagwells]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 20:01:00 GMT</pubDate>
            <atom:updated>2026-03-11T20:01:00.553Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4IeemKIV7CKBCR1SV1cHuw.png" /></figure><p><strong>A step-by-step account of building Bitcoin Core with wallet support on Linux and what’s changed since the old guides.</strong></p><p>If you’ve ever tried to build Bitcoin Core from source using an older tutorial, you’ve probably run into two things: a script called install_db4.sh that no longer exists, and instructions that tell you to run ./autogen.sh and ./configure in a repo that doesn&#39;t have them anymore. Here&#39;s what&#39;s actually going on in 2026 and how to get from a fresh clone to a running, pruned regtest, testnet or mainnet node and why two functional tests might fail on your machine.</p><h3>1. Clone the Repo (and Expect the First Try to Fail)</h3><pre>$ git clone https://github.com/bitcoin/bitcoin.git<br>$ cd bitcoin</pre><p>The repo is large (hundreds of thousands of objects, hundreds of MB). On flaky or restricted networks you may see:</p><pre>error: RPC failed; curl 56 Recv failure: Connection reset by peer<br>fatal: early EOF</pre><p>If that happens, run git clone again. The second attempt often completes because Git resumes where it left off.</p><h3>2. Berkeley DB: The Script Is Gone</h3><p>Older guides tell you to install Berkeley DB 4.8 with:</p><pre>$ ./contrib/install_db4.sh `pwd`</pre><p>If you try that today you get:</p><pre>-bash: ./install_db4.sh: No such file or directory</pre><p><strong>install_db4.sh was removed</strong> from Bitcoin Core in early 2023 (PR <a href="https://github.com/bitcoin/bitcoin/pull/26834">#26834</a>). The project no longer maintains that script; the &quot;Berkeley DB configuration&quot; in those old docs is outdated.</p><p>You only need Berkeley DB (and the depends build) if you want <strong>wallet support</strong>. If you’re fine with a node that has no wallet, you can build with wallet disabled and skip all of this. If you want the wallet, use the <strong>depends</strong> system instead of any install script.</p><h3>3. Build Dependencies with depends</h3><p>From the repo root:</p><pre># Install CMake if you don&#39;t have it (required for depends)<br>$ sudo apt install cmake   # Debian/Ubuntu</pre><pre># Build dependencies (Boost, BDB, SQLite, etc.). Don&#39;t use NO_BOOST=1 if you want the wallet.<br>$ rm -rf depends/x86_64-pc-linux-gnu   <br># if you had a previous partial build<br>$ make -C depends NO_QT=1 NO_NATPMP=1 NO_UPNP=1 NO_ZMQ=1 NO_USDT=1</pre><p>Omit NO_SQLITE=1 so the wallet (and its tests) work. When it finishes, the output will tell you the exact toolchain path, e.g.:</p><pre>To build Bitcoin Core with these packages, pass &#39;--toolchain /path/to/bitcoin/depends/x86_64-pc-linux-gnu/toolchain.cmake&#39; to the first CMake invocation.</pre><h3>4. No autogen.sh, No configure: Use CMake</h3><p>Bitcoin Core has moved from Autotools to <strong>CMake</strong>. There is no ./autogen.sh or ./configure in the repo anymore. If you run them, you get &quot;No such file or directory.&quot; Use CMake and the toolchain from depends instead.</p><p><strong>Configure:</strong></p><pre>$ cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake</pre><p>Use the path that make -C depends printed if your host triplet is different (e.g. on ARM or another OS).</p><p><strong>Build:</strong></p><pre>$ cmake --build build<br># or, for parallel jobs: $ cmake --build build -j$(nproc)</pre><p><strong>Where are the binaries?</strong> They’re not in build/src/ like in some older docs. They&#39;re under <strong>build/bin/</strong>:</p><pre>$ ./build/bin/bitcoind -version<br>$ ./build/bin/bitcoin-cli -version</pre><h3>5. Run a Pruned Regtest Node</h3><p>For a local, pruned regtest node:</p><pre>$ ./build/bin/bitcoind -regtest -prune=550 -daemon<br>$ ./build/bin/bitcoin-cli -regtest getblockchaininfo</pre><p>To stop it:</p><pre>$ ./build/bin/bitcoin-cli -regtest stop</pre><p>Same binaries support <strong>testnet</strong> (-testnet), <strong>signet</strong> (-signet), and <strong>mainnet</strong> (default); each uses its own datadir.</p><h3>6. Running Tests: make check Is Gone Too</h3><p>With CMake there is no make check. For <strong>unit tests</strong>:</p><pre>$ cd build &amp;&amp; ctest --output-on-failure<br># or from repo root: cmake --build build --target check</pre><p>For the <strong>functional test suite</strong> (Python, starts real nodes):</p><pre>$ test/functional/test_runner.py --extended</pre><p>Run from the repo root; the test runner will use the built binaries in build/bin/ when invoked from the same tree.</p><h3>7. Two Failing Tests (and Why That’s OK)</h3><p>After a full extended run you might see <strong>286 passed</strong>, a few <strong>skipped</strong>, and <strong>2 failed</strong>: feature_config_args.py and p2p_dns_seeds.py.</p><p><strong>Skipped tests</strong> are normal if you built without optional features (e.g. ZMQ, USDT). Nothing to fix there.</p><p><strong>feature_config_args.py</strong> can fail due to local config or permissions. It&#39;s often environment-specific.</p><p><strong>p2p_dns_seeds.py</strong> expects the node to query DNS seeds and to log <em>&quot;Loading addresses from DNS seed&quot;</em> within a short timeout. On locked-down networks (university labs, corporate firewalls, restricted DNS), that lookup may never succeed or may not happen in time, so the message never appears and the test fails. That&#39;s a <strong>network/DNS restriction</strong>, not a broken build. For regtest (and most use cases), you don&#39;t depend on DNS seeds in the same way, so you can treat this failure as an environment limitation and still trust your build.</p><h3>Summary</h3><p><strong>Old (outdated)</strong></p><p>./contrib/install_db4.sh</p><p>./autogen.sh then ./configure</p><p>make then make install</p><p>make check</p><p><strong>Current (2026)</strong></p><p>Build BDB (and deps) via make -C depends</p><p>cmake -B build --toolchain depends/.../toolchain.cmake</p><p>cmake --build build (binaries in build/bin/)</p><p>ctest in build/ or cmake --build build --target check</p><p>Building Bitcoin Core from source in 2026 means: <strong>depends for dependencies, CMake for the build, and </strong><strong>build/bin/ for the binaries.</strong> Once you have that, a pruned regtest node is a single bitcoind command away and the rest is just network and tests doing their thing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=357053f635a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>