Here is some random contract: 0x8055d0504666e2B6942BeB8D6014c964658Ca591

Pretend that the ABI was not uploaded on etherscan.io.

I want to run the function supportsInterface(bytes4) with data 0xa9059cbb on that contract.

How do I do this with geth?


Probably the easiest way is just to make your own ABI and then call it like you typically would. Here's an ABI for just this function:

        "constant": true,
        "inputs": [
                "name": "",
                "type": "bytes4"
        "name": "supportsInterface",
        "outputs": [
                "name": "",
                "type": "bool"
        "payable": false,
        "stateMutability": "pure",
        "type": "function"

I made some assumptions:

  1. The function is pure (doesn't read from or write to storage).
  2. The function returns a boolean.

You can easily hand-write ABI by looking at examples, but I made this one by just compiling the following contract in Remix:

pragma solidity ^0.4.19;

contract Foo {
    function supportsInterface(bytes4) pure public returns (bool);


You can also construct the call data yourself... it should be the keccak256 hash of the function signature ("supportsInterface(bytes4)") followed by a 32-byte (left-padded) version of the data (0x00000000000000000000000000000000000000000000000000000000a9059cbb). But it's easier to just use the ABI. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.