# Governance

The new Fabric chaincode lifecycle allows multiple organizations to come to an agreement on the parameters of a chaincode, such as the chaincode endorsement policy before it can be used to interact with the ledger.

### Rules

Rules are the skeleton of the whole system that defines how the business will function. Our system will be built based on the following ruleset.

* Every organization will run a single endorser and committing a peer node to validate transactions.
* Decisions on whether to allow a new member to join the system will be decided by voting.
* Which node will become admin will also be decided by voting.
* The decision that has more than 50% of the votes will be implemented.
* Rules will be enforced by the system admin.
* Orderer nodes must only be in odd numbers to establish the Raft mechanism.
* Data once pushed on the ledger will remain on the chain forever to make the data and system more reliable and sound.
* Any member found acting malicious must be forever removed from the system.

### Policies

Policies guide decisions in order to follow the rules of the system. Our system will have the following policies :

* Every organization has the right to participate to vote.
* Any member who is a part of a Private Data Collection should not leak the data to the non-member of the collection.
* Each product that is going to be processed into a different product must be accessible to any member.
* When shipping, the location must be updated.

### Roles

Roles dictate what a member can and should do or act within the system. Our system will consist of the following roles:

Admin:

* Will organize the voting system and act as the chairperson.
* Has read access to every channel and Private Data Collection.
* Will monitor and is responsible for the proper functioning of the system.

#### Chaincode roles

These are the roles which could be implemented in future versions of the chaincode.

| Operation             | Farm/Walmart roles       |
| --------------------- | ------------------------ |
| CreateProduct         | orgManager               |
| ShipProductTo         | orgManager               |
| GetProduct            | orgManager / orgEmployee |
| GetProductWithHistory | orgManager / orgEmployee |

### Questions & Answers

| Question                                         | Answer                                                                                                                                                                       |
| ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Who is allowed to join as a member?**          | Anyone who can become part of the system can join as long as the majority of admins allow.                                                                                   |
| **How are decisions made?**                      | Offline votings.                                                                                                                                                             |
| **What rules must members follow?**              | Channel policies.                                                                                                                                                            |
| **Who creates the rules?**                       | Any participant creates and after the voting in place, any proposal can become a rule.                                                                                       |
| **What are the different levels of membership?** | Now we have two levels, admin users and client users. Admins are like system administrations, they are allowed to register new users and check system functions and metrics. |
