error image indicates invalid address. this is on the call of the function. Ideas on why it fails? i suspect i'm missing something simple.


    alert("Attempting Create");
    const credentialOrgFactoryContract = this.state.credentialOrgFactoryContract
    var checkBool = this.state.web3.isAddress(this.state.createCredentialOrgSchoolAddress)
    var a,b,c;

    if (checkBool){
      a = this.state.createCredentialOrgShortName;
      b = this.state.createCredentialOrgOfficialSchoolName;
      c = this.state.createCredentialOrgSchoolAddress

      return credentialOrgFactoryContract.createCredentialOrg(a, b, c)
     .then(result => {
        return credentialOrgFactoryContract.selectOrgCount()
     }).then ((result) => {
        this.setState({credentialOrgCount: result.c[0]})

   } else {
      alert("invalid address");
  • What's the value of this.state.createCredentialOrgSchoolAddress? Can you just simplify your code down to web3.isAddress('0x123...') so others can reproduce it? – user19510 Aug 20 '18 at 18:08
  • screencast.com/t/hTIytkN5EBY the highlighted address is the one that is passed into it, from ganache github repository screenshot also shows address, but here it is in text: 0x1eC2c24e0110a0c0C4e0E03e694dBC95cd825162 – shaddow Aug 20 '18 at 18:11
  • Rather than guess, why don't you just console.log the address right before you use it (or better yet, hardcode it as I suggested). The goal is to narrow down where the issue is. (Is that address somehow invalid? Or is the address you're checking not what you think it is?) – user19510 Aug 20 '18 at 18:18
  • 1
    Could you please just try web3.isAddress('0x1eC2c24e0110a0c0C4e0E03e694dBC95cd825162')? It returns true in web3.js 0.20.3. If it returns true in your app too, that's further evidence that you're not actually passing the value you think you're passing. Once you determine you're not passing the right address, a good trick to try is console.log(JSON.stringify(this.state.createCredentialOrgSchoolAddress)). That might help spot other issues, like an extra space or an invisible unicode character. – user19510 Aug 20 '18 at 18:27
  • 1
    You're sending a transaction without specifying a from address, so it should be using web3.eth.defaultAccount. If that's undefined, then you're trying to send from an invalid address. – user19510 Aug 20 '18 at 18:37

per: smartx and the last comment: web3.eth.defaultAccount was undefined and thus causing the attempted send to occur out being attached to an account (thus invalid address)

thanks for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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