# A Blockchain-Based Audit Trail Mechanism: Design and Implementation
## 3 Audit Trail Mechanism Architecture  
Audit trails are information records that catalog important events to provide supporting documentation and history useful for security and operational actions or for mitigating challenges, including details on the date, time, and user information associated with the event. They provide a baseline for audit or analysis when necessary (an error has been detected, risk management, etc.). The proposed mechanism is implemented through smart contracts backboned by a Blockchain network, to take advantage of the following inherent features of Blockchain:  
* Integrity: The information recorded in Blockchain cannot be manipulated. As the information is distributed across multiple nodes, it cannot be modified at all. In this way, fraud prevention and detection are almost unnecessary. * Authenticity: Blockchain provides an unalterable assurance of origin; thus, nonrepublation is guaranteed. * Long-term maintenance of audit information: Once information has been entered into the Blockchain, it can never be deleted; consequently, the audit trail will always be traceable. Figure 1 shows the architecture design of the proposed Blockchain-based audit trail mechanism. It consists of five main elements:  
* Blockchain network: A permissioned Blockchain network should be considered as the backbone. All information provided to the audit trail will be recorded in all the nodes of the Blockchain, ensuring its integrity, authenticity, and long-term maintenance. This means that both the auditing system functionality and the information registered in the system cannot be modified at all, making them totally reliable. \begin{table}
\begin{tabular}{c c} \hline \hline
**Requirement Name** & **Description** \\ \hline \multirow{2}{*}{
\begin{tabular}{c} Inalterability (integrity) \\ Long-term maintenance \\ Assurance of origin \\ \end{tabular} } & The audit trail mechanism should provide inalterable evidence of information needed for audit purposes. \\  & The audit trail mechanism must retain evidence of past information (history records). \\  & The origin of all data recorded in the audit system should be securely identifiable. \\  & The audit trail mechanism should be able to support simultaneous input/output interaction from different stakeholders. \\  & The audit trail mechanism must have a very high availability (close to 99\%). \\  & All incoming and outgoing communications must be encrypted. \\  & Data recorded in the audit trail mechanism should only be provided and/or consumed by authorized users. \\  & The audit trail mechanism must provide a graphical and user-friendly interface. \\  & The audit trail mechanism should be used in any kind of use-case, without limiting it to a particular environment. \\  & The audit trail mechanism must provide the possibility of accessing the recorded data and abstracting the Blockchain technology, thus enabling its mass adoption. \\  & The audit trail mechanism must provide an REST API to facilitate the input/output interaction of information sources. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Blockchain-based audit trail mechanism requirements. Smart contracts: The audit trail functionalities are implemented through smart contracts deployed on the Blockchain network. Like information, smart contracts are registered on all the nodes of the Blockchain, ensuring their integrity and secure execution. Auditing functionalities include the registration of necessary data to be audited on the Blockchain, as well as the consumption of this previously registered data for integrity validation. In addition, Blockchain-based events will be generated to feed the Blockchain monitor. * Blockchain client: Each component using the auditing functionalities backboned by Blockchain needs a Blockchain client to be able to interact with the Blockchain. This Blockchain client will be deployed as a docker image for usability and interoperability reasons. This Blockchain client exposes a REST API to be able to interact with it.