trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.31k forks source link

"Migrations" -- invalid sender. #3949

Closed AngeloPauli closed 3 years ago

AngeloPauli commented 3 years ago

Hello, I am trying to deploy my contracts to the Ropsten Testnet (Infura). The Account which is shown in the Simulation is fine. I've read online that I should downgrade to HDWalletProvider 1.2.2, but this didn't solve my issue. The simulation works just fine so I am really not sure what the issue is.

Hopefully, someone can help me:)

Error Message: angelo@angelo-X570-GAMING-X:~/Schreibtisch/Blockchain_Dev/Tokenprojekt$ truffle deploy --network ropsten_infura

Compiling your contracts...

Everything is up to date, there is nothing to compile.

Migrations dry-run (simulation)

Network name: 'ropsten_infura-fork' Network id: 3 Block gas limit: 8000000 (0x7a1200)

1_initial_migration.js

Deploying 'Migrations'

block number: 9904476 block timestamp: 1616674785 account: 0xB63F823a4D56C8DF6A6eeEE8339cd98a6668824c balance: 625.81930577047638459 gas used: 144195 (0x23343) gas price: 2 gwei value sent: 0 ETH total cost: 0.00028839 ETH


Total cost: 0.00028839 ETH

2_deploy_contracts.js

Deploying 'MyToken'

block number: 9904478 block timestamp: 1616674817 account: 0xB63F823a4D56C8DF6A6eeEE8339cd98a6668824c balance: 625.81721061047638459 gas used: 1020242 (0xf9152) gas price: 2 gwei value sent: 0 ETH total cost: 0.002040484 ETH

Deploying 'KycContract'

block number: 9904479 block timestamp: 1616674832 account: 0xB63F823a4D56C8DF6A6eeEE8339cd98a6668824c balance: 625.81614506447638459 gas used: 532773 (0x82125) gas price: 2 gwei value sent: 0 ETH total cost: 0.001065546 ETH

Deploying 'MyTokenSale'

block number: 9904480 block timestamp: 1616674859 account: 0xB63F823a4D56C8DF6A6eeEE8339cd98a6668824c balance: 625.81468322647638459 gas used: 730919 (0xb2727) gas price: 2 gwei value sent: 0 ETH total cost: 0.001461838 ETH


Total cost: 0.004567868 ETH

Summary

Total deployments: 4 Final cost: 0.004856258 ETH

Starting migrations...

Network name: 'ropsten_infura' Network id: 3 Block gas limit: 8000029 (0x7a121d)

1_initial_migration.js

Deploying 'Migrations'

Error: Deployment Failed

"Migrations" -- invalid sender.

at /usr/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Migration._deploy (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:74:1)
at Migration._load (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
at Migration.run (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
at Object.runMigrations (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.run (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
at runMigrations (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
at Object.run (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:226:1)
at Command.run (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:136:1)

Truffle v5.2.4 (core: 5.2.4) Node v12.21.0

truffle-config.js:

const path = require("path"); require("dotenv").config({path: "./.env"}); const HDWalletProvider = require("@truffle/hdwallet-provider"); const AccountIndex = 0;

module.exports = { // See http://truffleframework.com/docs/advanced/configuration // to customize your Truffle configuration! contracts_build_directory: path.join(__dirname, "client/src/contracts"), networks: { development: { port: 7545, host: "127.0.0.1", network_id: 5777 }, ganache_local: { provider: function() { return new HDWalletProvider(process.env.MNEMONIC, "http://127.0.0.1:7545", AccountIndex) }, network_id: 5777 }, goerli_infura: { provider: function() { return new HDWalletProvider(process.env.MNEMONIC, "https://goerli.infura.io/v3/85fd59c2d0d64c2fb71d21b4b4ab266a", AccountIndex) }, network_id: 5 }, ropsten_infura: { provider: function() { return new HDWalletProvider(process.env.MNEMONIC, "https://ropsten.infura.io/v3/85fd59c2d0d64c2fb71d21b4b4ab266a", AccountIndex) }, network_id: 3 } }, compilers: { solc: { version: "0.6.1" } } };

gabmontes commented 3 years ago

Possible dup of #3936.

eggplantzzz commented 3 years ago

We released some changes that might have fixed this problem in v5.3.0. Can anyone confirm that this is fixed or that it still is an issue on current Truffle?

nkuba commented 3 years ago

Worked fine with "@truffle/hdwallet-provider": "1.2.6" and "truffle": "5.3.0". Provider config:

      provider: function () {
        return new HDWalletProvider({
          privateKeys: [PRIVATE_KEY],
          providerOrUrl: ETH_HOSTNAME,
        })
      },
eggplantzzz commented 3 years ago

Closing this as I believe it is resolved on the most recent version of @truffle/hdwallet-provider