August 2019
Intermediate to advanced
486 pages
13h 52m
English
As the name suggests, the access restriction design pattern restricts access to the functions of the contract based on roles. The Ethereum blockchain is public and all the addresses and transaction data is public to everyone. However, we can define the contract state variables as private; doing this it only restricts reading the state variable from the contract. Still, anyone can follow the transactions and can find the values of the private state variables present in the contract. To allow anyone to call a function present in the contract, it should be defined as public or external. However, when you need restricted access to a function, you should use modifiers to check for the access rights.
In the following ...