web3.js - line 3748 - Uncaught invalid address

when i try to run the ratings contract on mix (ethereum v0.9.92) windows 64bit. I'm getting this error thrown. It was working until a couple versions prior to this. can anyone help me find the problem. the contract/html code is exact from the tutorial here

Comments

  • YannYann Posts: 40
    hi,
    You have to the set the defaultAccount to be used:
    web3.eth.defaultAccount = web3.eth.accounts[0]
  • durdur Posts: 10
    How do you set the default account in Mix?
  • durdur Posts: 10
    Got it. Need to execute the command in the JS console.
  • Pit789Pit789 Posts: 4
    edited March 2016
    I'm just trying Mix for the first time using the tutorial and still get a similar error:
    web3.js - line 3881 - Uncaught invalid address
    (Shouldn't that issue either be corrected or an explanation added to the tutorial?)

    My problem: I don't know how to display the JS console to enter the proposed command? I cannot find a corresponding menu point in Mix. Any help would be appreciated!
  • swappermallswappermall Posts: 4
    The JS console can be displayed by clicking a command button in the Web View, which in turn can be displayed from the menu bar using Windows --> Show Web View. There are two command buttons to the right of the address bar in the Web View. Use the command button furthest to the right to open the JS console.
  • sunilsunil Posts: 1
    Go to Windows, select only "Show Web View", now by clicking on the button to the right of the check box "Auto reload on save" and you will launch the JS Console. Once you have this copy the above code to set the default account -- web3.eth.defaultAccount = web3.eth.accounts[0]
  • YannYann Posts: 40
    You could also create a new transaction using the from param:

    contract["NAME"].contract.function(param1, param2, { from: "0x...." })
  • AlexZAlexZ Posts: 1
    Works for me. As I understand this is a workaround. And this error is not expected and should not happen when following the tutorial?
  • maxxflyermaxxflyer Posts: 30
    Since it is a javascript command, in my understanding you must add the code web3.eth.defaultAccount = web3.eth.accounts[0]; to your javascript file.
    Or inside your html between javascript tags.
    It is missing in the sample contract, so it is confusing.
    If you input via js console it is in fact a workaround.
  • maxxflyermaxxflyer Posts: 30
    edited March 2016
    I modified the Sample coming with Mix this way (html file):

    open js tag

    ///////////////////////////////////////////////////////////////////////// HERE IT IS !

    web3.eth.defaultAccount = web3.eth.accounts[0];

    /////////////////////////////////////////////////////////////////////////


    function get() {
    var param = document.getElementById('query').value;
    var res = contracts['Sample'].contract.get();
    document.getElementById('queryres').innerText = res;
    }

    function set() {
    var key = document.getElementById('key').value;
    var res = contracts['Sample'].contract.set(key);
    }



    close js tag
  • mocamirceamocamircea Posts: 2
    maxxflyer said:

    Since it is a javascript command, in my understanding you must add the code web3.eth.defaultAccount = web3.eth.accounts[0]; to your javascript file.
    Or inside your html between javascript tags.
    It is missing in the sample contract, so it is confusing.
    If you input via js console it is in fact a workaround.

    Either within the javascript file, or as a command into the javascript console, as mentioned by dur
Sign In or Register to comment.