The SOFIE project will run four pilots in three diverse fields: energy, food-chain, and mixed reality mobile gaming. In all of these fields there is a demand for having a marketplace, in which actors (companies, public services, end users, etc.) can offer their services and products to each other. Taking this idea further, a decentralized marketplace is a marketplace that doesn't have a single entity owning or managing it, which in turn enhances its security, resiliency, transparency, and traceability. The decentralized marketplace can be partially decentralized, where for example a group of independent agriculture producers and retailers are managing it, or a fully decentralized where anyone can join and use the marketplace. Distributed ledger technologies (DLTs) allow creation of both types of decentralized marketplaces. In this post we describe our work on (partially) decentralized marketplaces using smart contracts.
In the SOFIE project, we have implemented a proof of concept decentralized marketplace using smart contracts on top of the Ethereum blockchain. The marketplace contains a set of data (such as the stipulations of requests and offers, details of services and products, history of the previous transactions, information about the managers, regulations of the marketplace, etc.), and operations with different access permissions (adding new requests and offers, changing the states of those requests and offers, selecting the best set of offers for a request based on predefined criteria, modifying the roles of managers, getting information about different entities of the marketplace, etc.). By calling the functions of the marketplace’s smart contracts, different parties can observe the state of the marketplace, make transactions they have permission for, and subsequently change the state of the marketplace.
We have detected the potential similarities in features that SOFIE pilots demand for their specific marketplaces. Based on those similarities, we have designed a generic decentralized marketplace which can be further extended to meet the specific requirements of SOFIE pilots. Furthermore, we have developed smart contracts of this generic marketplace to be deployed on Ethereum blockchain, and also tested the integrity and performance of the smart contracts using Truffle development framework. In addition, we have developed a backend to interact with the smart contracts of the marketplace. Below we describe development tools used.
In order to compile, deploy, and test our Solidity smart contracts, we used Truffle development framework. This framework is easy to use, and smart contracts can be compiled and deployed using simple commands. Truffle is compatible with live blockchain test networks, which can be used for deployment of smart contracts.
For testing purposes, we used Ganache, a personal Ethereum blockchain that was created by Truffle developers. The friendly UI of Ganache made it easy for us to observe the process and transactions during testing.
We will release the source code of our decentralized marketplace implementation in the SOFIE project’s GitHub repository by the end of this year: