zama-ai / fhevm-hardhat-template

fhEVM hardhat template
MIT License
20 stars 26 forks source link

ProviderError: failed to check sender balance: sender balance < tx cost (0 < 197257911921588): insufficient funds: insufficient funds #37

Open furkandemireleng opened 2 weeks ago

furkandemireleng commented 2 weeks ago

Hi Zama ! I have a question about deploying erc20 token.

I download the project then install packages after that I enter pnpm : pnpm run fhevm:start

it says :

`mpiled 3 Solidity files successfully (evm target: cancun).
gatewayContractAddress written to gateway/.env.gateway successfully!
node_modules/fhevm/gateway/lib/PredeployAddress.sol file has been generated successfully.
Nothing to compile
No need to generate any newer typings.
ACL address 0xf162A696Ea1441D1250DFf40f37694Ea3284Aab0 written successfully!
node_modules/fhevm/lib/ACLAddress.sol file generated successfully!
TFHE Executor address 0x8632ae1E429F0BB3897d49937E0d78B999ac4Db8 written successfully!
node_modules/fhevm/lib/FHEVMCoprocessorAddress.sol file generated successfully!
KMS Verifier address 0x39af75d7870A3067286c4EeD89B47cf56bdE4daD written successfully!
node_modules/fhevm/lib/KMSVerifierAddress.sol file generated successfully!
An unexpected error occurred:

ProviderError: failed to check sender balance: sender balance < tx cost (0 < 114204164111464): insufficient funds: insufficient funds

Please replace TFHEExecutor for one of these options wherever you are trying to read its artifact:

fhevm/lib/TFHEExecutor.sol:TFHEExecutor
fhevmTemp/fhevm/lib/TFHEExecutor.sol:TFHEExecutor

For more info go to https://hardhat.org/HH701 or run Hardhat with --show-stack-traces
An unexpected error occurred:

ProviderError: failed to check sender balance: sender balance < tx cost (0 < 197257911921588): insufficient funds: insufficient funds
.....
privateKey 717fd99986df414889fd8b51069d4f90a50af72e542c58ee065f5883779099c6
ownerAddress 0x305F1F471e9baCFF2b3549F9601f9A4BEafc94e1
GatewayContract was deployed at address:  0xc8c9303Cd7F337fab769686B593B87DC3403E0ce
Account 0x97F272ccfef4026A1F3f0e0E879d514627B84E69 was succesfully added as an gateway relayer`
the launch-fhevm.sh

# npx hardhat clean
mkdir -p fhevmTemp
cp -L -r node_modules/fhevm fhevmTemp/
npx hardhat compile:specific --contract fhevmTemp/fhevm/lib
npx hardhat compile:specific --contract fhevmTemp/fhevm/gateway
mkdir -p abi
cp artifacts/fhevmTemp/fhevm/lib/TFHEExecutor.sol/TFHEExecutor.json abi/TFHEExecutor.json

PRIVATE_KEY_GATEWAY_DEPLOYER=$(grep PRIVATE_KEY_GATEWAY_DEPLOYER .env | cut -d '"' -f 2)
npx hardhat task:computePredeployAddress --private-key "$PRIVATE_KEY_GATEWAY_DEPLOYER"

npx hardhat compile:specific --contract contracts

npx hardhat task:computeACLAddress
npx hardhat task:computeTFHEExecutorAddress
npx hardhat task:computeKMSVerifierAddress
npx hardhat task:deployACL
npx hardhat task:deployTFHEExecutor
npx hardhat task:deployKMSVerifier

rm -rf fhevmTemp

npx hardhat task:launchFhevm --skip-get-coin true
jatZama commented 6 days ago

Please, send the full logs to help debugging. Did you first setup your .env file? Or at least did you do cp .env.example .env? Another recommended solution first, before launching a local fhevm node, is to try the mocked mode as well : pnpm test:mock.

furkandemireleng commented 2 days ago

Hi Jat Thanks for the response

my .env

export INFURA_API_KEY="key"
export MNEMONIC="dog huge boring street rookie possible cycle funny occur file present special anxiety law merge"
export PRIVATE_KEY_GATEWAY_DEPLOYER="717fd99986df414889fd8b51069d4f90a50af72e542c58ee065f5883779099c6"
export PRIVATE_KEY_GATEWAY_OWNER="717fd99986df414889fd8b51069d4f90a50af72e542c58ee065f5883779099c6"
export PRIVATE_KEY_GATEWAY_RELAYER="7ec931411ad75a7c201469a385d6f18a325d4923f9f213bd882bbea87e160b67"

# Block explorer API keys
# export ARBISCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
# export BSCSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export ETHERSCAN_API_KEY="key"
# export OPTIMISM_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
# export POLYGONSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
# export SNOWTRACE_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"

the pnpm test:mock returns


furkandemirel@Furkan-MacBook-Pro fhevm-hardhat-template % pnpm test:mock      

> @zama-ai/fhevm-hardhat-template@1.0.0 test:mock /Users/furkandemirel/test/zama/fhevm-hardhat-template
> hardhat test --network hardhat

Nothing to compile
No need to generate any newer typings.
Nothing to compile
No need to generate any newer typings.
Nothing to compile
No need to generate any newer typings.
Code of Mocked Pre-compile set at address: 0x000000000000000000000000000000000000005d
gatewayContractAddress written to gateway/.env.gateway successfully!
node_modules/fhevm/gateway/lib/PredeployAddress.sol file has been generated successfully.
ACL address 0x2Fb4341027eb1d2aD8B5D9708187df8633cAFA92 written successfully!
node_modules/fhevm/lib/ACLAddress.sol file generated successfully!
TFHE Executor address 0x05fD9B5EFE0a996095f42Ed7e77c390810CF660c written successfully!
node_modules/fhevm/lib/FHEVMCoprocessorAddress.sol file generated successfully!
KMS Verifier address 0x12B064FB845C1cc05e9493856a1D637a73e944bE written successfully!
node_modules/fhevm/lib/KMSVerifierAddress.sol file generated successfully!
ACL was deployed at address: 0x2Fb4341027eb1d2aD8B5D9708187df8633cAFA92
Error HH701: There are multiple artifacts for contract "TFHEExecutor", please use a fully qualified name.

Please replace TFHEExecutor for one of these options wherever you are trying to read its artifact:

fhevm/lib/TFHEExecutor.sol:TFHEExecutor
fhevmTemp/lib/TFHEExecutor.sol:TFHEExecutor

For more info go to https://hardhat.org/HH701 or run Hardhat with --show-stack-traces
 ELIFECYCLE  Command failed with exit code 1.
 ```
 
 I probably miss something but I don't know where. I am looking forward to your responses !
 Thanks
 
jatZama commented 2 days ago

What OS are you using? If you use Windows, you should use the WSL. Otherwise, are you sure you are using the last main branch? Please retry by pulling last current main branch in a new clean directory.