5

I have a thought about the smart contract. I would like to know when the smart contract sends a transaction (send ether to someone) did it sign the transaction if yes how it does? does it have a private key?

2 Answers 2

6

Every transaction starts with an Externally Owned Account, and it's signed by somebody.

As part of that transaction, a contract may call another contract, and some people call this an "internal transaction", but an "internal transaction" isn't really a transaction; It's part of the transaction started by an Externally Owned Account. It's more accurate to refer to it as a call. A single transaction, with a single signature, may include multiple contract-to-contract calls.

A call doesn't need to be signed. The called contract automatically has access to the identity of the calling contract in a variable called msg.sender, so if it needs to make authentication checks it usually looks at that.

2

Smart Contracts dont need to sign the transaction. You sign your transaction and then the contract is executed. Other nodes that recieve this transaction can validate the smart contract's action by simply running the code.

The Smart Contract is just a set of rules. When writing the smart contract you need to make sure these rules are written correctly, so that the contract only sends Ether to someone if you want it to do that.

2
  • in the blockchain there is no unsigned transactions so there is a need. if in the contract we have send(X ether) so who signed this tx?
    – Sig Touri
    Commented Jan 10, 2017 at 0:01
  • @SigTouri That transfers value and potentially calls code, but it doesn't create a transaction - all the interactions happen inside the current transaction. Commented Jan 10, 2017 at 11:09

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.