Skip to main content
edited body
Source Link
Lee
  • 8.6k
  • 6
  • 46
  • 81

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this as rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

     var MyContract = web3.eth.contract(abi);
    
     var myContractInstanceMyContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this as rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

     var MyContract = web3.eth.contract(abi);
    
     var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this as rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

     var MyContract = web3.eth.contract(abi);
    
     var MyContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

added 1 character in body
Source Link
Lee
  • 8.6k
  • 6
  • 46
  • 81

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this aas rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

     var MyContract = web3.eth.contract(abi);
    
     var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this a rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

     var MyContract = web3.eth.contract(abi);
    
     var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this as rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

     var MyContract = web3.eth.contract(abi);
    
     var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this a rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

    var MyContract = web3.eth.contract(abi);

    var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');

    MyContractInstance.submitUnits('10');

     var MyContract = web3.eth.contract(abi);
    
     var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
    at web3.js:3887:15
    at web3.js:3713:20
    at web3.js:4939:28
    at map (<native code>)
    at web3.js:4938:12
    at web3.js:4964:18
    at web3.js:4989:23
    at web3.js:4055:16
    at apply (<native code>)
    at web3.js:4141:16

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this a rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

    var MyContract = web3.eth.contract(abi);

    var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');

    MyContractInstance.submitUnits('10');

I then get the following errors:

Error: invalid address
    at web3.js:3887:15
    at web3.js:3713:20
    at web3.js:4939:28
    at map (<native code>)
    at web3.js:4938:12
    at web3.js:4964:18
    at web3.js:4989:23
    at web3.js:4055:16
    at apply (<native code>)
    at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

I have a contract which I'd like to be able to sum numbers submitted by any other address:

contract UnitCounter {
    mapping (address => uint256) public UnitsFrom;
    uint256 public TotalUnits;

    function submitUnits(uint256 Units) {
        UnitsFrom[msg.sender] = Units;
        TotalUnits += Units;
    }
}

Using this a rough guidance, I followed the following steps on a private-net:

  1. Deploy the contract using mist

  2. Get the JSON Interface code using the "Show Interface" icon in mist

  3. Copy the address of the deployed contract 0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9 on my private blockchain.

  4. On a Geth console:

    var abi=[ { "constant": false, "inputs": [ { "name": "Units", "type": "uint256" } ], "name": "submitUnits", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "TotalUnits", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "UnitsFrom", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" } ]

     var MyContract = web3.eth.contract(abi);
    
     var myContractInstance = MyContract.at('0x17d541b8aACFFe473e3dD32eBA83C82B51DB8EF9');
    
     MyContractInstance.submitUnits('10');
    

I then get the following errors:

Error: invalid address
at web3.js:3887:15
at web3.js:3713:20
at web3.js:4939:28
at map ()
at web3.js:4938:12
at web3.js:4964:18
at web3.js:4989:23
at web3.js:4055:16
at apply ()
at web3.js:4141:16

What do these errors mean?

How should I debug from this point?

added 15 characters in body
Source Link
Lee
  • 8.6k
  • 6
  • 46
  • 81
Loading
Source Link
Lee
  • 8.6k
  • 6
  • 46
  • 81
Loading