I just got the chance to read about the Dark Forest problem describing an actual front running attack: https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest/

I didn't fully understand the attempted solution. Instead of the attempted solution what would make more sense to me is to check for contract owner address in the get() function.

So we could hard code the owner address as a constant:

address payable public constant OWNER = 0xe3F...;

And then in get() all we have to do is make sure that the sender is always the owner address:

require(msg.sender == OWNER);

Would this work or am I missing something?

1 Answer 1


The problem is how to obfuscate it enough, so that automated front-runners wouldn't figure out what was happening and replicate the solution with their own address before the writers' solution took effect. On the other hand, if it's too obfuscated, it gets complicated and there might be bugs and it'd simply not work.

I can't of course be sure, but I'd imagine they didn't want to hardcode any addresses there, because that would for example indicate that those addresses should be monitored by frontrunners. Otherwise your solution would be easier for sure.

  • Even in their case they would call the contract just once to rescue the funds. So it makes me wonder what sort of implications hard coding an address would have. It seemed like an obvious solution, and I don't see it used much when dealing with front running issues. Even if the issue is that the address is being revealed that address is always revealed in ethscan if it's being used to make calls to the contract.
    – Branzinho
    Aug 9, 2021 at 19:55
  • I'm only guessing here, but the later you 'reveal' the address, the better. If it was revealed earlier, there might be time even for human intervention to analyze what's the point of the contract Aug 10, 2021 at 4:44

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.