System and method for writing and retrieving data in blockchain

By specifying leadership nodes and broadcasting messages in the blockchain, the problem of discarding transactions when nodes are offline is solved, and data processing fault tolerance and performance improvements in IoT environment are achieved, allowing transaction data during offline to be recorded when nodes are restored online. to the main chain.

CN119156796APending Publication Date: 2024-12-17SIEMENS AG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380031110.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-01-31
Filing Date
2023-01-26
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The problem of nodes discarding transactions when offline in blockchain networks is particularly challenging in time-sensitive data and transaction processing in IoT environments, and existing solutions have failed to fully solve this problem.

Method used

By specifying the current leadership node in the blockchain, broadcasting messages and determining the node status, offline nodes store transaction data locally, regenerate and record transaction data into the blockchain, allowing asset-specific and use case-specific transactions when the node recovers online Added to the main chain.

Benefits of technology

The transaction data storage and recovery even when the node is offline is realized, and the fault tolerance and performance of the blockchain network is improved, especially data processing in an unstable network connection environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119156796A_ABST
    Figure CN119156796A_ABST
Patent Text Reader

Abstract

A system (100) and method (200) for writing and retrieving data in a blockchain (102) having a plurality of nodes (102a, 102b... 102n) adapted to manage a plurality of assets (110a, 110b... 110x). The method includes identifying an offline node and determining, by the node itself, whether it is online or offline at a current moment; locally storing therein, by the offline node, corresponding transaction data related to the managed assets; determining whether any offline node at a previous moment returns to online at a current moment; receiving transaction data from such a node returning to online; and recording the received transaction data to a current block in the blockchain (102) if transaction data for the asset is not recorded in any block at which the node is last identified as being submitted between offline and a current moment.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] The present disclosure relates generally to blockchain frameworks and, more particularly, to systems and methods for writing and retrieving data in a blockchain that allows data to be added even if a node is offline for a certain period of time.

[0002] Blockchain is a chronological database because it records data in the form of chained or ordered blocks, and each block corresponds to data or transactions in a specific logical or real-time period (epoch). Compared to its beginnings and use cases in the public domain, blockchain is now being used for various applications in the industrial field, such as supply chain, Internet of Things (IoT) environment, etc. Blockchain technology and IoT are considered a natural match. Blockchain allows data to be stored in a time-mapped, immutable manner. IoT devices have many advantages when using blockchain as a base technology for communication, data storage and computing. This also unlocks many new use cases such as data sharing, pay-per-use, maintenance and predictive analysis. Although it is a challenge, the current design of blockchain requires all nodes to be actively connected to the Internet "always" so that the created transactions can be added to the block at the moment of submission in the blockchain. Edge and IoT devices must consider potential network issues in their design because they may not have a stable network connection. Here, blockchain applications have strong obstacles to overcome.

[0003] In current blockchains, both public and private alike, a node that is disconnected from the network is essentially "stuck". Once a node comes online, all transactions it may have submitted during that time are discarded, and the node "catches up" with the current state of the blockchain by downloading all new blocks. There is an even greater challenge here. If a client or application is connected to a specific node of the network, and that node is disconnected from the network, all transactions will initially be submitted for that specific application. This happens because once a node is disconnected, it essentially becomes a single-node blockchain, and if that node approves all transactions, they become valid. But when the node joins back to the network again, all transactions completed in the time between disconnection and connection are canceled or reverted without the application interacting with the node knowing. This is a huge challenge to program, especially in situations with time-sensitive data and transactions (such as in an IoT environment).

[0004] That is, it is understood that canceling transactions created during the period when the node is disconnected from the network is actually a feature used to deal with one of the edge cases of the double spending problem. Therefore, this problem or challenge is a known risk presented by design in the blockchain framework. There are some architectural solutions that can be used to address it to some extent, but they do not completely solve the problem.

[0005] In view of the above, an object of the present disclosure is to provide a blockchain framework that allows data to be added even if a node is offline for a certain period of time.

[0006] The object of the present disclosure is achieved by a method for writing and retrieving data in a blockchain having a plurality of nodes adapted to manage a plurality of assets. The method includes designating one of the plurality of nodes as a current leader node at a current moment when a block is submitted to the blockchain. The method further includes broadcasting a message to each other node of the plurality of nodes by the current leader node at the current moment. The method further includes receiving a response from one or more other nodes of the plurality of nodes by the current leader node in response to the broadcasted message. The method further includes identifying, by the current leader node, a node that is offline at the current moment from other nodes of the plurality of nodes based on the response received thereby. The method further includes determining, by each other node of the plurality of nodes, that its current state is one of online and offline based on the broadcasted message received thereby and not received thereby at the current moment, respectively. The method further includes locally storing therein corresponding transaction data related to one or more assets managed thereby by each node whose current state has been determined to be offline. The method further includes determining, by the current leader node, whether any node identified as being offline at a previous moment when the block was submitted to the blockchain is back online at the current moment based on the response received thereby to the current broadcasted message. The method further includes receiving transaction data from each node that has been determined to be back online. The method further includes recording the received transaction data to a current block being submitted to the blockchain if transaction data for the one or more assets is not recorded in any block submitted to the blockchain between the time when the corresponding node was last identified as offline and the current time.

[0007] Existing blockchain technology expects nodes to always be online, and discards transactions when offline nodes come online. This is based on the "longest chain" rule, where the longest chain is considered the main chain. The proposed invention improves on this by allowing asset-specific and use case-specific transactions to be potentially added to the main chain.

[0008] In one or more embodiments, the method further includes: if transaction data of the one or more assets has been recorded in any block submitted to the blockchain between the time when the corresponding node was last identified as offline and the current time, re-executing one or more transactions in the received transaction data to generate new transaction data related to the one or more assets; and recording the generated new transaction data to the current block being submitted to the blockchain.

[0009] In one or more embodiments, the method further includes assigning a unique asset identification (ID) to each of the one or more assets.

[0010] In one or more embodiments, the transaction data has metadata associated therewith. Herein, the metadata includes: a unique asset ID of a corresponding asset of the one or more assets for which there is at least one corresponding transaction in the associated transaction data; one or more pointers, wherein each of the one or more pointers refers to a previous block containing a last transaction related to the corresponding asset of the one or more assets; and a first timestamp corresponding to a moment when the associated transaction data is stored.

[0011] In one or more embodiments, the metadata further includes a second timestamp corresponding to a moment when the associated transaction data was recorded in a block submitted to the blockchain.

[0012] In one or more embodiments, retrieving data from the blockchain is independent for each of the one or more assets and based on a first timestamp of transaction data associated therewith.

[0013] In one or more embodiments, each of the plurality of nodes is adapted to manage one or more of the plurality of assets.

[0014] In one or more embodiments, the current leader node is randomly or pseudo-randomly designated from among nodes that are currently online from among the plurality of nodes.

[0015] In one or more embodiments, a node that has determined that its current state is offline and is part of the same network partition locally stores corresponding transaction data related to one or more assets managed thereby in a sidechain.

[0016] The present disclosure also provides a system for writing and retrieving data in a blockchain having a plurality of nodes, the plurality of nodes being adapted to manage a plurality of assets and submit blocks therein. The system comprises one or more processing units, and a memory communicatively coupled to the one or more processing units, the memory comprising a module stored in the form of machine-readable instructions executable by the one or more processing units, wherein the module is configured to perform the method steps described above.

[0017] The object of the present disclosure is further achieved by a computer program product having computer-readable instructions stored therein, which, when executed by a processing unit, causes the processing unit to perform the method steps described above.

[0018] The object of the present disclosure is further achieved by a computer-readable medium on which a program code segment of a computer program is stored, which program code segment can be loaded into a system and / or can be executed in the system so that when the program code segment is executed in the system, the system performs the method steps described above.

[0019] Still other aspects, features and advantages of the present invention will be readily apparent from the following detailed description, simply by illustrating a number of specific embodiments and implementations, including the best mode for carrying out the contemplated invention. The present invention is also capable of other and different embodiments, and its several details may be modified in various obvious respects, all without departing from the scope of the present invention. Therefore, the drawings and description are to be regarded as illustrative in nature, rather than restrictive.

[0020] As used herein, the term "blockchain", "blockchain framework", or "blockchain network" may refer to a decentralized network including a plurality of nodes. In one example, the blockchain network is a consortium blockchain network. Such a plurality of nodes may, for example, perform transactions in the blockchain network.

[0021] As used herein, the term "computing device" may refer to a physical, virtual device, or computer program product. In many implementations, a computing device may be any device capable of performing operations, such as a dedicated processor, a portion of a processor, a virtual processor, a portion of a virtual processor, a portion of a virtual device, or a virtual device. The system of the present disclosure may include or be embodied in a computing device. In some implementations, a computing device may execute an application for writing and retrieving data in a blockchain.

[0022] As used herein, the term "network" may refer to a communication framework for communication of blockchain networks, computing devices, and ledgers. Additionally, the term "network topology" may refer to the physical and / or logical arrangement of network nodes in a network.

[0023] The above-mentioned properties, features and advantages of the present invention and the manner of achieving them will become more apparent and understandable (clear) through the following description of the embodiments of the present invention in conjunction with the corresponding drawings. The illustrated embodiments are intended to illustrate rather than limit the present invention:

[0024] Figure 1 is a schematic diagram representation of a system implementing a blockchain according to one or more embodiments of the present disclosure;

[0025] Figure 2 is a flowchart representation of a method according to one or more embodiments of the present disclosure, the method listing the steps involved in writing and retrieving data in a blockchain having a plurality of nodes adapted to manage a plurality of assets; and

[0026] Figure 3 is an exemplary implementation of a blockchain for writing and retrieving data therein according to one or more embodiments of the present disclosure.

[0027] Examples of methods, systems, computer program products, and computer-readable media for writing and retrieving data in a blockchain are disclosed herein. Various embodiments are described with reference to the accompanying drawings, in which the same reference numerals are used throughout to refer to the same elements. In the following description, for the purpose of explanation, many specific details are set forth in order to provide a thorough understanding of embodiments of the present invention. However, it is apparent to those skilled in the art that embodiments of the present invention may be practiced without these specific details or with equivalent arrangements. In other examples, in order to avoid unnecessarily obscuring embodiments of the present invention, well-known structures and devices are shown in block diagram form.

[0028] Unless otherwise specified in the following description, the terms "execution", "computation", "computer-aided", "calculation", "establishment", "generation", "configuration", "reconstruction" and the like preferably relate to operations and / or processes and / or processing steps of changing and / or generating data and / or converting data into other data, wherein the data may be represented or presented in particular in the form of physical variables, for example in the form of electrical impulses. The expression "computer" should in particular be interpreted as broadly as possible in order to cover in particular all electronic devices of a data processing nature. Thus, a computer may be, for example, a personal computer, a server, a programmable logic controller (PLC), a handheld computer system, a pocket PC device, a mobile radio device, as well as other communication devices, processors and other electronic data processing devices capable of processing data in a computer-aided manner.

[0029] Furthermore, in particular, a (relevant) person skilled in the art with knowledge of (one or more) method claims will of course be aware of all customary possibilities for realizing the product or possibilities for realization in the prior art, and therefore do not need to be specifically disclosed independently in the specification. In particular, these customary implementation variants known to those skilled in the art can be implemented exclusively by hardware (components) or exclusively by software (components). Alternatively and / or additionally, a person skilled in the art can, within the scope of his / her professional competence, select any combination of hardware (components) and software (components) to the greatest extent possible according to embodiments of the present invention in order to realize implementation variants according to embodiments of the present invention.

[0030] In particular, if part of the effects according to an embodiment of the present invention are brought about exclusively by dedicated hardware (for example, a processor in the form of an ASIC or FPGA) and / or another part is brought about by software (assisted by a processor and / or memory), a combination of hardware (components) and software (components) according to an embodiment of the present invention may occur.

[0031] In particular, in view of a large number of different implementation possibilities, it is impossible, unhelpful or unnecessary to list all of these implementation possibilities for understanding embodiments of the present invention. In this regard, in particular, all exemplary embodiments below are intended to show only by way of example some ways in which, in particular, such implementations according to the teachings of embodiments of the present invention can be manifested.

[0032] In particular, therefore, features of the individual exemplary embodiments are not restricted to the respective exemplary embodiments but relate in particular to general embodiments of the invention.

[0033] Thus, features of one exemplary embodiment may also be used as features of another exemplary embodiment, in particular without having to be stated explicitly in the respective exemplary embodiment.

[0034] Figure 1 An exemplary embodiment of the present disclosure is shown as a schematic diagram of a system 100 implemented for writing and retrieving data in a blockchain 102 having a plurality of nodes 102a, 102b, ... 102n adapted to manage a plurality of assets 110a, 110b, ... 110x. In the present implementation, the system 100 may reside on or be executed by one or more computing devices 104, which may be connected to a network (e.g., the Internet or a local area network), such as a network 106. The system 100 further includes a ledger 108 (such as a database). The blockchain 102, the computing devices 104, and the ledger 108 are communicatively coupled via the network 106.

[0035] like Figure 1 As illustrated in , the system 100 includes a blockchain 102. The blockchain 102 includes a plurality of nodes, such as nodes 102a, 102b...102n. Specifically, the blockchain 102 is a decentralized network including a plurality of nodes 102a, 102b...102n. In an example, the blockchain 102 is a consortium blockchain 102. Within the context of embodiments of the present disclosure, "blockchain node", "node", "node of blockchain", and the like may be understood to mean, for example, a device (e.g., a field device), a computer, a client, or a subscriber that performs operations using a blockchain (such as the blockchain 102).

[0036] exist Figure 1In the illustration of , a computing device 104 has been shown. In addition, as shown, the computing device 104 may include one or more processing units 104a and a memory 104b communicatively coupled to the one or more processing units 104a. Examples of computing devices 104 may include, but are not limited to, (one or more) personal computers, (one or more) laptop computers, (one or more) mobile computing devices, server computers, a series of server computers, (one or more) mainframe computers, or (one or more) computing clouds. In general, a "computing device" related to the present embodiment may be understood to mean, for example, a computer (system), a client, a smart phone, a device or a server, which in each case is arranged outside the blockchain or is not a participant in a distributed database (e.g., a blockchain) (that is, does not perform operations with the distributed database, or only queries it, but does not perform transactions, insert data blocks, or calculate proof of work).

[0037] In some implementations, the computing device 104 may be a physical or virtual device. In many implementations, the computing device 104 may be any device capable of performing operations, such as a dedicated processor, a portion of a processor, a virtual processor, a portion of a virtual processor, a portion of a virtual device, or a virtual device. In some implementations, the processor may be a physical processor or a virtual processor. In some implementations, a virtual processor may correspond to one or more portions of one or more physical processors. In some implementations, instructions / logic may be distributed and executed across one or more virtual or physical processors to execute instructions / logic.

[0038] In one example, computing device 104 can be a computer program product programmed to perform the purpose. In another example, computing device 104 can be a computer-readable medium on which a program code segment of a computer program is stored, which can be loaded into a system and / or can be executed in a system so that the system performs steps for performing the purpose. Computing device 104 can be incorporated into one or more physical packages (e.g., chips). As an example, a physical package includes one or more materials, components, and / or wires arranged on a structural assembly (e.g., a substrate) to provide one or more characteristics, such as physical strength, dimensional conservation, and / or electrical interaction limitations. It is contemplated that, in certain embodiments, computing device 104 can be implemented in a single chip. The system of the present disclosure as discussed in the preceding paragraphs can include computing device 104 or be embodied in computing device 104. It can be appreciated that for the purposes of the present disclosure, these two systems and (and corresponding components / elements) can be equivalent.

[0039] In one embodiment, the computing device 104 includes a communication mechanism, such as a bus for transferring information between components of the computing device 104. As discussed, the computing device 104 includes one or more processing units 104a and a memory 104b. Generally speaking, the memory 104b is communicatively coupled to the one or more processing units 104a. Hereinafter, the one or more processing units 104a are sometimes referred to as processors. In this article, in particular, the processor 104a has a connection to the bus to execute instructions and process information stored in the memory. The processor 104a may include one or more processing cores, each of which is configured to execute independently. A multi-core processor enables multi-processing to be implemented within a single physical package. Examples of multi-core processors include two, four, eight or more processing cores. Alternatively or additionally, the processor 104a may include one or more microprocessors configured in series via a bus to implement independent execution of instructions, pipelines and multithreading. The processor 104a may also be accompanied by one or more dedicated components to perform certain processing functions and tasks, such as one or more digital signal processors (DSPs), or one or more application-specific integrated circuits (ASICs). A DSP is typically configured to process real-world signals (e.g., sound) in real time, independent of a processor. Similarly, an ASIC can be configured to perform specialized functions that are not easily performed by a general-purpose processor. Other specialized components that help perform the inventive functions described herein include one or more field programmable gate arrays (FPGAs) (not shown), one or more controllers (not shown), or one or more other specialized computer chips.

[0040] As used herein, the term "processor" refers to a computing element operable to respond to and process the instructions driving the system. Optionally, the processor includes but is not limited to a microprocessor, a microcontroller, a complex instruction set computing (CISC) microprocessor, a reduced instruction set (RISC) microprocessor, a very long instruction word (VLIW) microprocessor, or any other type of processing circuit. In addition, the term "processor" may refer to one or more individual processors, a processing device, and various elements associated with a processing device that can be shared by other processing devices. Additionally, one or more individual processors, processing devices, and elements are arranged in various architectures for responding to and processing the instructions driving the system.

[0041] The processor 104a and accompanying components have connectivity to the memory 104b via a bus (not shown). The memory 104b includes both dynamic memory (e.g., RAM, magnetic disk, writable optical disk, etc.) and static memory (e.g., ROM, CD-ROM, etc.) for storing executable instructions that, when executed, perform the method steps described herein for writing and retrieving data in the blockchain 102. In particular, the memory 104b includes a module arrangement for performing the steps of writing and retrieving data in the blockchain 102. The memory 104b also stores data associated with or generated by the execution of the steps of the present invention.

[0042] Herein, memory 104b can be a volatile memory and / or a non-volatile memory. Memory 104b can be coupled for communicating with a processing unit. Processing unit 104a can execute instructions and / or codes stored in memory 104b. Various computer-readable storage media can be stored in memory 104b and can be accessed from memory 104b. Memory 104b can include any suitable element for storing data and machine-readable instructions, such as a read-only memory, a random access memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a hard disk drive, a removable media drive for handling a compact disk, a digital video disk, a magnetic disk, a cassette, a memory card, and the like.

[0043] In some implementations, the instruction sets and subroutines of the system 100 may be executed by one or more processors 104a, which may be stored on a storage device, such as a storage device coupled to a computer. In some implementations, the one or more storage devices may include, but are not limited to, a hard drive, a flash drive, a tape drive, an optical drive, a RAID array, a random access memory (RAM), and a read-only memory (ROM). Examples of user devices (and / or computers) may include, but are not limited to, personal computers, laptop computers, smart / data-enabled cellular phones, notebook computers, tablet computers, servers, televisions, smart televisions, media capture devices, and dedicated network devices.

[0044] In some implementations, the computing device 104 may include a data store, such as a database (e.g., a relational database, an object-oriented database, a triple storage database, etc.), and may be located in any suitable memory location, such as a storage device coupled to a computer. In some implementations, data, metadata, information, etc. described throughout the present disclosure may be stored in the data store. In some implementations, the computer may utilize any known database management system, such as, but not limited to, DB2, to provide multi-user access to one or more databases (such as the above-mentioned relational databases). In some implementations, the data store may also be a custom database, such as, for example, a flat file database or an XML database. In some implementations, any other form of data storage structure and / or organization may also be used. In some implementations, the system 100 may be a component of a data store, an independent application docked with the above-mentioned data store, and / or an applet / application accessed via a client application. In some implementations, the above-mentioned data store may be distributed in whole or in part in a cloud computing topology. In this way, the computer and storage device may refer to multiple devices that may also be distributed throughout the network 106.

[0045] In some implementations, the computing device 104 may execute an application for writing and retrieving data in a blockchain 102 having a plurality of nodes 102a, 102b, ... 102n adapted to manage a plurality of assets 110a, 110b, ... 110x, as described in detail later in this description. In some implementations, the system 100 and / or the application may be accessed via one or more client applications. In some implementations, the system 100 may be a standalone application, or may be an applet / application / script / extension that may interact with and / or execute within a component of the application and / or one or more client applications. In some implementations, the application may be a standalone application, or may be an applet / application / script / extension that may interact with and / or execute within the system 100, a component of the system 100, and / or one or more client applications. In some implementations, one or more client applications may be stand-alone applications, or may be applets / applications / scripts / extensions that may interact with and / or execute within and / or as components of the system 100 and / or applications. Examples of client applications may include, but are not limited to, standard and / or mobile web browsers, email applications (e.g., email client applications), text and / or graphical user interfaces, custom web browsers, plug-ins, application programming interfaces (APIs), or custom applications. The instruction sets and subroutines of the client applications that may be stored on a storage device coupled to a user device may be executed by one or more processors and one or more memory architectures incorporated into the user device.

[0046] In some implementations, one or more client applications may be configured to implement some or all of the functionality of the system 100 (and vice versa). Thus, in some implementations, the system 100 may be a pure server-side application, a pure client-side application, or a hybrid server-side / client-side application that is cooperatively executed by one or more client applications and / or the system 100.

[0047] In some implementations, one or more client applications may be configured to implement some or all of the functionality of an application (and vice versa). Thus, in some implementations, an application may be a pure server-side application, a pure client-side application, or a hybrid server-side / client-side application executed collaboratively by one or more client applications and / or applications. The system 100 and the application may implement some or all of the same functionality, either individually or in any combination, as one or more client applications, and any description of implementing such functionality via one or more client applications, the system 100, the application, or a combination thereof, and any described interaction between one or more client applications, the system 100, the application, or a combination thereof to implement such functionality should be taken as examples only and not to limit the scope of the present disclosure.

[0048] In some implementations, one or more users can access system 100 directly through network 106 (e.g., using one or more user devices). In some implementations, network 106 can be connected to one or more secondary networks, examples of which can include, but are not limited to, for example: a local area network; a wide area network; or an intranet. In some implementations, computing device 104 can be connected to network 106 through a secondary network having a virtual link line.

[0049] In some implementations, various user devices may be coupled directly or indirectly to the network 106. For example, a user device may be directly coupled to the network 106 via a hardwired network connection. Alternatively, a user device may be wirelessly coupled to the network 106 via a wireless communication channel established between the user device and a wireless access point (i.e., a WAP), which in turn may be directly coupled to the network 106. The WAP may be, for example, IEEE 802.11a, 802.11b, 802.11g, 802.11ac, 802.11ae, RFID and / or Bluetooth TM (including Bluetooth TM A low energy) device capable of establishing a wireless communication channel between the user device and the WAP. In other examples, the user device may be wirelessly coupled to the network 106 via a wireless communication channel established between the user device and a cellular network / bridge that may be directly coupled to the network 106. The user device may execute an operating system, examples of which may include, but are not limited to OS Red Or customize the operating system.

[0050] In some implementations, some or all of the IEEE 802.11x specifications may use Ethernet protocols and carrier sense multiple access with collision avoidance (i.e., CSMA / CA) for path sharing. Various 802.11x specifications may use phase shift keying (i.e., PSK) modulation or complementary code keying (i.e., CCK) modulation, for example, Bluetooth TM (including Bluetooth TM Wireless Low Energy (NFC) is a telecommunications industry specification that allows, for example, mobile phones, computers, smartphones, and other electronic devices to be interconnected using short-range wireless connections. Other forms of interconnection (e.g., Near Field Communication (NFC)) may also be used.

[0051] It is to be understood that the systems and computer-assisted methods described herein can be implemented in various forms of hardware, software, firmware, dedicated processors, or combinations thereof. "Computer-assisted" in relation to embodiments of the present disclosure may be understood to mean, for example, an implementation of the method, wherein in particular a processor performs at least one method step of the method. One or more of the present embodiments may take the form of a computer program product, which includes a program module accessible from a computer-available or computer-readable medium storing program code, which is used for use by one or more computers, processors, or instruction execution systems or in combination with them. "Module" in relation to embodiments of the present invention may be understood to mean, for example, a processor and / or a storage unit for storing program commands. As an example, a processor is specifically configured to execute program commands so that the processor performs functions in order to implement or execute a method according to an embodiment of the present invention or steps of a method according to an embodiment of the present invention. For the purposes of this description, a computer-available or computer-readable medium may be any device capable of containing, storing, transmitting, propagating, or transporting a program for use by an instruction execution system, device, or apparatus or in combination with it.

[0052] As described herein, the modules in the memory 104b of the computing device 104 are configured to perform operations of a method (described later) for writing and retrieving data in a blockchain 102 having a plurality of nodes 102a, 102b ... 102n adapted to manage a plurality of assets 110a, 110b ... 110x. The computing device 104 performs the operations of the method by using a network 106. In addition, transactions between one or more nodes of the blockchain 102 are stored in a ledger 108 via the network 106. Details of writing and retrieving data in a blockchain 102 having a plurality of nodes 102a, 102b ... 102n adapted to manage a plurality of assets 110a, 110b ... 110x are explained in detail below.

[0053] Figure 2is a flowchart representation of a method 200 according to an embodiment of the present disclosure, which sets out the steps involved in writing and retrieving data in a blockchain 102 having a plurality of nodes 102a, 102b, ... 102n adapted to manage a plurality of assets 110a, 110b, ... 110x. Figure 1 elements and further reference Figure 3 To explain Figure 2 Method 200. In this article, Figure 3 is an exemplary implementation of a blockchain for writing and retrieving data therein according to one or more embodiments of the present disclosure.

[0054] It is understood that in the blockchain 102, there may be multiple assets 110a, 110b...110x from multiple use cases. In addition, each block in the blockchain 102 may be composed of multiple transactions. In the present embodiment, the method 200 includes assigning a unique asset identifier (ID) to each of the one or more assets 110a, 110b...110x. In addition, in the present embodiment, each of the multiple nodes 102a, 102b...102n is adapted to manage one or more of the multiple assets 110a, 110b...110x. Figure 3 In the illustrated embodiment, an exemplary network architecture 300 for an implementation of a blockchain 102 for writing and retrieving data therein is illustrated. As shown, herein, asset 110a is managed by nodes 102a-102d; asset 110b is managed by nodes 102e-102g; and asset 110x is managed by node 102n. Again, it can be appreciated that such a network architecture 300 is merely exemplary. In general, there is a many-to-many relationship between nodes 102a, 102b...102n and assets 110a, 110b...110x. A node can manage more than one asset, and an asset can be managed by more than one node. However, the present disclosure operates at the asset level and will behave the same.

[0055] For the purposes of this disclosure, each transaction consists of transaction data (i.e., state change information) associated with the corresponding asset 110a, 110b...110x. Herein, the transaction data has metadata associated therewith. Such metadata includes a unique asset ID of a corresponding asset in one or more assets 110a, 110b...110x, for which there is at least one corresponding transaction in the associated transaction data. In addition, the metadata includes one or more pointers, each of which refers to a previous block containing the last transaction associated with the corresponding asset in one or more assets 110a, 110b...110x. The metadata may further include a first timestamp corresponding to the moment when the associated transaction data is stored. That is, the first timestamp (TxProTime) corresponds to the moment when the transaction is proposed. In some examples, the metadata may further include a second timestamp corresponding to the moment when the associated transaction data is recorded in a block submitted to the blockchain 102. That is, the second timestamp (TxUpTime) corresponds to the moment when the transaction is finally added to the distributed ledger 108. It will be appreciated that in the present disclosure, a moment may refer to a moment when a block may be written (committed) to the blockchain 102.

[0056] At step 202, the method 200 includes designating one of the plurality of nodes 102a, 102b ... 102n as a current leader node at a current moment in time when a block is submitted to the blockchain 102. As discussed, the blockchain 102 includes a plurality of nodes, such as nodes 102a, 102b ... 102n. Herein, the processing unit 104a may be configured to designate one of the nodes 102a, 102b ... 102n as a current leader node. "Current leader node" means that the selected node is designated as the leader node only for the current moment in time when a block is submitted in the blockchain 102; and for the next moment in time when a block is submitted in the blockchain 102, some other (or even the same) node may be designated as the leader node. In general, each time a block is added to the blockchain 102, a leader node is randomly selected from the participating nodes 102a, 102b ... 102n. In this embodiment, the current leader node is randomly or pseudo-randomly designated from the nodes that are currently online from a plurality of nodes 102a, 102b...102n. Wherein in this context, the terms "randomly" and "pseudo-randomly" are used to refer to arbitrarily selecting a leader node from nodes 102a, 102b...102n, which in some examples can be performed in a reproducible and / or deterministic manner. In other embodiments, without departing from the spirit and scope of the present disclosure, the current leader node can be designated based on (one or more) predefined criteria.

[0057] At step 204, method 200 includes broadcasting a message by the current leader node to each other node in the plurality of nodes at the current moment. That is, the current leader node may broadcast a message to all other nodes in blockchain 102 when a block is written in blockchain 102. For example, if node 102a is selected and designated as the current leader node, node 102a may broadcast a message to all other nodes, i.e., nodes 102b, 102c, ... 102n. Herein, the broadcasted message from the current leader node may be in the form of a ping to the other nodes.

[0058] At step 206, method 200 includes receiving, by the current leader node, a response from one or more other nodes of the plurality of nodes in response to the broadcasted message. That is, the current leader node may receive responses to the broadcasted message from all other nodes in blockchain 102 (when writing blocks in blockchain 102). As in the above example, if node 102a is selected and designated as the current leader node, and node 102a may have broadcasted a message to all other nodes, i.e., nodes 102b, 102c...102n; node 102a is further configured to receive confirmation of the reception of the broadcasted message from the other nodes, i.e., nodes 102b, 102c...102n. Herein, the response received from the other nodes may again be in the form of a ping to the current leader node.

[0059] At step 208, method 200 includes identifying, by the current leader node, nodes that are offline at the current moment from other nodes in the plurality of nodes based on the responses received thereby. That is, the current leader node may determine which of the other nodes in blockchain 102 are online at the corresponding time of writing the block therein based on the responses received to the broadcasted message. As in the above example, if node 102a is selected and designated as the current leader node, and node 102a may have broadcast a message to all other nodes (i.e., nodes 102b, 102...102n), and may have further received confirmation of receipt of the broadcasted message from at least some of the other nodes 102b, 102...102n; then node 102a is further configured to determine which of the other nodes 102b, 102...102n are online at the current moment based on the confirmation of receipt of the broadcasted message thereby. Herein, the current leader node may confirm that any other node is online if a confirmation is received from it, and other nodes from which no confirmation is received are considered to be offline for the current moment of writing a block in blockchain 102.

[0060] At step 210, method 200 includes determining by each other node of the plurality of nodes whether its current state is one of online and offline, respectively, based on the broadcast message received and not received thereby at the current moment. That is, each of the other nodes can independently determine its current state, i.e., whether the other node itself is online or offline, based on the broadcast message received or not received thereby. As in the above example, if any other node, such as node 102b, may have received the broadcast message from the current leader node 102a at the current moment, the other node 102b may determine that its state is online; and if some of the other nodes, such as node 102c, may not have received the broadcast message from the current leader node 102a at the current moment, the other node 102c may determine that its state is offline. Those skilled in the art can appreciate that this is possible because each of the nodes 102a, 102b...102n can have a corresponding internal clock that is synchronized with each other, and already has information about the time when the block is written in the blockchain 102, and therefore will expect to receive the broadcast message at the current moment.

[0061] At step 212, the method 200 includes locally storing therein, by each node whose current state has been determined to be offline, corresponding transaction data associated with one or more assets managed thereby. That is, since a node (such as node 102c in the above example) that may have been determined to be offline will not be able to transmit transaction data for corresponding assets 110a, 110b, ... 110x generated thereby when the last block was written in the blockchain 102, those nodes may locally store such transaction data therein. "Local storage" means that those nodes may at least temporarily store the data in a local storage medium.

[0062] In one or more embodiments, nodes that have determined their current status to be offline and are part of the same network partition store corresponding transaction data related to one or more assets managed thereby locally in a side chain. That is, if two or more nodes have determined their status to be offline at the current moment of writing a block to blockchain 102, and such nodes may be part of the same network partition and are therefore able to communicate with each other (because it may be a network access point for the network partition that may not be able to connect to the Internet, but allows local data communication), then those nodes may store corresponding transaction data locally in the form of a side chain (as described in the previous paragraph). Such a side chain may have transaction data from each of the two or more offline nodes that are part of the same network partition.

[0063] At step 214, the method 200 includes determining, by the current leader node, based on the response to the current broadcast message thus received, whether any node identified as being offline at the previous moment when the block was submitted to the blockchain 102 is back online at the current moment. That is, the leader node at the current moment (such as node 102a in the above example) can also check whether any node (such as nodes 102b, 102c...102n in the above example) determined to be offline at the previous moment (determined by the leader node at that time) is now online. For this purpose, such information about the status of offline nodes can be passed from the leader node at one moment to the leader node at the next moment. Thus, based on the comparison, according to the offline node list at (one or more) previous moments and the currently determined online nodes, the current leader node (i.e., node 102a in this example) can determine which nodes have returned online in the time period between the previous moment when the block was written in the blockchain 102 and the current moment.

[0064] At step 216, method 200 includes receiving transaction data from each node that has been determined to be back online. That is, the leader node may receive transaction data from a node that was previously offline (as determined by steps 204-208) and is now back online (as determined by step 214). Herein, transaction data is data stored locally by such a previously offline node, generated between the moment such a node may have first determined itself to be offline and the current moment (when it is back online). As discussed, in the case where multiple nodes from a single network partition were previously offline and stored data locally in the form of a side chain, transaction data from blocks of such a side chain may be received. Considering the above example, if a corresponding asset 110a (such as 110b) that was previously determined to be offline and had stored thereby managed has been stored Figure 3 The node 102c for the transaction data of the Node 102A (shown in ) is now determined to be online, and receives the transaction data stored therein and / or in the corresponding side chain.

[0065] At step 218, method 200 includes: if transaction data for the one or more assets is not recorded in any block submitted to the blockchain between the time when the corresponding node was last identified as offline and the current time, then recording the received transaction data to the current block being submitted to the blockchain. As discussed, each of the plurality of nodes 102a, 102b...102n is adapted to manage one or more of the plurality of assets 110a, 110b...110x. Again, considering the above example, now when transaction data for the corresponding asset 110a is received from node 102c (such as managed thereby), it is checked whether there are no other nodes (i.e., nodes 102a, 102b, and 102d, such as nodes 102a, 102b, and 102d) that also manage asset 110a between the time when node 102c was offline and the current time. Figure 3) has already added any transaction data related to asset 110a; and if this is the scenario, the transaction data related to asset 110a received from node 110c at the current moment is added to the block being written to blockchain 102 at the same current moment.

[0066] Considering the above example, another scenario would be if, after checking, it is determined that between the time node 102c was offline and the current time, one or more other nodes (i.e., nodes 102a, 102b, and 102d, such as Figure 3 ) has added any transaction data related to asset 110a. In such a scenario, in one or more embodiments, method 200 includes: if transaction data for the one or more assets has been recorded in any block submitted to the blockchain between the time when the corresponding node was last identified as offline and the current time, re-executing one or more transactions in the received transaction data to generate new transaction data related to the one or more assets. In addition, method 200 includes recording the generated new transaction data to the current block being submitted to blockchain 102. That is, instead of directly writing and submitting transaction data received from a node that was previously offline and is now online (such as node 102c), entries related to the received transaction data are executed again, and the corresponding generated new transaction data is recorded in the block submitted to blockchain 102 at the current time.

[0067] As discussed, each transaction consists of transaction data (i.e., state change information) associated with a corresponding asset 110a, 110b...110x. Herein, the transaction data has metadata associated therewith. Such metadata includes a unique asset ID of a corresponding asset in one or more assets 110a, 110b...110x, for which there is at least one corresponding transaction in the associated transaction data. In addition, the metadata includes one or more pointers, wherein each of the one or more pointers refers to a previous block containing the last transaction associated with the corresponding asset in the one or more assets 110a, 110b...110x. The metadata may further include a first timestamp corresponding to the moment when the associated transaction data is stored. In the present embodiment, retrieving data from the blockchain 102 is independent for each of the one or more assets 110a, 110b...110x, 110x and is based on the first timestamp of the transaction data associated therewith. Consider an example (not shown in the figure), if asset 110a is managed by nodes 102a, 102b, and 102c, and asset 110b is managed by nodes 102a, 102d, and 102e; and node 102a is offline, during which it proposes transactions related to both assets 110a and 110b; then such proposed transactions will be treated separately. Depending on transactions from other nodes 102b, 102c, 102d, and 102e, it may be possible that transactions related only to asset 110a, only to asset 110b, or both to asset 110a and asset 110b, or not related to both asset 110a and asset 110b are added to blockchain 102.

[0068] In general, the present method 200 provides that a unique identifier is assigned to each asset and identifies which nodes or groups of nodes are authorized to change and update which assets. For a subset of nodes that can edit assets, transactions are recorded even if they are offline. Unless the asset has changes made by some other nodes of the same subset, the transaction can be attached to the blockchain 102 when the node appears. Each transaction also has the "time proposed" as a metadata field. When tracking the history of an asset, the information can be linked based on when the asset-related transaction was made in the blockchain or based on metadata, and the actual time of the transaction can be determined. Even if the asset is modified while the node is offline, because other nodes do not change or update the asset or interact with the use case, the asset update can be attached to the blockchain later.

[0069] Now, whenever a new transaction is proposed, the blockchain 102 is traversed until the last block of transactions for that asset, and that pointer is added to the transaction metadata. If the transaction was not initiated from an offline node, then TxProTime and TxUpTime are the same. Additionally, the associated asset ID is added to the metadata, and the corresponding transaction(s) are added to the current block being submitted to the blockchain 102.

[0070] In addition, after each block is created, the leader node sends a broadcast message to all nodes and initiates a handshake protocol. Based on the response, offline nodes that may potentially add transactions when the offline node comes online are identified. In this article, an offline node is associated with one or a group of specific assets on the blockchain 102. When a node is offline, the blockchain 102 becomes a single-node blockchain for that node (this is the default blockchain design). Since the node does not receive any broadcast messages, it can determine on its own that it is not currently part of the network. This can be configured based on the number of blocks, time, or size of the chain. For example, if a node does not respond to 3 block creations, it is considered offline. During such a time period, the node proposes and adds transactions to the local blockchain. For the local blockchain, the chain will grow as if it were still part of the blockchain 102.

[0071] When the node becomes online again or joins the network again, the chain of the offline node is different from the chain of the network. The current leader node of the main blockchain 102 identifies that the offline node has joined again based on the broadcast message and the response. At this time, the previously offline node proposes its new transaction to the main chain. Each transaction is checked based on its asset ID to confirm whether the corresponding asset has other changes. If the asset has not had any other changes since the node went offline, the transaction is added to a new block in the blockchain 102. Herein, the first timestamp of the transaction (TxProTime) is the time when the transaction was proposed in the offline node, and the (TxUpTime) of the transaction is updated to the time when the transaction was added to the blockchain 102. Otherwise, if the asset has had a state change since the node went offline, the new state from the offline node is discarded, the transaction from the offline node is executed on the asset again, and the new state of the asset obtained from the transaction is stored in the blockchain 102.

[0072] Now, in order to traverse the blockchain 102, the blockchain 102 can be traversed independently for each asset. As discussed, each asset-related transaction has two timestamps, a first timestamp (TxProTime) and a second timestamp (TxUpTime). Based on the first timestamp (TxProTime), an actual timeline of the evolution of the asset can be created, even if it is added by an offline node.

[0073] The proposed blockchain framework allows data to be added even if the node is offline for a certain period of time. Existing blockchain technology expects nodes to be online at all times, and discards transactions when offline nodes become online. This is based on the rule of "longest chain", where the longest chain is considered the main chain. The present disclosure improves on this by allowing asset-specific and use case-specific transactions to be potentially added to the main chain. Therefore, the system and method of the present disclosure allows the performance of blockchain devices to be improved by providing a way to deal with unstable network connections, especially for IoT environments, by improving the fault tolerance of blockchain networks.

[0074] Although the present disclosure has been described in detail with reference to certain embodiments, it should be appreciated that the present disclosure is not limited to those embodiments. In view of the present disclosure, many modifications and variations will present themselves to those skilled in the art without departing from the scope of the various embodiments of the present disclosure as described herein. Therefore, the scope of the present disclosure is indicated by the following claims rather than the foregoing description. All changes, modifications and variations within the meaning and scope of the equivalents of the claims are considered to be within their scope.

Claims

1. A method (200) for writing and retrieving data in a blockchain (102) having a plurality of nodes (102a, 102b ... 102n) adapted to manage a plurality of assets (110a, 110b ... 110x), the method (200) comprising: Specifying one of a plurality of nodes (102a, 102b, ... 102n) at a current moment of submitting a block to a blockchain (102), wherein the specified node is a current leader node; Broadcasting a message by the current leader node to each other node in the plurality of nodes (102a, 102b...102n) at the current moment; In response to the broadcasted message, receiving, by the current leader node, responses from one or more other nodes of the plurality of nodes (102a, 102b ... 102n); Identifying, by the current leader node based on the responses received thereby, nodes that are offline at the current moment from other nodes in the plurality of nodes (102a, 102b ... 102n); Determining, by each other node of the plurality of nodes (102a, 102b ... 102n), that its current state is one of online and offline based on the broadcasted message received and not received thereby at the current moment, respectively; storing locally therein, by each node that has determined that its current state is offline, corresponding transaction data associated with one or more assets managed thereby; determining, by the current leader node based on responses to the currently broadcasted message received thereby, whether any node identified as being offline at a previous time when a block was submitted to the blockchain (102) is back online at said current time; receiving transaction data from each node that has been determined to be back online; as well as If transaction data of the one or more assets is not recorded in any block submitted to the blockchain (102) between the time when the corresponding node was last identified as offline and the current time, the received transaction data is recorded in the current block being submitted to the blockchain (102).

2. The method (200) according to claim 1, further comprising: If transaction data of the one or more assets has been recorded in any block submitted to the blockchain (102) between the time when the corresponding node was last identified as offline and the current time, re-execute one or more transactions in the received transaction data to generate new transaction data related to the one or more assets; The generated new transaction data is recorded into the current block being submitted to the blockchain (102).

3. The method (200) of claim 1, further comprising assigning a unique asset identification (ID) to each of the one or more assets.

4. The method (200) of claim 3, wherein the transaction data has metadata associated therewith, wherein the metadata comprises: a unique asset ID of a corresponding asset of the one or more assets, for which there is at least one corresponding transaction in the associated transaction data, one or more pointers, wherein each of the one or more pointers refers to a previous block containing a last transaction related to the corresponding asset of the one or more assets, and A first timestamp corresponds to a time at which the associated transaction data is stored.

5. The method (200) of claim 4, wherein the metadata further comprises a second timestamp corresponding to a moment when the associated transaction data is recorded in a block submitted to the blockchain (102).

6. The method (200) of claim 4, wherein retrieving data from the blockchain (102) is independent for each of the one or more assets and is based on a first timestamp of transaction data associated therewith.

7. The method (200) of claim 1, wherein each of the plurality of nodes (102a, 102b ... 102n) is adapted to manage one or more of the plurality of assets (110a, 110b ... 110x).

8. The method (200) according to claim 1, wherein the current leader node is randomly or pseudo-randomly designated from nodes that are currently online from among the plurality of nodes (102a, 102b ... 102n).

9. The method (200) of claim 1, wherein a node whose current state has been determined to be offline and which is part of the same network partition locally stores corresponding transaction data related to one or more assets managed thereby in a side chain.

10. A system (100) for writing and retrieving data in a blockchain (102) having a plurality of nodes (102a, 102b ... 102n), the plurality of nodes being adapted to manage a plurality of assets (110a, 110b ... 110x) and to commit blocks therein, the system (100) comprising: one or more processing units (104a); as well as A memory (104b) communicatively coupled to the one or more processing units (104a), the memory (104b) comprising modules stored in the form of machine-readable instructions executable by the one or more processing units (104a), wherein the modules are configured to perform the steps of the method (200) as claimed in claims 1 to 9.

11. A computer program product having computer readable instructions stored therein, which, when executed by a processor (104a), cause the processor (104a) to perform the steps of the method (200) according to any one of claims 1 to 9.

12. A computer-readable medium on which a program code segment of a computer program is stored, wherein the program code segment can be loaded into a system and / or can be executed in the system so that when the program code segment is executed in the system (110), the system (100) performs the steps of the method (200) according to any one of claims 1 to 9.