How do nodes contribute to security when the power comes from mining and what is the chain of transaction validation? Blockchain security comes from the decentralisation of hashing power by miners. They append transactions to a block, perform PoW and add them to the blockchain when that validate blocks. How do nodes contribute to this? Doesn't all the validation power come from the longest chain, which is decided by miners. And how do miners detect an invalid block that has been added to the blockchain?
When transactions are broadcasted, I though that public key cryptography is used to verify the transaction. At what level does this happen? Do nodes do this, and if so, is it every single node? When a block is added, do miners perform steps on the block to make sure they are legit. And what does an illegitimate transaction look like?
Thanks
Miners offer up blocks to the network hoping that their offerings will be accepted. Other nodes may accept or reject such blocks. A node that accepts a block adds that block to their copy of the blockchain. Nodes that don't accept a particular block don't add it to their copy of the blockchain and don't pass on that block to anyone else. Any miner that is consistently a source of bad blocks is likely to be ignored thereafter.
Miners can't spend income from a block until a further 100 blocks have been added on top of their block. So miners have a great incentive to only offer up blocks that are acceptable to everyone.
All nodes validate blocks and the transactions in them. This consists of checking that the blocks and transactions conform to a set of common rules. These rules are often called the consensus rules. The rules protect the interests of the buyers and sellers in transactions.
Nodes will eventually be ostracized if they consistently apply different rules and attempt to pass on blocks that meet their different rules but don't meet the mainstream rules.
All nodes called &quot;full nodes&quot; do check hashes and perform cryptographic checks on signatures. Some nodes (Simplified Payment Verification or SPV nodes) rely on other nodes to do much of this work, but they will still perform some checking themselves.
The classic example of an illegitimate transaction is one that attempts to spend money that has already been spent in a prior transaction. A trivially illegitimate block would be one whose independently calculated hash is greater than the current target value (inverse of difficulty)