Looking to code WEB3 to be able to send custom tokens out programmatically.
However, I am not sure where to specify the user account that actually sends the token.
This is the code I have thus far. I
var custom_token_address = req.params.customtoken;
var abi = loadABI();
var MyContract = web3.eth.contract(abi);
var myContractInstance = MyContract.at('0x416DFae2FED9B7a282E8beaC750210A7d952204A');
web3.eth.contract(abi).at(custom_token_address).transfer('0x61E28c6d1e5159E2415644FBBE5E0D40542e4C8c', 10000);
Where is is that I set the from account in all of this?
Thank you
Best Answer
[Note: the below is with web3.js 0.20 (the syntax changes for 1.0.0)]
You can either set the default from account for all transactions:
Or you can specify a transaction object on a case-by-case basis as the last parameter in your method: