## 4 Building the Reputation System
### Action Phase  
The action part of the reputation system in each node has the purpose of punishing black-hole nodes. The metrics used to check the reputation system's performance were the delivery ratio for good nodes, the false-positive ratio for good nodes, and the detection ratio for good nodes. For the action phase, the type of punishment selected and the time when nodes should start to apply the punishment are relevant. Considering the detection scheme chosen, if punishment is applied too soon, nodes might not have time to reach the false-positive ratio of 0%. By this, good nodes will be incorrectly penalized. On the other hand, if punishment is applied too late, it might not affect the nodes exchanges enough to change the delivery ratio of good nodes significantly. For punishment, three main and independent schemes were considered: An action related to creating messages, an action regarding the connection between nodes, and an action associated with deleting messages. Hereafter, they will be referred to as the Creation, Disconnect, and Delete action, defined as:  
* Creation Action: Nodes do not create messages for nodes that they have in the black-hole node list. * Disconnect Action: When a node is within range of another node that is in the black-hole node list, no connection is established, and no messages are exchanged. * Delete Action: All messages from nodes in the black-hole list are deleted from buffers. These were the main actions taken to punish the black-hole nodes. As one should not assume which scheme will perform better or even if all actions together provide a better result, all possible combinations of actions were tested. To decide when to start applying the punishments, the results from the detection scheme were observed. Prophet reaches a false-positive ratio of 0% around the fourth hour of the simulation. For this reason and evaluation purposes, it was decided to test the actions scheme starting at the beginning, and at the second, fourth, and eighth hour of the simulation. The simulations use the defined settings in Table 2. In the first instance, for selecting the best options for the action scheme, only the metric of the delivery ratio for good nodes is evaluated. A case called \"No Action\" is used, representing the delivery ratio for good nodes if no action was taken to punish the black-hole nodes. From the results, the three action schemes with the best performance were chosen to be analyzed in more depth, and the corresponding results are presented in Figure 7 with 95% confidence intervals. As the most important part of a detection scheme is to increase the number of messages exchanged between good nodes, they should have a better delivery ratio for good nodes. The action scheme that provides the highest delivery ratio for good nodes more times is the 4H-Disconnect + Delete. However, this cannot be the only indicator to choose an action  
Figure 6: False-positive and detection ratio for Prophet with 20% malicious nodes for the Exchange Good Nodes Tables Detection Scheme 97. which is a very good result. However, now, the false-positive ratio decreases much faster as good nodes classifications are exchanged. The false-positive ratio was 0% as early as the fourth hour of the simulation, while in the Independent Detection Scheme, it had not reached 0% after 24 h of simulation. scheme, as it is still necessary to observe the action scheme's impact on detecting nodes. It is expected that changes for either metric will only start appearing once the action scheme starts. If a false-positive ratio for good nodes of 0% is reached before the action phase starts, the action scheme should not have an impact on the false-positive ratio for the good nodes metric, whereas if it is not reached, the false-positive ratio will be higher than if no action was taken. This is mostly because, in any of the three action schemes, the Disconnect action prevents nodes from exchanging messages with nodes that they consider bad, making the detection process more difficult.