0

Suppose I know the address that had a smart contract. This smart contract ran and called the self destruct function, so at the current block the smart contract has nothing there. But if smart contract data is stored in the blockchain, the smart contract code (bytecode at least) should be stored in a prior block. Assuming I can figure out which in block the code was launched (I have the transaction ID for creation), is there any way to use this information to get the contract bytecode as it existed in the block in which it was launched?

1 Answer 1

1

It's doable, you must connect to an archive node's RPC and then you can pass overrides.blockTag when you call a contract method (I'm assuming Ether.js).

To get an archive node you can host yourself one (you need some disk size) or you can use a service like Alchemy that makes a full node freely available (with some limitations I think).

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.