0

Theoretical question: say I randomly managed to get a private key that provides a pubic key that hashes to and address that happens to be already in use for a contract instead of being an EOA.

Does this mean I would be able to sign transactions as if I was the owner of that address (contract)?

Maybe related to this: although I understand the cryptographic process behind the signature, I have not managed to figure if there is any kind of safeguard in the EVM blockchains that prevents an address with code in it (a contract) to initiate and sign a transaction. Does it only rely on the limitation (that is now being discussed due to account abstraction, see here) that there is no way for a contract to initiate the tx?

1

1 Answer 1

0

you are basically asking: did the Ethereum team validate for a possible bug of sending a Tx from a contract account? and the answer is , yes they did.

the function is called preCheck , here is the snippet:

    // Make sure the sender is an EOA
    if codeHash := st.state.GetCodeHash(st.msg.From()); codeHash != emptyCodeHash && codeHash != (common.Hash{}) {
        return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA,
            st.msg.From().Hex(), codeHash)
    }

if an entry in state database has a code the codeHash variable will be non-empty (meaning it is a contract)

https://github.com/ethereum/go-ethereum/blob/a35b654f25fdac518d5775b55aa064025040b01a/core/state_transition.go#L252

1
  • That was just my wondering. Thank you! Commented Jan 19, 2023 at 12:16

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.