I have a Smart Contract, created / migrated with Truffle to TestRPC. TestRPC provides several default accounts. If I call functions within the Smart Contract from the Truffle console it does that always from the same address, even if when I set web3.eth.defaultAccount = 'anotherAddress';.

What I want is to be able to call functions from different addresses provided by TestRPC. How can I achieve that?

And if I want to use web3.eth.sendTransaction, where I can specify from and to how do I specify the parameters of the function?


  • instance2.b_fun1(a_address) – anand011090 Mar 29 '18 at 8:18

You can pass options object as a last argument of contracts method.

contractInstance.someMethod(arg1, arg2, { from: 'someAddress' });

Your Answer

