I'm using web3.py to interact with contracts. I was wondering, after calling a function with
suicide(address), how do I find out that the contract is in fact dead?
You can call
eth.getCode to see if there is code at the address. If there is no code, there is no contract. If there is code, there is a contract associated with the address.
ether.js, you can see how it works below. The first call was after the contract was deployed and the second call was after it was
> kovanEthersProvider.getCode('0x761f887ea907DB3FBc13f55867Db2c2c9BDB34F9').then(console.log) 0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063b9554c5914602d575b600080fd5b60336035565b005b600073ffffffffffffffffffffffffffffffffffffffff16fffea265627a7a723158203c431b72fff6bd29b3dd6d5b1c73f87aa200fb5a5029cbc24f45dac0e030d52664736f6c63430005110032 > kovanEthersProvider.getCode('0x761f887ea907DB3FBc13f55867Db2c2c9BDB34F9').then(console.log) 0x
Follow the same pattern with