# Robot Interaction Through Smart Contract for Blockchain-Based Coalition Formation

Alexander Smirnov, Nikolay Teslya

► To cite this version:

Alexander Smirnov, Nikolay Teslya. Robot Interaction Through Smart Contract for Blockchain-Based Coalition Formation. 15th IFIP International Conference on Product Lifecycle Management (PLM), Jul 2018, Turin, Italy. pp.611-620, 10.1007/978-3-030-01614-2_56. hal-02075557

HAL Id: hal-02075557

https://inria.hal.science/hal-02075557

Submitted on 21 Mar 2019

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Robot Interaction through Smart Contract for Blockchain-based Coalition Formation

Alexander Smirnov and Nikolay Teslya[0000-0003-0619-8620]

SPIIRAS, 14th line 39, 199178 St.Petersburg, Russia

{smir, teslya}@iias.spb.su

**Abstract.** Nowadays robots are able to perform decisions independent from the operator. Also, they are able to form a various kind of unions, such as swarms, schools, or coalitions to perform joint task solving. The most powerful and flexible type of union is coalitions. Due to each robot acts like an independent agent it is important to provide trusted interaction between them. It is quite hard to do this with existing methods based only on the knowledge representation using ontologies and reasoning techniques. The paper proposes to use smart contracts in blockchain to enrich the knowledge-based system by functions, specific for blockchain such as immutable transaction log, consensus between all participants as well as possibility to automate control on task resolving. The paper describes the new environment framework based on integration of cyberphysical system and blockchain, and interaction model between all framework elements using BPMN 2.0 notation. Smart contracts presented in the paper provide functions for tasks distribution between robots, resource allocation, and monitoring the task execution and reward distribution.

**Keywords:** coalition, robot, CPS, blockchain, smart contract.

## 1 Introduction

Nowadays robots are able to make independent decisions in unknown situations to perform planned actions considering current context. It becomes available by equipping robots with a large number of various sensors to check the physical environment parameters, actuators to make actions in it, microcontrollers that provide high computation power as well as computational algorithms that allow making decisions based on information received from embedded sensors of the robot or external information sources.

Also, robots can perform the joint work to solve a common problem under current conditions. There are a large number of various solutions dedicated to the joint work performed by a group of robots. Among them, such models of joint work can be distinguished, like swarms, schooling and collective (coalition) work. The first two models are based on imitating wildlife swarms or schools, such as fish schools or insect swarms. Robots in such models use simple behavior patterns that allow them to make decisions based on a limited amount of information provided by nearest neighbors.
In a coalition model, each robot is viewed as a separate entity also known as agent, which allows the use of approaches developed for multi-agent systems [1, 2]. Robots can form a coalition when they are faced a problem and plan joint actions to solve it. Each robot in the coalition operates independently from the others, but within the scope of the developed plan and taking into consideration the current context. This approach provides possibility to make maximum use of the capabilities of individual robots to achieve a common goal. However, robot coalition formation with the distribution of tasks among all coalition members is very difficult NP-complete task. To date, many solutions have been proposed that provide an approximate solution to the coalition forming task [2, 3, 4, 5, 6]. Another important task in the robots coalition formation is the organization of an information interaction environment between them, which allows information exchanging about the current situation and the distribution of tasks among the participants in the coalition.

Tasks distribution and assignment among the coalition participants requires specific functions to be implemented in the interaction environment of cyberphysical system (CPS) formed by physical environment, robots and software [7]. The interaction based only on the knowledge representation using ontologies and reasoning techniques to distribute tasks among coalition participants can not provide a full picture of how the tasks were distributed [8]. Coalition members can get an approximate idea of this, only by making full reasoning among the knowledge of other members. This behavior is more typical for swarm interaction models and reduces overall efficiency of the coalition.

To enrich existing interaction methods, it is proposed to use a central or distributed ledger, in which results or coalition participants' work are displayed. Such ledger allows to reduce the number of calculations on the coalition formation stage and to distribute tasks taking into account the capabilities and characteristics of all the participants in the coalition. At the same time, each participant at any time will have a view of task distribution as well as when it is expected to receive the result from other participants and what resources are involved in solving the overall problem. The overall view makes it possible to reconfigure the coalition on the fly by adding new or replacing participants which will know what they should do from the very beginning.

