Towards macro programming of IoT devices and smart contracts

This project consisted in developing a tool called Smart Tool, which has been designed to ease the burden of programming across internet of things (IoT) devices, smart contracts, and other systems that integrate with them. This tool uses different skills to work on each of these platforms.

By using macro programming, Smart Tool attempts to alleviate some of the burdens associated with programming, enabling programmers to create source code and focus on a single abstract system. The accompanying image shows how the programmer’s code would be passed through the tool, to be processed and converted into individual files according to the specified platforms. The ultimate goal was to allow developers to concentrate on business logic instead of being hindered by different systems or components. This would save the programmers time by automatically ‘connecting the dots’ between how various systems communicate. In the long run, Smart Tool could provide increased value if more platforms were to become available (such as Ethereum and Arduino), which will make these single abstract systems cross-platform.

While allowing the IoT platform, the blockchain platform (where smart contracts are deployed), and the main platform to function independently, Smart Tool would simplify communication between them. On the main platform, all function calls would be encapsulated within another function ‒ the run-time call ‒ which triggers a function on the other platforms and waits for a response. The run-time call function of Smart Tool would accept three parameters relating to it, including the platform type, the function name, and some platform- specific settings.

As at the time of writing, Smart Tool did not provide options for selecting different platforms, such as Ethereum (blockchain) and Arduino (IoT). However, the tool has been designed in such a way that it could support other implementations. Both Stratis and Raspberry Pi generators inherit an interface that would determine the types of functions they could define. Therefore, if a different platform would be required, an experienced programmer familiar with that platform would need to define an interface provided by Smart Tool and implement the functions in that language.

The run-time call function discussed previously (i.e., the function that would enable platforms to communicate with each other) would also require an implementation in addition to the generator. As with the generator, this code must be language-specific, and it should depend on which protocols would be the most appropriate, for example, Hypertext Transfer Protocol (HTTP) or Transmission Control Protocol (TCP). At present, the run-time call contains two cases, Stratis and Raspberry Pi, which communicate via HTTP requests.

In comparing two systems ‒ that is, one generated by traditional methods and the other by Smart Tool ‒ it was determined that the lines of code generated by both were nearly identical. This suggests that the tool has a low overhead and that it is highly efficient. In the future, it is likely that more platforms would be supported, thus allowing users to benefit from a cross-platform tool and creating the system according to their preference.

Figure 1. Structural overview
Student: Joseph Cefai
Course: B.Sc. IT (Hons.) Software Development
Supervisor: Prof. Joshua Ellul