I am trying to build a light interface which can broadcast a raw transaction and execute an Ethereum contract's function. While I am able to build a simple transaction there is little guidance on how to execute a contract's function.
I have the following code to build the transaction:
function createRawTransacton(){
var privateKey = new Buffer('d3780dd620ef80b3918dfcdb9105f76147fc55a3775ff71805ccec09a89063ed', 'hex')
var rawTx = {
nonce: 'CX350',
gasPrice: 'C350',
gasLimit: '0x09184e72a000',
to: '0xc5622be5861b7200cbace14e28b98c4ab77bd9b4',
value: 'CX350',
data: '0x19dacbf83c5de6658e14cbf7bcae5c15eca2eedecf1c66fbca928e4d351bea0f'
}
var tx = new Tx(rawTx)
tx.sign(privateKey)
var serializedTx = tx.serialize()
console.log(serializedTx.toString('hex'))
broadCastTx(serializedTx.toString('hex'))
}