Blockchain-based Data Sharing Method, Node, Terminal and System
By generating unified data encoding and broadcast data operation records in the blockchain, the problem of difficulty in time sensing data changes during data sharing in the blockchain is solved, and efficient and accurate data interaction and response are achieved.
Patent Information
- Application Number
- CN202110184062.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-10
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-02-10
AI Technical Summary
In blockchain, when multiple cooperative institutions share business data through blockchain, it is difficult to perceive changes in designated data items in a timely manner, resulting in a lag in response. The main reasons include the decentralized characteristics of blockchain that lead to node time deviations, the lack of effective external notification mechanisms, and the inefficient polling and monitoring methods.
A blockchain-based data sharing method is proposed, by receiving data change requests, generating the latest data number, forming data operation records and broadcasting to other nodes of the blockchain. At the same time, the data sharing request from the terminal is received, the unsynchronized data operation record is determined, and it is transmitted to the terminal to update the data state.
In the blockchain data sharing scenario, it can improve the efficiency and accuracy of data interaction, reduce the cost of information acquisition, improve the response speed, and avoid repeated triggering of business processes.
Smart Images

Figure CN112965974B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a data sharing method, node, terminal and system based on blockchain. Background Art
[0002] With the development of blockchain technology, more and more institutions choose to operate the common data on the blockchain through smart contracts to share data, conduct business interactions and collaborative cooperation with partner institutions. However, in mainstream blockchains (such as hyperledger, Ethereum, etc.), each institution records data and cooperates by recording the final calculation results on the blockchain, resulting in it being difficult for other partner institutions to promptly perceive changes in specified data items and make corresponding responses. The main reasons are as follows: (1) Due to the decentralized nature of the blockchain itself, there are deviations in the system time of each node constituting the blockchain or the time of executing the contract, and there may also be deviations in the system time of each transaction partner. Therefore, the time used in a single backend system cannot be a unified standard for judgment (for example: it is impossible to judge whether the data has changed based on the last modification time, and it is impossible to judge the actual order of data changes based on the recording time). (2) Currently, there are few blockchain external notification solutions. If the data shared by a certain partner institution changes and multiple partner institutions need to respond, when adopting the blockchain external notification solution, multiple partner institutions need to be notified when executing the contract for data recording, which greatly increases the cost of contract execution. (3) Partner institutions monitor whether specific data records have changed by polling specific data records. This method is not applicable to monitoring large amounts of data records. If the data volume is large, polling a specific piece of data will consume a large amount of operating costs of partner institutions and it is also impossible to promptly perceive changes in a certain record. Summary of the Invention
[0003] An object of the present invention is to provide a data sharing method based on blockchain, and propose an efficient and reasonable data interaction method for the scenario where multiple partner institutions share business data and cooperate through blockchain. Another object of the present invention is to provide a node. Another object of the present invention is to provide a terminal. Another object of the present invention is to provide a data sharing system based on blockchain. Another object of the present invention is to provide a computer device. Another object of the present invention is to provide a readable medium.
[0004] To achieve the above objectives, on the one hand, the present invention discloses a data sharing method based on blockchain, including:
[0005] Receiving a data change request, where the data change request includes a data record number and a corresponding data status;
[0006] Obtain the latest data number according to the current data number and the preset number formation rule, obtain the data operation record according to the latest data number and the data change request, and broadcast it to other nodes of the blockchain;
[0007] Receive the data sharing request transmitted by the terminal, where the data sharing request includes the terminal data number, determine the unsynchronized data operation record according to the terminal data number and the latest data number, and transmit the unsynchronized data operation record to the terminal so that the terminal updates the data status of the data record number corresponding to the unsynchronized data operation record.
[0008] Preferably, it further includes before receiving the data change request transmitted by the first terminal:
[0009] Receive the data initial record transmitted by the terminal, where the data initial record includes the data record number and transaction information;
[0010] Form an initial data record number with the data record number as the key and the transaction information as the value, and store it in the data record table in key-value format.
[0011] Preferably, the data initial record further includes the initial state corresponding to the data record number, and the method further includes:
[0012] Obtain the latest data number according to the current data number and the preset number formation rule;
[0013] Form an initial data operation record with the latest data number as the key, the data record number and the initial state as the value, and store it in the data operation record table in key-value format.
[0014] Preferably, the obtaining the data operation record according to the latest data number and the data change request specifically includes:
[0015] Form a data operation record with the latest data number as the key, the data record number and the corresponding data state as the value, and store it in the data operation record table in key-value format.
[0016] Preferably, it further includes:
[0017] Receive the data record synchronization request transmitted by the terminal, where the data record synchronization request includes the terminal data record number;
[0018] Obtain the unsynchronized data record number according to the terminal data record number and the latest data record number in the data record table;
[0019] Transmit the unsynchronized data record number and the corresponding transaction information to the terminal.
[0020] The present invention also discloses a data sharing method based on blockchain, including:
[0021] Send a data sharing request to a blockchain node, the data sharing request includes a terminal data number, so that the node determines unsynchronized data operation records according to the terminal data number and the latest data number, and the unsynchronized data operation records are obtained by the node receiving a data change request, the data change request includes a data record number and a corresponding data status, obtaining the latest data number according to the current data number and a preset number formation rule, and according to the latest data number and the data change request;
[0022] Receive the unsynchronized data operation records transmitted by the node, and update the data status of the data record number corresponding to the unsynchronized data operation records.
[0023] Preferably, it further includes:
[0024] Transmit a data record synchronization request to the blockchain node, the data record synchronization request includes a terminal data record number, so that the node obtains an unsynchronized data record number according to the terminal data record number and the latest data record number in the data record table;
[0025] Receive the unsynchronized data record number and the corresponding transaction information transmitted by the node.
[0026] Preferably, the updating the data status of the data record number corresponding to the unsynchronized data operation records specifically includes:
[0027] Obtain an unsynchronized data record number according to the unsynchronized data operation records;
[0028] Modify the initial status of the unsynchronized data record number in the terminal to the data status.
[0029] The present invention also discloses a node, including:
[0030] A request receiving unit for receiving a data change request, the data change request includes a data record number and a corresponding data status;
[0031] An operation record unit for obtaining the latest data number according to the current data number and a preset number formation rule, obtaining data operation records according to the latest data number and the data change request, and broadcasting them to other nodes of the blockchain;
[0032] A data sharing unit, configured to receive a data sharing request transmitted by a terminal. The data sharing request includes a terminal data number. Determine unsynchronized data operation records according to the terminal data number and the latest data number, and transmit the unsynchronized data operation records to the terminal so that the terminal updates the data status of the data record number corresponding to the unsynchronized data operation records.
[0033] The present invention also discloses a terminal, including:
[0034] A request sending unit, configured to send a data sharing request to a blockchain node. The data sharing request includes a terminal data number, so that the node determines unsynchronized data operation records according to the terminal data number and the latest data number. The unsynchronized data operation records are obtained by the node receiving a data change request, where the data change request includes a data record number and a corresponding data status, obtaining the latest data number according to the current data number and a preset number formation rule, and according to the latest data number and the data change request.
[0035] A data updating unit, configured to receive the unsynchronized data operation records transmitted by the node, and update the data status of the data record number corresponding to the unsynchronized data operation records.
[0036] The present invention also discloses a blockchain-based data sharing system, including a blockchain and multiple terminals. The blockchain includes multiple nodes;
[0037] Wherein, the node is configured to receive a data change request, where the data change request includes a data record number and a corresponding data status; obtain the latest data number according to the current data number and a preset number formation rule, obtain data operation records according to the latest data number and the data change request, and broadcast them to other nodes of the blockchain; and receive a data sharing request transmitted by a terminal. The data sharing request includes a terminal data number, determine unsynchronized data operation records according to the terminal data number and the latest data number, and transmit the unsynchronized data operation records to the terminal;
[0038] The terminal is configured to receive the unsynchronized data operation records transmitted by the node, and update the data status of the data record number corresponding to the unsynchronized data operation records.
[0039] The present invention also discloses a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0040] When the processor executes the program, the above-mentioned method is implemented.
[0041] The present invention also discloses a computer-readable medium, on which a computer program is stored,
[0042] When the program is executed by a processor, the above-described method is implemented.
[0043] In the data sharing method of the present invention, after a blockchain node receives a data change request, it obtains the latest data number according to the current data number of the node and a preset number formation rule, and forms a data operation record by corresponding the latest data number with the data change request. Then, based on the broadcast function of the blockchain, the data operation record is broadcast to other nodes of the blockchain. When a node of the blockchain receives a data sharing request, it determines that all data numbers after the terminal data number in the data sharing request are unsynchronized data numbers according to the terminal data number and the latest data number. Then, the unsynchronized data operation records corresponding to the unsynchronized data numbers are transmitted to the terminal, and the terminal can process the data records according to the unsynchronized data operation records to update the data status corresponding to the data record numbers. Therefore, when sharing data through the blockchain in the present invention, the blockchain node generates a unified data code. Each terminal perceives the change of the data operation record by determining the change of the data code, so as to timely obtain the operation of the data status of the data record, can timely obtain the data shared by other terminals through the blockchain, reduce the information acquisition cost, improve the response speed, and avoid repeated triggering of business processes. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings without creative efforts based on these drawings.
[0045] Figure 1 Show the structural diagram of the existing blockchain-based data sharing system;
[0046] Figure 2 Show Figure 1 The data sharing flowchart of the blockchain-based data sharing system;
[0047] Figure 3 Show the flowchart of a specific embodiment (the execution subject is a node) of the blockchain-based data sharing method of the present invention;
[0048] Figure 4 Show the flowchart of a specific example of the blockchain-based data sharing method of the present invention;
[0049] Figure 5The flowchart showing a specific embodiment of the blockchain-based data sharing method of the present invention (the execution entity is a terminal);
[0050] Figure 6 The structural diagram showing a specific embodiment of a node of the present invention;
[0051] Figure 7 The structural diagram showing a specific embodiment of a terminal of the present invention;
[0052] Figure 8 The schematic structural diagram of a computer device suitable for implementing the embodiments of the present invention. Specific embodiments
[0053] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0054] Figure 1 The schematic diagram showing the principle of existing blockchain data sharing is shown. The existing blockchain-based data sharing system includes a cooperative institution terminal 1, a blockchain network 2, and a wireless / wired network 3.
[0055] Among them, the cooperative institution terminal 1 processes the shared business data according to its own business logic and shares it on the chain; at the same time, it accesses the blockchain network to obtain the shared business data of other institutions required for business operations. The blockchain network 2 includes multiple nodes (to ensure meeting the fault tolerance requirements of the Byzantine algorithm, at least four are required). Each node is connected to each other. Each accessing cooperative institution can deploy one or more nodes. All nodes are responsible for receiving and forwarding information and verifying all received information. If the information received by 2n + 1 nodes is consistent, the information passes the verification and reaches a consensus in the entire blockchain. Each node then executes the smart contract respectively to enter the received information into the chain. The wireless / wired network 3 is a wireless communication network or an INTERNET communication network provided by the operator.
[0056] Figure 2The flowchart shows the existing process of data sharing among collaborating institutions based on blockchain. In this specific example, an approval system collaborates with multiple banks to disburse funds after approval, which includes the following steps: (1) Approval agency A approves the disbursement records according to its own business process. After approval, the disbursement records are grouped according to the disbursing bank and shared on the blockchain; (2) The disbursing bank corresponding to the disbursement record (assumed to be Bank B) performs the actual disbursement operation in its own banking system after obtaining the corresponding disbursement record on the blockchain. After the disbursement is completed, the disbursement result is updated on the blockchain. For records with disbursement failures, the disbursement may be redone and the latest result uploaded to the blockchain; (3) Approval agency A obtains the latest disbursement result from the blockchain and notifies the relevant personnel in the approval process according to the business logic.
[0057] The existing data sharing process specifically includes the following steps:
[0058] Step 201 -> The initial state on the blockchain is empty data.
[0059] Step 202 -> Approval agency A completes the approval process, generates disbursement data to be processed, and shares the disbursement data that needs to be disbursed by Bank B on the blockchain.
[0060] Step 203 -> The blockchain modifies the current state of the data record (there are 5 disbursement data records to be processed).
[0061] Step 204 -> Bank B obtains the disbursement data to be processed and performs the disbursement in its banking system.
[0062] Step 205 -> Bank B completes the disbursement of some of the disbursement records and shares the result on the blockchain.
[0063] Step 206 -> The blockchain modifies the current state of the data record (there are 3 disbursement data records to be processed and 2 disbursement data records with results).
[0064] Step 207 -> Approval agency A polls all the disbursement data records, obtains all the updated status records (at this time, 2 disbursement data records with results will be obtained), and performs corresponding processing according to its own business logic.
[0065] Step 208 -> Bank B completes the disbursement of some of the disbursement records and shares the result on the blockchain.
[0066] Step 209 -> The blockchain modifies the current state of the data record (there are 5 disbursement data records with results, and the result of one record is updated this time).
[0067] In step 2010, the approval authority A polls all appropriation data records at each time interval. It obtains all the records with updated status (after step 209 occurs, 3 appropriation records with existing results and 1 appropriation record with updated results will be obtained), and makes corresponding processing according to its own business logic.
[0068] It can be seen from this that in the existing data sharing among multiple banking institutions based on blockchain, due to the delay of cross-bank appropriation in bank appropriation, banks may update the existing appropriation results on the blockchain. Since the approval authority A cannot know which records are the ones with newly updated appropriation results, in the continuously repeated step 2010, it is necessary to scan all appropriation data each time to confirm. If there are a large number of appropriation records to be processed at this time, a large amount of cost will be consumed each time step 2010 is executed. In order to solve the problem that the consortium blockchain in the prior art needs to poll multiple times to determine data changes in data sharing, the present invention simultaneously generates a set of unified unique codes for each piece of data shared by each institution; when each cooperating institution changes the data record in its own system, it does not send the calculation result to the blockchain, but sends the operation process; and the cooperating institution using the data record maintains a code table in its own system, polls the latest operation process data on the blockchain according to the code table, and after obtaining it in its own system, checks if the data change caused by this process meets its own business trigger condition, and then processes it according to the agreed process.
[0069] According to one aspect of the present invention, this embodiment discloses a data sharing method based on blockchain. As Figure 3 shown, in this embodiment, the method includes:
[0070] S100: Receive a data change request, where the data change request includes a data record number and the corresponding data status.
[0071] S200: Obtain the latest data number according to the current data number and the preset number formation rule, obtain a data operation record according to the latest data number and the data change request, and broadcast it to other nodes of the blockchain.
[0072] S300: Receive a data sharing request transmitted by a terminal, where the data sharing request includes a terminal data number, determine unsynchronized data operation records according to the terminal data number and the latest data number, and transmit the unsynchronized data operation records to the terminal so that the terminal updates the data status of the data record number corresponding to the unsynchronized data operation records.
[0073] In the data sharing method of the present invention, after a blockchain node receives a data change request, it obtains the latest data number according to the current data number of the node and the preset number formation rule, and forms a data operation record by corresponding the latest data number with the data change request. Then, based on the broadcast function of the blockchain, the data operation record is broadcast to other nodes of the blockchain. When a node of the blockchain receives a data sharing request, it determines that all data numbers after the terminal data number in the data sharing request are unsynchronized data numbers according to the terminal data number and the latest data number. Then, the unsynchronized data operation records corresponding to the unsynchronized data numbers are transmitted to the terminal, and the terminal can process the data records according to the unsynchronized data operation records to update the data status corresponding to the data record numbers. Therefore, when the present invention shares data through the blockchain, the blockchain node generates a unified data code. Each terminal perceives the change of the data operation record by determining the change of the data code, so as to timely obtain the operation of the data status of the data record, can timely obtain the data shared by other terminals through the blockchain, reduce the information acquisition cost, improve the response speed, and avoid repeated triggering of the business process.
[0074] In a preferred embodiment, the method further includes S000 before receiving the data change request transmitted by the first terminal:
[0075] S010: Receive the initial data record transmitted by the terminal, where the initial data record includes a data record number and transaction information.
[0076] S020: Use the data record number as the key and the transaction information as the value to form an initial data record number and store it in a data record table in key-value format.
[0077] It can be understood that, in order to achieve the purpose of data sharing where only the data record numbers that require upload operations and the corresponding data status obtained after the operations are needed during the data sharing process. Before receiving a data change request, it is necessary to pre-store the relevant transaction information corresponding to the data record numbers on the blockchain. For example, when a banking institution receives a customer's loan business, it needs to share the loan business with other banking institutions through the blockchain for approval. Then the banking institution can form a data record number and transaction information for this loan business. Among them, the transaction information may include information such as the creditor's account, debtor's account, and amount. The data record number can be obtained according to a preset data record number formation rule and the current latest data record number on the blockchain. Thus, when other banking institutions need to synchronize the transaction information of this loan business on the blockchain to the local, they can determine which loan business transaction information has not been synchronized to the local based on the local data record number and the updated data record number on the blockchain, and thus only need to obtain the transaction information of this part of the loan business that has not been synchronized to the local from the blockchain to achieve data sharing of the loan business, with fast sharing speed and high efficiency. And the key-value storage form has the characteristics of fast query speed, large amount of stored data, and support for high concurrency when a large amount of business data needs to be stored, and is very suitable for querying through the primary key. Therefore, in the current banking business data storage, a key-value form of table is usually used for storage.
[0078] In a preferred embodiment, the data initial record further includes the initial state corresponding to the data record number, and the method further includes:
[0079] S030: Obtain the latest data number according to the current data number and a preset number formation rule;
[0080] S040: Use the latest data number as the key, and the data record number and the initial state as the values to form an initial data operation record and store it in a data operation record table in key-value format.
[0081] It is understandable that when a data record is established, a data operation record of the data record can be formed simultaneously. For a simple transaction that can be completed in a short time on a terminal, a data operation record can be directly established for the data record according to the initial data record transmitted by the terminal, avoiding repeated information interaction and improving data sharing efficiency. For example, in a specific example, when a banking institution receives a loan business application, it can form a data record number and transaction information. At the same time, when the loan business needs to be approved by other banking institutions, the initial status of "pending approval" can be set in the initial data record, and other banking institutions can obtain the loan business through blockchain sharing. In another specific example, if the banking institution has approved the loan business application after receiving it, the initial status of "approval successful" can be set in the initial data record. Then, the upload of the loan business data record and the data operation record can be completed simultaneously through the initial data record, reducing the number of blockchain accesses during data sharing and improving the sharing efficiency.
[0082] In a preferred embodiment, the obtaining of the data operation record according to the latest data number and the data change request specifically includes:
[0083] Taking the latest data number as the key, and taking the data record number and the corresponding data status as the values to form a data operation record and store it in a key-value format data operation record table.
[0084] It is understandable that usually, the amount of data in the data operation record is huge. For the storage of the data operation record, it is also preferably stored in a key-value storage form. The key-value storage form has the characteristics of fast query speed, large data storage capacity, and support for high concurrency when a large amount of business data needs to be stored, and is very suitable for querying through the primary key. Therefore, a key-value format data operation record table can be formed to store the data operation record formed by each operation.
[0085] In a preferred embodiment, the method further includes:
[0086] S050: Receive a data record synchronization request transmitted by the terminal, where the data record synchronization request includes a terminal data record number.
[0087] S060: Obtain the unsynchronized data record numbers according to the terminal data record number and the latest data record number in the data record table.
[0088] S070: Transmit the unsynchronized data record numbers and the corresponding transaction information to the terminal.
[0089] It can be understood that the terminal can synchronize the data records stored on the blockchain to the local by sending a data record synchronization request to the blockchain node. Similarly, by uniformly numbering all data records in the form of setting a unified data record number, the data record number of the bank institution terminal is compared with the latest data record number on the blockchain, and the data record number formation rule is combined to obtain the data record numbers that have not been synchronized. Then, only the data record numbers that have not been synchronized and the corresponding transaction information need to be synchronized to the local, and data record sharing can be achieved without comparing all data. For example, when a bank institution receives a customer's loan business, it needs to share the loan business through the blockchain to other bank institutions for approval. Then the bank institution can form a data record number and transaction information for the loan business. The data record number can be obtained according to the preset data record number formation rule and the current latest data record number on the blockchain. Thus, when other bank institutions need to synchronize the transaction information of the loan business on the blockchain to the local, they can determine which loan business transaction information has not been synchronized to the local based on the local data record number and the updated data record number on the blockchain, and only need to obtain the transaction information of the part of the loan business that has not been synchronized to the local from the blockchain to achieve data sharing of the loan business, with fast sharing speed and high efficiency.
[0090] The following will specifically describe the present invention with reference to specific examples in the accompanying drawings: For Figure 1 For the system shown, the cooperative institution terminal 1 processes the shared business data according to its own business logic and shares it on the chain; at the same time, it accesses the blockchain network to obtain the shared business data of other institutions required for business operations. The blockchain network 2 includes multiple nodes (preferably, to ensure meeting the fault tolerance requirements of the Byzantine algorithm, at least four nodes can be set). Each node is connected to each other. Each accessed cooperative institution can deploy one or more nodes. All nodes are responsible for receiving and forwarding information and verifying all received information. If the information received by 2n + 1 nodes is consistent, the information passes the verification and reaches a consensus in the entire blockchain. Each node then executes its own smart contract to record the received information on the chain. The wireless / wired network 3 is a wireless communication network or an INTERNET communication network provided by the operator.
[0091] According to the business requirements of their respective systems, the cooperative institution terminals process and maintain the data on their own systems, and can share the data records, numbers, and data status of the data records on the chain; at the same time, they regularly scan the data status of the data records of other partners in the number operation record table and perform corresponding business processing. The cooperative institution terminals can also maintain the data number and the step size n, that is, the number of data operation records obtained. Each time it starts working, it queries the number operation record table to obtain the current maximum number n0, and then calculates the data number of the data records obtained this time as (n0 + 1, n0 + n) according to the number step size n, and uses this as a parameter to obtain the data status of the data records from n0 + 1 to n0 + n on the blockchain and records them in the operation record table. If the latest data number obtained this time is equal to the maximum data number of the acquisition request, then obtain a new maximum number n1 = n0 + n, and obtain the next batch of data again with the parameters (n0 + n + 1, n0 + n + n), and repeat this process until the maximum number obtained in the current acquisition is less than the maximum number of the acquisition request. After that, the above work process can be repeated again after setting the time interval Time0.
[0092] All nodes in the blockchain network are used to receive the data operation records v obtained from the data records of each cooperative institution and the data status after data operations, obtain the current latest data number n, and record the data in the form of {key: n, value: v}. The node can receive a data sharing request, check the maximum data number n on the current chain, record and return the data operation record corresponding to the updated data number n + 1. If the current data number n + 1 does not exist, then return 1. The node can also receive data query requests from each cooperative institution, form a key according to the start and end data numbers (n~n') sent up, and obtain and return the corresponding value.
[0093] Figure 4 The flowchart shows a multi-institution interaction method based on blockchain unified coding adopted by cooperative institutions, and the process of data sharing and collaboration through the blockchain includes the following steps:
[0094] Step 501 -> The initial state on the blockchain is empty data.
[0095] Step 502 -> The approval institution A completes the approval process, generates the data to be allocated, and shares the data records that need to be allocated by Bank B and the allocated data status of the data to be allocated on the blockchain through a data change request.
[0096] Step 503 -> The blockchain modifies the current status of the data record (there are 5 data records to be allocated). For example, for the newly arrived allocated data, set a data record number for the data record, and form a data record table with the data record number as the key and the debit account, credit account, amount, and data status of the data record as the value.
[0097] Step 504 -> Bank B obtains the data to be allocated and makes the allocation in the banking system.
[0098] Step 505 -> Bank B completes the allocation of some allocation records and shares the result to the blockchain.
[0099] Step 506 -> The blockchain modifies the current status of the data record (adds 2 data operation records, and updates the latest data number to 2). That is, in the operation record table, the latest data number is obtained according to the current data number and the preset number formation rule. Using the latest data number as the key and the data status and data record as the value, data operation records are formed.
[0100] Step 507 -> Approval agency A checks whether the latest data number on the blockchain is larger than the local one according to the local current data number (the local current data number is 0).
[0101] Step 508 -> It is checked that there is a larger latest data number. Approval agency A obtains the data operation records with data numbers 1 - 2, makes corresponding processing according to its own business logic, and updates the local current result data number to 2.
[0102] Step 509 -> Bank B completes the allocation of some allocation records and shares the result to the blockchain.
[0103] Step 510 -> The blockchain modifies the current status of the data record. Similarly, the blockchain node obtains the latest data numbers 3 - 6 according to the current data number (2) and the preset number formation rule in the operation record table. Using the latest data number as the key and the data status and data record as the value, data operation records are formed. In this step, 4 data operation records are added and the latest data number is updated to 6.
[0104] Step 511 -> Every time a time interval passes, approval agency A checks whether the latest data number on the blockchain is larger than the local one according to the local current data number (the current local result data number is 2).
[0105] Step 512 -> It is checked that there is a larger data number. Approval agency A obtains the data operation records with data numbers 3 - 6, makes corresponding processing according to its own business logic, and updates the local current data number to 6.
[0106] In Figure 4 the process shown, approval agency A can, in step 511, only check the latest data number on the blockchain each time to know whether there is an updated allocation result record (data operation record), without scanning all the data. In addition, by Figure 4From the one-to-one interaction scenario shown, if there are multiple institutions interacting (such as multiple approval institutions), each approval institution can obtain the latest appropriation result record for itself according to the data numbers maintained locally.
[0107] In summary, the blockchain node of the present invention only needs to perform unified data encoding when modifying and sharing the data records sent by the institutional terminal, without excessive additional costs. The unified encoding method also solves the problem that time on the blockchain cannot be used as a standard for sequence. Moreover, taking the unified global number generated by the blockchain as the standard, each cooperating institution can obtain and process only the data operation records that its own system has not obtained each time. Compared with the traditional polling process for the data records themselves, when the amount of data records is large, the present invention will save a large amount of data acquisition costs. In addition, each cooperating institution can adjust the time interval for obtaining data operation records according to its own business needs, so as to ensure that each institution can timely obtain the changes in the data operation records of the data records.
[0108] Based on the same principle, this embodiment also discloses a data sharing method based on blockchain. As Figure 5 shown, in this embodiment, the method includes:
[0109] S400: Send a data sharing request to the blockchain node, where the data sharing request includes a terminal data number, so that the node determines the unsynchronized data operation records according to the terminal data number and the latest data number. The unsynchronized data operation records are obtained by the node receiving a data change request, where the data change request includes a data record number and a corresponding data status, obtaining the latest data number according to the current data number and a preset number formation rule, and obtaining according to the latest data number and the data change request.
[0110] S500: Receive the unsynchronized data operation records transmitted by the node, and update the data status of the data record number corresponding to the unsynchronized data operation records.
[0111] In a preferred implementation manner, the method further includes:
[0112] S610: Transmit a data record synchronization request to the blockchain node, where the data record synchronization request includes a terminal data record number, so that the node obtains the unsynchronized data record numbers according to the terminal data record number and the latest data record number in the data record table;
[0113] S620: Receive the unsynchronized data record numbers and the corresponding transaction information transmitted by the node.
[0114] In a preferred embodiment, updating the data status of the data record number corresponding to the unsynchronized data operation record specifically includes:
[0115] S510: Obtaining the unsynchronized data record number according to the unsynchronized data operation record;
[0116] S520: Modifying the initial status of the unsynchronized data record number in the terminal to the data status.
[0117] Since the principle of this method for solving problems is similar to the above method, the implementation of this method can refer to the implementation of the method and will not be elaborated here.
[0118] Based on the same principle, this embodiment also discloses a node. As Figure 6 shown, in this embodiment, the node includes a request receiving unit 11, an operation record unit 12, and a data sharing unit 13.
[0119] Among them, the request receiving unit 11 is used to receive a data change request, and the data change request includes a data record number and a corresponding data status.
[0120] The operation record unit 12 is used to obtain the latest data number according to the current data number and a preset number formation rule, obtain a data operation record according to the latest data number and the data change request, and broadcast it to other nodes of the blockchain.
[0121] The data sharing unit 13 is used to receive a data sharing request transmitted by the terminal, the data sharing request includes a terminal data number, determine an unsynchronized data operation record according to the terminal data number and the latest data number, and transmit the unsynchronized data operation record to the terminal so that the terminal updates the data status of the data record number corresponding to the unsynchronized data operation record.
[0122] Since the principle of this node for solving problems is similar to the above method, the implementation of this node can refer to the implementation of the method and will not be elaborated here.
[0123] Based on the same principle, this embodiment also discloses a terminal. As Figure 7 shown, in this embodiment, the terminal includes a request sending unit 21 and a data updating unit 22.
[0124] The request sending unit 21 is configured to send a data sharing request to a blockchain node. The data sharing request includes a terminal data number, so that the node determines unsynchronized data operation records according to the terminal data number and the latest data number. The unsynchronized data operation records are obtained when the node receives a data change request, the data change request includes a data record number and a corresponding data status, obtains the latest data number according to the current data number and a preset number formation rule, and obtains according to the latest data number and the data change request.
[0125] The data update unit 22 is configured to receive the unsynchronized data operation records transmitted by the node and update the data status of the data record number corresponding to the unsynchronized data operation records.
[0126] Since the principle of this terminal for solving problems is similar to the above method, the implementation of this terminal can refer to the implementation of the method and will not be elaborated here.
[0127] Based on the same principle, this embodiment also discloses a blockchain-based data sharing system. The system includes a blockchain and multiple terminals, and the blockchain includes multiple nodes.
[0128] Among them, the node is configured to receive a data change request, the data change request includes a data record number and a corresponding data status; obtain the latest data number according to the current data number and a preset number formation rule, obtain data operation records according to the latest data number and the data change request and broadcast them to other nodes of the blockchain; and receive a data sharing request transmitted by a terminal, the data sharing request includes a terminal data number, determine unsynchronized data operation records according to the terminal data number and the latest data number, and transmit the unsynchronized data operation records to the terminal.
[0129] The terminal is configured to receive the unsynchronized data operation records transmitted by the node and update the data status of the data record number corresponding to the unsynchronized data operation records.
[0130] Since the principle of this system for solving problems is similar to the above method, the implementation of this system can refer to the implementation of the method and will not be elaborated here.
[0131] The systems, devices, modules or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer device. Specifically, the computer device can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0132] In a typical example, a computer device specifically includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method executed by the client as described above, or when the processor executes the program, it implements the method executed by the server as described above.
[0133] The following refers to Figure 8 , which shows a schematic structural diagram of a computer device 600 suitable for implementing the embodiments of the present application.
[0134] As Figure 8 shown, the computer device 600 includes a central processing unit (CPU) 601, which can perform various appropriate operations and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage section 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0135] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as required. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as required so that a computer program read from it can be installed in the storage section 608 as required.
[0136] Specifically, according to the embodiments of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication section 609, and / or installed from the removable medium 611.
[0137] A computer-readable medium includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information accessible by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0138] For convenience of description, when describing the above devices, they are divided into various units according to their functions and described separately. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0139] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0140] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0141] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so as to cause a series of operation steps to be executed on the computer or other programmable apparatus to generate computer-implemented processing, thereby providing instructions for implementing the functions specified in one process Figure 1 one process or a plurality of processes and / or blocks Figure 1 steps for the functions specified in one block or a plurality of blocks.
[0142] It should also be noted that the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an ……" does not exclude the presence of additional identical elements in the process, method, commodity or device comprising said element.
[0143] Those skilled in the art should understand that the embodiments of the present application may be provided as a method, a system or a computer program product. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0144] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media including storage devices.
[0145] Each embodiment in this specification is described in a progressive manner, and the same or similar parts among the embodiments may be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, they are described relatively simply, and the relevant parts may refer to the partial description of method embodiments.
[0146] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A data sharing method based on blockchain, characterized in that, comprising: Receiving a data change request, where the data change request includes a data record number and a corresponding data status; Obtaining the latest data number according to the current data number and a preset number formation rule, obtaining a data operation record according to the latest data number and the data change request, and broadcasting it to other nodes of the blockchain; Receiving a data sharing request transmitted by a terminal, where the data sharing request includes a terminal data number, determining unsynchronized data operation records according to the terminal data number and the latest data number, and transmitting the unsynchronized data operation records to the terminal so that the terminal updates the data status of the data record number corresponding to the unsynchronized data operation records; The obtaining a data operation record according to the latest data number and the data change request specifically includes: Using the latest data number as a keyword and the data record number and the corresponding data status as values to form a data operation record and store it in a data operation record table in key-value format.
2. The data sharing method based on blockchain according to claim 1, characterized in that, further comprising, before receiving a data change request transmitted by a first terminal: Receiving a data initial record transmitted by a terminal, where the data initial record includes a data record number and transaction information; Using the data record number as a keyword and the transaction information as a value to form an initial data record number and store it in a data record table in key-value format.
3. The data sharing method based on blockchain according to claim 2, characterized in that, the data initial record further includes an initial status corresponding to the data record number, and the method further comprises: Obtaining the latest data number according to the current data number and a preset number formation rule; Using the latest data number as a keyword and the data record number and the initial status as values to form an initial data operation record and store it in a data operation record table in key-value format.
4. The data sharing method based on blockchain according to claim 2, characterized in that, further comprising: Receiving a data record synchronization request transmitted by a terminal, where the data record synchronization request includes a terminal data record number; Obtaining unsynchronized data record numbers according to the terminal data record number and the latest data record number in the data record table; Transmitting the unsynchronized data record numbers and the corresponding transaction information to the terminal.
5. A data sharing method based on blockchain, characterized in that, comprising: Send a data sharing request to the blockchain node, where the data sharing request includes a terminal data number, so that the node determines unsynchronized data operation records according to the terminal data number and the latest data number. The unsynchronized data operation records are obtained when the node receives a data change request, where the data change request includes a data record number and a corresponding data status, and the latest data number is obtained according to the current data number and a preset number formation rule. The data operation record is obtained according to the latest data number and the data change request; The data operation record obtained according to the latest data number and the data change request includes: using the latest data number as the key, and the data record number and the corresponding data status as the values to form a data operation record and store it in a key-value format data operation record table; Receive the unsynchronized data operation record transmitted by the node, and update the data status of the data record number corresponding to the unsynchronized data operation record.
6. The blockchain-based data sharing method according to claim 5, wherein, further comprising: Transmit a data record synchronization request to the blockchain node, where the data record synchronization request includes a terminal data record number, so that the node obtains an unsynchronized data record number according to the terminal data record number and the latest data record number in the data record table; Receive the unsynchronized data record number and the corresponding transaction information transmitted by the node.
7. The blockchain-based data sharing method according to claim 5, wherein, The step of updating the data status of the data record number corresponding to the unsynchronized data operation record specifically includes: Obtain the unsynchronized data record number according to the unsynchronized data operation record; Modify the initial status of the unsynchronized data record number in the terminal to the data status.
8. A node, wherein, comprising: A request receiving unit, configured to receive a data change request, where the data change request includes a data record number and a corresponding data status; An operation record unit, configured to obtain the latest data number according to the current data number and a preset number formation rule, obtain a data operation record according to the latest data number and the data change request, and broadcast it to other nodes in the blockchain; The obtaining of the data operation record according to the latest data number and the data change request includes: using the latest data number as the key, and the data record number and the corresponding data status as the values to form a data operation record and store it in a key-value format data operation record table; A data sharing unit, configured to receive a data sharing request transmitted by a terminal, where the data sharing request includes a terminal data number, determine unsynchronized data operation records according to the terminal data number and the latest data number, and transmit the unsynchronized data operation records to the terminal so that the terminal updates the data status of the data record number corresponding to the unsynchronized data operation record.
9. A terminal, wherein, comprising: A request sending unit, configured to send a data sharing request to a blockchain node, where the data sharing request includes a terminal data number, so that the node determines unsynchronized data operation records according to the terminal data number and the latest data number, and the unsynchronized data operation records are that the node receives a data change request, the data change request includes a data record number and a corresponding data status, and the latest data number is obtained according to the current data number and a preset number formation rule, and the data operation record is obtained according to the latest data number and the data change request; The data operation record is obtained according to the latest data number and the data change request, including: using the latest data number as a keyword, and using the data record number and the corresponding data status as values to form a data operation record and store it in a key-value format data operation record table; A data update unit, configured to receive the unsynchronized data operation records transmitted by the node, and update the data status of the data record number corresponding to the unsynchronized data operation records.
10. A blockchain-based data sharing system, characterized in that, it includes a blockchain and multiple terminals, and the blockchain includes multiple nodes; wherein, the node is configured to receive a data change request, the data change request includes a data record number and a corresponding data status; obtain the latest data number according to the current data number and a preset number formation rule, obtain a data operation record according to the latest data number and the data change request and broadcast it to other nodes of the blockchain; and receive a data sharing request transmitted by a terminal, the data sharing request includes a terminal data number, determine unsynchronized data operation records according to the terminal data number and the latest data number, and transmit the unsynchronized data operation records to the terminal; The obtaining the data operation record according to the latest data number and the data change request includes: using the latest data number as a keyword, and using the data record number and the corresponding data status as values to form a data operation record and store it in a key-value format data operation record table; The terminal is configured to receive the unsynchronized data operation records transmitted by the node, and update the data status of the data record number corresponding to the unsynchronized data operation records.
11. A computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, when the processor executes the program, it implements the method according to any one of claims 1-7.
12. A computer-readable medium, on which a computer program is stored, characterized in that, when the program is executed by a processor, it implements the method according to any one of claims 1-7.
Citation Information
Patent Citations
Data sharing method and device based on block chain, computer equipment and storage medium
CN110868424A
Data synchronization method and system based on block chain
CN111078700A