I assume that two functions of different prototypes will yield two different encoded ABIs.

Is that correct?

With regards to two functions of the same prototype, I tested a pair of functions which are identical not only in their prototype but also in their implementation:

address public owner;
address public pendingOwner;

function claimOwnership1() public {
    owner = pendingOwner;
    pendingOwner = address(0);

function claimOwnership2() public {
    owner = pendingOwner;
    pendingOwner = address(0);

I then checked the encoded ABI via web3.js (1.0.0-beta.34):

console.log("claimOwnership1:", myContract.methods.claimOwnership1().encodeABI());
console.log("claimOwnership2:", myContract.methods.claimOwnership2().encodeABI());

And the printout is:

claimOwnership1: 0x45fd9e23
claimOwnership2: 0xa75343bf

But of course, that doesn't guarantee encoded-ABI uniqueness.

Is such uniqueness guaranteed anywhere in the Solidity standard?

Thank you!

  • You cannot have two function with the same name and same params, meaning that the function prototype is identical in every way. That in my case will guarantee uniqueness in some way. function overloading is allowed but that will surely result in unique data. And also encodeABI() uses the function prototype and params and have nothing to do with the implementation. Commented Apr 4, 2019 at 7:39

1 Answer 1


OK, I've found the answer in the Solidity official documentation.

In short, the encoded ABI is the hash of a string which represent the function name with the parenthesised list of parameter types split by commas (no spaces are used).

For example, the encoded ABI of:

function func(uint256 x, bool y) external view returns(uint8);

Is the first 4 bytes returned from an on-chain (Solidity) call to:


Or the first 8 hexadecimal characters returned from an off-chain (Javascript) call to:


The rest of the returned string will contain the values of the parameters, if applicable (in the example in my question there are no parameters, hence the encoded ABI is only 4 bytes / 8 characters long).

So uniqueness is not guaranteed, since two functions with the exact same name and parameter types may exist in two different contracts.

  • This is correct. Note that function selector (the first 4 bytes) collisions are certainly possible. The Solidity compiler will refuse to compile a contract that contains such a collision.
    – user19510
    Commented Apr 4, 2019 at 8:03
  • @smarx: I was actually asking this question with regards to functions which may reside in different contracts. In such case, if two (different) functions with the exact same name and parameter types exist in two different contracts, then uniqueness is not guaranteed. Thanks. Commented Apr 4, 2019 at 8:05
  • Correct. In fact, they're guaranteed to be identical.
    – user19510
    Commented Apr 4, 2019 at 8:06
  • @smarx: Yes, that's actually quite true :) Commented Apr 4, 2019 at 8:07
  • I was wondering: is uniqueness guaranteed for events? Thanks. Commented Jan 16, 2023 at 15:31

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.