5

Say you want to send an action to a smart contract, and you know the WASM of the contract. You somehow obtained the original source code which was in C++, you compiled it to WASM, and you got the same binaries. At this moment, you know that the contract does what the C++ code does.

However, how do you know that the contract won't be updated to alter the code before you send your action? Is there any way to atomically verify the code and execute the transaction only if the code is as expected?

1

You can do an SHA256 of the .wasm code to see its hash, and you can verify that on chain by doing cleos get code ACCOUNT_NAME. So it wouldn't be very difficult to write a script to check that the hash is as you expect it to be before performing a transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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