Ethereum Transactions – Understanding Size Limits

blocksfeesgasgas-limittransactions

Is there a theoretical limit for transaction data size when you send a transaction to Ethereum network?

Ref.

Is there a (theoretical) limit for amount of data that a contract can store?

Best Answer

Wow this is such an interesting question! TL;DR: the transaction size limit, at the time of writing, is about 780kB (about 3 million gas). But read on.


There is no direct or fixed limit, neither for transaction sizes nor for block sizes. This is a strength of the Ethereum network, it does scale.

That does not mean that there are no limits. There is the block gas limit of currently 3,141,592 gas which can be spent maximum per block.

That means, in theory, you could create a single transaction which consumes all the gas of a single block.

Let's try to send 256kB random data with a contract:

trx with 256kb random data

That would consume almost 9 million gas, which is not available currently. Mist tries to create the transaction but it will be invalid.

Let's try to create something close to the gas limit, 44,444 random bytes:

44k random bytes

That transaction went through, here is an explorer link. Hash:

I0207 11:47:14.558908 eth/api.go:946] Tx(0x25e54394ab4e5f17d6e1240c02c1a6c4bb675ef9471f1105b006988f5fe5aec1) to: 0xfcae7970392f510a985a7eaccd3820b7759d65d9
  • Value: 60 Finney (0.06 Ether)
  • Gas: 3131800
  • Gas Price: 50 Gwei (0.00000005 Ether)
  • Gas Used By Transaction: 3031800
  • Actual Transaction Cost: 151.59 Finney (0.15159 Ether)
  • Cumulative Gas Used: 3031800

So, I just added 44kB to the blockchain in block 967163.

And now, the scaling magic of Ethereum starts to kick in. In block 967164, the network reacts to the high gas consumption and increases the block gas limit to 3,142,967!

gas limit increased

So, if there is a continuous request in high gas consumption, the gas limit can be increased by plus/minus 1/1024, which is around 0.09%. See yellow paper equations 40-42.

In short, limit: yes, at the time of writing about 780kB for a tx full of zero bytes, or 46kB for a tx full of non-zero bytes. Fixed limits (like in Bitcoin): no.

Related Topic