Issues with building my smart contract with truffle "Failed to migrate a smart contract using truffle,"

When I run the command “truffle migrate --network goerli” I get this error, since I’m new to this subject I do not really know the issues.

$ truffle migrate --network goerli

Compiling your contracts...
===========================
> Compiling .\contracts\Migrations.sol
> Compiling .\contracts\VendingMachine.sol
> Artifacts written to C:\Users\asafy\Exjobb\vendingmachine\build\contracts
> Compiled successfully using:
   - solc: 0.8.19+commit.7dd6d404.Emscripten.clang


Starting migrations...
======================
> Network name:    'goerli'
> Network id:      5
> Block gas limit: 30000000 (0x1c9c380)


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
 *** Deployment Failed ***

"Migrations" could not deploy due to insufficient funds
   * Account:  0x2e09fdd41d3446cc9D8c24e01626e01fCbD1B087
   * Balance:  83064356200000000 wei
   * Message:  insufficient funds for gas * price + value
   * Try:
      + Using an adequately funded account
      + If you are using a local Geth node, verify that your node is synced.


Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.


Error:  *** Deployment Failed ***

"Migrations" could not deploy due to insufficient funds
   * Account:  0x2e09fdd41d3446cc9D8c24e01626e01fCbD1B087
   * Balance:  83064356200000000 wei
   * Message:  insufficient funds for gas * price + value
   * Try:
      + Using an adequately funded account
      + If you are using a local Geth node, verify that your node is synced.

    at C:\Users\asafy\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\deployer\src\deployment.js:330:1
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Truffle v5.8.1 (core: 5.8.1)
Node v18.15.0

3 Likes

I ran it once more and got this, the transaction was made but i still get this error:

$ truffle migrate --network goerli

Compiling your contracts...
===========================
> Compiling .\contracts\Migrations.sol
> Compiling .\contracts\VendingMachine.sol
> Artifacts written to C:\Users\asafy\Exjobb\vendingmachine\build\contracts
> Compiled successfully using:
   - solc: 0.8.19+commit.7dd6d404.Emscripten.clang


Starting migrations...
======================
> Network name:    'goerli'
> Network id:      5
> Block gas limit: 30000000 (0x1c9c380)


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0xf98f6804d711e233f23e85120dca0d97c4cb1894e95cd60e4e4f5c6ea7ee1506
- Blocks: 0            Seconds: 0
- Blocks: 0            Seconds: 4
- Blocks: 1            Seconds: 8
   > Blocks: 1            Seconds: 8
   > contract address:    0x1eE1deA0f62Fd8F0CE7DeB660713AF8a2Cb221EA
   > block number:        8883159
   > block timestamp:     1682333244
   > account:             0x2e09fdd41d3446cc9D8c24e01626e01fCbD1B087
   > balance:             0.063456017189256868
   > gas used:            250212 (0x3d164)
   > gas price:           78.366900911 gwei
   > value sent:          0 ETH
   > total cost:          0.019608339010743132 ETH

   Pausing for 2 confirmations...

   -------------------------------
   > confirmation number: 1 (block: 8883160)
   > confirmation number: 2 (block: 8883161)
- Saving migration to chain.
   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:     0.019608339010743132 ETH


2_vending_machine_migration.js
==============================

   Deploying 'VendingMachine'
   --------------------------
 *** Deployment Failed ***

"VendingMachine" could not deploy due to insufficient funds
   * Account:  0x2e09fdd41d3446cc9D8c24e01626e01fCbD1B087
   * Balance:  59872963981923065 wei
   * Message:  insufficient funds for gas * price + value
   * Try:
      + Using an adequately funded account
      + If you are using a local Geth node, verify that your node is synced.


Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.


Error:  *** Deployment Failed ***

"VendingMachine" could not deploy due to insufficient funds
   * Account:  0x2e09fdd41d3446cc9D8c24e01626e01fCbD1B087
   * Balance:  59872963981923065 wei
   * Message:  insufficient funds for gas * price + value
   * Try:
      + Using an adequately funded account
      + If you are using a local Geth node, verify that your node is synced.

    at C:\Users\asafy\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\deployer\src\deployment.js:330:1
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Truffle v5.8.1 (core: 5.8.1)
Node v18.15.0

2 Likes

Is this error due to my low goerlieth balance or is there some other errors?

2 Likes

Hi @robinho46 please note that the error is thrown because you don’t have sufficient funds to deploy your smart contract.

2 Likes

I see, I’m currently getting my goerlieth from this site “https://goerli-faucet.pk910.de/”, but it takes a lot of time is there any page where i could get more faster? I looked into another site and that site required that i had atleast 0,001 ETH on mainnet which I cant have atm.

2 Likes

Hi!,

Here is a link to various Goerli faucets:

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.