Besides receiving ethers, for which there is a dedicated receive function, what is a practical use case of fallback?

I can't think of a case when it would be desirable for a contract to execute a special logic when a caller is calling a function that doesn't exist rather than throwing an error.

1 Answer 1


The fallback function equips a contract with the possibility of handling function calls dynamically.

A common use case is to program the fallback function on a front-facing “proxy” contract to delegate all received calls to an “implementation” contract. This pattern is often used to implement a contract upgrade mechanism, e.g. here. The front-facing contract is deployed once in the beginning and its address will never change for the user, but the address of the implementation contract which it points to will be configurable.

Since the fallback function will delegate any function call it receives, and not only the calls to functions that existed when the proxy contract was deployed, it is possible to deploy a new implementation that has a brand new function, and after configuring the proxy to point to this new implementation, it will be possible to call that function on the original proxy, and the proxy fallback function will delegate it as expected. This would not be doable without the fallback function.

  • 1
    I see. That makes a lot of sense! Thank for the answer! May 9, 2021 at 22:25

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.