I know there are many similar questions, but I've been through all of them and haven't got the answer I'm looking for.

I'm trying to deploy a smart contract (that's already been compiled and deployed in Rinkeby) to a private network.


const Migrations = artifacts.require("Migrations");

module.exports = function (deployer) {
  deployer.deploy(Migrations, {from: "[address]"});


// migrations/2_deploy.js
// SPDX-License-Identifier: MIT
const compsc = artifacts.require("compsc");

module.exports = function(deployer) {


const PrivateKeyProvider = require('truffle-privatekey-provider');
const { projectId, mnemonic } = require('./secrets.json');

const privateKey = "[PK]";

module.exports = {
  networks: {
    rinkeby: {
      provider: () => new PrivateKeyProvider(privateKey, `[PROVIDER_URL]`),
      network_id: 4,
      gas: 4612388,
      timeoutBlocks: 200
    nodalblock: {
      provider: () => new PrivateKeyProvider(privateKey, `[IP:PORT]`),
      network_id: 4660
  compilers: {
    solc: {
      version: "0.8.0",    // Fetch exact version from solc-bin (default: truffle's version)
  db: {
    enabled: false

And I'm always getting:

Current account balance 0

   Deploying 'Migrations'

Error:  *** Deployment Failed ***

"Migrations" -- Web3ProviderEngine does not support synchronous requests..

    at /node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
Truffle v5.2.6 (core: 5.2.6)
Node v10.16.0

I've read that there's a problem with some web3 functions being async but being called synchronous by Truffle (at least, I think I understood the problem that way) but I can't get what I need to change/do differently to make it work.

The versions I'm using are:

"dependencies": {
    "truffle": "^5.2.6",
    "truffle-privatekey-provider": "^1.5.0"

Any help would be greatly appreciated. Thanks,

  • Did you try using the official package @truffle/hdwallet-provider?
    – Ismael
    Commented May 23, 2021 at 6:30
  • 1
    Hi Ismael, yes, I did try hdwallet as well, to no avail. Apparently, something's wrong with the Parity installation on the private network and bigger smart contracts, I deployed it on another blockchain we have (Geth with Clique PoA) and it deployed perfectly.
    – mdlapla
    Commented May 26, 2021 at 10:43

1 Answer 1


I think it is better for you to use the official HDWalletProvider instead of the PrivateKeyProvider.

For that, you need to include it: const HDWalletProvider = require('@truffle/hdwallet-provider');

And in the networks, configure it like this:

goerli: {
      provider: new HDWalletProvider({
        privateKeys: [process.env.SECRET],
        providerOrUrl: process.env.INFURA_URL
      network_id: "5"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.