WO2020232885A1 - 数据入链事务处理方法、装置、计算机设备及存储介质 - Google Patents
数据入链事务处理方法、装置、计算机设备及存储介质 Download PDFInfo
- Publication number
- WO2020232885A1 WO2020232885A1 PCT/CN2019/103172 CN2019103172W WO2020232885A1 WO 2020232885 A1 WO2020232885 A1 WO 2020232885A1 CN 2019103172 W CN2019103172 W CN 2019103172W WO 2020232885 A1 WO2020232885 A1 WO 2020232885A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- verification node
- business data
- service data
- writing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/12—Applying verification of the received information
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/12—Applying verification of the received information
- H04L63/123—Applying verification of the received information received data contents, e.g. message integrity
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- This application relates to the field of blockchain technology, and in particular to a method, device, computer equipment, and storage medium for processing data in-chain transactions.
- blockchain technology has gradually matured and is used in various industries. Especially in the trade industry, blockchain technology can effectively solve the problem of transaction trust and greatly promote the development of the trade industry.
- the number of transaction orders is huge, the transactions are frequent, and the transaction currencies are diverse, and the resulting business data often appears abnormal.
- it is usually first to perform the blockchain write chain operation, then perform the database write database operation, and finally perform the communication operation, but when the database write database or communication operation is abnormal, the block needs to be notified The chain performs data rollback. At this time, because the blockchain fails to increase transaction processing, there will be a problem of dirty data.
- the embodiments of the present application provide a method, device, computer equipment, and storage medium for processing data in-chain transactions, aiming to solve the problem of dirty data due to the failure of the blockchain to increase transaction processing when the data in-chain is abnormal.
- the embodiment of the present application provides a data in-chain transaction processing method, which includes: if it is detected that a user has newly added service data, verifying the service data; if the service data verification passes, checking The business data is written to a preset database; if no abnormality occurs when the business data is written to the preset database, the business data is sent to a verification node and the verification node confirms the business data; if No abnormality occurs when sending the business data to the verification node, and the block confirmed by the verification node is written to the blockchain; if the business data is written to the preset database, an abnormality occurs or the business data is changed An abnormality occurs when sending to the verification node or writing the block confirmed by the verification node to the blockchain occurs abnormally, and the business data is rolled back to the state before the newly added business data.
- the embodiment of the present application also provides a data in-chain transaction processing device, which includes: a verification unit, configured to verify the service data if the user newly added service data is detected; and a library writing unit , For writing the business data to a preset database if the business data is verified; a sending unit, for writing the business data if no abnormality occurs in writing the business data to the preset database Send to the verification node to confirm the business data by the verification node; the write chain unit is used to write the block confirmed by the verification node if no abnormality occurs when the business data is sent to the verification node Blockchain; a rollback unit, used if an abnormality occurs when the business data is written to the preset database or the business data is sent to the verification node is abnormal or the block confirmed by the verification node is written to The block chain is abnormal, and the business data is rolled back to the state before the newly added business data.
- a verification unit configured to verify the service data if the user newly added service data is detected
- a library writing unit For writing the business
- an embodiment of the present application also provides a computer device, which includes a memory and a processor, and a computer program is stored on the memory.
- a computer device which includes a memory and a processor, and a computer program is stored on the memory.
- the processor executes the computer program, the computer program described in the first aspect is implemented. method.
- embodiments of the present application also provide a computer-readable storage medium, where the storage medium stores a computer program, and the computer program, when executed by a processor, can implement the method described in the first aspect.
- FIG. 1 is a schematic diagram of an application scenario of a data in-chain transaction method provided by an embodiment of the application
- FIG. 2 is a schematic flowchart of a method for processing data in-chain transactions provided by an embodiment of the application
- FIG. 3 is a schematic diagram of a sub-flow of the method for processing data in-chain transactions provided by an embodiment of the application;
- FIG. 4 is a schematic diagram of a sub-flow of a method for processing data in-chain transactions provided by an embodiment of the application;
- FIG. 5 is a schematic diagram of a sub-flow of the method for processing data in-chain transactions provided by an embodiment of the application;
- Fig. 6 is a schematic diagram of a sub-flow of the data in-chain transaction processing method provided by an embodiment of the application
- FIG. 7 is a schematic block diagram of a data in-chain transaction processing device provided by an embodiment of the application.
- Fig. 8 is a schematic block diagram of specific units of the data in-chain transaction processing device provided by an embodiment of the application.
- FIG. 9 is a schematic block diagram of a computer device provided by an embodiment of the application.
- FIG. 1 is a schematic diagram of an application scenario of a data in-chain transaction processing method provided by an embodiment of the application.
- FIG. 2 is a schematic flowchart of a method for processing data in-chain transactions provided by an embodiment of the application.
- the data in-chain transaction processing method is applied to the terminal 10 and is implemented through interaction between the terminal 10 and the server 20.
- the transaction processing method for blockchain data entry proposed in this application is applied to a blockchain-based trading platform.
- FIG. 2 is a schematic flowchart of a data in-chain transaction processing method provided by an embodiment of the present application. As shown in the figure, the method includes the following steps S110-S150.
- business data refers to data generated by a series of operations performed by users on orders in the trading platform, such as adding orders, deleting orders, and modifying orders.
- Verification refers to verifying the legality and integrity of the user's new service data.
- a user adds an order in the trading platform. You first need to log in to the account, enter the order-related information in the account and confirm the order.
- the system detects the business data submitted by the user, it will immediately perform the verification of the legality and integrity of the business data. Test.
- the verification of the business data is performed before the transaction processing of the data entering the chain. If the verification of the business data is passed, the transaction of the data entering the chain can be executed. If the verification of the business data fails, the return is performed and the user performs the operation again.
- the step S110 may include steps: S111-S113.
- the user tag refers to information used to identify the user's identity, that is, a cookie, which includes the user account and password, for example, DJ001, password: 123456, and the user identifier can distinguish the identity of each user.
- the user tag is submitted along with the business data.
- the received user tag is compared with the account and password of the corresponding user stored in the database to determine the new business Whether the user label of the user of the data is consistent with the user account and password stored in the database, if it is consistent, it means that the business data is added by the user, and the business data is determined to be legal; if it is inconsistent, it means that the business data was not added by the user.
- the business data is determined to be illegal.
- S112 Check the integrity of the service data according to a preset rule.
- the preset rule refers to a verification rule for the integrity of business data. Since data will be affected by various interferences during transmission, such as impulse interference, random noise interference and man-made interference, which will cause data errors, in order to be able to control errors in the transmission process, it is necessary to check the integrity of the data. check.
- the main method of verification is to calculate a verification value for the submitted business data through a specified algorithm. When the business data is received, the verification value is calculated once through the same algorithm. If the verification value is calculated twice If the data is the same, it means that the data is complete and the service data is complete.
- the check algorithm can be any of parity check, CRC cyclic redundancy check, or MD5 check.
- the preset database refers to a database of a trading platform, and is used to store business data generated in the trading platform.
- the business data in-chain transaction can be executed.
- the first step is to write the database operation, write the newly added business data to the database for storage, and check whether it is in the process of writing the database. An exception occurs. For example, if the order amount is modified and the order amount is increased from 500,000 to 1 million, then the modified order amount of 1 million will be replaced by the order amount of 500,000 in the preset database and stored.
- the step S120 may include steps S121-S122.
- the unique constraint refers to ensuring that the data in a field or a group of fields is unique compared to the data in other rows in the table.
- the business data is stored in the preset database in the form of a table. If the new business data is written into the preset database and the unique constraint violation occurs, it means that the new business data is not unique in the table of the preset database. A duplicate value was entered. For example, an X order already exists in the preset database, and the user adds a new X order. When the newly added X order is written to the preset database, the unique constraint exception is violated, and the write failure judgment is abnormal.
- the verification node refers to a node in the blockchain network that is used to confirm that the service data is valid.
- the second step of communication is performed, that is, the service data is sent to the server, and other verification nodes confirm the validity of the service data after receiving the service data. Since the service data may be unsuccessfully sent during the sending process, it is necessary to determine whether the service data is successfully sent to the verification node during the communication operation.
- the business data Before the business data is sent to the verification node, the business data needs to be encrypted. Specifically, the business data is encrypted according to the user's pre-configured private key. After the verification node receives the business data, it is decrypted by the public key corresponding to the private key. Confirm business data.
- the private key refers to the key distributed through the asymmetric encryption algorithm.
- the asymmetric encryption algorithm uses two different keys when encrypting and decrypting, called the public key and the private key, which are encrypted by the public key. Only the private key can decrypt the data, and only the public key can decrypt the data encrypted by the private key.
- the private key is generated by a random number algorithm.
- the public key is generated according to the private key.
- the public key and the private key are distributed in pairs.
- the public key is public, and the private key is privately held and tightly protected. Each user is pre-configured with a pair of public keys. Key and private key.
- the step S130 may include steps: S131-S133.
- too much data volume of the service data causes the sending timeout, or the communication node is paralyzed and the communication connection is disconnected and the data cannot be transmitted. These reasons all cause the service data sending failure.
- the server will return a successful sending message. Therefore, if there is no response within a certain period of time and the successful sending message returned by the server is not received, it means that the sending of the service data has failed. At this time, a prompt message is generated to prompt the user to reconnect to the network again.
- Send business data Count the number of user failures to resend service data. When the number of failures to resend service data reaches a preset threshold, it is determined that an abnormality has occurred.
- the preset threshold is 3 times. Of course, it can be understood that it can also be other arbitrary settings. The number of times.
- the verification node after the verification node receives the business data, it decrypts the business data according to the public key disclosed by the user to verify the identity of the user and the integrity of the business data. After the verification is passed, the business data is confirmed through a consensus mechanism. .
- the consensus mechanism refers to how each verification node in the blockchain network reaches a consensus to confirm that the block is valid.
- the verification node completes the proof of work by packaging the received business data into the block for hash calculation and other verification
- the nodes jointly confirm to obtain a valid block.
- the verification node After the verification node confirms that the block is valid, it receives the block confirmed by the verification node and executes the third step of the write chain operation to write the block into the locally maintained blockchain.
- the step S140 may include steps: S141-S142.
- S141 Determine whether the business data exists in the block confirmed by the verification node.
- the confirmation block broadcasted by the verification node to the blockchain network is received, the third step of write chain operation is performed, and the block confirmed by the verification node is hashed according to the hash algorithm to obtain the block
- the business data compare the business data in the preset database with the data stored in the block to determine whether the data stored in the block has the same data as the business data. If it exists, the business data is verified If the node is confirmed to be valid, it can be written to the locally maintained blockchain; if it does not exist, it means that the business data has not been confirmed by the verification node to be valid, and the dirty data of the blockchain has been generated and cannot be written to the locally maintained blockchain , It is determined that an abnormality has occurred.
- rollback refers to the behavior of restoring the data to the last correct state due to a data processing error. If an exception occurs in the process of database writing, business data sending, communication operation, and blockchain writing, the execution Data rollback restores business data to the state before the user adds new business data. For example, if an exception occurs during the database writing process, the business data will be rolled back in the preset database and restored to the state where no new business data has been added, reducing system performance loss and reducing the dirty data of the blockchain.
- the embodiment of the application provides a method for processing data in-chain transactions, by verifying the service data if it detects that the user has added service data; if the service data is verified, the service data is written To the preset database; if the business data is written to the preset database without exception, the business data is sent to the verification node and the verification node confirms the business data; if the business data is sent When no abnormality occurs to the verification node, write the block confirmed by the verification node to the blockchain; if an abnormality occurs when the business data is written to the preset database or the business data is sent to the verification node, an abnormality occurs Or the block confirmed by the verification node is written to the block chain, and the abnormality occurs, and the business data is rolled back to the state before the new business data.
- This can reduce the number of blocks during the transaction processing of data entry into the chain.
- the dirty data of the chain reduces system performance loss.
- FIG. 7 is a schematic block diagram of a data in-chain transaction processing apparatus 200 provided by an embodiment of the present application.
- the present application also provides a data-in-chain transaction processing device 200.
- the data in-link transaction processing device 200 includes a unit for executing the above-mentioned data in-link transaction processing method, and the device can be configured in a desktop computer, a tablet computer, a laptop computer, and other terminals.
- the data in-chain transaction processing apparatus 200 includes: a verification unit 210, a writing library unit 220, a sending unit 230, a writing chain unit 240, and a rollback unit 250.
- the checking unit 210 is configured to check the service data if it detects that the user has newly added service data.
- the check unit 210 includes: a first check subunit 211, a second check subunit 212 and a determination subunit 213.
- the first check subunit 211 is used to check the legality of the service data according to the user tag.
- the second check subunit 212 is configured to check the integrity of the service data according to preset rules.
- the judging subunit 213 is configured to judge that the service data has passed the verification if the service data is legal and complete.
- the library writing unit 220 is configured to write the service data into a preset database if the service data passes the verification.
- the library writing unit 220 includes: a first determining subunit 221 and a first determining subunit 222.
- the first judging subunit 221 is configured to judge whether writing the service data to the preset database violates the unique constraint.
- the first determination subunit 222 is configured to determine that if writing the business data to the preset database violates the unique constraint, it is determined that an abnormality occurs in writing the business data to the preset database.
- the sending unit 230 is configured to send the service data to a verification node if no abnormality occurs in writing the business data to the preset database, and the verification node will confirm the business data.
- the sending unit 230 includes: a sending judgment unit 231, a second judgment subunit 232, and a second judgment subunit 233.
- the sending judgment unit 231 is configured to judge whether the service data is successfully sent to the verification node.
- the second judging subunit 232 is configured to judge whether the number of failed transmissions of the service data to the verification node reaches a preset threshold if the service data is not successfully sent to the verification node.
- the second determination subunit 233 is configured to determine that if the number of failures of the service sent to the verification node reaches a preset threshold, it is determined that the service data sent to the verification node is abnormal.
- the chain writing unit 240 is configured to write the block confirmed by the verification node to the blockchain if no abnormality occurs in sending the business data to the verification node.
- the write chain unit 240 includes: a third judgment subunit 241 and a third judgment subunit 242.
- the third judgment subunit 241 is configured to judge whether the business data exists in the block confirmed by the verification node;
- the third determining subunit 242 is configured to determine that if the business data does not exist in the block confirmed by the verification node, writing the block confirmed by the verification node to the blockchain is abnormal.
- the rollback unit 250 is used to write the business data to the preset database if an abnormality occurs or the business data is sent to the verification node is abnormal or the block confirmed by the verification node is written to the blockchain When an exception occurs, the business data is rolled back to the state before the newly added business data.
- the foregoing data in-chain transaction processing device may be implemented in the form of a computer program, and the computer program may run on the computer device shown in FIG. 9.
- the computer device 500 may be a terminal, where the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device.
- the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device.
- the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
- the non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032.
- the computer program 5032 includes program instructions. When the program instructions are executed, the processor 502 can execute a data in-chain transaction processing method.
- the processor 502 is used to provide calculation and control capabilities to support the operation of the entire computer device 500.
- the internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503, and the computer program 5032 is executed by the processor 502 to implement the data in-chain transaction processing method of the embodiment of the present application.
- the network interface 505 is used for network communication with other devices.
- FIG. 9 is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied.
- the specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
- the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
- the computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium.
- the program instructions are executed by at least one processor in the computer system to implement the process steps of the foregoing method embodiments.
- the storage medium may be a computer-readable storage medium.
- the storage medium stores a computer program.
- the processor executes the steps of the data in-chain transaction processing method described in the above embodiments.
- the storage medium is a physical, non-transitory storage medium, such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. medium.
- a physical, non-transitory storage medium such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. medium.
- the disclosed device and method may be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of each unit is only a logical function division, and there may be other division methods in actual implementation.
- multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented.
- the steps in the method of the embodiment of the present application can be adjusted, merged, and deleted in order according to actual needs.
- the units in the devices in the embodiments of the present application may be combined, divided, and deleted according to actual needs.
- the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium.
- the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium It includes several instructions to make a computer device (which may be a personal computer, a terminal, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请实施例公开了一种数据入链事务处理方法、装置、计算机设备及存储介质。本申请应用在研发管理中的事务处理过程优化领域。所述方法包括:若检测到用户新增业务数据,对业务数据进行校验;若所述业务数据校验通过,将所述业务数据写入到预设数据库;若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链;若上述操作发生异常,将所述业务数据回滚到新增业务数据之前的状态。
Description
本申请要求于2019年5月22日提交中国专利局、申请号为201910429337.7、申请名称为“数据入链事务处理方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及区块链技术领域,尤其涉及一种数据入链事务处理方法、装置、计算机设备及存储介质。
随着科技与经济的发展,区块链的技术已逐渐成熟,应用于各个行业当中。尤其是在贸易行业中,基于区块链技术可以有效地解决交易信任的问题,极大地促进了贸易行业的发展。然而,在基于区块链的贸易平台中,交易订单数量巨大,交易频繁,交易币种多样,由此产生的业务数据时常会出现异常。而在处理新增业务数据时,通常是首先执行区块链写链操作,然后再执行数据库写库操作,最后再执行通讯操作,但是当数据库写库或者通讯操作发生异常时,需要通知区块链进行数据回滚,此时由于区块链未能增加事务处理,会存在脏数据的问题。
申请内容
本申请实施例提供了一种数据入链事务处理方法、装置、计算机设备及存储介质,旨在解决数据入链异常时,由于区块链未能增加事务处理导致存在脏数据的问题。
第一方面,本申请实施例提供了一种数据入链事务处理方法,其包括:若检测到用户新增业务数据,对所述业务数据进行校验;若所述业务数据校验通过,将所述业务数据写入到预设数据库;若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;若将所述业务数据发送至验证节点未发生异常,将所述验证节点所 确认的区块写入到区块链;若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态。
第二方面,本申请实施例还提供了一种数据入链事务处理装置,其包括:校验单元,用于若检测到用户新增业务数据,对所述业务数据进行校验;写库单元,用于若所述业务数据校验通过,将所述业务数据写入到预设数据库;发送单元,用于若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;写链单元,用于若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链;回滚单元,用于若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态。
第三方面,本申请实施例还提供了一种计算机设备,其包括存储器及处理器,所述存储器上存储有计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述的方法。
第四方面,本申请实施例还提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序当被处理器执行时可实现上述第一方面所述的方法。
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的数据入链事务方法的应用场景示意图;
图2为本申请实施例提供的数据入链事务处理方法的流程示意图;
图3为本申请实施例提供的数据入链事务处理方法的子流程示意图;
图4为本申请实施例提供的数据入链事务处理方法的子流程示意图;
图5为本申请实施例提供的数据入链事务处理方法的子流程示意图;
图6为本申请实施例提供的数据入链事务处理方法的子流程示意图
图7为本申请实施例提供的数据入链事务处理装置的示意性框图;
图8为本申请实施例提供的数据入链事务处理装置的具体单元的示意性框图;以及
图9为本申请实施例提供的计算机设备的示意性框图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
请参阅图1和图2,图1为本申请实施例提供的数据入链事务处理方法的应用场景示意图。图2为本申请实施例提供的数据入链事务处理方法的示意性流程图。该数据入链事务处理方法应用于终端10中,通过终端10与服务器20之间交互实现。本申请提出的一种区块链数据入链事务处理方法,应用于基于区块链的贸易平台中。在基于区块链的贸易平台中处理区块链数据入链事务时,由于数据库写库操作或通讯操作异常时会导致区块链存在脏数据。因此,通过本申请提出的区块链数据入链事务处理方法,充分考虑异常发生的可能性、事务回滚的难易以及业务是否可处理,对区块链写链操作、数据库写库操作以及通讯操作进行重新排序,将异常发生率高的数据库写库操作放在首位执行,将事务处理容易的通讯操作放在次位执行,将增加事务管理难的区块链写链操作 放在最后执行。通过上述设计,当数据库写库操作或者通讯操作又或者区块链写链操作发生异常时,可将整个事务回滚,减少了区块链的脏数据,且事务回滚提前,能够减少系统性能损耗。
图2是本申请实施例提供的数据入链事务处理方法的流程示意图。如图所示,该方法包括以下步骤S110-S150。
S110、若检测到用户新增业务数据,对所述业务数据进行校验。
在一实施例中,业务数据指的是用户在贸易平台中对订单进行一系列操作所产生的数据,如新增订单、删除订单以及修改订单等。校验指的是对用户新增的业务数据的合法性和完整性进行验证。通常在贸易平台中用户新增一个订单,首先需要登录账号,在账户中录入订单相关信息并确认订单,当系统检测到用户提交的业务数据,随即执行对业务数据的合法性和完整性进行校验。业务数据的校验在数据入链事务处理前执行,若业务数据校验通过则可执行数据入链事务,若业务数据校验不通过,则返回,用户重新操作。
在一实施例中,如图3所示,所述步骤S110可包括步骤:S111-S113。
S111、根据用户标签对所述业务数据的合法性进行校验。
在一实施例中,用户标签指的是用于标识用户身份的信息,即cookie,其包括用户账号以及密码,例如,DJ001,password:123456,用户标识符可区分每一个用户的身份。用户在提交业务数据时用户标签跟随业务数据一并提交,当检测到用户新增业务数据后,根据接收到的用户标签与数据库中存储的对应该用户的账号以及密码进行对比,判断新增业务数据的用户其用户标签是否与数据库中存储的用户账号以及密码相一致,若一致说明业务数据是由该用户新增的,判定业务数据合法;若不一致说明业务数据不是由该用户新增的,判定业务数据不合法。
S112、根据预设规则对所述业务数据的完整性进行校验。
在一实施例中,预设规则指的是业务数据完整性的校验规则。由于数据在传输的过程中会受到各种干扰的影响,如脉冲干扰,随机噪声干扰和人为干扰等,这会使数据产生差错,因此为了能够控制传输过程的差错,需要对数据的完整性进行校验。校验的主要方法是通过一种指定的算法对所提交的业务数据计算出的一个校验值,当接收到业务数据后通过同样的算法计算一次校验值,如果两次计算得到的检验值相同,则说明数据是完整的判定业务数据完整,其 中,校验的算法可以是奇偶校验、CRC循环冗余校验或者MD5校验中的任意一种。
S113、若所述业务数据合法且完整,判定所述业务数据校验通过。
在一实施例中,只有当业务数据的合法性和完整性均校验通过后,才可判定业务数据校验通过。
S120、若所述业务数据校验通过,将所述业务数据写入到预设数据库。
在一实施例中,预设数据库指的是贸易平台的数据库,用于存储该贸易平台中产生的业务数据。在业务数据校验通过后,即可执行业务数据入链事务,首先第一步操作是写库操作,将新增的业务数据写入到数据库中进行存储,且在写库的过程中检测是否发生异常。例如,修改订单金额,将订单金额从50万增加到100万,那么则将修改的订单金额100万替换掉预设数据库中的订单金额50万并进行存储。
在一实施例中,如图4所示,所述步骤S120可包括步骤:S121-S122。
S121、判断将所述业务数据写入到预设数据库是否违反唯一约束。
S122、若将所述业务数据写入到预设数据库违反唯一约束,判定将所述业务数据写入到预设数据库发生异常。
在一实施例中,唯一约束指的是保证在一个字段或者一组字段里的数据与表中其它行的数据相比是唯一的。业务数据以表的形式存储在预设数据库中,若新增的业务数据写入到预设数据库中出现违反唯一约束异常,说明新增的业务数据在预设数据库的表中不是唯一的,写入了重复的值。例如,预设数据库中已存在了X订单,而用户又新增了一个X订单,当新增的X订单写入到预设数据库时则违反唯一约束异常,写入失败判定发生异常。
S130、若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认。
在一实施例中,验证节点指的是区块链网络中用于确认业务数据有效的节点。在执行完第一步的写库操作后,执行第二步通讯操作,即将业务数据发送到服务器中,其他验证节点接收到业务数据后对业务数据的有效性进行确认。由于业务数据在发送的过程中可能会出现发送不成功的情况,因此在执行通讯操作的过程中需要判断业务数据是否成功发送至验证节点。在业务数据发送至验证节点前,需要对业务数据进行加密,具体地,根据用户预配置的私钥对业 务数据进行加密,验证节点接收到业务数据后通过与私钥对应的公钥解密后再对业务数据进行确认。其中,私钥指的是通过非对称加密算法分配的密钥,非对称加密算法在加密和解密时使用的是两个不相同的密钥,分别称为公钥和私钥,通过公钥加密的数据只有私钥才能解密,通过私钥加密的数据只有公钥才能解密。私钥通过随机数算法生成,公钥根据私钥生成,公钥和私钥成对分配,其中,公钥匙公开的,私钥是私人持有且严密保护的,每个用户预配置一对公钥和私钥。
在一实施例中,如图5所示,所述步骤S130可包括步骤:S131-S133。
S131、判断所述业务数据是否成功发送至验证节点;
S132、若所述业务数据未成功发送至验证节点,判断所述业务数据发送至所述验证节点失败的次数是否达到预设阈值;
S133、若所述业务发送至所述验证节点的失败次数达到预设阈值,判定将所述业务数据发送至验证节点发生异常。
在一实施例中,在执行通讯操作的过程中,业务数据的数据量过大导致发送超时,或者通讯节点瘫痪导致通讯连接断开无法传输数据,这些原因均会导致业务数据发送失败。业务数据成功发送后服务器会返回发送成功的消息,因此若在一定时间能没有响应未接收到服务器返回的发送成功的消息,说明业务数据发送失败,此时则生成提示消息提示用户重新连接网络再次发送业务数据。统计用户重新发送业务数据失败的次数,当重新发送业务数据失败的次数达到预设阈值后,则判定发生异常,其中预设阈值为3次,当然可以理解的是,还可以是其他任意设定的次数。
S140、若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链。
在一实施例中,所述验证节点接收到业务数据后,根据用户公开的公钥对业务数据进行解密验证用户的身份和业务数据的完整性,验证通过后则通过共识机制对业务数据进行确认。共识机制指的是区块链网络中的各验证节点怎么达成共识一致确认区块有效的手段,验证节点通过将接收的业务数据打包到区块中进行哈希计算完成工作量证明并由其他验证节点共同确认从而得到确认有效的区块。在验证节点确认区块有效后,接收验证节点所确认的区块,执行第三步写链操作,将该区块写入到本地维护的区块链中。
在一实施例中,如图6所示,所述步骤S140可包括步骤:S141-S142。
S141、判断所述验证节点所确认的区块中是否存在所述业务数据。
S142、若所述验证节点所确认的区块中不存在所述业务数据,判定将所述验证节点所确认的区块写入到区块链发生异常。
在一实施例中,接收验证节点广播到区块链网络中的确认区块,执行第三步写链操作,根据哈希算法对验证节点所确认的区块进行哈希运算得到该区块中存储的数据,将预设数据库中的业务数据与该区块中存储的数据进行对比,判断该区块中存储的数据中是否存在有与业务数据相同的数据,若存在,说明业务数据被验证节点确认有效可以写入到本地维护的区块链中;若不存在,说明业务数据未被验证节点确认有效,产生了区块链的脏数据,不可以写入到本地维护的区块链中,判定发生异常。
S150、若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态。
在一实施例中,回滚指的是数据处理错误将数据恢复到上一次正确状态的行为,上述在数据库写库、业务数据发送即通讯操作以及区块写链的过程中发生异常,则执行数据回滚将业务数据恢复到用户新增业务数据之前的状态。例如,在数据库写库过程中发生异常,则在预设数据库中将业务数据进行回滚恢复到未新增业务数据的状态,减少系统性能损耗,减少了区块链的脏数据。
本申请实施例提供的一种数据入链事务处理方法,通过若检测到用户新增业务数据,对所述业务数据进行校验;若所述业务数据校验通过,将所述业务数据写入到预设数据库;若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链;若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态,可以在数据入链事务处理过程中,减少了区块链的脏数据,降低系统性能损耗。
图7是本申请实施例提供的一种数据入链事务处理装置200的示意性框图。如图7所示,对应于以上数据入链事务处理方法,本申请还提供一种数据入链 事务处理装置200。该数据入链事务处理装置200包括用于执行上述数据入链事务处理方法的单元,该装置可以被配置于台式电脑、平板电脑、手提电脑、等终端中。具体地,请参阅图7,该数据入链事务处理装置200包括:校验单元210、写库单元220、发送单元230、写链单元240以及回滚单元250。
校验单元210,用于若检测到用户新增业务数据,对所述业务数据进行校验。
在一实施例中中,如图8所示,所述校验单元210包括:第一校验子单元211、第二校验子单元212以及判定子单元213。
第一校验子单元211,用于根据用户标签对所述业务数据的合法性进行校验。
第二校验子单元212,用于根据预设规则对所述业务数据的完整性进行校验。
判定子单元213,用于若所述业务数据合法且完整,判定所述业务数据校验通过。
写库单元220,用于若所述业务数据校验通过,将所述业务数据写入到预设数据库。
在一实施例中中,如图8所示,所述写库单元220包括:第一判断子单元221以及第一判定子单元222。
第一判断子单元221,用于判断将所述业务数据写入到预设数据库是否违反唯一约束。
第一判定子单元222,用于若将所述业务数据写入到预设数据库违反唯一约束,判定将所述业务数据写入到预设数据库发生异常。
发送单元230,用于若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认。
在一实施例中中,如图8所示,所述发送单元230包括:发送判断单元231、第二判断子单元232以及第二判定子单元233。
发送判断单元231,用于判断所述业务数据是否成功发送至验证节点。
第二判断子单元232,用于若所述业务数据未成功发送至验证节点,判断所述业务数据发送至所述验证节点失败的次数是否达到预设阈值。
第二判定子单元233,用于若所述业务发送至所述验证节点的失败次数达到预设阈值,判定将所述业务数据发送至验证节点发生异常。
写链单元240,用于若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链。
在一实施例中中,如图8所示,所述写链单元240包括:第三判断子单元241以及第三判定子单元242。
第三判断子单元241,用于判断所述验证节点所确认的区块中是否存在所述业务数据;
第三判定子单元242,用于若所述验证节点所确认的区块中不存在所述业务数据,判定将所述验证节点所确认的区块写入到区块链发生异常。
回滚单元250,用于若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态。
需要说明的是,所属领域的技术人员可以清楚地了解到,上述数据入链事务处理装置200和各单元的具体实现过程,可以参考前述方法实施例中的相应描述,为了描述的方便和简洁,在此不再赘述。
上述数据入链事务处理装置可以实现为一种计算机程序的形式,该计算机程序可以在如图9所示的计算机设备上运行。
请参阅图9,图9是本申请实施例提供的一种计算机设备的示意性框图。该计算机设备500可以是终端,其中,终端可以是智能手机、平板电脑、笔记本电脑、台式电脑、个人数字助理和穿戴式设备等具有通信功能的电子设备。
参阅图9,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032包括程序指令,该程序指令被执行时,可使得处理器502执行一种数据入链事务处理方法。
该处理器502用于提供计算和控制能力,以支撑整个计算机设备500的运行。
该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,以实现本申请实施例的数据入链事务处理方法。
该网络接口505用于与其它设备进行网络通信。本领域技术人员可以理解,图9中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对 本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
应当理解,在本申请实施例中,处理器502可以是中央处理单元(Central Processing Unit,CPU),该处理器502还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
本领域普通技术人员可以理解的是实现上述实施例的方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成。该计算机程序包括程序指令,计算机程序可存储于一存储介质中,该存储介质为计算机可读存储介质。该程序指令被该计算机系统中的至少一个处理器执行,以实现上述方法的实施例的流程步骤。
因此,本申请还提供一种存储介质。该存储介质可以为计算机可读存储介质。该存储介质存储有计算机程序,该计算机程序被处理器执行时使处理器执行以上各实施例中所描述的数据入链事务处理方法的步骤。
所述存储介质为实体的、非瞬时性的存储介质,例如可以是U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的实体存储介质。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的。例如,各个单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划 分方式。例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。本申请实施例装置中的单元可以根据实际需要进行合并、划分和删减。另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,终端,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。
Claims (20)
- 一种数据入链事务处理方法,包括:若检测到用户新增业务数据,对所述业务数据进行校验;若所述业务数据校验通过,将所述业务数据写入到预设数据库;若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链;若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态。
- 根据权利要求1所述的数据入链事务处理方法,其中,所述对所述业务数据进行校验,包括:根据用户标签对所述业务数据的合法性进行校验;根据预设规则对所述业务数据的完整性进行校验;若所述业务数据合法且完整,判定所述业务数据校验通过。
- 根据权利要求1所述的数据入链事务处理方法,其中,所述将所述业务数据写入到预设数据库,包括:判断将所述业务数据写入到预设数据库是否违反唯一约束;若将所述业务数据写入到预设数据库违反唯一约束,判定将所述业务数据写入到预设数据库发生异常。
- 根据权利要求1所述的数据入链事务处理方法,其中,所述将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认,包括:判断所述业务数据是否成功发送至验证节点;若所述业务数据未成功发送至验证节点,判断所述业务数据发送至所述验证节点失败的次数是否达到预设阈值;若所述业务发送至所述验证节点的失败次数达到预设阈值,判定将所述业务数据发送至验证节点发生异常。
- 根据权利要求1所述的数据入链事务处理方法,其中,所述将所述验证 节点所确认的区块写入到区块链,包括:判断所述验证节点所确认的区块中是否存在所述业务数据;若所述验证节点所确认的区块中不存在所述业务数据,判定将所述验证节点所确认的区块写入到区块链发生异常。
- 根据权利要求5所述的数据入链事务处理方法,其中,所述判断所述验证节点所确认的区块中是否存在所述业务数据,包括:根据哈希算法对所述验证节点所确认的区块进行哈希运算得到所述区块中存储的数据;将所述区块中存储的数据与所述业务数据进行对比;若所述区块中存储的数据与所述业务数据相同,则判定所述验证节点所确认的区块中存在所述业务数据。
- 根据权利要求1所述的数据入链事务处理方法,其中,所述将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认之前,还包括:根据预配置的私钥对所述业务数据进行加密。
- 一种数据入链事务处理装置,包括:校验单元,用于若检测到用户新增业务数据,对所述业务数据进行校验;写库单元,用于若所述业务数据校验通过,将所述业务数据写入到预设数据库;发送单元,用于若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;写链单元,用于若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链;回滚单元,用于若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态。
- 根据权利要求8所述的数据入链事务处理装置,其中,所述写库单元包括:第一判断子单元,用于判断将所述业务数据写入到预设数据库是否违反唯一约束;第一判定子单元,用若将所述业务数据写入到预设数据库违反唯一约束,判定将所述业务数据写入到预设数据库发生异常。
- 根据权利要求8所述的数据入链事务处理装置,其中,所述写链单元包括:第三判断子单元,用于判断所述验证节点所确认的区块中是否存在所述业务数据;第三判定子单元,用于若所述验证节点所确认的区块中不存在所述业务数据,判定将所述验证节点所确认的区块写入到区块链发生异常。
- 一种计算机设备,包括存储器以及与所述存储器相连的处理器;其中,所述存储器用于存储计算机程序;所述处理器用于运行所述存储器中存储的计算机程序,以执行如下步骤:若检测到用户新增业务数据,对所述业务数据进行校验;若所述业务数据校验通过,将所述业务数据写入到预设数据库;若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链;若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所述业务数据回滚到新增业务数据之前的状态。
- 根据权利要求11所述的计算机设备,其中,所述对所述业务数据进行校验的步骤包括:根据用户标签对所述业务数据的合法性进行校验;根据预设规则对所述业务数据的完整性进行校验;若所述业务数据合法且完整,判定所述业务数据校验通过。
- 根据权利要求11所述的计算机设备,其中,所述将所述业务数据写入到预设数据库的步骤包括:判断将所述业务数据写入到预设数据库是否违反唯一约束;若将所述业务数据写入到预设数据库违反唯一约束,判定将所述业务数据写入到预设数据库发生异常。
- 根据权利要求11所述的计算机设备,其中,所述将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认的步骤包括:判断所述业务数据是否成功发送至验证节点;若所述业务数据未成功发送至验证节点,判断所述业务数据发送至所述验证节点失败的次数是否达到预设阈值;若所述业务发送至所述验证节点的失败次数达到预设阈值,判定将所述业务数据发送至验证节点发生异常。
- 根据权利要求11所述的计算机设备,其中,所述将所述验证节点所确认的区块写入到区块链的步骤包括:判断所述验证节点所确认的区块中是否存在所述业务数据;若所述验证节点所确认的区块中不存在所述业务数据,判定将所述验证节点所确认的区块写入到区块链发生异常。
- 根据权利要求15所述的计算机设备,其中,所述判断所述验证节点所确认的区块中是否存在所述业务数据的步骤包括:根据哈希算法对所述验证节点所确认的区块进行哈希运算得到所述区块中存储的数据;将所述区块中存储的数据与所述业务数据进行对比;若所述区块中存储的数据与所述业务数据相同,则判定所述验证节点所确认的区块中存在所述业务数据。
- 根据权利要求11所述的计算机设备,其中,所述将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认之前的步骤包括:根据预配置的私钥对所述业务数据进行加密。
- 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时使所述处理器执行以下步骤:若检测到用户新增业务数据,对所述业务数据进行校验;若所述业务数据校验通过,将所述业务数据写入到预设数据库;若将所述业务数据写入到预设数据库未发生异常,将所述业务数据发送至验证节点由所述验证节点对所述业务数据进行确认;若将所述业务数据发送至验证节点未发生异常,将所述验证节点所确认的区块写入到区块链;若将所述业务数据写入到预设数据库发生异常或将所述业务数据发送至验证节点发生异常或将所述验证节点所确认的区块写入到区块链发生异常,将所 述业务数据回滚到新增业务数据之前的状态。
- 根据权利要求18所述的计算机可读存储介质,其中,所述将所述业务数据写入到预设数据库的步骤包括:判断将所述业务数据写入到预设数据库是否违反唯一约束;若将所述业务数据写入到预设数据库违反唯一约束,判定将所述业务数据写入到预设数据库发生异常。
- 根据权利要求18所述的计算机可读存储介质,其中,所述将所述验证节点所确认的区块写入到区块链的步骤包括:判断所述验证节点所确认的区块中是否存在所述业务数据;若所述验证节点所确认的区块中不存在所述业务数据,判定将所述验证节点所确认的区块写入到区块链发生异常。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910429337.7 | 2019-05-22 | ||
| CN201910429337.7A CN110309160B (zh) | 2019-05-22 | 2019-05-22 | 数据入链事务处理方法、装置、计算机设备及存储介质 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020232885A1 true WO2020232885A1 (zh) | 2020-11-26 |
Family
ID=68074717
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/103172 Ceased WO2020232885A1 (zh) | 2019-05-22 | 2019-08-29 | 数据入链事务处理方法、装置、计算机设备及存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110309160B (zh) |
| WO (1) | WO2020232885A1 (zh) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112800040A (zh) * | 2021-01-22 | 2021-05-14 | 平安养老保险股份有限公司 | 业务数据校验方法、装置、计算机设备及存储介质 |
| CN113704254A (zh) * | 2021-07-30 | 2021-11-26 | 北京奇艺世纪科技有限公司 | 一种数据库的业务处理方法、装置、电子设备和存储介质 |
| CN115018622A (zh) * | 2022-05-25 | 2022-09-06 | 平安银行股份有限公司 | 业务重构系统的验证方法、装置、设备及可读存储介质 |
| CN115242349A (zh) * | 2022-06-21 | 2022-10-25 | 苏州盈数智能科技有限公司 | 企业级数据校验方法、装置、计算机设备及存储介质 |
| CN116560896A (zh) * | 2023-07-11 | 2023-08-08 | 智慧眼科技股份有限公司 | 一种异常补偿方法、装置、设备及存储介质 |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113064759A (zh) * | 2021-04-02 | 2021-07-02 | 浙江永旗区块链科技有限公司 | 一种区块链数据回滚处理方法及其处理系统 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106611061A (zh) * | 2016-12-29 | 2017-05-03 | 北京众享比特科技有限公司 | 基于区块链网络的数据库写入方法及系统 |
| US20170213209A1 (en) * | 2016-01-21 | 2017-07-27 | International Business Machines Corporation | Enterprise blockchains and transactional systems |
| CN108573741A (zh) * | 2017-12-25 | 2018-09-25 | 北京金山云网络技术有限公司 | 业务数据记录方法、装置、设备和存储介质 |
| CN109191355A (zh) * | 2018-08-21 | 2019-01-11 | 严治 | 一种基于区块链的创伤数据共享系统 |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111741494B (zh) * | 2015-07-14 | 2023-01-10 | Oppo广东移动通信有限公司 | 数据传输的方法、发送设备及接收设备 |
| CN108427601A (zh) * | 2017-02-13 | 2018-08-21 | 北京航空航天大学 | 一种私有链节点的集群交易处理方法 |
| CN108712431B (zh) * | 2018-05-24 | 2021-09-21 | 广东工业大学 | 一种基于联盟链的交通信息存放方法及装置 |
| CN109033143B (zh) * | 2018-06-11 | 2021-06-29 | 中国科学院广州能源研究所 | 基于区块链的分布式、分域电网数据处理系统及其方法 |
| CN109446208A (zh) * | 2018-09-03 | 2019-03-08 | 深圳壹账通智能科技有限公司 | 一种数据存储方法、计算机可读存储介质及服务器 |
| CN109446273B (zh) * | 2018-12-04 | 2022-07-22 | 深圳前海环融联易信息科技服务有限公司 | 区块链的数据同步方法、装置、计算机设备及存储介质 |
-
2019
- 2019-05-22 CN CN201910429337.7A patent/CN110309160B/zh active Active
- 2019-08-29 WO PCT/CN2019/103172 patent/WO2020232885A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170213209A1 (en) * | 2016-01-21 | 2017-07-27 | International Business Machines Corporation | Enterprise blockchains and transactional systems |
| CN106611061A (zh) * | 2016-12-29 | 2017-05-03 | 北京众享比特科技有限公司 | 基于区块链网络的数据库写入方法及系统 |
| CN108573741A (zh) * | 2017-12-25 | 2018-09-25 | 北京金山云网络技术有限公司 | 业务数据记录方法、装置、设备和存储介质 |
| CN109191355A (zh) * | 2018-08-21 | 2019-01-11 | 严治 | 一种基于区块链的创伤数据共享系统 |
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112800040A (zh) * | 2021-01-22 | 2021-05-14 | 平安养老保险股份有限公司 | 业务数据校验方法、装置、计算机设备及存储介质 |
| CN112800040B (zh) * | 2021-01-22 | 2024-02-06 | 平安养老保险股份有限公司 | 业务数据校验方法、装置、计算机设备及存储介质 |
| CN113704254A (zh) * | 2021-07-30 | 2021-11-26 | 北京奇艺世纪科技有限公司 | 一种数据库的业务处理方法、装置、电子设备和存储介质 |
| CN113704254B (zh) * | 2021-07-30 | 2023-06-16 | 北京奇艺世纪科技有限公司 | 一种数据库的业务处理方法、装置、电子设备和存储介质 |
| CN115018622A (zh) * | 2022-05-25 | 2022-09-06 | 平安银行股份有限公司 | 业务重构系统的验证方法、装置、设备及可读存储介质 |
| CN115018622B (zh) * | 2022-05-25 | 2024-03-26 | 平安银行股份有限公司 | 业务重构系统的验证方法、装置、设备及可读存储介质 |
| CN115242349A (zh) * | 2022-06-21 | 2022-10-25 | 苏州盈数智能科技有限公司 | 企业级数据校验方法、装置、计算机设备及存储介质 |
| CN115242349B (zh) * | 2022-06-21 | 2023-11-14 | 苏州盈数智能科技有限公司 | 企业级数据校验方法、装置、计算机设备及存储介质 |
| CN116560896A (zh) * | 2023-07-11 | 2023-08-08 | 智慧眼科技股份有限公司 | 一种异常补偿方法、装置、设备及存储介质 |
| CN116560896B (zh) * | 2023-07-11 | 2023-10-10 | 智慧眼科技股份有限公司 | 一种异常补偿方法、装置、设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110309160B (zh) | 2023-07-04 |
| CN110309160A (zh) | 2019-10-08 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2020232885A1 (zh) | 数据入链事务处理方法、装置、计算机设备及存储介质 | |
| CN111868689B (zh) | 区块链账本的运行时自校正 | |
| CN101902479B (zh) | 网络隔离系统及其数据传输方法 | |
| US7996713B2 (en) | Server-to-server integrity checking | |
| WO2021012552A1 (zh) | 一种登录处理方法及相关设备 | |
| CN111045855B (zh) | 备份数据的方法、装置和计算机程序产品 | |
| JP7004423B2 (ja) | 誤り訂正符号に基づく共有されたブロックチェーンデータの記憶のデータセキュリティ | |
| TW202023232A (zh) | 分布式網路中進行主節點變更的系統 | |
| CN112988764A (zh) | 数据存储方法、装置、设备和存储介质 | |
| CN111406252A (zh) | 基于纠错码的共享区块链数据存储的共识 | |
| CN119011308B (zh) | 基于信创环境下的物联网设备安全管理方法、系统、设备和介质 | |
| CN112035886A (zh) | 区块链的共识方法、装置、共识节点、系统以及存储介质 | |
| CN119299091B (zh) | 一种基于动态密钥的聊天安全通信方法及系统 | |
| US11144395B2 (en) | Automatic data preservation for potentially compromised encoded data slices | |
| US20180121669A1 (en) | Extended security scrutiny of data access requests in a dispersed storage network | |
| CN106294017B (zh) | 一种信息安全备份实现方法 | |
| CN107395772B (zh) | 一种重复数据的管理方法及管理系统 | |
| US12095909B1 (en) | Data integrity checks for reencryptions | |
| CN118199884A (zh) | 基于区块链的任务执行方法和装置 | |
| CN111752642A (zh) | 配置修改方法、装置、计算设备和存储介质 | |
| US10891058B2 (en) | Encoding slice verification information to support verifiable rebuilding | |
| CN111526122B (zh) | 数据监控的方法、装置、设备及介质 | |
| US11340988B2 (en) | Generating integrity information in a vast storage system | |
| CN121901332A (zh) | 基于区块链的数据库数据处理方法和计算机装置 | |
| CN121118120A (zh) | 一种基于区块链的数据处理方法及系统 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19929641 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19929641 Country of ref document: EP Kind code of ref document: A1 |