I know we have 'data' field to add any comments but is it possible to add our own field based on the application ie; a field like 'purchased products' which will have purchased products of a user along with transaction data in privatenet?

  • But no one has answered yet...:(
    – angelmaria
    Nov 22 '17 at 9:29

Using web3.js you can use sendTransaction(). For example with the geth console:

geth attach geth.ipc
> web3.eth.sendTransaction({
    from: web3.eth.coinbase,
    to: toAddress,
    value: web3.toWei(ethers),
    data: web3.toHex("My comment")

Replace toAddress with desired receipient, ethers with number of ethers to send, and "My comment" with the comment you want.

See https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendtransaction for details.

  • 2
    Instead of passing comment in 'data' field . Can we create a new field with new name?
    – angelmaria
    Jan 15 '18 at 5:49
  • 1
    What if I need to add a custom field along with transaction details when a function call from contract is done?
    – lekshmi
    Aug 21 '18 at 6:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.