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?
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.
Related Questions
- → laravel5 eloquent foreign key hasOne()
- → Get transactions in batches ShopifyAPI
- → Laravel: a model that belongs to two other models
- → shopify transaction api GET all transactions
- → Laravel DB::transaction exception PDO There is no active transaction
- → Query state in React, and setState or update if exists
- → How can I setup edit item functionality in this React application?
- → Fastest way to gather JS objects by date
- → PHPUnit + Laravel 5.2 + Attribute not returning properly
- → Database Transactions Not Found - Lumen
- → In a NodeJS Blockchain, does this code create a basic peer to peer blockchain that checks the previous block's hash?
- → Are "unconfirmed transactions" of a blockchain's memory pool spread over nodes?
- → How to receive only the transactions about particular set of addresses from blockchain without full syncing?