1

I have this scenario:

So whenever a wallet user is initiating a transaction, this goes as far as I understood into a Mempool. And that each node has its own Mempool.

I have some questions though: Do every node get all the transactions in their mempool, meaning it's like a syncronisez place where everybody can see the same transactions? If so, how does the rest of the network of miners know that the transactions they have chosen from the mining pool isn't already being mine by another miner?

Or each and every node get different transactions in their Mempools? If so, how is the transaction broadcasted? Does it go randomly to some miner's mempool?

Thank you for your patience!

2

When a new transaction is broadcast, it will be passed from the originating node to all available peers. Those peers will then pass it to all of their peers, and so on, until (hopefully) every node in the network has heard about the transaction. Each node can keep a mempool if they so choose, and that mempool will store all of the transactions they have heard about recently. Node operators can configure several variables in their software to only store a certain certain amount (in bytes) worth of txs, to only relay transactions that are above a certain fee rate minimum, etc.

The mempool of each node may thus be a little different, there is no consensus enforced on what is stored in the mempool of each node. In fact, a node operator may choose to not keep a mempool at all!

Miners will run full nodes that communicate with the network, this is how they hear about new transactions to include in the blocks they are mining. Once a new block is found, the miner will broadcast it to the network. As each node hears about the new block, they will work to independently validate the block and all of the transactions in it. Part of this process involves identifying which transactions are confirmed in the block, and removing those transactions from the node's mempool. Soon after hearing about a new block, each node's mempool will be updated to remove the now-confirmed transactions.

Do every node get all the transactions in their mempool, meaning it's like a syncronisez place where everybody can see the same transactions?

There is no enforced synchronization or consensus or mempools, but many mempools will likely have many of the same transactions stored at any given point in time.

..how does the rest of the network of miners know that the transactions they have chosen from the mining pool isn't already being mine by another miner?

Chances are there will be a large overlap in the transactions stored in each miner's mempool. When working on a new block, miners will use transaction from their mempool, but it doesn't matter if more than one miner tries to mine a block with the same transactions in it. Eventually one of the miners will find a valid block, and upon broadcasting it to the network, the other miners will simply update their own mempools to remove the now-confirmed transactions that were included in the last block (in the same way any other node will). Then the process starts all over again, with everyone racing to mine the next block, again using the unconfirmed transactions they have in their local mempools.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.