3

I keep getting Error: Invalid address when trying to run the application. My current setup of web3 using infura node is

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  const provider = new Web3.providers.HttpProvider('https://rinkeby.infura.io/doeL97MLPLVXBgAnRZRJ');
  web3 = new Web3(provider);
}
web3.eth.defaultAccount = web3.eth.accounts[0];
web3.personal.unlockAccount(web3.eth.defaultAccount)

The instance of the contract is

const contract = web3.eth.contract(abi);
const instance = contract.at(address);
instance.web3.eth.defaultAccount=instance.web3.eth.coinbase;

when trying to do a call to the contract, the value returned is undefined

const count = await EmployeeStore.employeesCount().then(function(value) {
      console.log(parseInt(value));
    }); 

as shown in the picture below, web3 is injected correctly and able to retrieve the accounts. Web3 injected

madsmosu
  • 31
  • 5
  • Could you be a little more specific and provide the address you are using? Are you referring to the contract address or your personal account address? This will help us answering your question better. – Thomas Vanderstraeten Oct 28 '18 at 08:52

1 Answers1

0

I suppose this due to invalid checksum, your address should have a valid checksum, it depends on the lower/upper case of characters in address.Refer to this

sp4c3
  • 440
  • 2
  • 12