参考文章:
https://me.tryblockchain.org/blockchain-solidity-event.html
感谢博主的分享!
我对event的理解就是相当于 console.log 和 printf 一样
测试代码
pragma solidity ^0.4.22; contract Coursetro { string fName; uint age; event Instructor( string name, uint age); function setInstructor(string _fName, uint _age) public { fName = _fName; age = _age; emit Instructor(_fName, _age); } function getInstructor() view public returns (string, uint) { return (fName, age); } }
输出结果