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")

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]})

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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