# Who pays the expenses of running all contract codes again and again?

As far as I understand, each new node that downloads the blockchain must run all code in all contracts from the beginning until the present time (is this correct?).

This means that a contract in an early block has to be executed many times, by every new node.

However, the contract caller only paid the cost (in gas) once - the first time he sent the function call.

Isn't there an economic problem here? A person pays only once, but his actions create an unbounded cost for society?

You are correct that the contract caller pays only once. You are also correct in that the community costs, in theory, is unbounded. In practice, however, the cost is bounded.

One way that the cost can be bounded is if not everyone runs all contract code. What matters for fiat currency is the collective decision about what is truth. For example, suppose there was a glitch ten years ago in a banking program that resulted in you having an extra \$1 in your bank account right now. Since we have collective trust (I'm referring to society, not necessarily the people who might frequent this stack exchange) in the banking system, if the bank says you have \$101, then that, in practice is what you have. So if we can get a consensus of what most people think is the current state of the Ethereum blockchain at, say, block 5000000 is (maybe a digitally signed version of the chain from some authoritative source is available for download), then there is no need to verify what happened before that point (in fact, the only purpose that serves is to uncover if there's been a mistake, but good luck getting everyone to switch to a new chain after that)!

Another way in which the cost might be bounded is that there are A) a finite number of people on the planet with a population growing more slowly than computations per unit energy is decreasing and B) we can assume that a person will only want to verify the entire blockchain from the start a fixed number of times in their lifetime. Suppose (for simplicity of calculation) that there are exactly 10 billion people alive on earth at any given time and that they each verify the blockchain once per year and that the earth exists in perpetuity. We can see that in the first year, it takes a total of X joules of energy for everyone to validate the first ever transaction on the Ethereum blockchain. In year two, it'll take X/k. Then in year three, it'll take X/(k^2), etc. Factoring out the X, we see that we have a simple sum of an infinite geometric series. At least until we can't figure out how to make computers more efficient... But until then, the geometric series must converge! And since it converges, we see that we can, in fact, amortize the cost of the computations such that a single, finite, price would cover all future verifiers' costs! (However, as you mentioned, these people are not paid to verify the blockchain)

Yes, each node that wants to download and verify the entire blockchain with 100% certainty must run the code for every contract function call again.

This is why the protocol supports 'light clients', enabling you to run a high-security node without downloading everything.