While creating contract, I am getting the error "oversized data" during contract creation.

Other than modifying the go-ethereum code file to increase the maxCodeSize, or splitting the contracts up, are there any other workarounds?

Why should there be a contract code size limit in a private blockchain in the first place?

  • You can try enabling optimization in the solidity compiler.
    – Ismael
    Aug 9, 2018 at 0:43

3 Answers 3


I fixed this issue by increasing the transaction size to 64KB in tx_pool.go

DOS is less applicable for private Ethereum networks such as Quorum.

// Heuristic limit, reject transactions over 32KB to prevent DOS attacks

// UPDATED to 64KB to support the deployment of bigger contract due to the pressing need for sophisticated/complex contract in financial/capital markets - Nathan Aw

if tx.Size() > 64*1024 {
    return ErrOversizedData




GoQuorum allows to configure the contract dize limit by using maxCodeSize and maxCodeSizeConfig arguments in the genesis file (the latter allows to configure by block). More information on https://docs.goquorum.consensys.net/en/stable/HowTo/Configure/GenesisOptions/#contract-code-size.

Those values can be configured between 24kb and 128kb.

  • I asked this 2 years back. Thanks anyway.
    – Nathan Aw
    Jul 23, 2021 at 10:14

Increasing this limit to check tx.Size does help, but it won't get you far as there are two more limits for large transactions:

  • There is a limit for RPC calls, it's in rpc/http.go:
maxRequestContentLength = 1024 * 128
  • There is a maximum size for contract code, which is particularly relevant when you are deploying contracts. It is called MaxCodeSize and it is configured in params/protocol_params.go:
MaxCodeSize = 24576

Altogether, the whole thing is calibrated to set the limit around 8 mill units of gas. To go well over that limit you can fork quorum and change all four things: max block gas, value in tx.Size check, maxRequestContentLength for RPC calls, and MaxCodeSize

I forked and patched a quorum version at https://github.com/juliofaura/quorum/tree/largertxs that should do the trick. I deployed a large contract that took a good 35 mill units of gas, and all good ;-)

Also - pantheon is built with a 16 Mb transaction size limit, which essentially fixes all this

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.