While browsing the Solidity docs, I noticed this instruction available in assembly:

caller(): call sender (excluding delegatecall)

What do the docs mean by "excluding delegatecall"? Is it that if contract A delegate calls to contract B, caller() will not return the address of contract A, but instead it would return the original EOA that called A? (I know that msg.sender is the same in this case)

1 Answer 1


It returns an empty number (0x000..0000).

You can check it yourself running the following code on Remix:

contract Stub {
  event Caller(uint caller);

  function testCaller() public {
      uint caller;
      assembly { caller := caller() }
      emit Caller(caller);

contract Delegator {

  // where stub must be the address of the above contract.
  function testDelegatecall(address stub) public returns (bool) {
    (bool success,) = stub.delegatecall(
    return success;
  • 1
    The contract above doesn't compile since you are using a variable which is also the name of an instruction in assembly. Also I believe the answer is wrong, when I tested the code on remix, it emits the EOA. Commented May 17, 2023 at 12:27

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.