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?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityIs 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?
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
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.
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.