|
7 | 7 | if uncertain about anything, just do what seems best and harding will edit |
8 | 8 | --> |
9 | 9 |
|
10 | | -FIXME:glozow |
| 10 | +Many nodes on the Bitcoin network store unconfirmed transactions in an |
| 11 | +in-memory pool, or _mempool_. This cache is an important resource |
| 12 | +for each node and enables the peer-to-peer transaction relay network. |
| 13 | + |
| 14 | +Nodes that participate in transaction relay |
| 15 | +download and validate blocks gradually rather than in spikes. |
| 16 | +Every ~10 minutes when a block is found, nodes without a mempool |
| 17 | +experience a bandwidth spike, followed by a computation-intensive |
| 18 | +period validating each transaction. On the other hand, nodes with a |
| 19 | +mempool have typically already seen all of the block's transactions and |
| 20 | +store them in their mempools. With [compact block relay][topic compact |
| 21 | +block relay], these nodes just download a block header along with shortids, |
| 22 | +and then reconstruct the block using transactions in their mempools. |
| 23 | +The amount of data used to relay compact blocks is tiny compared to |
| 24 | +the size of the block. Validating the transactions is |
| 25 | +also much faster: the node has already verified (and cached) |
| 26 | +signatures and scripts, calculated the timelock requirements, and |
| 27 | +loaded relevant UTXOs from disk if necessary. The node can also |
| 28 | +forward the block onto its other peers promptly, dramatically |
| 29 | +increasing network-wide block propagation speed and thus reducing the |
| 30 | +risk of stale blocks. |
| 31 | + |
| 32 | +Mempools can also be used to build an independent fee estimator. The |
| 33 | +market for block space is a fee-based auction, and keeping a mempool |
| 34 | +allows users to have a better sense of what others are bidding and |
| 35 | +what bids have been successful in the past. |
| 36 | + |
| 37 | +However, there is no such thing as "the mempool"---each node may |
| 38 | +receive different transactions. Submitting a transaction to one node |
| 39 | +does not necessarily mean that it has made its way to miners. Some |
| 40 | +users find this uncertainty frustrating, and wonder, "why don't we |
| 41 | +just submit transactions directly to miners?" |
| 42 | + |
| 43 | +Consider a Bitcoin network in which all transactions are sent directly |
| 44 | +from users to miners. One could censor and surveil financial activity |
| 45 | +by requiring the small number of entities to log the IP addresses |
| 46 | +corresponding to each transaction, and refuse to accept any |
| 47 | +transactions matching a particular pattern. This type of Bitcoin may |
| 48 | +be more convenient at times, but would be missing a few of Bitcoin's |
| 49 | +most valued properties. |
| 50 | + |
| 51 | +Bitcoin's censorship-resistance and privacy come from its peer-to-peer |
| 52 | +network. In order to relay a transaction, each node may connect to |
| 53 | +some anonymous set of peers, each of which could be a miner or |
| 54 | +somebody connected to a miner. This method helps obfuscate which node |
| 55 | +a transaction originates from as well as which node may be responsible |
| 56 | +for confirming it. Someone wishing to censor particular entities may |
| 57 | +target miners, popular exchanges, or other centralized submission |
| 58 | +services, but it would be difficult to block anything completely. |
| 59 | + |
| 60 | +The |
| 61 | +general availability of unconfirmed transactions also helps minimize |
| 62 | +the entrance cost of becoming a block producer---someone who is |
| 63 | +dissatisfied with the transactions being selected (or excluded) |
| 64 | +may start mining immediately. |
| 65 | +Treating each node as an equal candidate for transaction broadcast |
| 66 | +avoids giving any miner privileged access to transactions and their |
| 67 | +fees. |
| 68 | + |
| 69 | +In summary, a mempool is an extremely useful cache that allows nodes |
| 70 | +to distribute the costs of block download and validation over time, |
| 71 | +and gives users access to better fee estimation. At a network level, |
| 72 | +mempools support a distributed transaction and block relay network. |
| 73 | +All of these benefits are most pronounced when everybody sees all |
| 74 | +transactions before miners include them in blocks - just like any |
| 75 | +cache, a mempool is most useful when it is "hot" and must be limited in size |
| 76 | +to fit in memory. |
| 77 | +Next week's section will explore the use of incentive compatibility as |
| 78 | +a metric for keeping the most useful transactions in mempools. |
0 commit comments