I have a few questions about the specifics of Bitcoins peer-to-peer construction. Maybe the forum can enlighten me as to how the network goes about communicating between network nodes.
I'll do a play-by-play for questions as to make it clear what I am asking.
1. Sending New Transactions:
- When a new transaction is sent from my node to my nodes peers, what do my peers do with it?
- Do they send that new transaction to their peers as well?
- Or do they simply hold that new transaction as unprocessed?
- How does this new data spread through the network?
First they verify that it is a valid transaction and that it meets any necessary requirements for being relayed.
If it is valid, then the peer adds it to its own pool of unconfirmed transactions.
If it meets all the relay requirements, then it is sent to all the peers that it is connected to.
2. Downloading the Blockchain:
- When my client (node) requests pieces of the blockchain (from my node's peers), how does this play out?
I don't have the process memorized. If nobody else answers this for you, I'll look into the code and see step by step what exactly happens.
3. Mining and New Blocks:
- For mining, from my understanding, miners gather all unprocessed transactions to form their latest block submission (is this wrong?).
They choose which of the unconfirmed transactions they wish to include in their block. They might choose all of them, but they also might only choose a sub-set.
- Are these transactions just floating around the network, not in a block yet, where miners can (via their node) pick these TX's up and use those TX's to form their next block submission?
Correct. As the miner (or mining pool) hears about unconfirmed transactions from the peers they are connected to, they verify that the transaction is valid and check to see if it meets all the requirements for being relayed.
If the transaction is valid, then it is added to the memory pool of unconfirmed transactions.
If it meets the requirements to be relayed, then it is sent to all connected peers.
Then the next time the miner (or mining pool) needs to construct a block, it scans through its own list of unconfirmed transactions and chooses which ones to include in the block.
4. Do Nodes Request More Peers from other Peers?
- So do nodes ask other peers for their peer list, to expand their own peer list?
It depends on the peer, but generally yes.
- In other words, is it self expanding, or do I have to manually add more peers?
It depends on the peer, but in general most are self expanding. Some peer software also allows the user to configure specified peers as well if they wish.
5. Is my Node Being Sent New Transactions (that are not processed)?
- So is my node being sent the thousands of new transactions that have not been processed yet (i.e. put into a block)?
- Or is there something else happening here?
It depends on the software that you are running, but generally your node is being sent the thousands of new transactions that are not yet confirmed in a block, then verifying those transactions and sending them on to all the peers that your node is connected to.
6. Right Now, What Data is Being Sent to My Running Node?
- So what data right now is being sent to my node (I'm running the standard Bitcoin WIN Client/Node), I know there is new blockchain data, but what else?
Unconfirmed transactions. connection requests. new blocks. block requests, peer lists are the main things that come to mind. There may be a bit more that I'm not thinking of. If so, hopefully someone else will stop by to add to the list.
7. Is there Any Know P2P Structures that Bitcoin is modeled after?
- What P2P structure is Bitcoin modeled after, is it like a gossip style model or something else entirely?
I'm not familiar enough with P2P structures to answer your question.