2

In the following example from the Solidity documentation, what does emit do?

highestBidder = msg.sender;
highestBid = msg.value;
emit HighestBidIncreased(msg.sender, msg.value);
1
  • It means "when this transaction is written into the blockchain, write alongside it a HighestBidIncreased event with the current values of msg.sender and msg.value". – goodvibration Oct 28 '19 at 15:19
2

Emit keyword is used to emit an event in solidity, which can be read by the client in Dapp.

Event in solidity is to used to log the transactions happening in the blockchain.

Reference: https://solidity.readthedocs.io/en/v0.4.24/contracts.html#events

1
  • 1
    yes, thank you. – Lee Oct 30 '19 at 10:00

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.