Bitcoin Forum
May 02, 2024, 11:11:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Peer-To-Peer Discussion, How Events Play Out.  (Read 962 times)
SilentCicer0 (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
November 27, 2014, 02:35:56 AM
 #1

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?

2. Downloading the Blockchain:
- When my client (node) requests pieces of the blockchain (from my node's peers), how does this play out?

3. Mining and New Blocks:
- For mining, from my understanding, miners gather all unprocessed transactions to form their latest block submission (is this wrong?).
- 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?

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?
- In other words, is it self expanding, or do I have to manually add more peers?

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?

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?

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 know there is a tone of questions here, but if anyone can answer any, that would sure help me better understand the P2P layout of the Bitcoin protocol.


Cheers,
Nick.

1714648313
Hero Member
*
Offline Offline

Posts: 1714648313

View Profile Personal Message (Offline)

Ignore
1714648313
Reply with quote  #2

1714648313
Report to moderator
1714648313
Hero Member
*
Offline Offline

Posts: 1714648313

View Profile Personal Message (Offline)

Ignore
1714648313
Reply with quote  #2

1714648313
Report to moderator
1714648313
Hero Member
*
Offline Offline

Posts: 1714648313

View Profile Personal Message (Offline)

Ignore
1714648313
Reply with quote  #2

1714648313
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4613



View Profile
November 27, 2014, 04:28:09 AM
 #2

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.
hhanh00
Sr. Member
****
Offline Offline

Activity: 467
Merit: 266


View Profile
November 27, 2014, 06:02:49 AM
 #3

This should be of value to you if you haven't seen it already: https://en.bitcoin.it/wiki/Protocol_specification

2. Downloading the Blockchain:
- When my client (node) requests pieces of the blockchain (from my node's peers), how does this play out?
You request data with 'getdata' passing an inventory vector, basically a hash + type. Blocks are returned as 'block' messages.
You can ask for many blocks at once, but they will come back as separate messages.

Quote
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?
- In other words, is it self expanding, or do I have to manually add more peers?
You can proactively ask for peers with the 'getaddr' request or they may be given to you anyway with the 'addr' message.
To bootstrap, there is a hardcoded list of DNS servers specially setup to deliver peer addresses.

Quote
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?
They are sent to you as 'tx' messages if they are being relayed (live). However, if you connect to a peer and want to see the tx that it has unconfirmed, you must send a 'mempool' message.

Quote
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?
If you don't ask for anything and no one ask you anything, passively you can get: inv, addr, tx, ping and alert.

Quote
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?
Similar but different clients have different strategies. The protocol doesn't spec out this aspect. AFAIK, the reference client requests from a single peer but relays to many.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!