If I have a Blockchain which consists of few smart contracts. Let's say that the Blockchain consists of 2000 blocks. When a new block is added to the Blockchain then does the smart contract runs on all 2000 + 1 blocks or only the last one?
-
2Are you talking about Ethereum?– meshcolliderJan 3, 2018 at 20:18
-
I am more of talking about in general concept of smart contracts.– john doeJan 3, 2018 at 21:18
-
There is no such thing as general concept of smart contract. Every system has its own definition, and most of them aren't things you'd ordinarily call a contract. You'll have to specify what system you're talking about.– Pieter WuilleJan 3, 2018 at 23:02
-
I believe a general concept of smart contracts is equal to a programmable blockchain. Saying there is no general concept is like saying there is no general concept to cereal. A lot of different types... but we all know what cereal is.– Marc AlexanderJan 4, 2018 at 4:56
-
Still my answer to this question would be pretty much the opposite for Bitcoin and for Ethereum. I think that's enough to say that for the purpose of this question, there really is no established common ground.– Pieter WuilleJan 4, 2018 at 6:36
1 Answer
It would be running on the blockchain.. which is a chain of blocks. So really its running on the whole blockchain network regardless of how many blocks there are.
Although the smart contract never existed until the block which you deployed the smart contract on. For example you deployed a smart contract at block 1500 and right now its block 2000. If someone forked that blockchain at block 1499 your smart contract would never exist. But if they forked at block 1500 then your smart contract would exist on the new forked blockchain (look up the Ethereum classic fork. I hope this clears it up for you.