Disclaimer: this is a rather long question.
To my understanding, contract address and wallet address are two profoundly different concepts, with the only thing in common being the fact that they are both given as the hexadecimal representation of a 160-bit number.
The difference is described below:
When a contract is deployed, it is allocated at a unique address, i.e., no other contract on the chain can be allocated on that address.
Moreover, suppose that the contract holds state (global) variables with a total size of X bytes (including whatever padding added by the Solidity compiler).
The next time a contract is deployed to the chain, it will necessarily be allocated at the address of the previous contract + X, or higher.
So every contract occupies "real" memory.
A wallet address, on the other hand, is "flat".
It does not store any data, so two wallets can technically have two consecutive addresses.
So while the state variables of a contract are allocated "right after" the address of the contract, the money that a wallet holds is not allocated "right after" the address of the wallet, and in fact - is not allocated at all.
Instead, the money that a wallet holds is ascribed to the wallet address in one or more ERC20 contracts.
For example, suppose I have a wallet with 20 CoffeeCoins at address 0x1234...
.
Then it means that there is some ERC20 contract deployed on the chain, which stores this information:
contract CoffeeCoin is ERC20Basic {
mapping(address => uint256) balances;
...
}
And in that contract, balances[0x1234...] = 20
.
A minor implication of the difference described above:
Some wallet address out there can be equal to some contract address out there.
I believe that in the case of block-chain, the word address is probably more suitable to be used alongside contract rather than alongside wallet (while using it for both creates this confusion to begin with).
A wallet address is in fact nothing more than a public key.
Am I correct in each one of the claims made above?
Is my understanding of the difference between contract address and wallet address correct?
I will be happy to get any constructive comment.
Thank you.