2

I have this contract:

pragma solidity ^0.4.0; 
contract Proof { 
    function register(bytes32 hash) { 
        if (hashToDate[hash] != 0) return; 
        hashToDate[hash] = now; 

    } 
    function dateOf(bytes32 hash) constant returns (uint date) { 
        return hashToDate[hash]; 

    } 
    mapping (bytes32 => uint) hashToDate; 
}

I deployed this contract successfully. I can call dateOf successfully as well, since it is a constant function (return value 0 is intended, since the hash has not been registered, yet):

> proof.dateOf("0x492...fee7d")
0

Now I want to call register(bytes32).

This is what I have from the documentation, but I don't know where to include the argument.

var tx = proof.register.sendTransaction(proof.address, 0, {from:eth.accounts[0]})
Shane Fontaine
  • 18,036
  • 20
  • 54
  • 82
mitchkman
  • 225
  • 3
  • 10

1 Answers1

2

proof.register.sendTransaction(hashToRegister, {from:eth.accounts[0]})

Which can just be:

proof.register(hashToRegister, {from:eth.accounts[0]})

Because register is not labelled constant.

eth
  • 85,679
  • 53
  • 285
  • 406