I want to send eth by using web3 on testnet. Source address is 0xbddf0bf3ac858d7fb8a2bdda55884d61779ba5a9. The destination is 0x8005ceb675d2ff8c989cc95354438b9fab568681.
I found the example on web3 reference page. I can imagine how to use it. However I don't know what is "data" and how to calculate the gasLimit.
var Tx = require('ethereumjs-tx'); var privateKey = new Buffer('xxx', 'hex') var GAS = web3.eth.estimateGas({ to: "0x8005ceb675d2ff8c989cc95354438b9fab568681", data: "WHAT IS DATA" }); var rawTx = { nonce: '0x00', gasPrice: GAS, gasLimit: 'HOW AMOUNT OF GAS SHOULD I SET', to: '0x8005ceb675d2ff8c989cc95354438b9fab568681', value: '0x01', data: 'WHAT IS DATA' } var tx = new Tx(rawTx); tx.sign(privateKey); var serializedTx = tx.serialize(); web3.eth.sendRawTransaction(serializedTx.toString('hex'), function(err, hash) { if (!err) console.log(hash); }); https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendrawtransaction
Update 1
Seems data is optional value or something...
data - all of the interesting stuff goes here
What is the ethereum transaction data structure?
In Bitcoin, transaction fee is calculated by the size of transaction. Thus, I thought "data" is related to fee...