Is there a limit for transaction size?

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?

2 Answers

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:

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:

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!

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.

• Update: in Homestead, the block gasLimit is now 4,712,388 (1.5 times PI million) and gas price is 20 GWei. (Methodology above can still be used.)
– eth
Jul 1, 2016 at 19:21
• I may have missed this, but how does 89kB == 3 million gas? Jul 26, 2016 at 14:26
• Uhm, it's not. Well spotted. It's probably around 40kB. Someone please redo the math, 3 million gas is also outdated. :-)
– q9f
Jul 26, 2016 at 14:46
• You was actually sending 44,444 random bytes. Because you had 178 zero bytes inside, intrinsic gas was 21,000 + (178 * 4) + (44,266 * 68) = 3,031,800. Gas limit is variable (now for example is 500k because of the recent attack to the network) so I think it is not worth to update that value in the answer. Oct 18, 2016 at 3:43
• With this last answer, I'm a bit confused. Is the gasLimit still equal to 3 141 388 gas , or is updated to 4,712,388? Thanks Jan 31, 2017 at 18:51

As of 12/08/2017, the gas limit as detailed on EthStats.net is 6,700,314.

The gas limit was 'stuck' at 4.7 million. It was recommended that miners change their settings such that the gas limit could be raised.

As outlined in this article, this happened.

Each hexadecimal character is 4 bits. 2 characters is a byte.

The yellow paper outlines the fees for various operations.

Using similar calculations to those used by 5hcdn/Giuseppe Bertone we can now see that a transaction could (in principle) hold ****

(6,700,314 - 21,000) / 68 = 98,225 (rounded down) non-zero bytes.

Now.. the data provided by EthGasStation allows us to see that we could have a transaction mined with a gas price as low as 0.5 Gwei.

``````6,700,314 * 0.5 = 3,350,157 Gwei = 0.003350157 Ether.
``````

A more standard 20 Gwei gas price would yield:

``````6,700,314 * 20 = 40,201,884 Gwei = 0.040201884 Ether.
``````

At a current ETH price of around \$315 it would cost between \$1.05 and \$12.66 to submit that much data to the block chain.

• "As of 12/08/2017" Are you from the future? Aug 20, 2017 at 20:33
• Nope. I am British ;) Aug 20, 2017 at 20:44