Open gomezgoiri opened 10 months ago
Thanks for the report! We'll have to try to see what's going on here.
@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 :-).
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 :disappointed:
Anyway, few days after I opened this issue Consensys announced that they were sunsetting Truffle, so I moved to Hardhat where everything works fine ️🌈
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:
Expected Behavior
Get information about the deployed contracts and their addresses.
Actual Results
Truffle returns the following error:
Upfront cost exceeds account balance
.Environment
truffle version
): 5.11.3node --version
): 18.17.1npm --version
): 9.6.7