<p>Nodes communicate by gossiping about new data to their peers.</p>

<p>For example, whenever a new block is found, a node that hears about it, will tell all its peers "Hey, I've got a new block with the identifier , you want it?". These announcement take the form of "<a href="https://bitcoin.org/en/developer-reference#term-inventory" rel="nofollow noreferrer">Inventory messages</a>". They consist of two elements: The type of data being offered (i.e. transaction, block, or filtered block), and the identifier (i.e. transaction id, or block hash).
The peer receiving the inventory announcement will then request either the block header, or the complete item if they haven't seen it before, or nothing if they know about it already. The same happens in transaction relay.</p>

<p>Naturally, every node checks the validity of the data they receive before using it. This way, every node ends up assembling their own verified complete copy of the blockchain. They don't trust other nodes to tell them about UTXOs or which chain is the longest, but rather they only expect that their set of peers together will tell them about any new data that floats about eventually, while only trusting the data that they have verified and collected themselves.</p>

<p>The chain tip and UTXO set are therefore derived information that the node has calculated themselves from verifying all available information gathered from peers.</p>

CC BY-SA 3.0
2018-02-12T23:23:39.743Z
Thank you for helping me!  In your explanation, I understood that the block chain is fully decentralized.  
By the way, is TXID a hash of digest of a transaction(sender, resipient, amount?) and constitutes a merkle root?
mtdkki
CC BY-SA 3.0
2018-02-13T05:02:07.913Z
The txid is the hash of the transaction's data. The Merkle root is the result of a binary tree built from all the transactions: https://bitcoin.stackexchange.com/a/38399/5406
Murch
CC BY-SA 3.0
2018-02-12T17:28:32.487Z
2018-02-12T17:28:32.487Z
Murch
<blockquote>
  <p>get set of UTXO.</p>
</blockquote>

<p>Note: nodes don't download the UTXO set directly, they download the entire blockchain and build their own UTXO set as they verify the blockchain.</p>

<blockquote>
  <p>How does a node tell other nodes these requests?
  Like git, are there commands like 'pull requests'?</p>
</blockquote>

<p>Nodes communicate with each other directly via a P2P protocol, sending different types of messages to each other to retrieve different types of information. You can take a look here for the specifics of each message, <a href="https://bitcoin.org/en/developer-reference" rel="noreferrer">https://bitcoin.org/en/developer-reference</a></p>

<blockquote>
  <p>Where does a node get information from?
  I believe blockchain is decenterlized and all information is in the hands of all nodes.There must not be centerlized database.
  Then, how does a node decide who is reliable to get information from?</p>
</blockquote>

<p>Nodes will ask multiple neighbour nodes for information at once, rather than just trusting a single other node. It can then use the longest chain from all its neighbours, so as long as it connected to just one honest node it will be able to download the blockchain. This is very likely because the nodes it connects to are randomly selected from a set given to it by a DNS server</p>

CC BY-SA 3.0
2018-02-12T00:07:01.170Z
Your answer is exactly what I want.  
That's very kind of you.  

Then, can only full nodes validate UTXO, and be miner?
mtdkki
CC BY-SA 3.0
2018-02-12T04:17:53.213Z
@mtdkki no problem, please remember to give it the green tick if it answered your question :) Correct, only full nodes validate the UTXO set, SPV clients can only verify that a particular transaction is part of the blockchain (thereby trusting the other full nodes). Usually miners will all connect to one full node rather than individually running full nodes on every miner
meshcollider
CC BY-SA 3.0
2018-02-11T22:27:45.583Z
2018-02-11T22:27:45.583Z
meshcollider
<p>I think a node sometimes needs to get a information from other nodes.<br>
e.g.</p>

<ul>
<li>get set of UTXO.  </li>
<li>get main(longest) chain.</li>
</ul>

<p>I have two questions.  </p>

