Truffle is giving > 24kB and out of gas errors, but Buidler is not. I have checked the number of characters in the 'deployedBytecode' of the JSON:

Buidler 33k characters (so 16.5kB) Truffle 55k characters (so 27.5kB)

I have the following compiler settings in both truffle config and buidler config:

compilers: {
    solc: {
      optimizer: {
        enabled: true,
        runs: 1
      version: "0.6.6",

What's going on? I'm about to hand my code over for a formal audit. Truffle suggests I need to refactor to reduce file size, but buidler says I don't need to bother. I don't want to have my code audited only to have to refactor it later and hand it over to be audited again.

If you wish to try for yourself, the repo is here. It is the RealityCards contract that is relevant.

  • The value of runs is 200 by default. The fact that you're configuring it to 1 could yield a significant difference. Other than that, please share you code so that others can give it a try. Commented May 9, 2020 at 8:19
  • I added a link to my repo. Surely the number of runs is irrelevant with respect to why they are different sizes, as long as both are set to the same? I increased to 200 and they have both increased in size a little bit. Truffle's remains ~50% larger. Pls try deleting the existing jsons and doing 'truffle compile' and 'npx buidler compile' and see the results yourself :) Commented May 9, 2020 at 8:31

1 Answer 1


It was because I was using the wrong syntax in truffle config and I did not have the optimiser enabled :)

Buidler config and Truffle config use different syntax for their solc settings.

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.