Send a transaction from Zero Address
Asked Answered
V

1

6

I am writing and testing a smart contract. Using web3, I could not send a transaction from a Zero Address (0x0). I was wondering if it is ever possible to sign and send a transaction using the zero address. In effect the msg.sender in the function should be the zero address.

In other words, can this require statement any time return true ?

require(msg.sender == address(0))

From what I understand:

  1. A contract A cannot call another contract B's function using a zero address. The msg.sender in contract B's function will always be contract A's sender.
  2. It is not possible to generate a zero address as one of the addresses in an ethereum wallet. It will also be impossible to figure out the private key associated with the zero address.

Is there something wrong with my understandings or something that I am missing ?

Thanks in advance for your help.

Van answered 26/10, 2021 at 4:9 Comment(0)
R
11

I was wondering if it is ever possible to sign and send a transaction using the zero address.

Only if you hold the private key controlling the zero address. Which is currently probably unknown, maybe even non-existing. As you can see, there are currently no sent transactions from this address.

require(msg.sender == address(0))

This statement has about the same value as checking require(block.timestamp == 0). Which, if the EVM works correctly, will never happen.

I can't speak for the author's intentions - maybe they confused msg.sender with the fact that it's common practice to emit the Transfer() event with the first argument having the 0x0 address (usually used for minting tokens, which looks like if they were sent from the 0x0 address).


Note: Until 2017, it was possible to send a specifically signed transaction (without the correct private key) that resulted in the msg.sender having the null sender address 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF. This was fixed in the EIP-86, you can find more details in this article.

Rigidify answered 26/10, 2021 at 8:43 Comment(1)
hmm! 33 million dollars as of now, it is worth building a quantum computer and run a scanner to find out if such private key (for address(0)) existsDarkling

© 2022 - 2024 — McMap. All rights reserved.