How Do Peers Choose Which Peer To Trust? So the way I understand how the blockchain works is that each new block uses the previous block's hash, which means if my block[100].hash != someone_elses_block[100].hash that means that either I broke some rule, or the other person did; In this case, how does my client find a trusted peer? And WHERE does my client get the latest CORRECT blockchain? Is there a central server for it? If so, where did the server it from? Because the miner will have the longest chain, but what if they are not actually following the rules? Then what?
Lets say I stopped my client for 100 days, during those 100 days there was 500 new transactions, which means that if I was to compare my last block with someone elses then my client would be outdated, therefore it needs to download the extra blocks, where does it find these blocks and how does it determine which peers to sync to and to trust?
A question about the nonce, if lets say there was no nonce; If client A has a chain that followed the rules and client B was verifying transactions without actually doing all the proper checks, that means that client A at block[100].hash != client B at block[100] therefore client B is not following the rules, so the question is what is the real need for the nonce? Because in my mind it seems like it's just there to make it harder to mine for people, correct? Or does it add some sort of security? And if it does, will it have the same security if let's say the nonce was always any number between 0 and 15? Or would it have to be adjusted as mining gets faster?


Thanks!
either I broke some rule, or the other person did; In this case, how does my client find a trusted peer


Your client does not trust any peer. It fully validates the blockchain. In the event of multiple conflicting blocks at a given block height, your node will choose to go with the first block it hears of. However it will still retain and validate all of the other blocks that it has received for that block height. Only after more blocks have been mined does it actually choose which of those conflicting blocks becomes part of its main chain. It chooses based upon which branch has the most cumulative work.

There is no trust in this process; it uses first heard initially and then will readjust if later blocks belong to a different branch. These reorganizations are why it is recommended to wait for multiple confirmations as one block reorgs are not uncommon.

Also, the blockchain with the most cumulative work (typically referred to as the longest blockchain) is not the only determination for what blockchain to use. The blockchain also has to be valid, it can't just have the most work.


  2: Lets say I stopped my client for 100 days, during those 100 days there was 500 new transactions, which means that if I was to compare my last block with someone elses then my client would be outdated, therefore it needs to download the extra blocks, where does it find these blocks and how does it determine which peers to sync to and to trust?


Your node does the normal peer discovery process every time it goes online. Your node will then randomly choose one of the peers it has connected to to be the "sync node". It doesn't actually sync much off of this node, just the block headers. It downloads the block headers from this node and validates them. Then it will download the blocks for those headers from the other nodes it has connected to.

Once the headers chain of one node has been synced, it will request the headers of other nodes to get an idea of what their best headers chain is in order to determine if the sync node was dishonest.

Again, there is no trust in this process as all blocks and headers are still fully validated. Since the download involves checking against multiple nodes, it is unlikely that your node will have the incorrect blockchain as not just one node dictates what chain you download.


  so the question is what is the real need for the nonce?


The nonce is completely unrelated to validity except for the fact that it is part of the block header which is hashed. The nonce's sole purpose is to have something to change when mining. It provides no security characteristics nor is it related to the consensus rules (except for the fact that it has to exist, it could be zero). Miners could very well just not do anything to the nonce and change something else to get a different hash. It exists solely as a convenience.