5

I was reading the solidity docs and I don't quite understand what the zero-account is.

They say: "If the target account is the zero-account (the account with the address 0), the transaction creates a new contract. As already mentioned, the address of that contract is not the zero address but an address derived from the sender and its number of transactions sent (the “nonce”). "

Does anyone have a different explanation?


From Introduction to Smart Contracts - Transactions:

Transactions

A transaction is a message that is sent from one account to another account (which might be the same or the special zero-account, see below). It can include binary data (its payload) and Ether.

If the target account contains code, that code is executed and the payload is provided as input data.

If the target account is the zero-account (the account with the address 0), the transaction creates a new contract. As already mentioned, the address of that contract is not the zero address but an address derived from the sender and its number of transactions sent (the “nonce”). The payload of such a contract creation transaction is taken to be EVM bytecode and executed. The output of this execution is permanently stored as the code of the contract. This means that in order to create a contract, you do not send the actual code of the contract, but in fact code that returns that code.

3 Answers 3

3

The "zero account" is really just the fake account associated with the address 0x00000...

Sending funds there doesn't actually transfer them to the account; instead, the miners interpret this as an instruction to create a new smart contract.

3

Section 4.2 : The Transaction from the Ethereum Yellow Paper (p4-5) defines the "zero-address / zero-account" as an:

RLP empty byte sequence.

So it Ethereum or Solidity, it looks like:

0x0000000000000000000000000000000000000000    // "zero-address" = 20 bytes of '00'

As described below, there is a conditional check to see if the transaction intend to transfer funds or create a new contract:

  • If it's a 20-byte address hash, then it is a transfer of ethers.
  • If it's an RLP empty byte sequence, then it is a contract creation.

Zero address from the Ethereum Yellow Paper

1
  • A good overall answer, particularly citing the Yellow Paper... unfortunately, the part you didn't cite (the RLP of an empty byte array), is wrong :D. Should be 0x80, not 0x0. Jul 26, 2021 at 16:16
2

Paraphrase:

If the transaction does not supply a target address (ie it instead sends zeroes where the address would go), the transaction creates a new contract. As already mentioned, the address of that contract is an address derived from the sender and its number of transactions sent (the “nonce”). "

1
  • ` (ie it instead sends zeroes where the address would go)` is surprisingly clarifying. I was getting mixed up between address 0 and transaction output 0 in bitcoins Mar 25, 2017 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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