I have been developing my contracts using the truffle framework. Everything has been fine, but now when running tests for one of my contracts I am getting the error The contract code couldn't be stored, please check your gas amount. I'd like to reference EIP-170 as I haven't seen other questions regarding this error reference it. https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md

There is in fact a hard limit on the size of contracts. How can I determine if my contract exceeds the size set forth in EIP 170, if it is a problem with truffle, or if it is a problem with my code.

1 Answer 1


You can query the size of your contracts in bytes with:

grep \"bytecode\" build/contracts/* | awk '{print $1 " " length($3)/2}'

According to EIP 170 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md) if contract bytecode is bigger than 24576 bytes (0x6000 bytes), contract creation fails with an out of gas error.

See also https://github.com/trufflesuite/ganache/issues/960.

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.