0

After reading a ton of solidity and ethereum documentation and following a course about writing ethereum contracts, a question has arised. This is:

When a contract is deployed to the blockchain, it seems it is stored in a block like any other transaction. The only difference is that it doesn't have a target address. This leads me to a question about the contract storage. I have seen a lot of contracts in the course I am following that have dynamic arrays at contract level. These arrays have a non fixed value (for example to store the number of addresses that have used the contract) but, when the contract is deployed, it becomes immutable. So, how can we have dynamic storage memory?

1

The contract code itself is immutable, but its storage is not.

The underlying logic about how each storage type is allocated in the physical level is rather complicated, but as I understand, the contract storage location and contract bytecode location are separate and don't overlap. Transactions can extend the used memory.

In the end, it's up to the node client implementations to decide how to store the storage in physical drives. I imagine that's also quite complicated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.