The paper presents a usage of blockchain to enrich existing robots coalition formation approach based on context management methodology and publish / subscribe-based semantic interoperability mechanism. During the coalition creation, robots are negotiating to spread own knowledge about the task being solved, their current state and parameters of the environment. The negotiation process is carried out in a common information space also known as smart space, and the result of negotiations is the coalition in which the common complex problem is divided to tasks distributed among the coalition members. The separate tasks are bond to the robots, as well as the required resources, and the remuneration for solving the problem. Assignment and binding of tasks, resources and remuneration is proposed to be carried out using a smart contract that is based on the blockchain technology.

The rest of the paper is structured as follows. Section 2 provides description of related works in field of blockchain usage for robots and Internet of Thing components interaction. Section 3 provides a framework structure for robot negotiation during the coalition formation based on the cyberphysical smart space concept and blockchain,
and model of the framework’s components interaction using the BPMN 2.0 notation. Section 4 describes types of smart contracts used for negotiation and code examples for each type of contract.

## 2 Related Work

This section is aimed to provide examples of blockchain usage for organizing interaction between coalition participants in various models.

The paper [8] considers the use of blockchain technology to create a logically centralized system for managing the distribution of tasks among coalition members. The blockchain technology itself is considered as a mechanism for recording and tracking transactions between participants performing control over the distribution of tasks. At the same time, it is possible to create a virtual ledger that contains all distributions of the assets available among the coalition participants.

The paper [9] provides an example of the E-Business model for decentralized autonomous corporations based on IoT and blockchain. The blockchain network is used here to create smart contracts and perform payment transactions using Bitcoin and system's own currency - IoTcoin. The presented approach provides the following advantages that can also be used in robot coalitions: internal resources of the system are presented in the form of payment system tokens; distributed ledger for transactions, built-in mechanism of digital signature; and protection of transactions by linking blocks with a hash function of a given complexity. Interaction between elements is carried out by transactions passing through four phases: preparing a transaction, negotiating, signing a contract, and fulfilling the terms of the contract.

A similar method is considered in relation to a Smart Home scenario in [10]. Also, there is an unchanged transaction ledger as an advantage of integrating IoT and Blockchain technologies. The proposed framework provides the following transaction processing functions: transaction storage, access to the transactions history and real-time monitoring. Also, due to the adaptation of the hierarchical structure of the proposed framework (which includes three levels: the smart home, overlay network, and cloud storage), optimization of resource consumption is achieved, and scalability of the network is increased. The functions of the block are focused on the level of interaction of elements in the overlay network.

