+
+Let's calculate the fee for the following transaction:
+
+
+
+
+
+
+
+
+
+**Fee = Input - (Output1 + Output2)**
+= 299.99430000 - (0.00140000 + 299.99240000)
+= 0.00050000 BTC (50,000 sats)
+
+**Remember:** Sum(Inputs) should always be greater than Sum(Outputs)
+
+---
+
+## Why Do We Need Fees?
+
+The purpose of fees is to incentivize miners to include transactions in the block.
+Without fees, miners would have no reason to include transactions in their blocks.
+
+- But how exactly do miners decide which transactions to include ?
+
+---
+
+### How Miners Select Transactions ?
+
+Miners receive two types of rewards for securing the network:
+
+1. **Block Reward**
+2. **Transaction Fees**
+
+
+
+
+
+
+
+
+A miner who mines a block will have revenue as:
+
+
+ $$Revenue = Tx\ Fees + Block\ Subsidy$$
+
+
+To maximize their revenue, miners prioritize transactions that pay higher fees. The way they determine which transactions pay more will be covered in the next topic when we discuss fee rates.
+
+For now, understand that:
+
+- Transactions paying **higher fees** get priority for inclusion (fast confirmation)
+- Transactions paying **lower fees** may wait longer in the mempool (or even fail)
+
+
+
+
+
+
+
+
+---
+
+### Minimum Relay Fee
+
+While miners can choose which transactions to include based on fees, there's actually a minimum threshold that transactions must meet just to be relayed through the network.
+
+This is called the **minimum relay fee**.
+
+- It's the minimum fee required for nodes to relay and accept a transaction
+- Default is typically 1 sat/vbyte (we'll explain this unit sat/vbyte in the next topic)
+- Transactions below this threshold will be rejected by nodes
+- Helps prevent spam and DoS attacks on the network
+
+
+ 💡 Even if you pay the minimum relay fee, your transaction might still take
+ a long time to confirm if network activity is high. The minimum relay fee is
+ just the baseline for transaction acceptance.
+
+
+This brings us to an important question: What happens when you submit a transaction with fees that are above the minimum relay fee but still too low for current network conditions?
+
+---
+
+### Fee Adjustment Methods
+
+When network activity increases, transactions with lower fees might get stuck in the mempool. This can happen even if you paid above the minimum relay fee, as miners will prioritize transactions offering higher fees.
+
+Let's say you have a transaction that's been sitting in the mempool for hours because you set the fee too low during a period of high network activity.
+
+
+
+
+
+
+
+
+You have two main solutions to "unstick" it:
+
+1. **RBF (Replace-by-Fee)**
+2. **CPFP (Child Pays for Parent)**
+
+We will cover both these fee adjustment methods in detail in upcoming sections.
diff --git a/decoding/transaction-weight.mdx b/decoding/transaction-weight.mdx
new file mode 100644
index 0000000..ce159dc
--- /dev/null
+++ b/decoding/transaction-weight.mdx
@@ -0,0 +1,87 @@
+---
+title: "Transaction Weight"
+date: 2024-01-25T15:32:14Z
+lastmod: "2024-07-26"
+draft: false
+category: Transactions
+layout: TopicBanner
+order: 6
+icon: "FaClipboardList"
+images: ["/bitcoin-topics/static/images/topics/thumbnails/musig-thumbnail.webp"]
+parent: "fee-calculation"
+---
+
+When sending Bitcoin transactions, we need to pay fees. But how does the network determine how much we should pay?
+
+It all comes down to space - specifically, how much space our transaction takes up in a block.
+
+## Transaction Size (Legacy)
+
+Originally, measuring transaction size was straightforward:
+
+
+
+This simple measurement worked because:
+- Each transaction was just a series of bytes
+- Fees were calculated based on these bytes
+
+
+
+## Enter SegWit Transactions
+
+The legacy system was simple, but it had a problem: transaction signatures.
+
+Every Bitcoin transaction needs signatures to prove ownership, similar to signing a check. These signatures:
+- Take up a lot of space (often 65% of the transaction)
+- Were part of the main transaction data
+- Could be slightly modified without invalidating them (transaction malleability)
+
+This is where SegWit (Segregated Witness) comes in. "Segregated" means separated, and "Witness" refers to the signature.
+
+So SegWit simply means:
+"Let's store the signatures separately from the main transaction data!"
+
+
+
+
+
+
+
+
+
+
+SegWit splits each transaction into two parts:
+- **Base data**: The essential information (addresses, amounts) - the "what"
+- **Witness data**: The signatures - the "proof"
+
+
+#### Transaction Weight
+
+But splitting the data created a new challenge: how do we measure transaction size now?
+The solution was a new measurement called "transaction weight", calculated as:
+
+
+
+For example, if you have a transaction with base data of 200 bytes and witness data of 100 bytes, the weight would be: (200 × 4) + 100 = 900 weight units
+
+This formula means:
+- Base data counts heavily (4× weight)
+- Witness data counts lightly (1× weight)
+
+
+ 💡 For legacy (non-SegWit) transactions, the entire transaction is considered base data,
+ so weight = size × 4
+
+
diff --git a/static/images/topics/transactions/fees/fees_0_temp.png b/static/images/topics/transactions/fees/fees_0_temp.png
new file mode 100644
index 0000000..7b75e82
Binary files /dev/null and b/static/images/topics/transactions/fees/fees_0_temp.png differ
diff --git a/static/images/topics/transactions/fees/fees_1.svg b/static/images/topics/transactions/fees/fees_1.svg
new file mode 100644
index 0000000..ae15c82
--- /dev/null
+++ b/static/images/topics/transactions/fees/fees_1.svg
@@ -0,0 +1,24 @@
+
diff --git a/static/images/topics/transactions/fees/fees_2.svg b/static/images/topics/transactions/fees/fees_2.svg
new file mode 100644
index 0000000..3ef3de4
--- /dev/null
+++ b/static/images/topics/transactions/fees/fees_2.svg
@@ -0,0 +1,40 @@
+
diff --git a/static/images/topics/transactions/fees/fees_3.svg b/static/images/topics/transactions/fees/fees_3.svg
new file mode 100644
index 0000000..2388103
--- /dev/null
+++ b/static/images/topics/transactions/fees/fees_3.svg
@@ -0,0 +1,22 @@
+
diff --git a/static/images/topics/transactions/fees/fees_4.svg b/static/images/topics/transactions/fees/fees_4.svg
new file mode 100644
index 0000000..21f02b7
--- /dev/null
+++ b/static/images/topics/transactions/fees/fees_4.svg
@@ -0,0 +1,35 @@
+
diff --git a/static/images/topics/transactions/fees/fees_5.svg b/static/images/topics/transactions/fees/fees_5.svg
new file mode 100644
index 0000000..c062f63
--- /dev/null
+++ b/static/images/topics/transactions/fees/fees_5.svg
@@ -0,0 +1,43 @@
+