2

As I understand it, you can instantiate a contract at any valid address that hasn't yet received ether, by sending a transaction, which contains the contract code as the data payload, to that address. Is this correct?

I was wondering what would happen if I directed my client to generate an address and then sent a contract to that address before loading the new wallet with ether, and then subsequently sent ether to the address. Is there something with the nonce that prevents what I am describing?

0

First question is incorrect. To create a contract, you send a transaction to an empty address (to:""), and then the contract's address is determined by How is the address of an Ethereum contract computed? It is also possible to send ether to the contract's address before it is created: the ether would be locked as explained in the next question.

For the second question, it's just as if the contract had already been created and you sent ether to the contract. The ether is locked in the contract unless it had rules for it's release, like a selfdestruct back to your address.

This may also be of interest: What if I had the private key that had the public address of a contract?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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