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!
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
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 🚀