When I add new contract (testrpc) with truffle with parameter of type "address" the reading value of this property seems wrong (always 0x0000000000000000000000000000000000000000), I do not find the cause of the problem

The Demo.sol contract:

pragma solidity ^0.4.2;

contract Demo
     address public test;
     function Demo(address test) payable
        test = test;

I add the new contract with truffle

Demo.new("0x9e99b1aaa2114fdae97c9ab2f20863dfde4659bd", {
    from: account,
    value: web3.toWei(0.1, 'ether')
}).then(function (instance) {
    return instance.test.call({from: account});
}).then(function(test) {

The expected result is 0x9e...9bd but the output is 0x00...000.

If necessary, I push the demo project on Github, Thank you for your help

  • Where did account come from? Is it defined? Consider dropping it and things should default to first account. Apr 17, 2017 at 1:38
  • I use web3.eth.getAccounts... and Metamask opens well to ask for confirmation
    – vincentLg
    Apr 17, 2017 at 8:39

1 Answer 1


I answer to myself... there was a stupid error in the smart contract... The class variable and the parameter had the same name

This code works :

 address public myaddress;
 function Demo(address test) payable
    myaddress = test;

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.