3

I found that

  1. From ethereum yellow whitepaper

Transaction contains fields:

  • nonce
  • gasPrice
  • gasLimit
  • to
  • value
  • v, r, s
  • init (contains "smart contract creation code" that should return "smart contract runtime code") OR data (arguments to call smart contract, typically "solidity function name hash" and "function arguments")

also

There are a number of intrinsic parameters used when creating an account: ........, the salt for new account’s address (ζ) .....

The salt ζ might be missing (ζ = ∅); ......

If the creation was caused by CREATE2, then ζ = ∅.

  1. The "smart contract initialization code" should
  • copy code to memory
  • using the RETURN(start_offset_of_memory, end_offset) return the "runtime code"

enter image description here


It seems like if I provide the "salt" (of course together with "init" and all other fields except of "data") field in transaction issued from EOA it will create smart contract with deterministic address (just like CREATE2 opcode does)

But there is no such field "salt" for transaction, and I see that everyone create smart with deterministic address using "ProxyFactory smart contract" (OpenZeppelin 1 and 2 or here the Deployer smart contract)

It seems like:

  • IF EOA creates smart contract from transaction - smart contract will be created using CREATE approach implicitly
  • IF smart contract creates smart contract - it can be created using CREATE or CREATE2 opcodes

Question: is it possible / why it's not possible to create smart contract with deterministic address from transaction itself without using ProxyFactory approach?

7

1 Answer 1

3

Tnx to Paul Razvan Berg

This is by design, that's what I wanted to hear

So when people like here https://ethereum.stackexchange.com/a/761/82396 say

For contract created by CREATE2 its address will be:

keccak256( 0xff ++ senderAddress ++ salt ++ keccak256(init_code))[12:]

Note that senderAddress can be either an externally-owned account (EOA) or a contract.

I will know that no, it cannot be EOA, because senterAddress is a address of factory

enter image description here

3
  • 1
    Thanks again for bringing my attention to this. I'm always happy to learn and also be corrected when I make a mistake; the linked one wasn't mine as we see from its revision history :)
    – eth
    Commented Oct 1, 2021 at 5:14
  • 1
    Funnily enough it was I who added that note about senderAddress. Wow. Hoisted by my own petard. Commented Oct 1, 2021 at 11:13
  • 1
    @PaulRazvanBerg We appreciate all your contributions to this site! :) Interesting petard phrase too!
    – eth
    Commented Oct 11, 2021 at 0:28

Your Answer

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

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