1

I have few questions on this:

If the target account is not set (the transaction does not have a recipient or the recipient is set to null), the transaction creates a new contract

I understand that contract is basically a set of instructions. So can a transaction create a contract if there is no code provided? Is it even possible to have a txn with neither any code nor the target account?

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”).

What does 'number of transactions' mean here? When we are creating a new contract, its basically a single txn. isn't? Moreover I understand 'nonce' in context of mining, what does it mean here?

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.

How does it actually work? Or is it that as developer I just use 'deploy' facility and internally system does this magic, like creating 'code that returns that code when executed'?

1 Answer 1

1

If you try to send funds to a null address, Ethereum does not send it to burn address or a null address, instead it mints a new smart contract and send there.

In your first question, you are using a function called transfer if you are transferring a token from your account. It would be mentioned in your token's smart contract via an function or an interface.

In your second question, It is defining that on what basis the smart contract address is generated. It is generated based upon your address+ the nonce(number of transactions) as it would be a unique combination. It is written "number of transactions sent (the “nonce”)" It is total number of transactions send by the user till now.

In your third question, as we are not passing any code to the smart contract, the smart contract made would contain the code which would ran from the smart contract which originated the transaction. For example if you are sending 1 DAI to null address, transfer function of DAI contract would run and smart contract which would be minted would contain the transfer function of DAI contract.

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.