This is a question that I am asked often by developers who assume that a contract has a private key of its own to sign any transactions that it makes.

up vote 31 down vote accepted

Contracts do not possess private keys in the same way that your ether wallet does. Instead, they have programming code written in the language of the Ethereum Virtual Machine.

To determine what a contract "does", all members of the Ethereum network simply run the relevant portion of code every time a transaction or other contract uses the contract's function. Because the code and EVM are carefully defined, everyone will always agree on what the outcome of the operation was. This includes whether or not the contract sent a transaction to any other contract. Because everyone can agree on the origin of the message, no further degree of verification (such as that provided by a signature) is necessary.

  • 1
    The above answer is contradictory to this answer for a similar question. What's the deal? This linked answer seems to imply that a contract's public address has a private key in the sense that it's part of a cryptographic key-pair. And if the private key were somehow discovered/cracked, the contract's funds could be extracted. Can someone please explain? – Jonathan Tran Nov 13 '17 at 22:25

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.