Skip to main content
edited title
Link

Modify string in contract (Error: invalid address)

added 239 characters in body
Source Link

I'm trying to write a contract that has a string that can be modified/updated by the owner later on. I tested it in Remix and it works perfectly. But when I deploy it to my private blockchain, I get errors. Any ideas? Or is there at least a reasonable way to debug the code? These errors seem to be useless!

pragma solidity ^0.4.13;

contract c5 {
    uint currentVersion;
    string command;
    address owner;

    //Constructor is automatically executed upon creation:
    function c5(){
            currentVersion = 1;
            command = "test1";
            owner = msg.sender;
    }

    function update(uint input){
            if(msg.sender != owner) return;
            currentVersion = input;
    }

    function query() constant returns (string){
            return command;
    }

    function version() constant returns (uint){
            return currentVersion;
    }
}

This is the error I get in the geth console:

> c5.query()
"test1"
> c5.version()
1
> c5.update("4")
Error: invalid address
at web3.js:3879:15
at web3.js:3705:20
at web3.js:4948:28
at map (<native code>)
at web3.js:4947:12
at web3.js:4973:18
at web3.js:4998:23
at web3.js:4061:16
at apply (<native code>)
at web3.js:4147:16

Are these strings indeed editable? or do I need to submit a new contract with the new string and direct queries to it via an updated address via DELEGATECALL:

Upgradeable smart contracts

Thanks in advance for any ideas!

I'm trying to write a contract that has a string that can be modified/updated by the owner later on. I tested it in Remix and it works perfectly. But when I deploy it to my private blockchain, I get errors. Any ideas? Or is there at least a reasonable way to debug the code? These errors seem to be useless!

pragma solidity ^0.4.13;

contract c5 {
    uint currentVersion;
    string command;
    address owner;

    //Constructor is automatically executed upon creation:
    function c5(){
            currentVersion = 1;
            command = "test1";
            owner = msg.sender;
    }

    function update(uint input){
            if(msg.sender != owner) return;
            currentVersion = input;
    }

    function query() constant returns (string){
            return command;
    }

    function version() constant returns (uint){
            return currentVersion;
    }
}

This is the error I get in the geth console:

> c5.query()
"test1"
> c5.version()
1
> c5.update("4")
Error: invalid address
at web3.js:3879:15
at web3.js:3705:20
at web3.js:4948:28
at map (<native code>)
at web3.js:4947:12
at web3.js:4973:18
at web3.js:4998:23
at web3.js:4061:16
at apply (<native code>)
at web3.js:4147:16

I'm trying to write a contract that has a string that can be modified/updated by the owner later on. I tested it in Remix and it works perfectly. But when I deploy it to my private blockchain, I get errors. Any ideas? Or is there at least a reasonable way to debug the code? These errors seem to be useless!

pragma solidity ^0.4.13;

contract c5 {
    uint currentVersion;
    string command;
    address owner;

    //Constructor is automatically executed upon creation:
    function c5(){
            currentVersion = 1;
            command = "test1";
            owner = msg.sender;
    }

    function update(uint input){
            if(msg.sender != owner) return;
            currentVersion = input;
    }

    function query() constant returns (string){
            return command;
    }

    function version() constant returns (uint){
            return currentVersion;
    }
}

This is the error I get in the geth console:

> c5.query()
"test1"
> c5.version()
1
> c5.update("4")
Error: invalid address
at web3.js:3879:15
at web3.js:3705:20
at web3.js:4948:28
at map (<native code>)
at web3.js:4947:12
at web3.js:4973:18
at web3.js:4998:23
at web3.js:4061:16
at apply (<native code>)
at web3.js:4147:16

Are these strings indeed editable? or do I need to submit a new contract with the new string and direct queries to it via an updated address via DELEGATECALL:

Upgradeable smart contracts

Thanks in advance for any ideas!

Source Link

Modify string in contract

I'm trying to write a contract that has a string that can be modified/updated by the owner later on. I tested it in Remix and it works perfectly. But when I deploy it to my private blockchain, I get errors. Any ideas? Or is there at least a reasonable way to debug the code? These errors seem to be useless!

pragma solidity ^0.4.13;

contract c5 {
    uint currentVersion;
    string command;
    address owner;

    //Constructor is automatically executed upon creation:
    function c5(){
            currentVersion = 1;
            command = "test1";
            owner = msg.sender;
    }

    function update(uint input){
            if(msg.sender != owner) return;
            currentVersion = input;
    }

    function query() constant returns (string){
            return command;
    }

    function version() constant returns (uint){
            return currentVersion;
    }
}

This is the error I get in the geth console:

> c5.query()
"test1"
> c5.version()
1
> c5.update("4")
Error: invalid address
at web3.js:3879:15
at web3.js:3705:20
at web3.js:4948:28
at map (<native code>)
at web3.js:4947:12
at web3.js:4973:18
at web3.js:4998:23
at web3.js:4061:16
at apply (<native code>)
at web3.js:4147:16