5

Suppose you write a contract that you want others to interact with. My understanding is that if you want others to interact with your contract, you need to provide the contract's ABI and address. Is this correct?

If so, would you then publish the contract's ABI and address at a specific place for people to use, so they can interact with it? Would you publish the code so people could compile the contract and get the ABI?

OR, is it possible to interact with a contract by just knowing it's address/hash.

1
  • but why some other contracts.. we can interact just by not knowing their ABI? for example dice contract where we could just send ether to their contract? Commented Mar 20, 2017 at 8:34

1 Answer 1

6

Yes, for people to interact with your contract you would want to publish the contract's ABI and address.

To be more trustworthy, you would also publish your contract source code (and compiler version and compiler flags used), so that people can verify for themselves that what is deployed at the address, matches the source code. By providing the source code and compiler version you used, people will also be able to generate the ABI themselves.

If you don't provide the ABI (or the source code and compiler details), people won't be able to interact with your contract easily: they would have to reverse engineer your contract from the bytecode to try to figure out what your function names and parameters are.

2
  • How do you verify that a contract was actually created with a given source code? As far as I know, the ABI only contains the methods, their in- and outputs and the defined events. So even if the ABI matches, there could still be changes in what the methods actually do, right? Is there any way to verify what happens inside the methods? Commented Mar 20, 2017 at 10:05
  • @Max: You're correct the ABI is limited, but with the source code you can compile it and compare it against the blockchain as in ethereum.stackexchange.com/questions/195/…
    – eth
    Commented Mar 31, 2017 at 9:54

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.