0

When someone sends Ether, he/she use his private key matching address to sign the transaction. The private key not being part of the ledger, nobody can draw the fund of the account which sent money.

But how does this works for a smart contract since (as far I understand) a smart contract doesn’t have a private key ?

This not for asking how the CALL opcode works, but how internal transactions which sends Ether are handled in the ledger.

2
  • What I’m not even understanding is first : how the target contract address is chosen during the contract creation transaction’s ? Commented Jun 4, 2018 at 18:05
  • related Commented Jun 4, 2018 at 20:15

2 Answers 2

0

Every transaction that has ever occurred was first initiated externally from a regular or external account. If that transaction is to another external account, then the transaction is finished.

If that transaction is to a smart contract account, then further interactions (either sending ether and calling into other smart contracts) is possible.

The smart contracts themselves never initiate transactions. This is why it's so important to demand of the developers to publish their source code. The word "contract" implies that if you initiate a transaction from the outside, it will do exactly what you've told it to do.

0

The contract does not sign transactions. Remember that the execution of a contract is triggered by an externally owned account. That external account is who signs the transaction that will be executed by the contract, even when the contract calls another contract, this is just a part of the same transaction.

Hope this helps

3
  • So do you mean that when miner verify a specific contract balance, it needs to recompute previous transactions ? This is a similar question bitcoin.stackexchange.com/q/75899/64911 except it is for smart contract and not accounts. Commented Jun 4, 2018 at 20:11
  • No, I do not mean that. I do not know how your comment relates to the question that you posted initially.
    – Jaime
    Commented Jun 4, 2018 at 20:18
  • I just realize I need the source code that prevent double spending for a smart contract. Commented Jun 6, 2018 at 14:57

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.