How to deploy on ropsten with zos? (deployment failed with error: Unknown address - unable to sign transaction for this address)

Hi. I'm curious how I will be able to deploy contracts with "zos push" to the ropsten-network?

After:

zos push --network ropsten --skip-compile --deploy-dependencies --verbose

I always get the following error:

[2019-06-27T13:00:41.367Z@ErrorHandler.js#call] Error: Token deployment failed with error: Unknown address - unable to sign transaction for this address: "0xe280db001246e1cff4b437d161f47e4a8895506d"

The output of zos push starts with:

[2019-06-27T13:00:38.510Z@ZosPackageFile.js#write] Updated zos.json
[2019-06-27T13:00:38.527Z@Session.js#getOptions] Using session with sender address 0xe280db001246e1cff4b437d161f47e4a8895506d, timeout 3600 seconds
[2019-06-27T13:00:39.936Z@ZWeb3.js#toChecksumAddress] WARNING: Address 0xe280db001246e1cff4b437d161f47e4a8895506d is not checksummed. Consider checksumming it to avoid future warnings or errors.

I already have send Ether to this account via ropsten-faucet. So an out of gas issue can be excluded obviously.

What do I wrong here?

truffle.config:

ropsten: {
  provider: function() {
    return new HDWalletProvider(mnemonic, 'https://ropsten.infura.io/v3/' + INFURA_ID)
  },
  network_id: '3',
  gas: 4465030,
  gasPrice: 10000000000,
  from: '0xe280db001246e1cff4b437d161f47e4a8895506d'
},

I use my own Infura-ID.

Thanks for any advice.

1 Like

Seems to be a generic issue, that truffle-hdwallet-provider seems to have with Infura.

I’ve found these issues:

  1. https://github.com/trufflesuite/truffle-hdwallet-provider/issues/7
  2. https://github.com/trufflesuite/truffle-hdwallet-provider/issues/49#issuecomment-406825894

Has anyone faced the same?

Hi @itinance

The from in your truffle-config.js is causing the issue.
The error is meant to explain that your from address is unknown
Unknown address - unable to sign transaction for this address:

https://www.trufflesuite.com/docs/truffle/reference/configuration#networks
from : From address used during migrations. Defaults to the first available account provided by your Ethereum client.

Without specifying a from the transaction will be sent using the first account generated by the mnemonic.
If the account doesn't have enough Ether you will get the error insufficient funds for gas * price + value

If you want to use an account other than the first account, you can specify the index to the account.

https://www.trufflesuite.com/tutorials/using-infura-custom-provider
Without any other arguments, the account in charge of migration will be the first one generated by the mnemonic. But if desired, you can pass in an argument to specify which account to use. As an example, to use the third account:

new HDWalletProvider(mnemonic, "https://ropsten.infura.io/v3/<INFURA_PROJECT_ID>", 2);

(Recall that the index is zero-based, so 2 is the third address.)


If you ever have issues deploying, I recommend deploying a simple contract to check your config, as deploying via Infura can silently fail if there is an issue with config. (I had an issue with my config today, and resolved by deploying a simple contract using truffle to Ropsten first)

truffle-config.js

require('dotenv').config();

const HDWalletProvider = require('truffle-hdwallet-provider');
const infuraKey = process.env.INFURA_API_KEY;

module.exports = {
  networks: {
    development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    },

    ropsten: {
        provider: () => new HDWalletProvider(process.env.DEV_MNEMONIC, "https://ropsten.infura.io/v3/" + infuraKey),
        network_id: 3,       // Ropsten's id
        gas: 5500000,        // Ropsten has a lower block limit than mainnet
        confirmations: 2,    // # of confs to wait between deployments. (default: 0)
        timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)
        skipDryRun: true,     // Skip dry run before migrations? (default: false for public nets )
    },
  },
}

.env

INFURA_API_KEY="ENTER YOUR INFURA PROJECT ID"
DEV_MNEMONIC="ENTER YOUR 12 WORD SEED PHRASE"

I deployed and interacted with the contract using ZeppelinOS 2.4.0 interactive commands, following the Quick Start in the documentation

$ npx zos 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 0xc4De55D1d5c20fDf40c9A0D41CfC8A9245040d9b
0xc4De55D1d5c20fDf40c9A0D41CfC8A9245040d9b

If you are using ZeppelinOS without truffle (and hence you don't have a truffle-config.js) you use network.js for network configuration.

network.js

require('dotenv').config();

const HDWalletProvider = require('truffle-hdwallet-provider');
const infuraKey = process.env.INFURA_API_KEY;

module.exports = {
  networks: {
    development: {
      protocol: 'http',
      host: 'localhost',
      port: 8545,
      gas: 5000000,
      gasPrice: 5e9,
      networkId: '*',
    },
    ropsten: {
      provider: () => new HDWalletProvider(process.env.DEV_MNEMONIC, "https://ropsten.infura.io/v3/" + infuraKey),
      networkId: 3,       // Ropsten's id
    },
  },
};
1 Like

I have written a guide on how to Deploy to a public testnet using ZeppelinOS 2.4

2 Likes

Thx @abcoathup! Suddenly it works without the from-statement. Tried out yesterday too. Weird.

When I deploy on development network, zos create is asking me “Do you want to call a function on the instance after creating it?”, but not when I deploy on ropsten.

Even when I exercute zos send-tx it just quits without any message, when I select ropsten-network.

zos call also stops after selecting ropsten-network. Even when I run it with --verbose, no messages appear.

1 Like

It sounds like your configuration for Ropsten is not setup correctly. I have had issues with Infura config silently failing when there is a problem.

Check that you are setting your Infura Project ID and mnemonic in your truffle-config.js appropriately.

1 Like

Yes you are right. Applying the right settings and it starts deployment. Would be cool if any error message would have been shown in such cases :slight_smile:

And the error that I have initially reported is back:

zos push --network ropsten --verbose --from=0x2353e45fF9613cFB05CC797E15cC37fd0d7F9658

Token deployment failed with error: Unknown address - unable to sign transaction for this address: "0x2353e45ff9613cfb05cc797e15cc37fd0d7f9658"

When I remove the --from argument, I run into "insufficient funds for gas * price + value".

I have imported the mnemonic into MyCrypto and sent 1 ETH to the very first account. But there seems to be another account used.

1 Like

I have figured out the root cause: Deploy to a public testnet using ZeppelinOS 2.4

1 Like