0

I'm using solc_version version 0.8.16, which i checked is installed, but when i'm trying to deploy the contract getting error Runtime error: code size to deposit exceeds maximum code size. While using truffle it works fine.

_compiled_contract = compile_files(
        contracts_to_compile, output_values=["abi", "bin"], optimize=True, optimize_runs=200, evm_version="byzantium", solc_version="0.8.16")

2 Answers 2

1

The maximum size of a contract is 24.576 kb. Make sure to check your contract size using this hardhat tool

There are multiple ways to reduce the size, find more details in this post

1
  • Thanks a lot man! I was using optimization but after going though you reply i realized i was doing blunder BCZ that increases the gas costs for running the functions Commented Sep 30, 2023 at 5:36
0

Use the optimizer when compiling your contract. This will try to remove any unnecessary code.

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.