<ol>
<li><p>How does a node tell other nodes these requests?<br>
Like in github, are there commands like 'pull requests'?  </p></li>
<li><p>Where does a node get information from?<br>
I believe blockchain is decenterlized and all information is in the hands of all nodes.There must not be centerlized database.<br>
Then, how does a node decide who is reliable to get information from?  </p></li>
</ol>

<p>I wish you could understand my poor English...</p>

<relay><broadcast><inventory>
How does a node get information from other nodes?
mtdkki
# How does a node get information from other nodes?

(Asked by: username_0 on 2018-02-11)

I think a node sometimes needs to get a information from other nodes.  
e.g.

* get set of UTXO.
* get main(longest) chain.

I have two questions.

1. How does a node tell other nodes these requests?  
   Like in github, are there commands like 'pull requests'?
2. Where does a node get information from?  
   I believe blockchain is decenterlized and all information is in the hands of all nodes.There must not be centerlized database.  
   Then, how does a node decide who is reliable to get information from?

I wish you could understand my poor English...

**Tags:** relay, broadcast, inventory


---

## 2 answers

### Answer by username_2 on 2018-02-11. Score: 6 | Accepted answer

> get set of UTXO.

Note: nodes don't download the UTXO set directly, they download the entire blockchain and build their own UTXO set as they verify the blockchain.

> How does a node tell other nodes these requests?
> Like git, are there commands like 'pull requests'?

Nodes communicate with each other directly via a P2P protocol, sending different types of messages to each other to retrieve different types of information. You can take a look here for the specifics of each message, <https://bitcoin.org/en/developer-reference>

> Where does a node get information from?
> I believe blockchain is decenterlized and all information is in the hands of all nodes.There must not be centerlized database.
> Then, how does a node decide who is reliable to get information from?

Nodes will ask multiple neighbour nodes for information at once, rather than just trusting a single other node. It can then use the longest chain from all its neighbours, so as long as it connected to just one honest node it will be able to download the blockchain. This is very likely because the nodes it connects to are randomly selected from a set given to it by a DNS server

> **Comments:**
> **username_0**: Your answer is exactly what I want.   That's very kind of you.    Then, can only full nodes validate UTXO, and be miner?  
> **username_2**: @username_0 no problem, please remember to give it the green tick if it answered your question :) Correct, only full nodes validate the UTXO set, SPV clients can only verify that a particular transaction is part of the blockchain (thereby trusting the other full nodes). Usually miners will all connect to one full node rather than individually running full nodes on every miner  

---

### Answer by username_1 on 2018-02-12. Score: 3

Nodes communicate by gossiping about new data to their peers.

For example, whenever a new block is found, a node that hears about it, will tell all its peers "Hey, I've got a new block with the identifier , you want it?". These announcement take the form of "[Inventory messages](https://bitcoin.org/en/developer-reference#term-inventory)". They consist of two elements: The type of data being offered (i.e. transaction, block, or filtered block), and the identifier (i.e. transaction id, or block hash).
The peer receiving the inventory announcement will then request either the block header, or the complete item if they haven't seen it before, or nothing if they know about it already. The same happens in transaction relay.

Naturally, every node checks the validity of the data they receive before using it. This way, every node ends up assembling their own verified complete copy of the blockchain. They don't trust other nodes to tell them about UTXOs or which chain is the longest, but rather they only expect that their set of peers together will tell them about any new data that floats about eventually, while only trusting the data that they have verified and collected themselves.

The chain tip and UTXO set are therefore derived information that the node has calculated themselves from verifying all available information gathered from peers.

> **Comments:**
> **username_0**: Thank you for helping me!  In your explanation, I understood that the block chain is fully decentralized.   By the way, is TXID a hash of digest of a transaction(sender, resipient, amount?) and constitutes a merkle root?  
> **username_1**: The txid is the hash of the transaction's data. The Merkle root is the result of a binary tree built from all the transactions: https://bitcoin.stackexchange.com/a/38399/5406  

---

