How many contract can be stored in One block in blockchain ? What happen if sub class call the super class , if super class is already deployed and sub class contract is just deployed ?
2 Answers
Answer the first part of your Question: It depends on how big the contracts are in gas. Each block have a limited but flexible max gas-size.
-
1Can You please elaborate it . "It depends on how big the contracts are in gas. Each block have a limited but flexible max gas-size." Commented Jul 11, 2017 at 5:34
-
Sure. Each block can be a certain size (measured in gas), and to deploy a contract cost gas. A complex contract cost more gas than a simple contract, so if a block can fit 7million gas, it can fit three 2m gas contracts or seven 1m gas contracts. Commented Jul 11, 2017 at 10:52
How many contracts can be stored in One block?
The number of contract stored in one block means number of transaction stored in one block, so it mainly depends upon the following factors:
- Transaction gas (TG): Transaction gas (gas limit) is gas required to execute the transaction in the ethereum network.
- Block Gas limit(BGL): Block gas limits is the maximum amount of cumulative transaction gas allowed in each block.
Total number of transaction include in block is ratio of BGL to TG.
What happen if sub class call the super class , if super class is already deployed and sub class contract is just deployed ?
Previous state of the super class (as refered to OOP) is in the previous block where it was included. Now when we deploy new sub class (as refered to OOP) of the contract then both contract are treated as seperately and are in different contract address.
Please note that we cannot deploy inhereated contract later which can inherit super contract. Both contract mantain state seperately.
The state of the contract is maintained in that particular block where the transaction is included.