| pragma solidity ^0.4.11; |
| contract Semi-PublicControl { |
| //Declare addresses for different roles. |
| address public CommanderAddress; address public EndorserAddress; |
| address public OrdererAddress; address public CommitterAddress; |
| //Commander node authority control and verification |
| modifier onlyCommander() { |
| require(msg.sender == commanderAddress);} |
| //Endorser node authority control and verification |
| modifier onlyEndorser() { |
| require(msg.sender == EndorserAddress);} |
| //Orderer node authority control and verification |
| modifier onlyOrderer() { |
| require(msg.sender == OrdererAddress);} |
| //Committer node authority control and verification |
| modifier onlyCommitter() { |
| require(msg.sender == CommitterAddress);} |
| //Permission node authority control and verification |
| modifier onlyPermission() { |
| require( |
| msg.sender == OrdererAddress||msg.sender == CommanderAddress||msg.sender == EndorserAddress||msg.sender == CommitterAddress);} |
| //Set up a new Commander, only the Commander has authority function setCommander(address_newcommander) external onlyCommander { |
| //Address cannot be null check |
| require(_newCommander != address(0)); |
| CommanderAddress = _newcommander;} |
| //Set up a new Endorser, only the Commander has authority function setEndorser(address_newEndorser) external onlyCommander { require(_newEndorser != address(0)); |
| EndorserAddress = _newEndorser;} |
| //Set up a new Orderer, only the Commander has authority function setOrderer (address_newOrderer) external onlyCommander { |
| require(_newOrderer != address(0)); |
| OrdererAddress = _newOrderer;} |
| //Set up a new Committer, only the Commander has authority function setCommitter (address_newCommitter) external onlyCommander { |
| require(_newCommitter != address(0)); |
| CommitterAddress = _newCommitter;} |
| //Permission node universal permission, only Permission node has permission function TODO (address_newCommitter) external onlyPermission { |
| //This method verifies the Permission node address before executing the code}} |