Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

"Upfront cost exceeds account balance" on Besu private zero gas network #6190

Open
1 task done
gomezgoiri opened this issue Sep 11, 2023 · 3 comments
Open
1 task done

Comments

@gomezgoiri
Copy link


Issue

I want to deploy a smart contract in a free gas private network with Truffle. Although Besu seems to work as expected, Truffle returns the following error if the deploying account has zero balance: Upfront cost exceeds account balance error.

Steps to Reproduce

I've found this error with many configurations (IBFT2, QBFT, different Besu versions), but here I'll describe the simplest way to reproduce it:

  1. Create a free gas network using Quorum-dev-quickstart: npx quorum-dev-quickstart@latest --clientType besu --orchestrate false --quorumKeyManager false --privacy false --monitoring none --blockscout false
  2. Run the network: docker compose up -d
  3. Deploy any smart contract. To test it, you can use this project.

Expected Behavior

Get information about the deployed contracts and their addresses.

Actual Results

Truffle returns the following error: Upfront cost exceeds account balance.

Environment

  • Operating System: Ubuntu
  • Ethereum client: Besu. Although I tested with many configurations, the default one with quorum-dev-quickstart uses version 23.4.1 and QBFT as a consensus algorithm.
  • Truffle version (truffle version): 5.11.3
  • node version (node --version): 18.17.1
  • npm version (npm --version): 9.6.7
@haltman-at
Copy link
Contributor

Thanks for the report! We'll have to try to see what's going on here.

@yunxi-zhang
Copy link

yunxi-zhang commented Feb 5, 2024

@gomezgoiri, sharing my solution here, as I've just hit the same error as you described here, but the difference is I setup my Besu development private network from scratch instead of using Quorum-dev-quickstart. What I've done is I manually added my wallet address with a predefined balance to the genesis file in the "alloc" section.

So, the alloc section in my genesis file looks like below, the last part is my wallet address - 78214bfdbf9a2cd021c51c22ac8476a7d2b72ddd and predefined the balance value.

 "alloc" : {
    "fe3b557e8fb62b89f4916b721be55ceb828dbd73" : {
      "privateKey" : "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
      "comment" : "private key and this comment are ignored.  In a real chain, the private key should NOT be stored",
      "balance" : "0xad78ebc5ac6200000"
    },
    "627306090abaB3A6e1400e9345bC60c78a8BEf57" : {
      "privateKey" : "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3",
      "comment" : "private key and this comment are ignored.  In a real chain, the private key should NOT be stored",
      "balance" : "90000000000000000000000"
    },
    "f17f52151EbEF6C7334FAD080c5704D77216b732" : {
      "privateKey" : "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f",
      "comment" : "private key and this comment are ignored.  In a real chain, the private key should NOT be stored",
      "balance" : "90000000000000000000000"
    },
    "78214bfdbf9a2cd021c51c22ac8476a7d2b72ddd" : {
      "balance" : "90000000000000000000000"
    }
  } 

Hope this helps :-).

@gomezgoiri
Copy link
Author

Thanks @yunxi-zhang, but your solution does not really address my actual problem of deploying a contract to a zero gas network using any account with Truffle 😞

Anyway, few days after I opened this issue Consensys announced that they were sunsetting Truffle, so I moved to Hardhat where everything works fine‎ ‎️‍🌈

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants