Truffle: "Migrations" -- transaction could not be decoded: could not recover secp256k1 key

I keep getting this error when trying to migrate on rinkeby, I have tried mnemonic as well as private key (with 0x stripped). Any idea what could be the problem?

Error:  *** Deployment Failed ***

"Migrations" -- transaction could not be decoded: could not recover secp256k1 key: calculated Rx is larger than curve P.

    at /home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Migration._deploy (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:74:1)
    at Migration._load (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
    at Migration.run (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
    at Object.runMigrations (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.runAll (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
    at Object.run (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
    at runMigrations (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
    at Object.run (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:226:1)
    at Command.run (/home/cryptokkie/.nvm/versions/node/v14.16.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:136:1)
Truffle v5.2.4 (core: 5.2.4)
Node v14.16.0

My truffle-config.js:

require(“dotenv”).config();
const HDWalletProvider = require("@truffle/hdwallet-provider");

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)
},

rinkeby: {

  provider: () => 

    new HDWalletProvider('theprivatekey', `https://rinkeby.infura.io/v3/${process.env.INFURA_API_KEY}`),

  // provider: () => 

  //   new HDWalletProvider({

  //   mnemonic: {

  //     phrase: process.env.MNEMONIC, 

  //   },

  //   providerOrUrl: `https://rinkeby.infura.io/v3/${process.env.INFURA_API_KEY}`

  // }),

  network_id: 4,       // Rinkeby's id

   

  gas: 8500000,        

  gasPrice: 1000000000,  // 1 gwei (in wei) (default: 100 gwei)

  

  confirmations: 2,    // # of confs to wait between deployments. (default: 0)

  timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)

  skipDryRun: false     // Skip dry run before migrations? (default: false for public nets )

},
1 Like

Hi @Cryptokkie,

Welcome to the community :wave:

You can try downgrading to the previous version of Truffle and Truffle HDWallet Provider.

It looks like the issue occurs using the latest versions.

See: "Migrations" -- transaction could not be decoded: could not recover secp256k1 key: calculated Rx is larger than curve P - #7 by abcoathup

Hi @abcoathup I managed to get it working by downgrading to truffle 5.0.44 and hdwallet 1.2.1
Thank you very much for your help!

1 Like