var myContract = web3.eth.contract(abi); var address = contract address; var contract_data = myContract.at(address); var sender = '0xd3aaa525c087978133abb517593ea334f16abd1f'; var receiver = '0xff2b56315dc5372b45dfa3773c4cfd64f70c8e9c'; //transfer is the function in the contract to transfer money from wallet A to B var getData = contract_data.transfer.getData(receiver,amount); web3.eth.sendTransaction({to:receiver, from:sender, data: getData});
Source: How to call my contract's function using sendTransaction
When I am tracking the balance, it turns out that only gas price is being deducted from wallet A and nothing else ? But when I use metamask UI to do the transactions, balances are updated successfully. I believe, there is some flaw with the way I am using this api, it'd be really great if anyone could share their experience.