I would like to check the code hash of an account from within my smart contract. Is this possible?
3 Answers
I have since learned that this isn't possible, and could only be done using an external oracle or other off-chain service. If this changes in the future I will update this answer.
-
1I wrote the patch for this feature, but not yet merged. github.com/EOSIO/eos/pull/7835– conr2dFeb 24, 2020 at 20:38
There's currently no WASM intrinsic to do that. However, Newdex keeps a list of all smart contracts for anyone to check on-chain. See here for more details
Update Actually, you don't have access to account_object
from the contract.
You can use account.code_version
.
From cleos do: cleos get code <accountName>
-
2The question asks how to do it from within a smart contract, not how to do it with cleos. Sep 24, 2018 at 15:42