I need to call methods from my contract in Ethereum without using MetaMask. I use Infura API and try to call my methods from account, recently created with web3.eth.create() method. This method returns object like this:

    address: "0xb8CE9ab6943e0eCED004cG5834Hfn7d",
    privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6",
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}

I also using infura provider:

 const web3 = new Web3(new Web3.providers.HttpProvider(

So, when I try to write smth like that:

          from: '0xb8CE9ab6943e0eCED004cG5834Hfn7d', // here I paste recently created address
          value: web3.utils.toWei("0.5", "ether")

I have this error:

Error: No "from" address specified in neither the given options, nor the default options.

How it could be no from address if I write it in from option??

P.S. With Metamask my application works fine. But when I logout from MetaMask and try to create new account with web3.eth.create() method and use it, I have that issue.

  • Did you verify that when you re-login in Metamask you had selected Rinkeby testnet and you have a positive balance on that account? – CPereez19 May 20 '18 at 15:05
  • Well, I don't care of MetaMask actually) I have problem with account that created with web3.eth.create() method – Alex Johnson May 20 '18 at 15:27
  • Created it on rinkeby instead of ethereum main blockchain? – CPereez19 May 20 '18 at 15:28
  • I don't know where this create() method creates account, rinkeby or main network – Alex Johnson May 20 '18 at 15:30
  • Look, there is no problem with MetaMask, there's problem with recently created account from web3.eth.create() – Alex Johnson May 20 '18 at 15:31

I've already faced this problem. You specifying address on from field in checksumed format (mixed case). Try to convert it to lowercase and test again. I found it when researched the same issue - looks like web3 still operated un-checksumed addresses.

  • Thanks, but unfortunatelly it doesn't help – Alex Johnson May 21 '18 at 7:17
  • @AlexJohnson maybe you can share minimal reproducible example for your case? Then I can trace it. – Alex G.P. May 21 '18 at 8:47
  • Actually, according to docs, I need to sign transaction with my key, I can't just put recently created account address and call some methods. Now I try to use ethereumjs-tx library for doing this – Alex Johnson May 21 '18 at 8:51

Try setting it up this way:

yourContract.options.from = '0xb8CE9ab6943e0eCED004cG5834Hfn7d';

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.