# Trusted Electronic Contract for Enabling Peer-to-Peer HPC Resource Sharing
## 3 Proposed Design
### Smart Contract Design and Communication Flow
These values are very small compared to the duration that a typical job normally takes to change its states which could take from seconds (e.g., job crashed: RUN \(\rightarrow\) END) to weeks (e.g., job wait in the long-running queue: QUEUE \(\rightarrow\) RUN). In addition, the amount of resources (e.g., CPU, memory) needed in the execution is very small and insignificant compared to the capability of HPC’s frontend. The script also uses only memory for keeping track of state data, no read/write to the storage. Therefore, the inclusion of the module in the HPC systems will not impact the overall performance and system workload or interrupt the core operational process of HPC. ### Security Analysis

1. _Access Control on Blockchain Network Resources_

Two permission layers were configured to enhance security on the blockchain. The first was an access control list (ACL) which defined permission on network resources (i.e., submit transactions, perform system activities, subscribe to event hub). Another permission layer was defined within the smart contract's functions to ensure that only legitimate entities are allowed to make a request. Using attribute-based access control

\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Network** & \multicolumn{3}

(ABAC), the identity of the transaction actor is checked if he/she is authorized to execute the requested operations. To test if the policy can enforce security control on network resources, we created a set of entities with different roles. By switching between roles and attempting to submit transactions of both invoke and query types, results showed that entities that do not acquire grant permission will receive a rejection response, which is displayed as follows. **Error: failed evaluating policy on signed data during check policy**

[signature set did not satisfy policy]

To validate ABAC permission, entities whose attribute (i.e., node_name) fails to satisfy the condition at the smart contract level (code snippet is displayed in Implementation Section), the custom error specified in the requested function will be displayed as follows. ### Error: Invoking Entity is Unauthorized. #### 2.1.2 Event Subscription--HTTP Systems, Users

Apart from using transactions as a means to communicate data between network participants, the proposed model also emphasized using events for notifying changes in the shared network state. To ensure the event message (composed as an HTTP packet) is authentic, a mutual TLS connection was enabled on every client (i.e., users, HPC system) to ensure the packets are sent from legitimate sources via an encrypted channel. Thus, it is impossible for malicious users to send falsified events with the purpose of interrupting the system operation. Results from conducting packet analysis with Wireshark showed that the tool cannot extract any information from captured packets. #### 3.1.3 Account Generation

Once the user is matched to the HPC system, a smart contract will automatically generate a username, which is unique across the network, as a user account for login to the HPC system. This username is then returned to the user and sent to the matched HPC system to generate a temporary passcode for first-time access. This passcode will be sent to the user off the chain to ensure no confidential data are being recorded on the shared state. The user can then combine knowledge attained from the blockchain (username) and HPC system (passcode) to access the computing resource. This approach ensures that malicious users who capture the packets cannot acquire complete access to information that can potentially cause harm to the HPC system. #### 3.1.4 HPC Interface Module

The interface module is installed to the HPC frontend node as a container, which in our implementation, is the Docker container. Many studies suggest that Docker is risky for deploying in HPC as it requires administrator privilege in execution, and recommend using Singularity [37] as a better alternative. Nevertheless, the purpose of using a container