I have implemented transactions using ETH, however, I want to exchange tokens between accounts. Here is my code
var postData = {"jsonrpc":"2.0","method":"eth_sendTransaction","params": [{"from":"0x52f273a06a420453aa5b33c4f175395c9a1fddd8", "to": data.ethAddress, "value": 1e18}], "id":1}
var url = 'http://localhost:8545/'
var options = {
method: 'post',
body: postData,
json: true,
url: url
}
request(options, function (err, res, body) {
if (err) {
console.error('error posting json: ', err)
throw err
}
var headers = res.headers
var statusCode = res.statusCode
console.log('headers: ', headers)
console.log('statusCode: ', statusCode)
console.log('body: ', body)
})
This is completing the transaction with 1 ETH being transferred between accounts. However, I want to setup this same action but with my custom token as the currency, not ETH. Any help would be greatly appreciated. Thanks