9

The current maximum size of a block is 1 MB. Current block sizes are about half that, so the absolute worse case scenario is that the block chain grows in size twice as fast as it does now. That's not particularly scary. It's easy to create more than 1 MB of transactions every 10 minutes. If anyone does that, some transactions can't be included in blocks. ...


9

A block may contain only one transaction: the coinbase transaction. However, the time it takes to mine a block is not affected by the number of transactions in that block, so mining blocks with fewer transactions does not benefit the miner. On the other hand, miners collect fees from the transactions they include in a block, so by including more transactions ...


8

This is a common misconception: mining is progress free. Yes, it may take 10000 hashes in your example on average to find a block, but this only means that every attempt has 1/10000 chance of being a good one. It is irrelevant how many hashes you've done so far. Even if you have performed 9999 hashes already, the next one still only has a 1/10000 chance. So ...


7

Your answer assumes different nodes can have a consistent view of the mempool. If that were the case, we wouldn't need a blockchain at all, whose sole purpose is establishing consistency between different nodes' view of history. The reason this is not possible is due to the laws of physics. A transaction tx1 broadcast in Australia, which conflicts with a ...


7

https://www.coindesk.com/information/how-do-bitcoin-transactions-work/ She then sends them from her bitcoin wallet out to the wider bitcoin network. From there, bitcoin miners verify the transaction, putting it into a transaction block and eventually solving it. Transactions are broadcast over the P2P network, which miners are also a part of, so they ...


7

Miners pick transactions from the mempool which is the queue of unconfirmed transactions. When there are fewer transactions waiting than would fit into a block, the block will not be full. The miner could create more transactions themselves, but that would be only useful if they wanted to send one themselves already in the first place, otherwise they'd just ...


6

The code you're looking for is in CreateNewBlock. The usual way transactions are added to a block is by sorting by priority. The priority of an input is the value being spent in the input multiplied by the number of confirmations it has. The priority of a transaction is the sum of all the priorities of the inputs. See this line: dPriority += (double)...


6

input_value_in_base_units is the number of satoshis that the input is worth. One Bitcoin is worth 100,000,000 satoshis. input_age is how many blocks the input has been present for. An unconfirmed transaction has an age of 0, and one that has 100 confirmations has an age of 100.


6

Blocks can contain whatever is valid, anything beyond that is up to the miner to decide. Including no transactions other than the coinbase transaction is valid, and there is no way of having a rule where this is not the case (was there transactions to include at that point in time?). Miners will absolutely not wait for transactions to be available to mine, ...


6

This is not a full answer, but a partial answer somebody may use as a stepping stone to craft a complete answer. E.g. blockchain.info shows both "received time" and the time of the block a transaction was included in. It appears to me that the "11 minutes" in the "Included in Blocks" time for this transaction corresponds to the difference between "...


5

It is actually less likely to occur by the same miner. The reason for this is the fact that the miner that found the Block will have already validated it, thus it knows which transactions from the mempool were used. If the block is mined by another person their mining software might not have validated the previously mined block yet, which causes them to be ...


5

The whole mempool won't fit in a block; getblocktemplate returns enough transactions for a block. Blocks are, by default, limited to 750kb by policy, but many miners increase the size to the block limit of 1mb (which can be done by command-line flag). The specific piece of code that decides on the transactions that should be included in a block can be found ...


5

Yes, you are correct that miners get to decide whether to include transactions in their block that they're mining. The protocol itself doesn't force them to include any transactions. Instead, they have a financial incentive to include transactions because they can collect transaction fees and profit more. It's an interesting trade-off for them, because ...


5

Do all the miners have one global pool filled with transactions Different full nodes have a different version of the mempool. Transactions are broadcasted to the bitcoin network on a best effort basis. If a transaction never reaches a node, it would not include it in the mempool. It would not learn about this transaction until it is included in the block by ...


5

For the purpose of mining transaction selection Bitcoin Core converts sigops into an effective weight value based on the ratio of the limits. If the weight implied by the sigops count is higher than the true weight, the higher value is used for fee handling calculations. On any kind of remotely sane transaction this has essentially no effect, but eliminates ...


4

Miners have total freedom to choose which transactions they will include in their blocks. Most miners will include any transaction that reaches them (assuming it includes an appropriate fee) but nothing forces them to do so. But if a miner decides, for whatever reason, to omit a particular transaction, or if it's omitted by an accident of timing, no ...


4

There are indeed many new transactions every second. The way miners deal with it is two-fold: If an appropriate proof-of-work is found on any merkle root, simply publish that block and any transactions that did not make it into the block go into the next block (assuming sufficient fees) Otherwise, calculate a new merkle root every so often (varies per miner,...


4

We don't have to wait until a block is full, instead blocks are created in a random process. Whenever one is found, the miners directly try finding the next one. This takes roughly ten minutes, regardless of how many transactions are waiting to be confirmed. So, we'll all be waiting for the new block.


4

Every node in the network has a mempool. The mempool contains unconfirmed transactions. Each mempool may be slightly different as they constitute a subset of all unconfirmed transactions in the network: Some might not have been relayed to a node, so he doesn't know about them, the node owner has set a higher minTxRelayFee and filtered out some transactions ...


4

The Bitcoin consensus rules do not require transactions to have a fee, so it's still theoretically possible for a free transaction to be confirm. It is, however, unlikely that any miners today will confirm free transactions. You can test this by sending yourself a free transaction to see if it confirms (but be sure you use a quality wallet, such as Bitcoin ...


4

The process of a transaction being created and included in the blockchain is as follows: The sender creates, signs, and broadcasts the transaction All Bitcoin full nodes, including miners and regular users, receive the transaction and validate it by making sure it follows the Bitcoin protocol rules Nodes temporarily store the unconfirmed/yet-to-be-mined ...


4

$ src/bitcoin-cli getmempoolentry ed45c837d26c25fb6a763708376a87f1875ff57efbb0f56d1b26d00a16c1899e { "fees": { "base": 0.00012042, "modified": 0.00012042, "ancestor": 0.00125452, "descendant": 0.00012042 }, "vsize": 224, "weight": 896, "fee": 0.00012042, ...


4

How does miner order transactions if two are unrelated? e.g., A pays C, X pays Y. I assume changing the order in the block will change the hash, so I am curious how Bitcoin code combines them in which order. Transactions can be ordered in a block in any way a miner wishes to so long as a transaction which spends an output created by another transaction in ...


3

technically each individual miner can choose the list of transactions except for coinbase transaction. Is this correct? Technically it is possible. In fact no one do it. Pool operator assembles a list of transactions and miners only calculate sha-hashes. They do not know block contents. or do pool operators dictate the full block contents? Yes


3

First of all, this is a slight oversimplification: after taking transactions with fees, the standard policy is that priorities of remaining transactions are weighted by age and amount transacted. For each input to the transaction, the age of the input being spent (counted by number of confirmations) is multiplied by the bitcoin amount of the input, and the ...


3

Welcome to the site! It depends on the protocol being used. Some protocols have the pool dictate how often the list of transactions is updated, and others have it defined by the mining client. Stratum In Stratum, the pool sends the miner a new merkle branch when it sees a new block or when a certain amount of time has passed. By default, it updates the list ...


3

It is up to individual mining pools to decide how quickly to include newly received transactions. There are no strict rules here and delays of a few minutes are usually acceptable. Transactions with higher fees may encourage miners to include them in a block ASAP.


3

There are a few issues with this proposal: No transaction could ever be confirmed in less than ten minutes. We already have plenty people up in arms that choose to rely on zero confirmation transactions. Waiting at least ten minutes would increase confirmation times. Every node has their own mempool and they don't necessarily match. Every node receives ...


3

As long as all selected transactions are valid, you may select any transactions you want. You should check that there are no double spends among the selected transactions and that you keep any transactions which build on each other in the correct order, i.e. if TX B spends an output of TX A, TX B has to be listed after TX A in the block if you select both. ...


3

When you broadcast a transaction, to get a confirmation you're bidding for blockchain space, a limited good. Since blocks currently supply only one megabyte of space, miners maximize their profit by selecting transaction in order of fee rate, i.e. the number of satoshis offered to the miners per byte of transaction size. (Unless there is an additional out-of-...


Only top voted, non community-wiki answers of a minimum length are eligible