<p>A node is only called a peer if you're connected to it. So by definition you are always connected to all your peers.</p>

<p>I assume you're asking whether you're connected to every node in the network. The answer is no; most Bitcoin node software implementations only connected to around 8 others.</p>

<p>What happens if one is malicious? Bitcoin is trust-minimized by design. This means that it verifies to the extent possible whether incoming data is correct. Where this isn't possible, it uses a objective and unforgeable metric (proof of work) to select the winner in case there are multiple acceptable possibilities (blocks).</p>

<p>For most types of attacks, the assumption is that at least one of your peers is honest. If that's the case, you'll eventually learn the best valid version of history the rest of the network learns too. If all your peers are malicious, they may prevent you from seeing actual history - though it is very hard even in this case to forge and invalid version of history and convince your node of that.</p>

CC BY-SA 4.0
2019-02-22T14:58:29.853Z
Why if we have just one honest node I’ll learn the best valid version? One honest node out of 8 means the 12.5% of your nodes, meaning, if we validate the truth by using percentage, 87.5% (malicious nodes) Vs 12.5% (the only honest one)? We would take the malicious nodes as if they were valid.
Juan
CC BY-SA 4.0
2019-02-22T15:17:40.420Z
It doesn't matter how many peers say what. As long as you learn from one peer about the real chain, you will switch to it, because it will be unambiguously a better chain than what other nodes told you.
Pieter Wuille
CC BY-SA 4.0
2019-02-22T15:19:48.240Z
How would you know what chain is valid since it’s the first time you’re getting it? By checking the PofW?
Juan
CC BY-SA 4.0
2019-02-22T15:21:55.183Z
A chain is *valid* if it satisfies all the rules (no invalid signatures, no double spends, no printing money, ...). When there are multiple valid chains, you accept the one with most proof of work.
Pieter Wuille
CC BY-SA 4.0
2019-02-22T14:54:02.613Z
2019-02-22T14:54:02.613Z
Pieter Wuille
<p>The default number is 8 peers, but you can change it on the configurations. If a peer starts acting maliciously, the node will block it and find another one.</p>

CC BY-SA 4.0
2019-02-22T14:36:21.490Z
How would the node know that X peer is acting maliciously ? Since 1) The node might be getting the information for the first time. 2) The node could become malicious since its peers are malicious too.
Juan
CC BY-SA 4.0
2019-02-22T14:40:15.687Z
Your node has the genesis block on its source code, from there it can verify any block its peers send to it.
João Grilo Bitcoinheiro
CC BY-SA 4.0
2019-02-22T14:34:54.793Z
2019-02-22T14:34:54.793Z
João Grilo Bitcoinheiro
<p>Does a Node connect to all the peers in the network? Or just a few?</p>

<p>If its just a few, how many?
If its just a few, what about if all of those nodes in the list are malicious? </p>

<bitcoin-core><network><nodes><consensus>
Does a Node connect to all the peers?
Juan
# Does a Node connect to all the peers?

(Asked by: username_0 on 2019-02-22)

Does a Node connect to all the peers in the network? Or just a few?

If its just a few, how many?
If its just a few, what about if all of those nodes in the list are malicious?

**Tags:** bitcoin-core, network, nodes, consensus


---

## 2 answers

### Answer by username_1 on 2019-02-22. Score: 5

A node is only called a peer if you're connected to it. So by definition you are always connected to all your peers.

I assume you're asking whether you're connected to every node in the network. The answer is no; most Bitcoin node software implementations only connected to around 8 others.

What happens if one is malicious? Bitcoin is trust-minimized by design. This means that it verifies to the extent possible whether incoming data is correct. Where this isn't possible, it uses a objective and unforgeable metric (proof of work) to select the winner in case there are multiple acceptable possibilities (blocks).

For most types of attacks, the assumption is that at least one of your peers is honest. If that's the case, you'll eventually learn the best valid version of history the rest of the network learns too. If all your peers are malicious, they may prevent you from seeing actual history - though it is very hard even in this case to forge and invalid version of history and convince your node of that.

> **Comments:**
> **username_0**: Why if we have just one honest node I’ll learn the best valid version? One honest node out of 8 means the 12.5% of your nodes, meaning, if we validate the truth by using percentage, 87.5% (malicious nodes) Vs 12.5% (the only honest one)? We would take the malicious nodes as if they were valid.  
> **username_1**: It doesn't matter how many peers say what. As long as you learn from one peer about the real chain, you will switch to it, because it will be unambiguously a better chain than what other nodes told you.  
> **username_0**: How would you know what chain is valid since it’s the first time you’re getting it? By checking the PofW?  
> **username_1**: A chain is *valid* if it satisfies all the rules (no invalid signatures, no double spends, no printing money, ...). When there are multiple valid chains, you accept the one with most proof of work.  

---

### Answer by username_2 on 2019-02-22. Score: 0

The default number is 8 peers, but you can change it on the configurations. If a peer starts acting maliciously, the node will block it and find another one.

> **Comments:**
> **username_0**: How would the node know that X peer is acting maliciously ? Since 1) The node might be getting the information for the first time. 2) The node could become malicious since its peers are malicious too.  
> **username_2**: Your node has the genesis block on its source code, from there it can verify any block its peers send to it.  

---

