Instantly share code, notes, and snippets.

Embed
What would you like to do?
Calling Ethereum contract methods via Web3.js
// Automatically determines the use of call or sendTransaction based on the method type
myContractInstance.myMethod(param1 [, ...][, callback]);
// Explicitly calling this method - simulate execution and return result
// No cost, no actual transaction is sent to the blockchain
myContractInstance.myMethod.call(param1 [, ...] [, callback]);
// Explicitly sending a transaction to this method
myContractInstance.myMethod.sendTransaction(param1 [, ...] [, callback]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment