Ad

Are "unconfirmed Transactions" Of A Blockchain's Memory Pool Spread Over Nodes?

I am trying yo implement a blockchain in python, I have already the chain code with the ability of create transactions and blocks (and all cryptographical stuff). I have a local memory pool for unconfirmed transactions, are this transactions supposed to be shared with other nodes?

I have searched information about this topic but I haven't found any concrete information. In my mind, it makes sense that transactions get spread in a kind of "unconfirmed transactions" memory pool and that the nodes check for unconfirmed transactions that they don't have in other nodes, deleting those that already exist in the chain. Is this correct? If yes I would be pleased to recive some help or link to information.

Another question: Let's say I own 0.5 of that coin, I want to transfer them to mister X. I perform my transaction and the node checks that in the current chain, I do have 0.5 coins so I sign my transaction and send it to that supposed unconfirmed transaction pool (mention that those are not on the real chain). Then let's say I make another transaction of 0.5 before that transaction get's confirmed. It's work of the process of building a block to check that I got 0.5 for the first transaction but I do not for the second? Or it's work of the process of transaction creation? If it's the second, that unconfirmed transactions should take part on the count of actual money... You see my mess?

Ad

Answer

Are “unconfirmed transactions” of a blockchain's memory pool spread over nodes?

Yes, as soon as a transaction is received by a node (assuming that node is configured normally) it will broadcast that transaction to it's peers immediately following validation. Of course, if the transaction has already been mined (included in a block) it will fail validation. This is necessary because unless that one node has a lot of hashpower, it will be very difficult to mine since it would be the only one to know about the transaction. There would also be a lot of conflicts if the mempool wasn't shared.

On your second question:

When you submit a transaction, the wallet software should deduct that from your available balance (assuming it was not rejected). In Bitcoin (and other related currencies), if the transaction is not confirmed (included in a block) within a certain timeframe (Bitcoin is 2 weeks), then it will be removed from the mempool, and the coins are free to spend again. Otherwise, you can do a replaceByFee to override that transaction and send coins back to yourself for a small fee.

Ad
source: stackoverflow.com
Ad