December 2018
Intermediate to advanced
222 pages
6h 6m
English
Access restriction is a solidity security pattern. It only allows authorized parties to access certain functions. Due to the public nature of the blockchain, all data on the blockchain is visible to anyone. It is critical to declare your contract function, state with restricted access control, and provide security against unauthorized access to smart contract functionality.
pragma solidity ^0.4.24;contract Ownable { address owner; uint public initTime = now; constructor() public { owner = msg.sender; } //check if the caller is the owner of the contract modifier onlyOwner { require(msg.sender == owner,"Only Owner Allowed." ); _; } //change the owner of the contract //@param _newOwner the address of the new owner of the ...Read now
Unlock full access