Deployment failed with error: invalid sender - Using oz cli

Trying to deploy upgradable contracts (oz push, oz create) to ropsten, fails with “Deployment failed with error: invalid sender” any time. It works ok with a local ganache-cli.

I’ve checked the address has balance and is derived ok. Im using infura nodes.

:computer: Environment

  "@openzeppelin/contracts-ethereum-package": "^2.3.0",
  "@openzeppelin/upgrades": "^2.5.3",
  "@truffle/hdwallet-provider": "^1.0.17",
require('dotenv').config();

const HDWalletProvider = require('@truffle/hdwallet-provider');

const mnemonic = process.env.MNEMONIC;
const infuraKey = process.env.INFURA_API_KEY;

module.exports = {
  networks: {
    local: {
      host: 'localhost',
      port: 8545,
      gas: 5500000,
      gasPrice: 5e9,
      network_id: '*'
    },
    ropsten: {
      provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/${infuraKey}`),
      gas: 5500000,
      gasPrice: 5e9,
      network_id: '3'
    },
    mainnet: {
      provider: () => new HDWalletProvider(mnemonic, `https://mainnet.infura.io/v3/${infuraKey}`),
      gas: 5500000,
      gasPrice: 5e9,
      network_id: '1'
    }
  }
}
1 Like

Hi @chentschel,

Welcome to the community :wave: and thanks for posting your question in the forum.

I have reproduced the invalid sender error you are seeing.

The issue appears to be with @truffle/hdwallet-provider. There is an open issue: https://github.com/trufflesuite/truffle/issues/2431

The last working version is 1.0.18. https://github.com/trufflesuite/truffle/issues/2431#issuecomment-539532772

I was able to deploy successfully with this version
npm i @truffle/hdwallet-provider@1.0.18.

As an aside, you don’t need to do oz push first anymore, you can go straight to oz create.

$ oz create
Nothing to compile, all contracts are up to date.
? Pick a contract to instantiate Counter
? Pick a network ropsten
✓ Contract Counter deployed
All contracts have been deployed
? Do you want to call a function on the instance after creating it? No
✓ Setting everything up to create contract instances
✓ Instance created at 0x1E3f30cD85306C5427f2aCdED8cc621B4d24C221
0x1E3f30cD85306C5427f2aCdED8cc621B4d24C221

Thanks a lot. :slight_smile:

1 Like

Hi @chentschel,

Feel free to ask all the questions that you need.

If you have a moment, it would be great if you could introduce yourself to the community

Hi @chentschel,

Latest version of Truffle appears to have resolved the invalid sender issue. I tried today with the latest version of truffle and @truffle/hdwallet-provider and didn’t get the error.