Back to top

Master's Thesis Batuhan Erden

Last modified Jan 29
   No tags assigned

Automated Unit Testing of Solidity Smart Contracts in an Educational Context

 

Abstract

In the rising era of modern computing, blockchain technology has emerged as a crucial player, enabling secure transactions within an immutable record-keeping system. Capturing major attention from both academia and industry, its growth has encouraged continuous development, especially in the area of smart contracts. Due to the unalterable nature of a blockchain, it is imperative to test smart contracts to guarantee that they are free of vulnerabilities before deployment. Therefore, automated testing of smart contracts has become an important notion that has also found its way into educational environments to build foundational knowledge.

This thesis proposes a scalable service for automated unit testing of Solidity smart contracts within an educational context, allowing students to upload their smart contract inputs, which are executed against instructor-provided tests to offer constructive feedback on their contracts. The comparative analysis of the testing tools — Truffle, Hardhat, and Foundry — informs the selection of the optimal one to be used for smart contract testing, considering factors like usability, development experience, features, performance, and containerization capabilities. The service is designed with a microservice architecture and developed with the chosen tool used for smart contract testing. Furthermore, it is containerized using Docker and orchestrated with Docker Compose. Following that, inter-service communication is facilitated through RabbitMQ for stability under high loads, and Docker Swarm is utilized to enable horizontal scaling.

The evaluation of the testing service encompasses security, stability, efficiency, and scalability, confirming its ability to handle the simultaneous load of multiple submissions in a secure and stable software package. The work concludes with discussion on the summary of the work, possible future directions, and the extensive documentation offered for future maintainability.

We claim that this testing service will significantly contribute to the technological developments in educational settings, aiding students in creating more secure, reliable, and robust smart contracts before deploying them in critical applications. By utilizing an automated smart contract tester, students can have their contracts evaluated against tests developed by instructors, enhancing the learning process and eliminating the need for them to write their own tests. Moreover, the scalable and load-balancing nature of the service will allow for a smooth user experience, even during times of heavy load.

 

Research Questions

  • RQ01: What are the requirements for educational unit testing?
    • a) What is the core use case?
    • b) What are exemplary exercises that we would like students to do?
  • RQ02: What is the status quo in automated smart contract testing?
    • a) Are there examples of smart contract testing as a service?
    • b) Which tools are most commonly used for smart contract testing?
    • c) How can we characterize those tools in terms of their key features and performance measurement capabilities?
  • RQ03: What do we have to consider regarding security and stability when using a
    testing tool in a way that is not entirely intended?
    • a) How can errors and crashes in the contract execution be handled?
    • b) What measures do we need to take to prevent accidental or intentional system overload?
  • RQ04: How can a learning platform giving feedback through automated smart contract
    unit testing be developed?
    • a) What considerations need to be made to ensure the service is scalable and expandable?

 

Code Repositories

The code developed during this thesis is publicly accessible and can be found in the following GitHub repositories:

The following are some additional GitHub repositories that are not directly related to the main project, but still have some involvement:

 

Files and Subpages

Name Type Size Last Modification Last Editor
Erden Final Presentation.pdf 5,68 MB 29.01.2024
Erden Kick-off Presentation.pdf 1,38 MB 29.01.2024
Erden Master's Thesis.pdf 4,66 MB 29.01.2024
Erden Proposal.pdf 319 KB 29.01.2024