1 ether
is 10**18 wei
) which can be modified by sending transactions that include Ether.null
), 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 data 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 when executed.gas_price * gas
up front from the sending account. If some gas is left after the execution, it is refunded to the creator in the same way.msg.sender
and msg.value
do not change their values.selfdestruct
operation. The remaining Ether stored at that address is sent to a designated target and then the storage and code is removed from the state. Removing the contract in theory sounds like a good idea, but it is potentially dangerous, as if someone sends Ether to removed contracts, the Ether is forever lost.selfdestruct
, it is still part of the history of the blockchain and probably retained by most Ethereum nodes. So using selfdestruct
is not the same as deleting data from a hard disk.selfdestruct
, it can still perform that operation using delegatecall
or callcode
.