I'm trying to figure out if it's possible to read smart contract data from the blockchain itself. I know in ordinary circumstances, smart contracts sit on top of the chain in the ledger. I'd like to know if the below is possible.
- Using Hyperledger Besu to create a private chain
- Smart contract has already been deployed to the chain and verified
- Data that is to be read already exists on the ledger (the contract function has been called, state updated, etc)
- For this purpose, we cannot use the RPC, web3 API, etc to read the data
- We know the account that we are attempting to get data for and the address of the smart contract
- We would be doing a soft fork after deploying the contracts/updating state data to ensure the ledger is updated before checking for values
What I'd like to do:
- I would like to check if the miner address exists in the smart contract state data from within the underlying Besu code (the Java that creates the jar for the chain). Basically, as the chain is running, there is a piece where the chain itself will check certain state data on the smart contract.
If this is possible, can you walk me through the process of doing that? What is needed to be able to check the ledger data and find the specific contract/state data for said account?