CN112256476B - Data operation method, device, equipment and medium based on block chain - Google Patents

Data operation method, device, equipment and medium based on block chain Download PDF

Info

Publication number
CN112256476B
CN112256476B CN202011031942.8A CN202011031942A CN112256476B CN 112256476 B CN112256476 B CN 112256476B CN 202011031942 A CN202011031942 A CN 202011031942A CN 112256476 B CN112256476 B CN 112256476B
Authority
CN
China
Prior art keywords
data
transaction
callback function
rollback
addition
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.)
Active
Application number
CN202011031942.8A
Other languages
Chinese (zh)
Other versions
CN112256476A (en
Inventor
苗政委
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shaanxi Medicine Chain Group Co Ltd
Original Assignee
Shaanxi Medicine Chain Group Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shaanxi Medicine Chain Group Co Ltd filed Critical Shaanxi Medicine Chain Group Co Ltd
Priority to CN202011031942.8A priority Critical patent/CN112256476B/en
Publication of CN112256476A publication Critical patent/CN112256476A/en
Application granted granted Critical
Publication of CN112256476B publication Critical patent/CN112256476B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction

Abstract

The application provides a data operation method, a device, equipment and a medium based on a blockchain, comprising the following steps: the data of the block chain operation is divided into strong related data and weak related data, wherein the strong related data refers to the data which can be subjected to current data operation after the last data operation consensus is completed and submitted, and the weak related data refers to the data which can be subjected to current data operation without the last data operation consensus; setting an attribute for marking an execution state for each strongly correlated data; and according to the attribute, corresponding data operation is carried out under three conditions of transaction processing, submitting and rolling back respectively. According to the method and the device, the data based on the blockchain operation are divided into the strong related data and the weak related data, the strong related data is specially marked, the data is correspondingly operated according to different marks, the technical problem that the strong related data cannot realize multi-thread simultaneous operation is solved, and the execution efficiency of the blockchain transaction is improved.

Description

Data operation method, device, equipment and medium based on block chain
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a blockchain-based data manipulation method, apparatus, device, and medium.
Background
Currently, blockchain data operations are inconsistent with centralized data operations, and blockchain data transactions mainly include three parts: processing, commit, and rollback. The blockchain data processing needs to be agreed to before it can actually be submitted, and the completion of the actual data operation is confirmed by the blockchain. The data of the blockchain operation can only be executed by a single thread, and a period of time is required for the blockchain data operation to be executed to commit or rollback, the blockchain is commonly known according to one block, and a plurality of blocks are required to be actually irreversible.
There are several problems with current blockchain-based data operations:
1. blockchain data operations cannot roll back on a single transaction;
2. the blockchain data cannot be multithreaded;
3. avalanche rollback occurs in the transaction.
The above-mentioned drawbacks make the blockchain unable to efficiently perform transactions, with relatively low performance.
Disclosure of Invention
In view of this, the present application provides blockchain-based data manipulation methods, apparatus, devices, and media that aim to improve the efficiency of execution of blockchain transactions.
In order to achieve the above purpose, the technical scheme adopted in the application is as follows:
in a first aspect, the present application provides a blockchain-based data manipulation method, comprising:
the data of the block chain operation is divided into strong related data and weak related data, wherein the strong related data refers to the data which can be subjected to current data operation after the last data operation consensus is completed and submitted, and the weak related data refers to the data which can be subjected to current data operation without the last data operation consensus;
setting an attribute for marking an execution state for each strongly correlated data;
and according to the attribute, corresponding data operation is carried out under three conditions of transaction processing, submitting and rolling back respectively.
Optionally, the value of the attribute is a boolean value.
Optionally, according to the attribute, performing corresponding data operations in three situations of transaction processing, submitting and rolling back respectively specifically includes:
when the transaction processing is carried out, judging whether the value of the attribute is false, if so, modifying the current data;
setting the value of the attribute as false when the transaction is submitted, and deleting the rollback callback function corresponding to the transaction processing;
and when the transaction rollback is carried out, setting the value of the attribute as false, and calling a rollback callback function to restore the corresponding data state.
Optionally, the data for the blockchain operation is divided into strongly correlated data and weakly correlated data, and then further includes:
dividing weakly correlated data into three components, an operable portion, an added portion and a subtracted portion;
judging whether to perform addition operation or subtraction operation on the weak correlation data;
if the weak correlation data is subjected to addition operation, storing a transaction ID and an addition callback function in the adding part, when the transaction is submitted, searching a corresponding addition callback function in the adding part according to the submitted transaction ID, executing the addition callback function if the corresponding addition callback function is searched, adding the added data to the operable part, and when the transaction is rolled back, searching the addition callback function in the adding part according to the transaction ID, and deleting the addition callback function if the corresponding addition callback function is found;
and if the weakly related data is subjected to subtraction operation, subtracting the subtracted data from the data of the operable part, storing a transaction ID and an operable part rollback callback function into the deletion part, searching the rollback callback function in the deletion part according to the submitted transaction ID when the transaction is submitted, deleting the rollback callback function if the transaction ID is found, searching the rollback callback function in the deletion part according to the transaction ID when the transaction is rolled back, executing the rollback callback function if the transaction ID is found, and adding the subtracted data in the operable part.
In a second aspect, the present application provides a blockchain-based data manipulation device comprising:
the classification module is used for classifying the data of the blockchain operation into strong related data and weak related data, wherein the strong related data refers to the data which can be subjected to the current data operation after the last data operation consensus is completed and submitted, and the weak related data refers to the data which can be subjected to the current data operation without the last data operation consensus completion;
a setting module for setting an attribute for marking an execution state for each of the strongly related data;
and the first operation module is used for respectively carrying out corresponding data operation under three conditions of transaction processing, submitting and rollback according to the attribute.
Optionally, the value of the attribute is a boolean value.
Optionally, the first operation module specifically includes:
the modification module is used for judging whether the value of the attribute is false or not when the transaction processing is carried out, and modifying the current data if yes;
the deleting module is used for setting the value of the attribute to be false when the transaction is submitted, and deleting the rollback callback function corresponding to the transaction processing;
and the calling module is used for setting the value of the attribute to be false when the transaction rollback is carried out, and calling a rollback callback function to restore the corresponding data state.
Optionally, the apparatus further includes:
the data dividing module is used for dividing the weak related data into three components, namely an operable part, an adding part and a deleting part;
a judging module, configured to judge whether to perform an addition operation or a subtraction operation on the weakly correlated data;
the second operation module is used for storing the transaction ID and the addition callback function into the adding part if the weak related data are subjected to addition operation, searching the corresponding addition callback function in the adding part according to the submitted transaction ID when the transaction is submitted, executing the addition callback function if the corresponding addition callback function is searched, adding the added data into the operable part, searching the addition callback function in the adding part according to the transaction ID when the transaction is rolled back, and deleting the addition callback function if the corresponding addition callback function is found;
and a third operation module, configured to, if subtraction is performed on weakly related data, subtract the subtracted data from the data of the operable portion, store a transaction ID and an operable portion rollback callback function in the pruned portion, when the transaction is submitted, search the rollback callback function in the pruned portion according to the submitted transaction ID, delete the rollback callback function if found, and when the transaction is rolled back, search the rollback callback function in the pruned portion according to the transaction ID, execute the rollback callback function if found, and add the subtracted data in the operable portion.
In a third aspect, embodiments of the present application further provide an apparatus, including: a processor, a memory, and a communication unit;
the memory stores machine readable instructions executable by the processor, the processor and the memory in communication via the communication unit when the device is operating;
wherein the processor executes the machine-readable instructions to perform the method of the above aspects.
In a fourth aspect, embodiments of the present application further provide a computer readable storage medium, where a computer program is stored, where the computer program is executed by a processor to perform the method according to the above aspects.
The beneficial effects of this application are:
1. according to the method and the device, the data based on the blockchain operation are divided into the strong related data and the weak related data, the strong related data are specially marked, the data are correspondingly operated according to different marks, the technical problem that the strong related data cannot realize multi-thread simultaneous operation is solved, and the execution efficiency of blockchain transaction is improved;
2. the method optimizes the operation of the weakly related data, so that the corresponding transaction of the weakly related data can be executed in parallel, any transaction is submitted and rolled back, other transactions are not affected, and when the earlier transaction is rolled back, avalanche rollback is not caused, so that the problem of parallel execution of blockchain transactions is well solved;
3. the method and the device can realize rollback of the blockchain data operation according to a single transaction, standardize the blockchain data operation and facilitate popularization and application and further development of the blockchain technology.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method of blockchain-based data manipulation of the present application;
FIG. 2 is a block diagram of a block chain based data manipulation device of the present application;
fig. 3 is a block diagram of the first operation module of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments.
As shown in fig. 1, in a first aspect, the present application provides a data operation method based on a blockchain, including:
s101: the data of the block chain operation is divided into strong related data and weak related data, wherein the strong related data refers to the data which can be subjected to current data operation after the last data operation consensus is completed and submitted, and the weak related data refers to the data which can be subjected to current data operation without the last data operation consensus;
the strong correlation data are data which depend on the operation result of the last operation, and the current data cannot be operated if the last operation is irreversible; the weak correlation data is data which is independent of the last operation result, whether the last operation is irreversible or not, the operation can be executed, and even if the last operation rolls back, the operation is not affected.
The strongly correlated data is typically state data, the different states of which can be switched arbitrarily. The weakly correlated data is typically used for data addition and subtraction operations.
S102: setting an attribute for marking an execution state for each strongly correlated data;
as an alternative embodiment, the value of the attribute is a boolean value. The attribute may be represented by pending, where the transaction may not be operated if pending=true, and may be operated if pending=false.
It should be noted that, the attribute may be represented by other symbols, and the correspondence between the value of the attribute and the operation may be interchanged, for example, when the value of the attribute is defined to be true, the transaction is operable, and when the value of the attribute is defined to be false, the transaction is not operable.
S103: and according to the attribute, corresponding data operation is carried out under three conditions of transaction processing, submitting and rolling back respectively.
As an optional implementation manner, according to the attribute, performing corresponding data operations in three situations of transaction processing, submitting and rolling back specifically includes:
when the transaction processing is carried out, judging whether the value of the attribute is false, if so, modifying the current data;
setting the value of the attribute as false when the transaction is submitted, and deleting the rollback callback function corresponding to the transaction processing;
and when the transaction rollback is carried out, setting the value of the attribute as false, and calling a rollback callback function to restore the corresponding data state.
The strongly correlated data operation flow:
when a transaction T1 operates on state data s1, firstly locking an s1 object, judging whether s1.pending= true is false, if so, setting s1.pending= true and setting a rollback callback function rfun of the operation, and modifying the state data s1; if true, the exception is thrown, the current state data cannot be modified, and unlocking of the state data s1 is completed.
When the transaction T1 is submitted, locking the s1 object, setting s1.pending=false, deleting the rollback callback function corresponding to the T1 operation, and finishing unlocking the s1.
When the transaction T1 rolls back, the s1 object is locked, s1.pending=false is set, the roll-back callback function is called to recover the state data s1, and the unlocking of the s1 is completed.
According to the method and the device, the data based on the blockchain operation are divided into the strong related data and the weak related data, the strong related data are specially marked, whether the corresponding operation can be carried out on the data or not is determined according to different marking states, the current operation cannot be carried out before one transaction is irreversible, the technical problem that the multithreading simultaneous operation cannot be realized by the strong related data is solved, and the execution efficiency of the blockchain transaction is improved.
As an optional implementation manner, the data for the blockchain operation is divided into strongly related data and weakly related data, and then further includes:
dividing weakly correlated data into three components, an operable portion, an added portion and a subtracted portion;
judging whether to perform addition operation or subtraction operation on the weak correlation data;
if the weak correlation data is subjected to addition operation, storing a transaction ID and an addition callback function in the adding part, when the transaction is submitted, searching a corresponding addition callback function in the adding part according to the submitted transaction ID, executing the addition callback function if the corresponding addition callback function is searched, adding the added data to the operable part, and when the transaction is rolled back, searching the addition callback function in the adding part according to the transaction ID, and deleting the addition callback function if the corresponding addition callback function is found;
if subtraction operation is carried out on the weakly related data, storing a transaction ID and an operable part rollback callback function into the deletion part, subtracting the subtracted data from the data of the operable part, searching the rollback callback function in the deletion part according to the submitted transaction ID when the transaction is submitted, deleting the rollback callback function if the transaction ID is found, searching the rollback callback function in the deletion part according to the transaction ID when the transaction is rolled back, executing the rollback callback function if the transaction ID is found, and adding the subtracted data in the operable part.
Weak correlation data operation flow:
in the case of performing the addition operation,
when a transaction T1 carries out addition operation on weak related data d1, locking d1, and setting an addition callback function cfun, wherein the operation of cfun is to add an addition number to an operable part of d1, so as to finish unlocking d 1;
when the transaction T1 is submitted by a commit, locking d1, searching for an addition callback function of an added part, and executing the addition callback function if the addition callback function is searched, so as to finish unlocking d 1;
when the transaction T1 rolls back, locking d1, searching the adding callback function in the adding part, and deleting the adding callback function if the adding callback function is searched, so as to finish unlocking d 1.
When the subtraction operation is performed,
when a transaction T1 carries out subtraction operation on weak related data d1, locking d1, judging whether an operable part of d1 can execute the subtraction operation, if so, executing the subtraction operation, setting a rollback operation rfun to carry out reverse operation, if not, throwing out abnormality, and completing the transaction if the operable data of d1 is too small, and completing the unlocking of d 1;
when a transaction T1 is submitted, locking d1, searching the deleting part of d1, and deleting a rollback callback function rfun corresponding to T1 when the rollback callback function rfun is searched, so as to finish unlocking d 1;
when the transaction T1 is rolled back, locking d1, searching the deletion part of d1, and when the rollback callback function rfun corresponding to T1 is searched, executing the rollback callback function rfun to finish unlocking d 1.
For the blockchain, most operations are weakly related data, and the operations have higher requirements on parallelism, and the method optimizes the weakly related data operations, so that corresponding transactions of the weakly related data can be executed in parallel, any transaction is submitted and rolled back without affecting other transactions, and when the earlier transaction rolls back, avalanche rollback is not caused, thereby well solving the problem of parallel execution of the blockchain transactions.
In a second aspect, as shown in fig. 2, the present application provides a blockchain-based data manipulation device, comprising:
the classification module 210 is configured to divide the data of the blockchain operation into strong related data and weak related data, where the strong related data refers to data that can be subjected to the current data operation after the last data operation consensus is completed and submitted, and the weak related data refers to data that can be subjected to the current data operation without the last data operation consensus completion;
the strong correlation data are data which depend on the operation result of the last operation, and the current data cannot be operated if the last operation is irreversible; the weak correlation data is data which is independent of the last operation result, whether the last operation is irreversible or not, the operation can be executed, and even if the last operation rolls back, the operation is not affected.
The strongly correlated data is typically state data, the different states of which can be switched arbitrarily. The operation on the weakly correlated data is typically a data addition or subtraction.
A setting module 220 for setting an attribute for marking an execution state for each strongly related data;
as an alternative embodiment, the value of the attribute is a boolean value. The attribute may be represented by pending, where the transaction may not be operated if pending=true, and may be operated if pending=false.
The first operation module 230 is configured to perform corresponding data operations in three situations of transaction processing, submission and rollback according to the value of the attribute.
As an alternative embodiment, as shown in fig. 3, the first operation module 230 specifically includes:
a modifying module 231, configured to determine whether the value of the attribute is false when performing transaction processing, and if yes, modify the current data;
a deleting module 232, configured to set the value of the attribute to false when the transaction is submitted, and delete the rollback callback function corresponding to the transaction processing;
and a calling module 233, configured to set the value of the attribute to false when the transaction rollback is performed, and call the rollback callback function to recover the corresponding data state.
The strongly correlated data operation flow:
when a transaction T1 operates on state data s1, firstly locking an s1 object, judging whether s1.pending= true is false, if so, setting s1.pending= true and setting a rollback callback function rfun of the operation, and modifying the state data s1; if true, the exception is thrown, the current state data cannot be modified, and unlocking of the state data s1 is completed.
When the transaction T1 is submitted, locking the s1 object, setting s1.pending=false, deleting the rollback callback function corresponding to the T1 operation, and finishing unlocking the s1.
When the transaction T1 rolls back, the s1 object is locked, s1.pending=false is set, the roll-back callback function is called to recover the state data s1, and the unlocking of the s1 is completed.
According to the method and the device, the data based on the blockchain operation are divided into the strong related data and the weak related data, the strong related data is specially marked, the data is correspondingly operated according to different marks, the technical problem that the strong related data cannot realize multi-thread simultaneous operation is solved, and the execution efficiency of the blockchain transaction is improved.
As an alternative embodiment, the apparatus further comprises:
a data dividing module 240 for dividing the weakly related data into three components, namely an operable part, an adding part and a deleting part;
a judging module 250, configured to judge whether to perform an addition operation or a subtraction operation on the weakly correlated data;
a second operation module 260, configured to store, if the weak correlation data is subjected to an addition operation, a transaction ID and added data in the adding portion, when the transaction is submitted, find the added data in the adding portion according to the submitted transaction ID, find the added data in the operable portion, and when the transaction is rolled back, find the added data in the adding portion according to the transaction ID, and find the added data in the deleting portion;
and a third operation module 270, configured to store the transaction ID and the subtracted data in the pruned portion if the weakly related data is subjected to the subtracting operation, subtract the subtracted data from the data in the operable portion, search the pruned portion according to the submitted transaction ID when the transaction is submitted, delete the subtracted data if found, search the pruned portion according to the transaction ID when the transaction is rolled back, and add the subtracted data to the operable portion if found.
Weak correlation data operation flow:
in the case of performing the addition operation,
when a transaction T1 carries out addition operation on weak related data d1, locking d1, and setting an addition callback function cfun, wherein the operation of cfun is to add an addition number to an operable part of d1, so as to finish unlocking d 1;
when the transaction T1 is submitted by a commit, locking d1, searching for an addition callback function of an added part, and executing the addition callback function if the addition callback function is searched, so as to finish unlocking d 1;
when the transaction T1 rolls back, locking d1, searching the adding callback function in the adding part, and deleting the adding callback function if the adding callback function is searched, so as to finish unlocking d 1.
When the subtraction operation is performed,
when a transaction T1 carries out subtraction operation on weak related data d1, locking d1, judging whether an operable part of d1 can execute the subtraction operation, if so, executing the subtraction operation, setting a rollback operation rfun to carry out reverse operation, if not, throwing out abnormality, and completing the transaction if the operable data of d1 is too small, and completing the unlocking of d 1;
when a transaction T1 is submitted, locking d1, searching the deleting part of d1, and deleting a rollback callback function rfun corresponding to T1 when the rollback callback function rfun is searched, so as to finish unlocking d 1;
when the transaction T1 is rolled back, locking d1, searching the deletion part of d1, and when the rollback callback function rfun corresponding to T1 is searched, executing the rollback callback function rfun to finish unlocking d 1.
For the blockchain, most operations are weakly related data, and the operations have higher requirements on parallelism, and the method optimizes the weakly related data operations, so that corresponding transactions of the weakly related data can be executed in parallel, any transaction is submitted and rolled back without affecting other transactions, and when the earlier transaction rolls back, avalanche rollback is not caused, thereby well solving the problem of parallel execution of the blockchain transactions.
In a third aspect, embodiments of the present application further provide an apparatus, including: a processor, a memory, and a communication unit;
the memory stores machine readable instructions executable by the processor, the processor and the memory in communication via the communication unit when the device is operating;
wherein the processor executes the machine readable instructions to perform the method of the above aspects.
The memory may be used to store the processor's execution instructions and may be implemented by any type of volatile or non-volatile memory terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk. The execution of the instructions in memory, when executed by the processor, causes the apparatus to perform some or all of the steps in the method embodiments described below.
The processor is a control center of the memory terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and executes various functions of the electronic terminal and/or processes data by running or executing software programs and/or modules stored in the memory, and invoking data stored in the memory. The processor may be comprised of an integrated circuit (Integrated Circuit, simply referred to as an IC), for example, a single packaged IC, or may be comprised of a plurality of packaged ICs connected to the same function or different functions. For example, the processor may include only a central processing unit (Central Processing Unit, simply CPU). In the embodiment of the application, the CPU may be a single operation core or may include multiple operation cores.
And the communication unit is used for establishing a communication channel so that the storage device can communicate with other terminals. Receiving user data sent by other terminals or sending the user data to other terminals.
In a fourth aspect, embodiments of the present application further provide a computer storage medium, where the computer storage medium may store a program, and the program may include some or all of the steps in the embodiments provided herein when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
In the embodiments provided herein, it should be understood that the disclosed systems and methods may be implemented in other ways. For example, the node embodiments described above are merely illustrative, e.g., the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another device, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The modules described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes or substitutions are covered by the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (6)

1. A method of blockchain-based data manipulation, comprising:
the data of the block chain operation is divided into strong related data and weak related data, wherein the strong related data refers to the data which can be subjected to current data operation after the last data operation consensus is completed and submitted, and the weak related data refers to the data which can be subjected to current data operation without the last data operation consensus;
setting an attribute for marking an execution state for each strongly correlated data;
according to the attribute, corresponding data operation is carried out under three conditions of transaction processing, submitting and rollback respectively;
the value of the attribute is a Boolean value;
the corresponding data operation in three situations of transaction processing, submitting and rolling back according to the attribute specifically comprises the following steps:
when the transaction processing is carried out, judging whether the value of the attribute is false, if so, modifying the current data;
setting the value of the attribute as false when the transaction is submitted, and deleting the rollback callback function corresponding to the transaction processing;
and when the transaction rollback is carried out, setting the value of the attribute as false, and calling a rollback callback function to restore the corresponding data state.
2. The blockchain-based data manipulation method of claim 1, wherein the data manipulating the blockchain is separated into strongly correlated data and weakly correlated data, further comprising:
dividing the weakly related data into three components, namely an operable part, an adding part and a deleting part;
judging whether to perform addition operation or subtraction operation on the weak correlation data;
if the weak correlation data is subjected to addition operation, storing a transaction ID and an addition callback function in the adding part, when the transaction is submitted, searching a corresponding addition callback function in the adding part according to the submitted transaction ID, executing the addition callback function if the corresponding addition callback function is searched, adding the added data to the operable part, and when the transaction is rolled back, searching the addition callback function in the adding part according to the transaction ID, and deleting the addition callback function if the corresponding addition callback function is found;
and if the weakly related data is subjected to subtraction operation, subtracting the subtracted data from the data of the operable part, storing a transaction ID and an operable part rollback callback function into the deletion part, searching the rollback callback function in the deletion part according to the submitted transaction ID when the transaction is submitted, deleting the rollback callback function if the transaction ID is found, searching the rollback callback function in the deletion part according to the transaction ID when the transaction is rolled back, executing the rollback callback function if the transaction ID is found, and adding the subtracted data in the operable part.
3. A blockchain-based data manipulation device, comprising:
the classification module is used for classifying the data of the blockchain operation into strong related data and weak related data, wherein the strong related data refers to the data which can be subjected to the current data operation after the last data operation consensus is completed and submitted, and the weak related data refers to the data which can be subjected to the current data operation without the last data operation consensus completion;
a setting module for setting an attribute for marking an execution state for each of the strongly related data;
the first operation module is used for respectively carrying out corresponding data operation under three conditions of transaction processing, submitting and rollback according to the attribute;
the value of the attribute is a Boolean value;
the first operation module specifically includes:
the modification module is used for judging whether the value of the attribute is false or not when the transaction processing is carried out, and modifying the current data if yes;
the deleting module is used for setting the value of the attribute to be false when the transaction is submitted, and deleting the rollback callback function corresponding to the transaction processing;
and the calling module is used for setting the value of the attribute to be false when the transaction rollback is carried out, and calling a rollback callback function to restore the corresponding data state.
4. The blockchain-based data manipulation device of claim 3, wherein the device further comprises:
the data dividing module is used for dividing the weak related data into three components, namely an operable part, an adding part and a deleting part;
a judging module, configured to judge whether to perform an addition operation or a subtraction operation on the weakly correlated data;
the second operation module is used for storing the transaction ID and the addition callback function into the adding part if the weak related data are subjected to addition operation, searching the corresponding addition callback function in the adding part according to the submitted transaction ID when the transaction is submitted, executing the addition callback function if the corresponding addition callback function is searched, adding the added data into the operable part, searching the addition callback function in the adding part according to the transaction ID when the transaction is rolled back, and deleting the addition callback function if the corresponding addition callback function is found;
and a third operation module, configured to, if subtraction is performed on weakly related data, subtract the subtracted data from the data of the operable portion, store a transaction ID and an operable portion rollback callback function in the pruned portion, when the transaction is submitted, search the rollback callback function in the pruned portion according to the submitted transaction ID, delete the rollback callback function if found, and when the transaction is rolled back, search the rollback callback function in the pruned portion according to the transaction ID, execute the rollback callback function if found, and add the subtracted data in the operable portion.
5. An electronic device, comprising: a processor, a memory, and a communication unit;
the memory stores machine readable instructions executable by the processor, the processor and the memory in communication via the communication unit when the device is operating;
wherein the processor executes the machine readable instructions to perform the method of any one of claims 1 to 2.
6. A computer-readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, performs the method of any of claims 1 to 2.
CN202011031942.8A 2020-09-27 2020-09-27 Data operation method, device, equipment and medium based on block chain Active CN112256476B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011031942.8A CN112256476B (en) 2020-09-27 2020-09-27 Data operation method, device, equipment and medium based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011031942.8A CN112256476B (en) 2020-09-27 2020-09-27 Data operation method, device, equipment and medium based on block chain

Publications (2)

Publication Number Publication Date
CN112256476A CN112256476A (en) 2021-01-22
CN112256476B true CN112256476B (en) 2024-04-16

Family

ID=74234306

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011031942.8A Active CN112256476B (en) 2020-09-27 2020-09-27 Data operation method, device, equipment and medium based on block chain

Country Status (1)

Country Link
CN (1) CN112256476B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508337A (en) * 2018-11-12 2019-03-22 杭州秘猿科技有限公司 A kind of transaction is parallel to execute method, apparatus, electronic equipment and system
CN110517141A (en) * 2019-08-27 2019-11-29 深圳前海微众银行股份有限公司 A kind of common recognition method and device based on block catenary system
CN110741342A (en) * 2017-06-26 2020-01-31 国际商业机器公司 Blockchain transaction commit ordering
CN111033542A (en) * 2017-08-29 2020-04-17 区块链控股有限公司 Input constraints for unlocking transactions in blockchains
CN111240831A (en) * 2019-12-31 2020-06-05 陕西医链区块链集团有限公司 Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium
CN111368362A (en) * 2020-03-06 2020-07-03 广联达科技股份有限公司 Building model component protection method and system based on block chain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10565192B2 (en) * 2017-08-01 2020-02-18 International Business Machines Corporation Optimizing queries and other retrieve operations in a blockchain

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110741342A (en) * 2017-06-26 2020-01-31 国际商业机器公司 Blockchain transaction commit ordering
CN111033542A (en) * 2017-08-29 2020-04-17 区块链控股有限公司 Input constraints for unlocking transactions in blockchains
CN109508337A (en) * 2018-11-12 2019-03-22 杭州秘猿科技有限公司 A kind of transaction is parallel to execute method, apparatus, electronic equipment and system
CN110517141A (en) * 2019-08-27 2019-11-29 深圳前海微众银行股份有限公司 A kind of common recognition method and device based on block catenary system
CN111240831A (en) * 2019-12-31 2020-06-05 陕西医链区块链集团有限公司 Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium
CN111368362A (en) * 2020-03-06 2020-07-03 广联达科技股份有限公司 Building model component protection method and system based on block chain

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
A Parallel Proof of Work to Improve Transaction Speed and Scalability in Blockchain Systems;Shihab Shahriar Hazari等;《2019 IEEE 9th Annual Computing and Communication Workshop and Conference (CCWC)》;全文 *
区块链技术下共享金融发展研究;乔海曙等;《经济与管理》;全文 *

Also Published As

Publication number Publication date
CN112256476A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
CN106603264A (en) Method and equipment for positioning fault root
CN111240831A (en) Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium
CN113505024B (en) Data processing method and device of alliance chain, electronic equipment and storage medium
WO2020253045A1 (en) Configured supplementary processing method and device for data of which forwarding has abnormality, and readable storage medium
CN111857984A (en) Job calling processing method and device in bank system and computer equipment
CN112256476B (en) Data operation method, device, equipment and medium based on block chain
CN112598510B (en) Resource data processing method and device
US20240045787A1 (en) Code inspection method under weak memory ordering architecture and corresponding device
CN107391539B (en) Transaction processing method, server and storage medium
CN103703449A (en) Memory coalescing computer-implemented method, system and apparatus
CN111221650A (en) System resource recovery method and device based on process type association
CN116610752A (en) Transactional distributed data synchronization method, device, system and storage medium
CN111078473A (en) Test item copying method and device
CN111382189A (en) Heterogeneous data collision analysis method, terminal device and storage medium
CN106776052A (en) Shared resource access method and device
CN114265813A (en) Snapshot query method, device, equipment and storage medium
CN111078449B (en) Information processing method, information processing device and terminal equipment
CN114493598A (en) Computing resource management method, device, computer equipment and storage medium
US5615371A (en) Debug processing system for user programs
CN113220598A (en) System test method, apparatus, device, medium, and program product
CN110765144B (en) Distributed heterogeneous database data processing method and device
CN108932284B (en) General logic scheduling method, electronic device and readable storage medium
CN112669151A (en) Method and equipment for processing multi-system cooperative service
CN111752911A (en) Data transmission method, system, terminal and storage medium based on Flume
CN111199483A (en) Block chain transaction execution method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant