Keywords

1 Introduction

Recently, New Retail has become one of the most popular concepts in the world, particularly in China, and it is considered to be an optimal combination of physical and online retails [1]. Despite a commercial hype to some extent, a few famous Internet companies like Alibaba [2] and Amazon [3] have released their high-level solutions to New Retail, such as mobile payment and self-service supermarket. Even so, there are still many different types of problems to be solved. According to the best practices of the Internet in other industries (e.g., e-Business and e-Government), we believe that traditional retail problems will be tackled by new Internet technologies, business models, and operating methods. Moreover, the Internet will reshape the infrastructure of the traditional retail industry.

As we know, the Retail Point of Sale (POS) System is a critical component of the traditional retail infrastructure. From the perspective of necessity, a retail POS system is also one of the essential IT systems in modern retail stores. Nowadays, an increasing number of retail POS systems begin to transform from a single machine to a cloud terminal. For large retail chains, standard cloud-based retail POS systems can help managers monitor and control their operations more directly and globally. A cloud-based retail POS system uses the “cloud + terminal” mode, in which the management system for orders, inventory, and funds is placed in the cloud (or called POS cloud), while the terminal includes cash registers which can connect to the POS cloud via the Internet or a dedicated network. Generally speaking, this type of cloud-based retail POS systems is efficient enough for most retail chains. Due to the unforeseeable failure of Internet equipment, instability of access to the Internet environment, and other specific factors, it is straightforward to cause an unexpected interruption of the connection to the Internet. As a result, local retail stores fail to sell any products, thus affecting their business operations and customer experience severely.

Developing a robust POS system has always been a matter for software engineers, and setting up a transactional cache locally in a cash register is one of the standard solutions. However, these existing approaches usually result in two issues. On the one hand, although the connection of a retail POS system to the POS cloud is out of service, other systems and terminals continue to work, possibly leading to data conflicts in the data synchronization process after network recovery. On the other hand, during the period of disconnection to the Internet, the security in offline transactions of the retail POS system cannot be guaranteed because the transaction environment is not credible. Inspired by the ideas of Blockchain and Edge Computing, the primary goal of this work is to design and develop a novel retail POS system. This type of retail POS systems can be deployed in a particular area in a retail store, using the mechanisms of blockchain networking, trustworthiness, and security. In particular, to deal with sudden network interruptions, all cash registers of a retail POS system act as nodes to build a POS blockchain network and store the related transaction records in it. Besides, once the access of the retail POS system to the Internet recovers, a node in the blockchain network will be selected as a POS edge computing server to synchronize data with the POS cloud and resume regular communication between them.

The rest of this paper is organized as follows. Section 2 introduces the preliminaries to this study, mainly including the concept, explanation, and applications of Blockchain and Edge Computing. Section 3 presents specific requirements and application scenarios of our work. Section 4 describes the details of blockchain-enabled transactions, including the definition of a POS block, the method of building a POS blockchain network, and the transaction process based on the POS blockchain. Section 5 presents the selection mechanism of a POS edge computing server as well as the communication mechanism between the POS edge computing server and the cloud. Section 6 introduces the development and implementation of the proposed retail POS system by an example. Finally, Sect. 7 concludes the paper.

2 Preliminaries to This Work

2.1 Blockchain

Blockchain, initially Block Chain, is an underlying technology of Bitcoin. It is a decentralized transparent ledger with transaction records—the database that is shared by all network nodes, updated by miners, monitored by everyone, and owned and controlled by no one [4]. As a best practice, it enables Bitcoin [5], a new digital currency, running well to describe how assets are transferred between buyers and sellers. Although blockchain was not first proposed in Satoshi Takemoto’s paper, it is increasingly recognized by both the academia and industry and becomes gradually independent of the bitcoin system. In addition to Bitcoin, blockchain, emerged as an independent and promising technology, has been used in many application scenarios, such as food safety traceability and judicial electronic data security.

2.2 Edge Computing

Edge Computing is a new computing paradigm increasingly emerged after Cloud Computing and Internet of Things (IoT). According to the definition of IEEE Report, it refers to “the enabling technologies allowing computation to be performed at the edge of the network, on downstream data on behalf of cloud services and upstream data on behalf of IoT services” [6, 7]. Edge Computing is suitable for the scenarios that data is continuously generated and needs to be processed quickly and timely, but current network bandwidth is not enough to deliver these data to the cloud for processing, such as mobile communications, unmanned driving and so on.

3 Requirements and Application Scenarios

There are two types of popular POS systems in the market, one of which is the local type and the other is cloud-based. The former type of POS systems represents that the entire POS system works inside a retail store, including financial, invoicing and other management software, as well as a cash register. This local POS system does not need to interact with the corresponding systems of other retail stores, and such a system usually does not fail unless its LAN (Local Area Network) is unavailable. However, this type of local POS systems is often limited in the scope of applications, and they are more suitable for small-scale retail companies that own only one store.

For large-scale chain stores, the cloud-based POS system is undoubtedly a preferable choice. First, such a POS system can save the money, time, and labor costs of deploying the system in various retail stores. Second, this type of cloud-based POS systems can monitor and control the operations of all stores distributed in various places. Moreover, it is also beneficial to the cloud-based management and coordination between different stores, such as out-of-stock warnings and out-of-town transfers. However, the disadvantage of the cloud-based POS system is that it is always affected by the Internet environment. Once the network of a store is suddenly interrupted, the operation of the store will undoubtedly be limited to a standstill. To the best of our knowledge, there have been several related attempts before, for example, a transaction is cached to a local cash register and then synchronized to the cloud after the network recovers from a failure. However, due to unsafety and unreliable local environment as well as the instability of data synchronization, the current realizations are prone to cause data loss and accounting errors. In the absence of the Internet, any cash register is considered to be a un-trust machine without the support of the POS cloud because it is accessible to be attacked.

Inspired by the ideas of Blockchain and Edge Computing, we develop a robust retail POS system in which cash registers can continue to work after the connection to the Internet is interrupted. The network topology of this system is different from that of the traditional cloud-based POS system. As shown in Fig. 1, in the traditional cloud-based POS system, any cash register in a retail store is directly connected to the POS cloud and communicates with the POS cloud. In other words, each cash register is a relatively independent device, and there is no interaction between each other. Figure 2 shows the network topology of the new POS system proposed in this paper. The most significant feature of this system architecture is the self-selection of running mode for each cash register when the network of a retail store fails. More specifically, if each cash register cannot connect directly to the POS cloud, it will quickly switch to the off-line mode. They organize together autonomously and automatically to form an internal peer-to-peer network. The POS system then selects a specific node in the peer-to-peer network as a POS edge computing server which communicates with the cloud and transfers data after the access to the Internet is recovered.

Fig. 1.
figure 1

Traditional cloud-based POS system architecture: every retail store adopts the mode of connecting to the cloud directly through a router and a backbone network.

Fig. 2.
figure 2

The network topology of the new POS system. In case of network failure, all cash registers in this retail store do not connect directly to the POS cloud but first form an internal peer-to-peer network. The POS system then selects a specific node in the peer-to-peer network to communicate with the POS cloud and transfer data.

Here, the peer-to-peer network in the retail store is a private blockchain (network). It can be used to build trust and establish a decentralized system that does not require a foundation of mutual trust or relies on a single centralized organization to guarantee the security and traceability of transactions.

Selecting a node as the POS edge computing server is responsible for communicating with the POS cloud and synchronizing transaction information between the local blockchain and the POS cloud, ensuring that our POS system can synchronize all local transaction information to the POS cloud accurately. Whether the network of a retail store is available, the cash registers of the retail store are not affected. Once the network is interrupted or unavailable, the local blockchain does not choose to synchronize data periodically but resumes data synchronization after the network connection to the POS cloud is re-established.

4 Blockchain-Enabled Transactions

4.1 The Definition of a POS Block

A POS block is the basic unit of a POS blockchain, including the information, called the head of the block that will be added to a blockchain, and the details of transactions. In this article, we define the primary data structure of a POS block in Table 1, and the head of a POS block includes:

Table 1. The primary data structure of a POS block.
  1. (1)

    Index: the position of this block in the entire blockchain;

  2. (2)

    Timestamp: the build time of the current block;

  3. (3)

    Previous hash: the hash value of the previous block;

  4. (4)

    Proof of Work (POW): proving the correctness of the work generated by the new block.

Moreover, the elements of a transaction include:

  1. (1)

    Transaction stream ID: a five-tuple composed of cash register identification, system user ID, transaction time, transaction serial number, and random number generating the transaction. This element is used to globally identify the uniqueness of the transaction, as well as to trace the time and location of the transaction and the participants involved in the transaction.

  2. (2)

    Trading time: the specific time of the transaction.

  3. (3)

    Trading commodity information: an array that records the identification information of commodities involved in the transaction, the price of each commodity, the quantity of each commodity, and the actual sales price of each commodity.

  4. (4)

    Transaction amount: the total amount generated in a transaction.

  5. (5)

    Transaction ID: buyer identification.

  6. (6)

    Transaction hash: the hash value of the above transaction information used to ensure that the transaction information is not modified.

4.2 Building a POS Blockchain Network

The trust relationship between nodes is fundamental to building a POS blockchain network. In this sub-section, we will focus on the security networking mechanism of the proposed POS blockchain, which depends mainly on the CA certificate.

Figure 3 depicts the core components of this mechanism and how they work. These core components include:

Fig. 3.
figure 3

Core components of the security networking mechanism of the proposed POS blockchain and how they work with each other.

  • CA Services: They are used to issue trusted digital certificates to cash registers so that these cash registers can form a blockchain.

  • POS Certification: This certification contains the POS machine’s public key, POS machine information, and digital summary information.

When a new node is ready to join the blockchain network, the new node first initiates a broadcast sending the certificate. After the networked nodes have received the certificate, they would like to let the new node join the blockchain network after the certificate has been verified to be true.

4.3 POS Blockchain-Based Transactions

Figure 4 shows the whole transaction process of the proposed POS blockchain, including the following four steps.

Fig. 4.
figure 4

The whole transaction process of the POS blockchain.

Step 1: Generate transactions and broadcast. In the POS blockchain network, any node can generate transactions, and each transaction generated by any node will be transferred to other nodes in a manner of broadcasting. Each node needs to maintain a blockchain and can accept transactions generated by all nodes and write these transactions into a new block. Typically, each block may have hundreds or thousands of transactions.

Step 2: Verify transactions and reach a consensus. Although each node can receive transactions and write them into new blocks, the determination of a node which owns the most realistic transactions requires a consensus among all the nodes in the network. In our method, the POW is very simple. Each node which records a ledger will obtain the right of verification. It can broadcast the hash information of all transactions to the entire network and compare the information with other nodes.

Step 3: Broadcast the new block. The node that can first complete the POW is recognized to own the certified new block, and it will broadcast its block to other nodes in the blockchain network.

Step 4: Add the new block to the blockchain. Other nodes will confirm whether the transaction contained in this block is valid. After confirming that the transaction has not been duplicated and has a sign of validity, a node can accept the block. At this time, the block is officially linked to the blockchain, and the data of the block can no longer be modified. Once all nodes have accepted the block, other blocks which did not finish the POW work before become invalid, and each node will re-establish a block and continue the next POW calculation.

5 Data Synchronization Based on Edge Computing

When the network resumes work, the new retail POS system we develop will restore the online mode. Before this mode is turned on, the transactions generated in the offline mode and recorded in the POS blockchain must be synchronized to the POS cloud. The synchronization process requires a node selected from the POS blockchain network to be responsible for the work of data synchronization. Here, the selected node is called a POS edge computing server.

The selection of a POS edge computing server is currently straightforward. The POS blockchain network is a peer-to-peer network, in which each node has complete POS blockchain information as well as all the transaction data. Theoretically, any node in the POS blockchain network can be used as a POS edge computing server to synchronize data with the POS cloud. In our system, we choose the node which first completes the POW before the end of the offline mode as the edge computing server. When it finishes broadcasting new blocks to other nodes, it starts to synchronize data with the POS cloud as quickly as possible.

6 Development and Implementation

We implemented the retail POS system in JDY.com. JDY.com is the largest management software and cloud service in China, provided by Kingdee. In particular, it provides new retail solutions such as POS System for medium, small- and micro-sized enterprises. Before this, JDY.com provided a variety of traditional POS system solutions for retailers with cash registers based on the Android and iOS platforms. As stated at the beginning of the paper, the traditional cloud-based POS system is designed based on the Internet. Once the access to the Internet is unavailable, the cash register equipment cannot transfer data to the cloud promptly, possibly leading to financial losses of retail stores.

Here, we improved these traditional POS systems according to the solution mentioned in this paper. For each cash register, we provide a packaged SDK (Software Development Kit) integration into its terminal system software. Any cash register does not connect directly to the POS cloud when it starts. The retail POS system obtains other similar devices in the same local area network by broadcasting, shaping a peer-to-peer network through two-way links. Then, a POS blockchain comes into being. Of course, we also made some modifications in the cloud to be able to synchronize transaction data in the local blockchain.

Figures 5 and 6 show how cash registers work after the retail POS system updates. Figure 5 is an overview screenshot from the POS cloud. It depicts a business case with a total of three retail stores in a particular area in Shenzhen city. Each point on the map represents a retail store, and the different colors of the points represent different network states of the three retail stores. Among the three retail stores, the blue dot indicates that the retail store network is healthy, and the red dot indicates that the network is abnormal. In other words, all the cash registers in the three retail stores represented by the red dot cannot connect to the POS cloud.

Fig. 5.
figure 5

A business case with a total of three retail stores in a specific area in Shenzhen. More specifically, each point on the map represents a retail store, and the different colors of the points represent different network states of the retail stores. Note that the blue dot indicates that the retail store network is healthy and the red dot indicates that the network is abnormal.

Fig. 6.
figure 6

Five cash registers have successfully formed a POS blockchain after the network of the retail store was unavailable.

Figure 6 depicts a typical cash-collection scenario when an individual retail store is abnormal on the Internet from the viewpoint of a cash register. From this figure, we can see that there are six cash registers in this retail store with an abnormal Internet state. Among all the cash registers, five cash registers have successfully constituted a POS blockchain after the network was interrupted. Moreover, at this time, the retail store’s transaction is continued from the time of the disconnection to the time of screenshot. A total of 262 transactions were successfully conducted, and the transaction amount exceeded 23,000 RMB.

Figures 7 and 8 show a comparison of the changes in the synchronization of specific transaction data between different nodes in the blockchain. Figure 7 shows the screenshot of the cash register under discussion before the transaction was synchronized. At this time, there was a total of 2 transactions with a transaction value of 228 RMB. Figure 8 displays the result of sales data of other cash registers synchronizing to the cash register via the POS blockchain. The transaction amount is a little more than that shown in Fig. 7, for a total of 3 transactions with a transaction value of 248 RMB.

Fig. 7.
figure 7

The screenshots of the cash register in question before the transaction was synchronized.

Fig. 8.
figure 8

The result of other cash registers’ sales data synchronizing to this cash register via the POS blockchain.

7 Conclusion

The article is an application-typed paper. In this paper, we propose and develop a novel robust POS system based on the technologies of Blockchain and Edge Computing for retail chains, which can be used in “weak” Internet environments. A “weak” Internet environment implies that when the Internet connection of a retail store is suddenly interrupted, cash registers in this store will turn on the off-line mode to continue work. In this off-line mode, each cash register can form a POS blockchain network, in which each node can trade and maintain blocks, and the transaction of all nodes is recorded by the blockchain to ensure that the transaction is complete and reliable. When the access to the Internet becomes available, these cash registers will be switched to the online mode. A node with a full block in the POS blockchain network will be selected as a POS edge computing server to communicate with the POS cloud. The selected POS edge computing server synchronizes these off-line transactions to the POS cloud, and then the whole retail POS system can be restored to regular use. The advantages of the robust retail POS system compared with the traditional POS systems include two aspects. On the one hand, our POS system does not always rely on the Internet if the Internet access is suddenly interrupted, thus making retail stores less affected by the network failure. On the other hand, changes in the POS system caused by external changes in the Internet are automated and do not require manual intervention.