0

When an agent deploy a smart contract, how blockchain accepts this smart contract and sends an address of smart contract to agent.

1-How the blockchain accepts this smart contract? 2-who accepts the smart contract in blockchain ? 3-which generates the address of the smart contract?

2

The contract-deployment is a transaction, the same as any other transaction (whether it's a funds-transfer transaction or a function-call transaction).

The address of the deployed contract is a hash of the address of the deployer's account and the nonce used for the deployment transaction, which guarantees uniqueness.

  • i.e every deployment of the smart contract, there is a new address of the smart contract? but when I read in the articles, some authors said that when an agent deploy a smart contract, he must have an address of the smart contract then he must disseminate it to all users in order to make others transactions with this address. Please correct me if it's wrong. – amira May 26 at 10:07
  • 1
    @amira: This agent doesn't need to specify that address when deploying the contract, because this address will be made from the agent's address and the agent's nonce (more precisely, the hash of the concatenation of the address and the nonce). The agent can post this address immediately after deploying the contract, so that everyone who wants to send transactions to the contract will be able to do so. – goodvibration May 26 at 10:12
  • so, the smart contract will be deployed once by the agent and other users can use this address when they have to send a transaction to the smart contract. That is right? – amira May 26 at 10:19
  • 1
    @amira: Yes, that is correct (though for clarity of your statement, I'd put a comma between "the agent" and "and other users"). – goodvibration May 26 at 10:21
0

Deploying a smart contract is posting a transaction with data to the network, so the miner sealing the next block will accept the transaction if it is valid and with sufficient gas. The address of the contract is generated from the address of the sender and the nonce of the transaction

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.