Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
How to add private keys to deploy a smart contract to Roptsen?

I am trying to deploy a smart contract to the Ropsten test net.

I have tried to add the private keys mnemonic to a .secret file but get the following error below when running in the terminal truffle migrate --network ropsten

Error: Private key does not satisfy the curve requirements (ie. it is invalid)

The infura api key works by importing it with dot env.

The mnemonic private key is from a metamask wallet.

This is what is in the truffle.config file now:

require('babel-polyfill');
require('dotenv').config();
const HDWalletProvider = require('truffle-hdwallet-provider-privkey');
const MNEMONIC = './.secret';
const infuraKey = process.env.INFURA_API_KEY


module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },

    ropsten: {
      provider: () => new HDWalletProvider(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 )
    }
  },
  contracts_directory: './src/contracts/',
  contracts_build_directory: './src/abis/',
  compilers: {
    solc: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Someone else encountered this issue here

There was a suggestion to use Buffer.from, i.e. Buffer.from('<PRIVATE_KEY>', 'hex') to convert your private key to a Buffer first.

Could try using below:

const privateKey = Buffer.from('PRIVATEKEYFROMMETAMASK', 'hex');
const provider = new HDWalletProvider(privateKey, "https://ropsten.infura.io/v3/INFURATOKEN");
const web3 = new Web3(provider);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda