5

Imagine that I have obtained the contract ABI, but I'm not sure if I got the right address it was deployed.

If I do:

var contract = web3.eth.contrat(abi);
var deployed = contract.at('<invalid address');

I still get the contract object.

How can I be sure I'm using the "correct" version that was deployed?

Edit

By "correct" I mean a contract that is acknowledged by the network.

4

From reading your example, when you mention 'invalid address' I assume you mean it is actually a valid Ethereum contract address, it just may not be the instance of the contract you want.

In that case, I think it really depends on what your definition of correct is in terms of your contract.

If you're deploying multiple versions of the same contract you could either track the "version" you want on the client side, or store something in the contract you could call that would identify each version.

This is more of an application design issue then a contract issue.

  • I've edited the question to explain what I mean for 'correct' – Henrique Barcelos May 5 '16 at 13:32

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.