[Ethereum] What does address(0) mean?


Referring to this link: https://theethereum.wiki/w/index.php/ERC20_Token_Standard

looking at the last contract. (Line 130)

function totalSupply() public constant returns (uint) {
    return _totalSupply  - balances[address(0)];

Why do we use balances[address(0)] here? Is that means we will get the sum of all values in the balances?

Best Answer

balances is a mapping of address to how many tokens that address owns.

balances[address(0)] then means how many tokens the address 0 (0x00000000...00) owns.

Although I don't like the practice, some ERC20 tokens consider tokens that are sent to address 0 to be "burned" and thus don't count them in the total. So _totalSupply - balances[address(0)] gives the total number of tokens minus those that have been "burned" by transferring them to address 0.

Related Topic