0

I'm interested in learning how Solana's consensus mechanism works. I understand that in a proof of stake system, stake is bonded (usually in a smart contract). While this is a great way for creating an "identity" for validators, I'm wondering if the rest of the consensus mechanism is carried out on or off-chain. For example, are block proposals, attestations, and reports for dishonest/offline nodes sent in a transaction to the staking contract? Or are they carried out off-chain through the use of a gossip protocol? Or maybe a combination of both?

Please let me know and provide any resources I can read myself,

Thanks!

1 Answer 1

1

Staking on Solana is implemented as what's called a native program (contract) who's code is compiled directly into the validator software, rather than stored in an account like a normal BPF program. This is done for two reasons

  • The runtime is tightly coupled to the accounts` state of this program as stake weights affect many aspects of the protocol, not to mention distribution of rewards is an asynchronous task that's not initiated by any transaction
  • Native programs being compiled directly into the validator are executed directly on the target architecture rather than on demand JIT-compiled and executed in a VM, making them much more performant

Otherwise, native programs behave identically to normal programs, their accounts are manipulated by transactions, etc.

Some of the things you cite (this post really should've been closed for lack of focus and split into multiple posts instead) have nothing to do with the staking program at all. Block attestation is under the purview of the vote program, another native program. Block production is handled directly by the runtime. Everything in native programs or the runtime would be considered "on chain" as it is under consensus and encoded in block or accounts state data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.