I am trying to implement a security feature on a ERC20 Token for the event of a vulnerability on it's code or the solidity core. This feature consists basically in two steps :

First, the owner of the Token contract can freeze the token functions ( transfer, transferFrom, approve...)

Second, a new token with the same features but with its vulnerabilities fixed will be distributed to the vulnerable token holders at a time prior to the vulnerability exposure.

My questions are :

First: Is it a good idea?

Second: How can i fetch all token holder adressess and their balances at any past block ? I have event listeners for critical functions of my token and crowdsale but i don't know how to proceed to get the info i want.

Many Thanks.

  • 2
    Seems like a bad idea to me. I wouldn't value any ERC20 token where the owner could just take my tokens away at will. Perhaps your scenario is different, and the potential owners of your token trust you enough to allow that. But in that case, why are you bothering with a smart contract on a trustless platform like Ethereum?
    – user19510
    Commented Feb 23, 2018 at 20:25
  • Thx for your reply smarx Well the owner of the contract could be one (or various) trusted escrows. Which by consensus that a vulnerability occured could freeze transactions. Commented Feb 23, 2018 at 20:48
  • Thing is the utilities of the token on my project are numerous, Also the project will be lasting decades which broadens the spectum of things that could go wrong. Trust needs to be built in that the system is recoverable in that event. Commented Feb 23, 2018 at 20:48
  • Why using a trustless platform like ethereum ? well besides the decentralized control of projects, ethereum adds value in many other ways, it is very well known, it is tested and working. It can handle the project, it is straight forward and easy to use and understand, less dev expenses, global adoption (no borders), crowdsales, less barriers (as of now) to get funding for a project... Commented Feb 23, 2018 at 20:49
  • Also fun fact, the EOS token which is currently the 9th top valued coin on coinmarketcap has a feature to freeze all transactions which can be called by anyone once the crowdsale ends with no promise of getting anything in return for your frozen tokens xD Commented Feb 23, 2018 at 20:57

1 Answer 1


No, it is not possible to fetch historic values of variables, but you could theoretically log all transactions. Sadly restoring your contract to a previous state would cost way more than the block gas limit, even if accessing previous values was possible directly. You would need to pay more than 0.20$ per token holder.

You should also think about the moral standpoint: Should the owner of a token be able to change the code or move tokens?

  • Thx for reply, I am now thinking thx to your knowledge that it can be better to have a function in which users can lock their own tokens until they unlock them, which will trigger an event and register and unregister their tokens. Also for the moral standpoint i made some points above replying to another user who had the same concerns, i would like to hear, if possible, some feedback on that. Thanks again. Commented Feb 23, 2018 at 23:44
  • Sure, as long as everyone knows that you have full control over it, this is completely fine. EOS is a bit of a different story, because their ERC20 token ist just a way to facilitate the crowdsale and has nothing to do with the final product. Commented Feb 23, 2018 at 23:50

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.