It is also noted that the combination of the peer-to-peer network and the cryptographic algorithms that are underlying the blockchain technology allow for a negotiation process and consensus building without the presence of any controlling authorities. The distributed nature of the blockchain can be used in swarm robotics to store global knowledge about swarm actions [11]. At the same time, due to blockchain, the security of the transmitted data is ensured (garbage data can affect the achievement of a common goal), distributed decision making (creating a distributed voting system for the solution and use of the multi-signature), separation of robots behavior (switching between behavior patterns depending on the robot's role in the swarm), the emergence of new business models using the swarm. In addition, the availability of a distributed transaction ledger allows new robots to join the swarm and gain all the knowledge they have
gained prior to the moment of inclusion by downloading and analyzing the transaction history.

# 3 Robot Interaction Framework

## 3.1 Framework description

Robot interaction for coalition creation and functioning is based on the cyberphysical framework. The proposed framework implements publish/subscribe mechanism to provide real-time information sharing between robots. The conceptual scheme of the framework for the robots interaction is presented on Figure 1. The framework is based on the smart space concept that implements publish/subscribe interaction mechanism using the “blackboard” interaction model. It allows to organize interaction of robots in the physical and cyber (virtual) spaces that includes solo and joint actions of robots with various physical objects into the operation environment, information exchange about the current state of robots, objects, and environment for planning further joint actions during the coalition formation.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Framework for robot coalition interaction</figcaption></figure>

Large number of different robots and sensors, from different manufacturers and with different software, connected using different data transfer network raises a problem of the great heterogeneity of provided information and function as well as distribution of coalition participants that should be taken into account during their interaction. To provide interoperability between all coalition participants, the information exchange between them is implemented based on the ontologies usage. Such approach allows to expand the context by providing additional information about the semantic meaning of individual context parameters of shared information, for example, robot characteristics or object measurements. Each member of the CPS is presented by a knowledge processor (KP). KP implements functions of processing information from CPS member, as well as interaction (sharing and requesting the information) with other KPs using ontologies. For this purpose the common ontology can be developed for the whole system,
or ontologies of individual components can be used, and information exchange between them is carried out using ontology matching methods [12, 13] including usage of background knowledge for matching process [14]. The concept of cyberphysical smart space in this case allows providing all CPS members a common information space through which they can distribute information. All the members have equal access rights to read and write information in cyberphysical space.

CPS itself cannot be viewed as trusted environment due to the lack of mechanisms to check authorship and correctness of the information shared through the cyber environment. To provide trustiness, information exchange that requires long-term immutable storage and the impossibility of unauthorized access to stored information it is proposed to use blockchain technology. These properties of the blockchain are required to solve several tasks at once, namely: monitoring the implementation of the basic norms of coalition interaction and agreements recorded in the smart contracts, as well as control over the expenditure of resources, including the basic resources of the system, specific to the problem area of the problem being solved. Several independent chains are created in the blockchain to store the distribution state of each of the available resources (Figure 1). A separate chain of blocks is used to share smart contracts that store the basic norms of behavior in the coalition and agreements formed based on the norms for the distribution of tasks among the coalition members.

## 3.2 Interaction model

The interaction between all components of framework for coalition interaction is presented on Figure 2 using BPMN 2.0 notation. Robots interact with each other through the cyberphysical smart space and through the blockchain by using of KP located on the robots’ control block. KP provides the functions of processing data from physical components of robots, as well as sharing information through the cyber space. In addition, KP implements functions for robots interaction with each other during the coalition formation and accessing to the blockchain to obtain information about the available resources required to solve the bond subtask as well as to obtain the required amount of resource according to the corresponding smart contract.

Physical and cyber resources are also presented in the framework by corresponding KPs — Sensors KP for control the physical resources and information service KP to control the information resources. They perform control on resources state and timely informing all participants of cyberphysical system about changes in resources state and their characteristics as well as storing large data sets from sensors and robots in the cyber space (Figure 2). Resource characteristics changes are displayed in the smart space, while a changes of available amount of resources are displayed in the corresponding blockchain chain, which allows tracking its consumption and arrival. In order to ensure trust when changing the amount of resource, access to the blockchain is provided for all KPs directly using the private-public key pair from blockchain platform.

Cyber space is connected to the blockchain through blockchain KP. This KP provides consistency between information in cyber space and blockchain. It can be necessary for automatic control over the performance of smart contract conditions based on information located in smart space.
<figure><img src="image_3.png" /><figcaption>Fig. 2. Robot interaction model</figcaption></figure>

When robot processes collected information required for the task it negotiates with other robots to make an agreement which task have to be solved by it. Conditions of the agreement are fixed into a smart contract that is placed in the blockchain's separate contract-oriented chain. To fix the task distribution new blocks are added to the blockchain that bind robots and subtasks. If robot needs some resource, it should provide request to the blockchain and allocation will be stored into the new transaction. In the subtask was successfully resolved the robot receives a bonus, which is to increase the competence parameter associated with the task being solved or some amount of internal currency. In case of non-fulfillment of the contract, the robot gets a lowering of the
relevant competence, and the other participants receive an automatic notification about
faults to adjust the plans for performing their tasks.

# 4 Smart Contract Examples for Robots Negotiation

Automation of robots interaction for the coalition formation and joint work is carried
out through smart contracts. They describe the basic interactions of robots among them-
selves and during resources consumption. There are three types of contracts in the sys-
tem, according to the functions provided:

* Contract for the tasks distribution between robots;

* Contract for resource allocation;

* Contract for monitoring the task execution.

A description of each of the contract types is presented below taking into account
the platform used for blockchain creation. It is proposed to use the Hyperledger Fabric
platform to build the blockchain environment for robots’ interaction [15]. This choice
can be explained in the way that the Fabric provides extensive architecture capabilities
for configuring the platform for various tasks, as well as the ability to organize private
blockchains. The platform provides a key-value storage for recording transactions, the
ability to replace the mechanism for achieving consensus (by default, the Byzantine
Fault Tolerance (BFT) mechanism is implemented using the BFT-SMaRt software
module [16]), as well as the creation of contracts using the programming languages Go
and Java, and contracts are executed in containers based on Docker. The declared speed
of the platform satisfies the needs for interaction between robots due to the possibility
of processing 3500 transactions per second [15].

## 4.1 Contract for the tasks distribution between robots

The distribution of tasks between robots is based on an analysis of the robot's corre-
spondence to the requirements of the task to solve it, as well as the robot's requirements
for rewarding for the task solution. It is believed that the dividing of a complex task
into sub-tasks is predetermined and known at the time of the coalition formation. Cor-
respondence of the robot to a certain subtask is determined by analyzing its equipment
and comparing the onboard equipment to the one that is required to solve the subtask.
At the same time robots, spending their energy and work resource can demand a reward
in the form of an internal currency of the system, which can later be used to repair or
charge by the owner of the robot. The contract presented here describes the search for
robots to solve subtasks and binds the subtask to the robot, which can and is ready to
perform it.

var robot, robot2 Robot // Robots of the system
var task Task // Task to be solved
func findRobot(stub shim.ChaincodeStubInterface, args []string) (string, error) {
```golang
robot, robot2, task = args[0], args[1], args[2]
if robot.properties == task requirements{
    if robot.work_cost < robot2.work_cost {
        // bind task to robot, calculate end time and write
to the ledger
        stub.PutState(task.id, robot.id)
        stub.PutState(task.time, calc_end_time robot))
    }
} else return error
}
```

## 4.2 Contract for resource allocation

The resources used by robots are represented in the blockchain as tokens. Each resource has its own token, and the total number of tokens for the resource cannot exceed the maximum amount of the resource in the system (for example, for plant fertilizer in case of agriculture task or drugs in case of medicine task this quantity can be limited by the storage capacity of the warehouse), and the token itself is indivisible, corresponding to the minimum available unit of resource.

To account for the distribution of resources in the blockchain, a separate chain is created, which is realized in Hyperledger Fabric through channels. Each channel is accessible only to those participants who have an appropriate smart contract, which makes it possible to isolate the channels from each other.

```golang
func allocateResource(stub shim.ChaincodeStubInterface,
    args []string) (string, error) {
    robot, amount = args[0], args[1]
    if state resource) > amount { // allocate resource
        stub.PutState robot.id, amount)
        stub.PutState resource, state resource - amount)
    }
} else return error
}
```

## 4.3 Contract for monitoring the task execution

The task execution process is also tracked through a smart contract. This approach allows real-time notification of other coalition participants about the fact of the solving ending and automatically verifies the correctness and reliability of the subtask solution by interested coalition participants, for whom the result is important. If they agree with the results, the robot who solved the subtask is paid a reward and the performance of the entire task is progressing further according to the plan. If the robot has not coped with the solution, the contract condition is not met and, accordingly, the robot is not paid a reward, and the robot itself is replaced by another having the required competencies. At the same time, the plan for solving the common task must be recalculated taking into account the change in the composition of the coalition.
```python
func setResolved(stub shim.ChaincodeStubInterface, args
    []string) (string, error) {
    robot, task, state = args[0], args[1], args[2]
    if state == "Resolved" {
        stub.delState robot.id, task.id
        stub state = task.id, "resolved"
    }
} else return error
```

## 5 Conclusion

The use of blockchain technology and smart contracts has been proposed to provide immutable distributed storage of transactions about robot actions and resource allocation available for all coalition participants. This kind of storage is important on the negotiation stage when the coalition is formed to bind separated tasks with concrete coalition participants as well as on the execution stage to check the tasks execution process. Integration of blockchain and cyberphysical smart space had allowed to reduce the number of calculations on the coalition formation stage and to distribute tasks taking into account the capabilities and characteristics of all the participants in the coalition.

Interaction model has been developed for the proposed framework components. It allowed to detect main interaction between components and formalize types of contracts needed for robots negotiation and joint task solving. These types are: tasks distribution between robots; resource allocation; and monitoring of the task execution. For each type of contract the examples had been proposed taking into account the Hyperledger Fabric blockchain platform specific. This platform has been selected for the proposed framework because it provides extensive architecture capabilities for configuring the platform for various tasks, as well as the ability to organize private blockchains and high performance in transaction processing.

As a result of the smart space and blockchain integration each robot is provided a possibility to have a view of task distribution at any time as well as have a view of what is expected time to receive the result from other participants and what resources are involved in solving the overall problem. The overall view makes it possible to reconfigure the coalition on the fly by adding new or replacing participants which will know what they should do from the very beginning.

**Acknowledgments.** The presented research was supported by the projects funded through grants # 17-29-07073, 17-07-00247 and 17-07-00327 of the Russian Foundation for Basic Research, and State Research # 0073-2018-0002.

## References

1. Kaliaev, A.: Multiagent Approach for Building Distributed Adaptive Computing System. Procedia Comput. Sci. 18, 2193–2202 (2013). doi: 10.1016/j.procs.2013.05.390
2. Guerrero, J., Oliver, G., Valero, O.: Multi-Robot Coalitions Formation with Deadlines: Complexity Analysis and Solutions. PLoS One. 12, 1–26 (2017). doi: 10.1371/journal.pone.0170659

3. Ayari, E., Hadouaj, S., Ghedira, K.: A dynamic decentralised coalition formation approach for task allocation under tasks priority constraints. In: 2017 18th International Conference on Advanced Robotics (ICAR). pp. 250–255. IEEE (2017). doi: 10.1109/ICAR.2017.8023526

4. Mouradian, C., Sahoo, J., Glitho, R.H., Morrow, M.J., Polakos, P.A.: A coalition formation algorithm for Multi-Robot Task Allocation in large-scale natural disasters. In: 2017 13th International Wireless Communications and Mobile Computing Conference (IWCMC). pp. 1909–1914. IEEE (2017). doi: 10.1109/IWCMC.2017.7986575

5. Dukeman, A., Adams, J.A.: Hybrid mission planning with coalition formation. Auton. Agent. Multi. Agent. Syst. 31, 1424–1466 (2017). doi: 10.1007/s10458-017-9367-7

6. Agarwal, M., Agrawal, N., Sharma, S., Vig, L., Kumar, N.: Parallel multi-objective multi-robot coalition formation. Expert Syst. Appl. 42, 7797–7811 (2015). doi: 10.1016/j.eswa.2015.05.032

7. Guerrero, J., Oliver, G.: Multi-robot coalition formation in real-time scenarios. Rob. Auton. Syst. 60, 1295–1307 (2012). doi: 10.1016/j.robot.2012.06.004

8. Verma, D., Desai, N., Preece, A., Taylor, I.: A block chain based architecture for asset management in coalition operations. In: Pham, T. and Kolodny, M.A. (eds.) Proc. SPIE 10190, Ground/Air Multisensor Interoperability, Integration, and Networking for Persistent ISR VIII. p. 101900Y (2017). doi: 10.1117/12.2264911

9. Zhang, Y., Wen, J.: The IoT electric business model: Using blockchain technology for the internet of things. Peer-to-Peer Netw. Appl. 10, 983–994 (2017). doi: 10.1007/s12083-016-0456-1

10. Dorri, A., Kanhere, S.S., Jurdak, R.: Towards an Optimized BlockChain for IoT. Proc. Second Int. Conf. Internet-of-Things Des. Implement. - IoTDI '17. 173–178 (2017). doi: 10.1145/3054977.3055003

11. Ferrer, E.C.: The blockchain: a new framework for robotic swarm systems. (2016). Arxiv id: 1608.00695

12. Smirnov, A., Kashevnik, A., Shilov, N., Balandin, S., Oliver, I., Boldyrev, S.: On-the-fly ontology matching in smart spaces: A multi-model approach. Lect. Notes Comput. Sci. 6294 LNCS, 72–83 (2010). doi: 10.1007/978-3-642-14891-0_7

13. Euzenat, J., Shvaiko, P.: Ontology Matching. Springer Berlin Heidelberg, Berlin, Heidelberg (2013). doi: 10.1007/978-3-642-38721-0

14. Smirnov, A., Teslya, N., Savosin, S., Shilov, N.: Ontology Matching for Socio-Cyberphysical Systems: An Approach Based on Background Knowledge. In: Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics). pp. 29–39 (2017). doi: 10.1007/978-3-319-67380-6_3

15. Androulaki, E., Barger, A., Bortnikov, V., Cachin, C., Christidis, K., De Caro, A., Enyeart, D., Ferris, C., Laventman, G., Manevich, Y., Muralidharan, S., Murthy, C., Nguyen, B., Sethi, M., Singh, G., Smith, K., Sorniotti, A., Stathakopoulou, C., Vukolić, M., Cocco, S.W., Yellick, J.: Hyperledger Fabric: A Distributed Operating System for Permissioned Blockchains. 15 (2018). Arxiv: 1801.10228

16. Bessani, A., Sousa, J., Vukolić, M.: A byzantine fault-tolerant ordering service for the hyperledger fabric blockchain platform. In: Proceedings of the 1st Workshop on Scalable and Resilient Infrastructures for Distributed Ledgers - SERIAL '17. pp. 1–10. ACM Press, New York, New York, USA (2017). doi: 10.1145/3152824.3152830