I am sending data with my transaction by using following way
var tx = {from: eth.coinbase, to:eth.accounts[1], value: web3.toWei(1, "ether"),data:web3.toHex("Test Data")}
personal.sendTransaction(tx, "password")
As we can see I am using simple string in data which is converted to hex, I have some questions around it
1.Is there any recommended datatype to use it within data field 2.Is there any standard way to put JSON data in that data field.
- Is there any recommended datatype to use it within data field
- Is there any standard way to put JSON data in that data field.
(note:currently I am sending JSON data by manually converting the data to JSON string by following way
data:web3.toHex("{\"key1\":\"Data1\",\"key2\":\"Data2\"}"))