As the question states a bit confused on how a validator knows a current state is valid if he does not have the data from genesis, is it in the form of blockhashes, such that when a validator first comes it syncs and computes these hashes from the start, but in order to do that where does the data comes from if its never kept by any validator or not enforced, i guess in summary how can a solana validator sync up without there ever being data from genesis and does this then not force you to trust cold storage solutions to not have had changed data ? If am not wrong ethereum is set to do the same thing after the merge where only hashes of data will be kept on chain but the data themselves will be offloaded, am just confused how is this secure and how this works when a validator first starts up.
1 Answer
The important concept to understand is Consensus. All validators on Solana are constantly confirming the accuracy of new transactions and blocks as they get added to the chain, and once enough validators have verified that the included transactions are all valid and voted that the block is trustworthy it moves from the state of 'processed' to 'confirmed' and then to 'finalized'. This is the difference between transactions that are:
- 'processed' - submitted and including in a block, pending consensus agreement
- 'confirmed' - included in a block that has reached consensus in a supermajority of validators (2/3rds == 67%)
- 'finalized' - included in a block that has become the root block in a supermajority of validators (the "point of trust", where all known forks are after the root block)
As an example:
If the Solana blockchain is 2 years old, and you start from a current point of a finalized block with consensus agreed by 67% or more of the network, you know the full state of everything on chain. Your validator can now adjust the known state with each new confirmed block as they get added, verified by all validators, and confirmed/finalized. As long as you have a trusted start point, you only need to track the adjustments to it in order to keep an accurate state of the blockchain and all accounts on it.
In order to get this consensus, a validator can listen to every other validator (or a select few trusted validators) in order to get the last state that the majority agreed is fully accurate. Each validator can choose to ask every single validator (if they wanted) or a specific few they trust to confirm the true state - if they somehow get a modified or invalid version of the current state, other validators can identify that they are using a different set of blocks - this is a fork - and then then validators that recognize they are on a fork will be forced to catchup to the true, consensus-agreed latest state of the chain. If they keep pulling an invalid state from an invalid or malicious source, they will never be able to fully catch up to the chain and create their own blocks.
For further reading, check out information about consensus in Solana's documentation, and specifically look at the terms 'root', 'lockout', and 'finality'. https://docs.solana.com/terminology