You have three options to retrieve bytecode: type(C).runtimeCode which returns the runtime code of a contract, type(C).creationCode which returns the creation code of a contract and address.code which returns the code at a certain address (EOA or Smart Contract), which can be empty for an EOA. Now my question is if it is the runtimeCode or the creationCode at the address when calling address.code. This seems to not be documented properly so I wanted to ask the community (https://docs.soliditylang.org/en/latest/units-and-global-variables.html?highlight=address%20initial#members-of-address-types).

A little question to discuss: Is it proper to validate a Smart Contract based on its bytecode (be it the creation or the runtime code) or is this a don't.

1 Answer 1


The creation code is not stored in the blockchain, it runs only once when the contract is deployed. So the address.code is returning the runtime code.

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.