5 ms·
When you make a bitcoin transaction, it gets put into a "mempool". Basically you send your TX to a node, that shares it with other nodes on the network, and the
by Klathmon 9y ago
When you make a bitcoin transaction, it gets put into a "mempool". Basically you send your TX to a node, that shares it with other nodes on the network, and they all hold it in memory. Once a block is found, the miner that found the block will pull as many transactions as possible from the mempool and put them into that block and sign it on the blockchain forever.
Since TX fees go to miners, they are incentivized to pick the transactions with the largest "fee per size" to include first to maximize their profit (though they aren't required to do so).
So basically you can envision all transactions as a stack, with the highest fees at the top. Once a block is found, it takes the top ~1MB worth of transactions, and the cycle repeats. [0] is a good visual representation of this.
Unfortunately this means there isn't an easy way to determine what fee will absolutely get you included in a block before it's mined, since if thousands of transactions show up with higher fees than yours after you (but before a block is mined) yours might not make it in the next block (even if your fee was the highest when you made the transaction).
It's a tough problem to solve, but there are some solutions being worked on to help solve this problem for the vast majority of bitcoin transactions.
[0]https://core.jochen-hoenicke.de/queue/#24h https://core.jochen-hoenicke.de/queue/#24h
- simpsond 9y agoI don’t understand why miners wouldn’t include all pending transactions in their block. Seeing as how pow is a guessing game, there are plenty of permutations of the Merkle tree to generate plenty of roots. I guess to dissencentivize free loaders so miners can continue to make money once Coinbase txns are no longer a thing? It’s certainly not free to mine!
- Bootvis 9y agoThe number of transactions that can be included in a block is limited. A block is generated on average 10 minutes (a bit quicker due to increasing hash rate) so the number of transactions in an hour is also limited. Naturally the transactions that pay most to the miners are getting selected by them and included in these blocks.
- Klathmon 9y agoAs the other commenter said, there is about 1 MB of room in each block, and almost always >1 MB worth of transactions in the "mempool" (actually it's often >12MB for the most part, because people will make tons and tons of transactions at 1sat/byte and not really care if they take forever to go through). And you are correct that bitcoin's ultimate goal is to have mining income come solely from transaction fees eventually. But by that point the hope is that "second layer" systems will take the brunt of the transactions and the actual core blockchain will only be a settlement layer where a $500 fee is no big deal for 2 banks settling hundreds of millions of dollars directly on the blockchain.
- greenhouse_gas 9y agoSo are fees a percentage (.05bc a transaction) or a Flat fee (.05bc a transaction)?
- Klathmon 9y agoFees are set as a "flat rate" per transaction, but normally expressed as a fraction of "price over size" So if a fee is 150 "sat/byte" or satoshi's per byte. A satoshi is 0.00000001 of a bitcoin. So if your transaction is 250 bytes (which is average for a single transaction to a single person), then you will pay (250 * 150) satoshis (37500 sat), which is about $5. If your transaction is larger, you'll pay more, if it's smaller, you'll pay less. But they are "ranked" in terms of who is picked first by "sat/byte" since the amount of room in the block is only 1MB. So a 500 byte transaction with 37500 sats in fees is worth less than a 250 byte transaction with 37500 sats in fees, because the 500 byte transaction takes up more room that other higher paying transactions could fit in.
- retromario 9y agoThanks for the explanation. Why do transactions vary so much in relative size?
- vel0city 9y ago
- makomk 9y agoIf they could, miners probably would put all the pending transactions into a block. That's why the block size limit exists; every other node in the network has to process all those transactions and they're not paid for it in any way, so without the size limit miners would be likely to act in a way that hurts the rest of the network.
- seanwilson 9y ago> Once a block is found, the miner that found the block will pull as many transactions as possible from the mempool and put them into that block and sign it on the blockchain forever. Might be a nitpick, but you mean the miner puts as many high value transactions as they can fit into a block and then searches for a valid hash?
- Klathmon 9y agoYeah that's more correct. Technically the miner needs to know what they are going to be including in a block when they begin trying to find a valid hash, but for the sake of explanation I generally switch it around for simplicity.
- bigtunacan 9y agoSo how does one make money as a miner via processing these fees? Is this money being taken by pools, individual miners? Who is the middle-man that is actually taking this profit?
- Klathmon 9y agoIt's pretty clever. Whenever you make a transaction in bitcoin, you point to the previous balance you have from a previous transaction, then you say how much you are sending to what address. The "fee" is the difference between the amounts. So if I have 1 Bitcoin, and I send .9 to you, the fee is .1 If you want to make sure you keep some Bitcoin, you just send it to yourself. So 1 have one, and I send .1 to you, and .8 back to me, the fee is .1 Then when a miner mines a block, any unspent money is now theirs, and they claim it via the address they liked for.