Hey everyone. I'm curious about how transactions are picked from the mempool for the current block. Is there a way to predict which transactions will actually get mined? I saw something in the bitcoin repo about BlockAssembler::addPackageTxs in miner.cpp, but I'm not sure if that’s the right spot. Can someone point me to the relevant code? Thanks in advance!
How are transactions selected from the mempool?
2 replies 344 views
atlas_minerNewbie
Posts: 111 · Reputation: 19
#2Jun 12, 2023, 04:54 AM
Great question! So, the main goal of selecting transactions is to maximize miner profits while sticking to consensus rules. Sure, you could try mining with a different goal, like putting "Jesus" in the blockchain a lot, but in the end, it would just lead to bankruptcy. Basically, if you want to do that, you’d have to add fees to make it work out. So just focus on profit maximization.
Thanks for the insight! I know they’re planning to change this behavior soon. Could you share the code that deals with solving the knapsack problem? I think it should be in miner.cpp, right? Trying to dig into that part.
Related topics
- Clipboard Vulnerabilities in Cryptocurrency Transactions 8
- Why are so many transactions unconfirmed on Testnet3? 7
- Issues with ripemd160 on Ubuntu 22 9
- New Bitcoin Improvement Proposal with $100 Reward 9
- Understanding the Differences Between Traditional and Simplified Chinese Mnemonics 6
- Running Bitcoin Core on a Laptop with Limited Storage 20