pragma solidity ^0.4.0;

contract test {

  bool test_bool1 = false;

  bool test_bool2 = true;

  modifier test_modifier(bool _test_bool){
      if (_test_bool == false) throw;

  function test1(uint input1) test_modifier(test_bool1) returns (uint){
      return input1;

   function test2(uint input2) test_modifier(test_bool2) returns (uint){
      return input2;


Here is my simple modifier test code. If I deploy that contract and call test.test1(5), I expect shoud not return anything because test_bool1 is false. The result of eth.getTransaction() of this function call transactionHash will be:


And if I do it again with test.test2(5) (which passed modifier test) I get:

> console.log((eth.getTransaction("0xdf2d0d0ff2a7aed5bf53ca23ccbcb05c76f350255120a098829c839965c4439d").input))

Why did that happend?
Is there anything about first 8 digits of transaction input? caf44683, 19ae8994

  • The first 4 bytes are the method signature (see this how it is produced ethereum.stackexchange.com/a/1171). Without the code you are using is hard to say exactly what is going on. But test.test1(5) should throw, check the gas used in the transaction receipt. And test.test2(5) should succeed, but remember you cannot check the return value if you call a contract method (ethereum.stackexchange.com/a/770). – Ismael Jul 8 '17 at 15:41

You get transaction details for a failed transaction but later on, you are checking the input value of this transaction, which indeed for the first transaction is 5 (data sent by you as specified in docs):


rather that checking for a result value. To do so, you may publish an event populated by a return value and listen for such an event.

  • How do I check for a result value? – shegeley Jul 8 '17 at 16:12
  • I've edited my answer proposing the usual pattern with publishing an event. – Jakub Wojciechowski Jul 8 '17 at 16:23

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.