Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is '0x0' address in Solidity (Ethereum)?

I'm studying solidity programming, and I have a question on this line of code:

Transfer(0x0,msg.sender,tokens);

I don't understand what 0x0 means. Is it the new token address or is it the new smart contract's address?

like image 468
Harry Avatar asked May 29 '18 09:05

Harry


People also ask

What is 0x0 address?

0x0 is actually 0 but in hex. Usually we use 0x0 to check whether the address is not set by us and it is set to default value by the solidity which is 0x0. E.g. 0x0 in Solidity is short for 0x0000000000000000000000000000000000000000 , and if we use this as some address than it does have value greater than zero.

What is address 0 Return solidity?

When the to address is the zero-address, a new contract will be created by executing the code in data (this is what is meant by "code that returns the code"). The address of the newly created contract is technically known beforehand as it's based on the address of the sender and it's current nonce.

What is address in solidity?

In Ethereum and Solidity, an address if of 20 byte value size (160 bits or 40 hex characters). It corresponds to the last 20 bytes of the Keccak-256 hash of the public key. An address is always pre-fixed with 0x as it is represented in hexadecimal format (base 16 notation) (defined explicitly).

Do Ethereum addresses start with a zero or an O?

The 0x is necessary, because it lets the receiver know it's an address in hexadecimal format. Upvoted, yes 0x makes it clear that the address is hex.


1 Answers

0x0 is essentially a black hole of an address. Ether funds go in, none come out (kind of like a marriage!). It's an abbreviation for the genesis address 0x0000000000000000000000000000000000000000, which with almost absolute certainty nobody has the private key for, so it can't be spent. Note that tokens like ERC20 can be transferred OUT depending on the contract, but not Ether.

Amusingly/tragically a lot of people screw up and send money here by accident.

In your case, it looks like the contract is trying to send money to this address. Apparently, there's some use cases for this called "proof of burn" which I guess means that you can send ether? I don't quite understand that as it's literally taking Ether out of circulation.

Other cases can be for using it as a large amount for an address for comparison. Example is your_ETH_balance < 0x0 (Is probably TRUE).

Currently, 0x0 has 7251 ether (and growing since I started typing). Today's trading puts it worth about $4.2 million, so it'd be one of the more valuable addresses to crack if you happen to have a functional quantum computer (which you don't).

like image 95
pgSystemTester Avatar answered Dec 23 '22 23:12

pgSystemTester