I am trying to send an when a method is executed, but in all the events of my contract , the first parameter is empty, even I send it.

 event priceAdded(bytes32,address);

And I am calling that using


The event is created like this:


"": "0x751a355e8021109e332e7283ef81710bda7ef174" }

Contract code:

pragma solidity ^0.4.0;
contract Check {

mapping (uint256 => uint256) CPTPrices;

event priceAdded(uint256,uint256);

// Methods related to CPT prices.
//To store the sugery price
function addPrice(uint256 CPT, uint256 price) {
    CPTPrices[CPT] = price;
} }
  • I make a simple demo is OK, please refresh remix and again.If it doesn't work, please giving contract code. – BinGoBinBin Aug 7 '17 at 4:58
  • @BinGoBinBin I tried multiple times, but no use. I will update the question with contract code. – BalaChandra Aug 7 '17 at 5:05

The event is being fired. If an event is fired then the output will be the values passed into it. It will be same in private geth also(if the source code of geth is not altered). The contract is working fine.

Send the complete flow of how did you reach to the event.(See the screenshot and share details if something else is done)

Update:- Just found a bug of sort. If the names are not given in the event, then it takes one of the arg returned in the event as name. So modify event priceAdded(uint256,uint256); to include name of the arguements as event priceAdded(uint256 CPT,uint256 price); . It should now work fine(Got the same prb on my system ).

Please upvote if it answers your question

| improve this answer | |

I test your contract and the event callback is ok. result

| improve this answer | |
  • priceAdded{ "": "2" }. This is how my event came. I am using a private geth node. – BalaChandra Aug 7 '17 at 6:10
  • It is coming like ibb.co/eVdMKv – BalaChandra Aug 7 '17 at 6:18
  • How odd! I deployed on private node and test, everything is ok. I add param name for event method,event priceAdded(uint256 p1,uint256 p2), and add a watcher by var event = browser_test_sol_check.priceAdded(); event.watch(function(error, result){ if (!error) console.log("p1=" + result.args.p1 + " p2=" + result.args.p2); }); , call addPrice method result is right. https://ibb.co/cVzLev – BinGoBinBin Aug 7 '17 at 6:59

Your contract is working fine. Below is the execution:

from    0xca35b7d915458ef540ade6068dfe2f44e8fa733c
to  browser/Untitled.sol:Check.addPrice(uint256,uint256) 0x692a70d2e424a56d2c6c27aa97d1a86395877b3a
gas     3000000 gas
transaction cost    43324 gas
execution cost  21604 gas
hash    0x6dc0135401ce46d9bec627039e8a1122c5e8ed3ff478c23bc2e3356fb9ed9dc5
input   0x57279353000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000141
decoded input   {
"uint256 CPT": "123",
"uint256 price": "321"
decoded output  {}
logs    [
    "event": "priceAdded",
    "args": [
value   0 wei
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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