Bitcoin Dev Project's avatar
Bitcoin Dev Project
_@bitcoindevs.xyz
npub10p33...n2l2
The go-to resource for developers to learn bitcoin and related technologies. Get inspired to kickstart and grow your career in bitcoin open source software (โ‚ฟOSS).
Bitcoin Dev Project's avatar
bitcoin_devs 10 months ago
Weโ€™ve got a good #DecodingBitcoin post for you today. The topic? ๐„๐ง๐๐ข๐š๐ง๐ง๐ž๐ฌ๐ฌ, AKA the order of bytes in a computerโ€™s memory. When we put it like that it sounds a little boring, but thereโ€™s something interesting, and dare we say ๐‘Ž๐‘›๐‘›๐‘œ๐‘ฆ๐‘–๐‘›๐‘”, about how bitcoin handles endiannessโ€ฆ Before we get to that, letโ€™s better understand what endianness is. Imagine reading directions in different languages: while English is written and read from left to right, Arabic text flows from right to left. image Similarly, computers have two ways to store data: 1. ๐๐ข๐ -๐ž๐ง๐๐ข๐š๐ง (BE): Most significant byte first 2. ๐‹๐ข๐ญ๐ญ๐ฅ๐ž-๐ž๐ง๐๐ข๐š๐ง (LE): Least significant byte first image When computers with different byte orders try to communicate, they can misread each other. Itโ€™s like two people reading numbers from opposite directions. image ๐๐ข๐ -๐ž๐ง๐๐ข๐š๐ง ๐ฌ๐ญ๐จ๐ซ๐ž๐ฌ ๐ญ๐ก๐ž ๐ฆ๐จ๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž ๐Ÿ๐ข๐ซ๐ฌ๐ญ. This is similar to how humans read numbers and Hex in most cases: starting with the most important information. Suppose we want to store the number 12345678 (hexadecimal: 0x00BC614E) in memory. In big-endian, the bytes are stored in this order: 00 BC 61 4E image Observe that: - The ๐ฆ๐จ๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (00) is stored at the ๐ฅ๐จ๐ฐ๐ž๐ฌ๐ญ ๐ฆ๐ž๐ฆ๐จ๐ซ๐ฒ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (00). - The ๐ฅ๐ž๐š๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (4E) is stored at the ๐ก๐ข๐ ๐ก๐ž๐ฌ๐ญ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (03). Big-endian is considered more "human-readable" because the data is stored in the order we naturally read it. ๐‹๐ข๐ญ๐ญ๐ฅ๐ž-๐ž๐ง๐๐ข๐š๐ง ๐ฌ๐ญ๐จ๐ซ๐ž๐ฌ ๐ญ๐ก๐ž ๐ฅ๐ž๐š๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž ๐Ÿ๐ข๐ซ๐ฌ๐ญ. This might feel counter intuitive to humans but is more efficient for modern processors. Using the same number 12345678 (0x00BC614E), here's how it looks in little-endian: 4E 61 BC 00 image This time, the ๐ฅ๐ž๐š๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (4E) is stored at the ๐ฅ๐จ๐ฐ๐ž๐ฌ๐ญ ๐ฆ๐ž๐ฆ๐จ๐ซ๐ฒ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (00). The ๐ฆ๐จ๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (00) is stored at the ๐ก๐ข๐ ๐ก๐ž๐ฌ๐ญ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (03). This "reversal" of bytes is common in the Bitcoin Core codebase. In bitcoin, most data like transaction IDs, block headers, and amounts are all in little-endian format or with the bytes reversed. image ๐‘๐‘œ๐‘ก๐‘’: ๐ธ๐‘›๐‘‘๐‘–๐‘Ž๐‘›๐‘›๐‘’๐‘ ๐‘  ๐‘œ๐‘›๐‘™๐‘ฆ ๐‘Ž๐‘๐‘๐‘™๐‘–๐‘’๐‘  ๐‘ก๐‘œ ๐‘–๐‘›๐‘ก๐‘’๐‘”๐‘’๐‘Ÿ๐‘ . ๐ผ๐‘ก ๐‘–๐‘  ๐‘›๐‘œ๐‘ก ๐‘๐‘œ๐‘Ÿ๐‘Ÿ๐‘’๐‘๐‘ก ๐‘ก๐‘œ ๐‘ ๐‘Ž๐‘ฆ ๐‘Ž โ„Ž๐‘Ž๐‘ โ„Ž ๐‘–๐‘  ๐‘™๐‘–๐‘ก๐‘ก๐‘™๐‘’-๐‘’๐‘›๐‘‘๐‘–๐‘Ž๐‘›. ๐‘†๐‘–๐‘›๐‘๐‘’ ๐‘กโ„Ž๐‘’๐‘Ÿ๐‘’โ€™๐‘  ๐‘›๐‘œ ๐‘œ๐‘“๐‘“๐‘–๐‘๐‘–๐‘Ž๐‘™ ๐‘ก๐‘’๐‘Ÿ๐‘š ๐‘“๐‘œ๐‘Ÿ ๐‘กโ„Ž๐‘–๐‘  ๐‘ค๐‘’ ๐‘ ๐‘Ž๐‘ฆ โ€œ๐‘๐‘ฆ๐‘ก๐‘’ ๐‘ ๐‘ค๐‘Ž๐‘๐‘๐‘’๐‘‘โ€ ๐‘œ๐‘Ÿ โ€œ๐‘Ÿ๐‘’๐‘ฃ๐‘’๐‘Ÿ๐‘ ๐‘’ ๐‘๐‘ฆ๐‘ก๐‘’๐‘ โ€. For readability, the bytes are swapped back to the style of big-endian when this data is displayed to humans. A block explorer is one example of where you can see this. Bitcoin Coreโ€™s JSON-RPC interface was the first time block hashes were printed for human consumption. That was when someone decided to reverse the ordering of hash so that it looked like a human readable integer. image It turns out the real block hash, the actual sha256 value you get if you compute the hash yourself, is: e4b1d56439d46d9070e58c4368cccc97596fa908daf101000000000000000000 The zeros are actually on the right! At first glance it looks like this is a very large number, but we know the integer value of a block hash actually gets smaller as the difficulty increases. It's clear that the bytes are reversed and in the style of little-endian. But why? We can thank Satoshi for that. Satoshi decided to interpret the block hash as a little-endian integer. The more zeroes there are on the right side, the smaller the (little-endian) integer. Since most modern CPUs are little-endian, bitcoin uses it to optimize performance. However, network protocols typically use big-endian, creating a mismatch ๐Ÿ™€ Big-endian is used for network communication (network byte order). Little-endian is used for bitcoinโ€™s internal storage. This duality requires developers to frequently, and sometimes frustratingly, convert between the two formats when working with bitcoin data. Have you been the victim of an endianness oversight when writing bitcoin code? It's a common source of pain for developers new to bitcoin (and even the seasoned ones!) As covered by the transaction ID example earlier, byte order confusion can be common. image Another gotcha is length specification. When converting to little-endian, always specify the correct byte length: image Hope you learned something new about endianness today. If you enjoyed this, share it with a friend and donโ€™t forget to follow us, @Bitcoin Dev Project ! This material is from Decoding Bitcoin, your go-to resource for understanding #bitcoin, privacy, and decentralization. Visit for the full lesson, and more free, interactive content. Thanks for reading!
Bitcoin Dev Project's avatar
bitcoin_devs 11 months ago
There is an oft-repeated sentiment in the community that bitcoin does not need you. While bitcoin is designed to be resilient, we ๐‘‘๐‘œ need you. Bitcoin needs all the talent and energy it can gather to solve some of the most difficult technical problems of our time. Bitcoin in your hands changes everything. image
Bitcoin Dev Project's avatar
bitcoin_devs 11 months ago
Itโ€™s #DecodingBitcoin time! Letโ€™s go over the basic elements of a transaction. Alice wants to send 5 BTC to Bob. She needs to create a bitcoin transaction using the unspent outputs (UTXOs) in her wallet. image UTXOs are unspent transaction outputs. They can be used as inputs for new transactions. Think of them as "coins" in a wallet, waiting to be spent. Alice checks her wallet and finds two UTXOs: image To create a transaction, Alice has to specify exactly which UTXOs to spend. A UTXO is identified by the transaction it came from, specifically - the transaction ID and - an index that says where the UTXO is in the list of transaction outputs image Wallets usually store this information for you but you can also look it up on the blockchain. Alice's wallet shows these available UTXOs: - UTXO #1: 4 BTC (from Transaction 1, Output Index 1) - UTXO #2: 2 BTC (from Transaction 2, Output Index 0) Together, they provide enough funds (4 BTC + 2 BTC = 6 BTC) for the payment and any transaction fees. Now Alice has everything she needs to identify her UTXOs. As she adds them to the transaction, she saves space for the signatures she will make later. These signatures authorize the spending of the UTXOs. image Now that the transaction inputs have been taken care of, itโ€™s time to look at the outputs! Alice needs to create two outputs: - 5 BTC to Bob (the payment amount) - 0.99 BTC back to Alice as change (there is a 0.01 BTC transaction fee) image Why do we have to make a separate output for change? UTXOs must be spent in their entirety. You cannot partially spend a UTXO. Instead, you create a new output that sends the excess amount back to yourself as change. image Looks good! The transaction structure is now complete, but itโ€™s not yet valid. Alice must sign it to prove she owns the inputs. Weโ€™ll cover that in a future lesson ๐Ÿ™‚ Follow us @Bitcoin Dev Project to stay updated! This material is from Decoding Bitcoin, your go-to resource for understanding #bitcoin, privacy, and decentralization. If you enjoyed it, visit for the full lesson, and more free, interactive content. Thanks for reading!
Bitcoin Dev Project's avatar
bitcoin_devs 11 months ago
Are you tired of searching for "lightning" only to get results about sparks in the sky and ice hockey teams in Florida? So are we. That's why we built Bitcoin Search, which pulls from a curated list of credible #bitcoin tech sources. We've built the world's largest collection of technical bitcoin-related resources: articles, podcast transcripts, blog posts, and more. Sources are regularly monitored to make sure your search results are up-to-date. We hand-pick sources for their contributions to technical bitcoin concepts. Examples include the Bitcoin-dev Mailing List, LN dev Mailing List, Bitcoin Optech, and many more. Bookmark it and try it out today! image
Bitcoin Dev Project's avatar
bitcoin_devs 11 months ago
What's the deal with #bitcoin fees? How are they calculated? Where do they go? Let's have a look with a #DecodingBitcoin post: A transaction's fee is equal to the total amount of bitcoin in the inputs, minus the total amount of bitcoin in the outputs. image Here's how to calculate the fee for this transaction: Fee = Input - (Output1 + Output2) Fee = 299.99430000 - (0.00140000 + 299.99240000) Fee = 299.99430000 - 299.99380000 Fee = 0.00050000 Fee = 50,000 sats Remember: Sum(Inputs) should always be greater than Sum(Outputs) image Fees incentivise miners to include transactions in blocks. Without fees, miners would have little reason to put transactions into blocks! In addition to fees, miners also receive a block reward. Total miner revenue = fees + block reward image How do miners decide what transactions go into a block? The short answer is miners will usually maximize revenue by prioritizing transactions with the highest fee rate (we've got a whole lesson fee rates coming!) image While miners can choose which transactions to include based on fees, there's a minimum threshold, a "minimum relay fee" that must be met just for a transaction to be relayed through the network. Transactions below this threshold are rejected by nodes. It helps prevent spam and DoS attacks on the network image This brings us to an important question: What happens if you submit a transaction with a fee rate above the minimum but still too low for current network conditions? That transaction could sit in the mempool for hours because the fee rate is too low for the high level of network activity. Even if you met the minimum, there can still be plenty of transactions with higher fee rates than yours, ones that miners will choose first. image At this point, you have two main ways to "unstick" it: 1. RBF (Replace-by-Fee) 2. CPFP (Child Pays for Parent) -------------------------------- That's all for now! We'll dive deeper into fee rates, RBF, and CPFP in a future post. This material is from Decoding Bitcoin, your go-to resource for understanding #bitcoin, privacy, and decentralization. If you enjoyed it, visit for the full lesson, and more free, interactive content! And don't forget to follow us for more posts about bitcoin tech and tools to help you in your developer journey ๐Ÿš€
Bitcoin Dev Project's avatar
bitcoin_devs 11 months ago
Psst. Don't have enough hours in the day to read the mailing list and Delving Bitcoin? We have a secret weapon for you. Bitcoin TLDR has daily summaries, available by post or by thread: Here's today's summary of the bitcoin-dev mailing list: - Ava Chow announced Bitcoin Core version 28.1. It makes adjustments to p2p configurations to enhance usability & reduce startup failures. It also has internal ID counting updates, enhancements in key handling, build system improvements, & a call for community participation in reporting bugs and joining the announcement list - @Jameson Lopp raised concerns about the reliability of transaction timestamp data, specifically the vulnerability of nLockTime. It can be manipulated for unfair prioritization benefits, undermining the effectiveness of new prioritization rules. - Yuval Kogman critiqued misconceptions around privacy mechanisms, focusing on wabisabi credentials & Wasabi wallet. He sheds light on the challenges with safeguarding privacy and security, emphasizing transparency, comprehensive security measures, & ethical considerations. image
Bitcoin Dev Project's avatar
bitcoin_devs 11 months ago
Let's talk about the 2 ways to track user balances on decentralized networks. Time for a #decodingbitcoin post: 1. Account Model (Ethereum): Tracks balances like a bank ledger (simple and intuitive). 2. UTXO Model (Bitcoin): Tracks specific unspent outputs from transactions (complex but powerful) image The account model is like your bank statement. Simple to understand and works well with smart contracts. The downside is it's less private and can be vulnerable to replay attacks. image The UTXO model is like bills in a wallet. UTXOs (unspent transaction outputs) can only be spent once. Each transaction creates new UTXOs, and your balance is the sum of all your unspent UTXOs image This model has better privacy, prevents double spending, and allows for parallel transaction processing. The cons are it's more difficult to understand, is harder for complex applications, and requires UTXO management. Here's a comparison chart of the two models: image This material is from Decoding Bitcoin, your go-to resource for understanding #bitcoin, privacy, and decentralization. If you enjoyed it, visit for the full lesson, and follow us for more free educational #bitcoin content!
Bitcoin Dev Project's avatar
bitcoin_devs 11 months ago
Like this note if youโ€™re the worldโ€™s best โ‚ฟOSS contributor. Repost if youโ€™re going to become one this year. image
Bitcoin Dev Project's avatar
bitcoin_devs 1 year ago
๐Ÿš€ Help us save Satoshi! And learn the fundamentals of bitcoin tech while youโ€™re at it ๐Ÿ“ข Introducing Saving Satoshi! The worldโ€™s first interactive, practice-focused game to teach you bitcoin development. www.savingsatoshi.com Bitcoin tech can be hard to learn. Yes, there are many incredible resources. Our goal is to complement them and add our drop of interactivity to the ocean of learning. Try Saving Satoshi today! image What will you learn? - How to find and decode the hidden message in the genesis block - Elliptic curve cryptography - Message signing and verification - Building a transaction - Building a block template - Bitcoin Script - How the Lightning network works - And so, so much more! How is Saving Satoshi different? - Logged in state to remember your progress - Ability to share accomplishments publicly - A real story to motivate you to learn - Free and Open Source image Saving Satoshi started as a hackathon idea: โ€œHow can we make bitcoin tech education more engaging and fun?โ€ Since then itโ€™s become a game with 10 fun chapters, and support for both Python and JavaScript Worldwide there are groups like TabConf and Scalar School playing together. image Give Saving Satoshi a go today, and let us know what you think. Shoutout to the team that helped bring this over the finish line image Now be quick, Satoshi needs you! www.savingsatoshi.com
Bitcoin Dev Project's avatar
bitcoin_devs 1 year ago
๐Ÿš€ Decoding Bitcoin! An interactive, exercise-first way to learn bitcoin development 100% free and open-source ๐Ÿ‘‡ Dive into bitcoin tech with us below! Decoding Bitcoin makes learning bitcoin tech easier, funner, and more efficient It gives you the perfect mix of - Concise explanations - Real-world exercises - Tons of interactive demos image Being able to play with interactive elements to understand Bitcoin concepts is the best way to solidify a working mental model image No libraries allowed, youโ€™ll craft everything from scratch! We support both JavaScript and Python (of course!) Each bitcoin concept comes with its own exercise, so youโ€™ll learn not just how things work, but also when and where to use them. image By the end of each module, youโ€™ll challenge yourself by creating a project to test your understanding. image Weโ€™ve started with the first module on Scripts. More content is coming soon! Please share your feedback on this first releaseโ€”it helps us understand what you want to see next, whether itโ€™s content or new features.
Bitcoin Dev Project's avatar
bitcoin_devs 1 year ago
๐Ÿ“ข Introducing Bitcoin Search v2 Want to find that one specific technical bitcoin nugget? Youโ€™re in luck! There is only one place that allows you to search the depths of bitcoinโ€™s technical ecosystem and retrieve the highest signal info about bitcoin tech. ๐Ÿ”—๐Ÿ‘‡ Bitcoin Search is unique Unlike Google, when you search for โ€œlightningโ€ We actually know what you mean (Hint: Itโ€™s not electric sparks in the sky. Or an ice hockey team in Florida). image Features We let you sort and filter by categories that matter - Authors and - Sources And in ways that matter - Relevance and - Date And with views you love: dark ๐ŸŒ‘ & light ๐ŸŒž Scope The scope of the product is laser focused: bitcoin tech Users can suggest sources deeper in the product. This bolsters our repo of bitcoin tech sources We build pathways to scrape the data Which grows our library of bitcoin tech literature and resources Ecosystem of Knowledge Creation Bitcoin Search thrives as a collaborative ecosystem. As you do more Transcript Reviews and suggest new credible sources, our database continuously expands and improves, ultimately benefiting the entire Bitcoin technical community. Itโ€™s a virtuous cycle of knowledge creation image We already had a live V1. Why build a V2? We wanted to improve comprehension of the product for newer devs interested in bitcoin tech While improving its usability, and increasing a sense of delight when using it. image Biggest thanks to the team! Dev: Emmanuel, Solomon, Balogun, Otuedon Design: @paperpsych Dev Lead: Theo Vision: Jonas Product: @art assoiants So, give Bitcoin Search a go! Tell us what you like and donโ€™t like. Whatโ€™s missing. What should we do better? And importantly - what kinds of products and tools are missing for bitcoin devs and builders in the ecosystem?
Bitcoin Dev Project's avatar
bitcoin_devs 1 year ago
Want to contribute to #Bitcoin FOSS development But don't know where to start? ๐Ÿ“ข Introducing Bitcoin Good First Issues! A tool designed specifically for devs just entering bitcoin development. ๐Ÿค” We know itโ€™s hard to guess which projects to start with and what issues to tackle. Bitcoin Good First Issues gathers beginner-friendly issues labelled Bug, Help Wanted, and (heh) Good First Issues. It pulls them live for your from vetted Free Open Source Software projects. ๐Ÿ› ๏ธ Why Give It a Go? - Vetted Projects - Easy Navigation - Lowered Barrier to Entry Whether you're just starting or already a developer, Bitcoin Good First Issues is built to accelerate your contributions. Give it a roll and make a difference! Letโ€™s build the future of bitcoin together. ๐Ÿ‘ฉโ€๐Ÿ’ป Check the image below to learn how the data flow works: image ๐Ÿ–ค Biggest thanks to our team! - Vision: Theo - Ideation: Emmanuel, Solomon, Abubakar Ismail - Design: Theo with thanks to paperpsych - Dev: Theo, Solomon, Balogun - Product: @art assoiants ๐Ÿ“ƒ Examples of vetted FOSS projects in Bitcoin Good First Issues - BDK - Core LN - Eclair - Fedimint - LDK - Polar - Stratum Mining We're looking forward to your feedback!
Bitcoin Dev Project's avatar
bitcoin_devs 1 year ago
Better search For better learning And better buidling Coming. image
โ†‘