In some proof-of-stake Ethereum implementation that uses on-chain smart contracts to manage staking and validator selection somehow (any example would work), how does the client interact with that when it runs the consensus engine? More specifically, exactly where in the repository, if someone could point me to it, so that I can study it and learn more about it.
1 Answer
How I ended up doing it, is to (in Go-Ethereum, and probably similar in other node implementations) use the StateDB class, and then for reading storage, the GetState method. Initially I considered using internal/ethapi/api.go and the Call method in BlockChainAPI class, but it could be done at a lower level. For writing to contract storage, transactions would be used (unless you want to alter contract data by sidestepping the protocol rules for doing so, and then SetState method in StateDB can be used. )