When I am trying to deploy my smart contract(It is a 600+ lines smart contract)through truffle framework (version 4.1.14) on Rinkeby testnet it is showing the above error.But when I am deploying the same contract with remix ide and using metal mask then it is deployed successfully. I know that the code size limit of 32KB is in ethereum-go implementation to avoid DOS attack.So if anyone can answer why the contract is getting deployed with remix but not with truffle. Here is the link on rinkbey testnet https://rinkeby.etherscan.io/tx/0xe42b8fa9a7aab732a633465a84e8a56433eb482e0cb5aa49ed38f5428dfc82a4

2 Answers 2


My guess would be that you have optimisation turned on in remix, but not in Truffle. This would mean that under remix the code size is small enough to deploy, but not under Truffle.

You can add something like: solc: { optimizer: { enabled: true, runs: 200, }, } to truffle.js to turn on optimisation. There is switch under settings in remix that does the same thing.

  • I enabled the optimizer but the error is still the same. “error ”oversized data".
    – Shadab
    Oct 1, 2018 at 5:58
  • I'd need to see the code then to try and work out what was going on.
    – Adam Dossa
    Oct 1, 2018 at 9:05
  • Sorry . I cannot post the smart contract codes .company policies. Now I am changing the ethereum-go implementation codes. Increasing the tx.Size value to 128Kb. Here is the question related to this I asked.ethereum.stackexchange.com/questions/59778/…
    – Shadab
    Oct 1, 2018 at 11:05
  • I have updated the tx.Size value to 128KB.For this, I cloned the official go-ethereum repository and then used make geth command.and after all this run two nodes and tried deploying the smart contract but still same error over sized data.Is it because I wasn't able to use the geth implementaion correctly according to change in tx_pool.go file?
    – Shadab
    Oct 1, 2018 at 13:22
  • Can you deploy to ganache? Ganache enforces the same 32Kb limit, but can be overriden using: ganache-cli --allowUnlimitedContractSize So if it works with this flag, and doesn't work without the flag, you at least know it is def. related to this issue.
    – Adam Dossa
    Oct 1, 2018 at 15:06

The solution for this error was just to split the bigger smart contracts into smaller ones and use inheritance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.