event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

What is the purpose of this line?


1 Answer 1


This line defines an event which can be emitted after something takes place. Clients can then listen for this event and react when it happens. http://solidity.readthedocs.io/en/develop/contracts.html#events

  • Is it necessary for the ownership of a contract to be transferred? Or is it just an extra functionality? Commented Mar 12, 2018 at 17:01
  • No.. smart contracts can't be edited once deployed. So its good to put it in there just in case. Commented Mar 12, 2018 at 20:08
  • But we can still change the owner address without the event. What do you mean? Commented Mar 13, 2018 at 0:39

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.