CN113627938B - Data deleting method, device and equipment of block chain and storage medium - Google Patents
Data deleting method, device and equipment of block chain and storage medium Download PDFInfo
- Publication number
- CN113627938B CN113627938B CN202110976953.1A CN202110976953A CN113627938B CN 113627938 B CN113627938 B CN 113627938B CN 202110976953 A CN202110976953 A CN 202110976953A CN 113627938 B CN113627938 B CN 113627938B
- Authority
- CN
- China
- Prior art keywords
- transaction
- deleted
- block
- hash
- deletion
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 34
- 238000012217 deletion Methods 0.000 claims abstract description 140
- 230000037430 deletion Effects 0.000 claims abstract description 140
- 238000012795 verification Methods 0.000 claims abstract description 38
- 238000004422 calculation algorithm Methods 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 6
- 239000003550 marker Substances 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 8
- 230000003287 optical effect Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 230000001105 regulatory effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3825—Use of electronic signatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/21—Design, administration or maintenance of databases
- G06F16/215—Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3827—Use of message hashing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3829—Payment protocols; Details thereof insuring higher security of transaction involving key management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/40—Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
- G06Q20/401—Transaction verification
- G06Q20/4014—Identity check for transactions
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Theoretical Computer Science (AREA)
- Accounting & Taxation (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Finance (AREA)
- General Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Computer Security & Cryptography (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a data deleting method, device, equipment and storage medium of a blockchain. The method comprises the following steps: when the deleting transaction in the block is identified, carrying out identity verification on the deleting transaction according to the transaction information contained in the deleting transaction; if the verification is passed, determining a transaction to be deleted and a deletion mark according to transaction information contained in the deletion transaction, wherein the deletion mark comprises: hash of transaction to be deleted; deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted. By the technical scheme, the deletion mark and the deletion transaction can be introduced, so that the deleted transaction and the deletion transaction can be mutually verified according to the deletion mark, and the problem of data deletion on a data chain is solved on the basis of not changing the tamper-proof characteristic of the blockchain.
Description
Technical Field
The embodiment of the invention relates to the technical field of blockchains, in particular to a method, a device, equipment and a storage medium for deleting data of a blockchain.
Background
The block chain is a decentralized distributed database system which is maintained by all nodes in the block chain network in a common participation mode, and consists of a series of data blocks generated based on a cryptography method, wherein each data block is one block in the block chain. Blocks are linked together in order according to the order of the time of generation, forming a chain of data, known in the figure as a blockchain. The blockchain has the unique block generation, transaction generation and verification protocols and has the security characteristics of non-falsification, complete traceability and the like.
In an actual business scenario, there is a need to delete data on the blockchain. Transaction data that does not meet legal or regulatory rules on the blockchain, for example, needs to be deleted. However, due to the inherent non-tamperable nature of blockchains, the data on blockchains cannot be deleted in the prior art.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for deleting data of a blockchain, which can realize mutual verification between deleted transactions and deleted transactions according to deletion marks by introducing the deletion marks and deletion transactions, and solve the problem of deleting the data on the data chain on the basis of not changing the tamper-proof characteristic of the blockchain.
In a first aspect, an embodiment of the present invention provides a method for deleting data of a blockchain, including:
When the deleting transaction in the block is identified, carrying out identity verification on the deleting transaction according to the transaction information contained in the deleting transaction;
If the verification is passed, determining a transaction to be deleted and a deletion mark according to transaction information contained in the deletion transaction, wherein the deletion mark comprises: hash of transaction to be deleted;
Deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted.
Further, the deleting the transaction information included in the transaction includes: the method comprises the steps of transaction hash to be deleted, block number to be deleted, transaction identity information to be deleted, transaction signature to be deleted, transaction identification to be deleted and transaction number to be deleted.
Further, the performing identity verification on the deletion transaction according to the transaction information included in the deletion transaction includes:
verifying the deleted transaction signature according to the deleted transaction identity information;
if the deleted transaction identity information is consistent with the deleted transaction signature, judging whether the deleted transaction identity information is in a pre-stored deleted transaction authority list or not;
And if the deleted transaction identity information is in a pre-stored deleted transaction authority list, the verification is passed.
Further, the determining the transaction to be deleted according to the transaction information contained in the deletion transaction includes:
determining a block to be deleted according to the number of the block to be deleted, and obtaining a hash of the block to be deleted;
And if the hash of the block to be deleted is consistent with the hash of the block to be deleted calculated by the current blockchain node, determining the transaction to be deleted in the block to be deleted according to the hash of the transaction to be deleted.
Further, determining a deletion flag according to the transaction information included in the deletion transaction includes:
acquiring the deleted block number and the deleted block hash from the block where the deleted transaction is located;
And determining a deletion mark corresponding to the transaction to be deleted according to the transaction hash to be deleted, the deletion block number, the deletion block hash and the deletion transaction number.
Further, identifying a delete transaction in the block includes:
When a block is received, extracting a block hash of the block;
judging whether the block hash is consistent with the block hash calculated by the current block chain node;
if yes, determining the transaction comprising the deletion transaction identifier in the block as a deletion transaction.
In a second aspect, an embodiment of the present invention further provides a data deleting apparatus for a blockchain, where the apparatus includes:
the verification module is used for carrying out identity verification on the deleted transaction according to the transaction information contained in the deleted transaction when the deleted transaction in the block is identified;
The determining module is configured to determine a transaction to be deleted and a deletion mark according to transaction information included in the deletion transaction if the verification is passed, where the deletion mark includes: hash of transaction to be deleted;
And the deleting module is used for deleting the data of the transaction to be deleted and marking the transaction to be deleted based on the deleting mark, wherein the transaction to be deleted is the deleted transaction to be deleted.
In a third aspect, an embodiment of the present invention further provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements a method for deleting data of a blockchain according to any one of the embodiments of the present invention when the processor executes the program.
In a fourth aspect, embodiments of the present invention also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for deleting data of a blockchain as described in any of the embodiments of the present invention.
The embodiment of the invention leads the deleted transaction and the deleted transaction to be mutually verified according to the delete mark by introducing the delete mark and the delete transaction, and solves the problem of deleting the data on the data chain on the basis of not changing the non-tamperable characteristic of the blockchain.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, 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 invention and therefore should not be considered as limiting the scope, and 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 for deleting data of a blockchain in accordance with a first embodiment of the present invention;
FIG. 2 is a schematic diagram of a block hash calculation method according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram showing a relationship between a transaction to be deleted and a deletion transaction according to a first embodiment of the present invention;
FIG. 4 is a flowchart of a method for deleting data from a blockchain in accordance with a second embodiment of the present invention;
FIG. 5 is a schematic diagram of a structure of a transaction tag to be deleted based on a delete tag in a second embodiment of the present invention;
FIG. 6 is a schematic diagram of a block chain data deleting device according to a third embodiment of the present invention;
Fig. 7 is a schematic structural diagram of a terminal device in a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Example 1
Fig. 1 is a flowchart of a method for deleting data of a blockchain, which is provided in an embodiment of the present invention, where the method may be implemented by a blockchain deleting device in the embodiment of the present invention, the device may be implemented in a software and/or hardware manner, and the device may be integrated in a blockchain node, and the blockchain node may be a terminal device. The terminal device may be a notebook computer, a mobile phone, a wearable device, a navigation device, etc., which is not limited in the embodiment of the present invention.
As shown in fig. 1, the method specifically includes the following steps:
S110, when the deleting transaction in the block is identified, the deleting transaction is authenticated according to the transaction information contained in the deleting transaction.
Wherein, the block is a carrier storing data information, and the elements included in each block include: the block ID number, the previous block ID number and a plurality of transactions. Deleting a transaction refers to a transaction for deleting other transaction data. The delete transaction may be generated based on a user's transaction delete request, which may be considered a request to delete other transaction data.
Specifically, when the blockchain node receives the block, identifying whether a deletion transaction exists in the block, if so, acquiring transaction information contained in the deletion transaction, and performing identity verification on the deletion transaction according to the transaction information contained in the deletion transaction.
For example, deleting transaction information contained in a transaction may include: deleting relevant information of the transaction may include, for example: delete transaction number, delete transaction signature, delete transaction identity information, etc., to facilitate verification of authority to delete the identity of the transaction. May further include: the relevant information of the transaction to be deleted may include, for example: the transaction hash to be deleted, the block number to be deleted and the block hash to be deleted are used for conveniently positioning the transaction to be deleted. The transaction hash is a numerical value obtained by calculating transaction data through a hash algorithm, the hash algorithm is a cryptographic algorithm which can only be encrypted and not decrypted, the block data with any length can be converted into a section of character string with fixed length through the hash algorithm, and each transaction can be calculated to obtain a unique hash. The block hash is calculated from the root hash of Mei Gener tree of each transaction in the block and the previous block hash. When data of a transaction in a block changes, the transaction hash and the corresponding block hash also change, and in the block chain, the non-tamper property of the block chain data is ensured through the uniqueness of the transaction hash and the block hash.
For example, as shown in fig. 2, if there are transactions D1, D2, D3 and D4 in the block, the transaction D1 is calculated by a hash algorithm to obtain hash 1, the transaction D2 is calculated by a hash algorithm to obtain hash 2, the transaction D3 is calculated by a hash algorithm to obtain hash 3, and the transaction D4 is calculated by a hash algorithm to obtain hash 4; hash 1 and hash 2 are calculated by a hash algorithm to obtain hash 12, hash 3 and hash 4 are calculated by a hash algorithm to obtain hash 34, and hash 12 and hash 34 are calculated by a hash algorithm to obtain a root hash. The hash of the current block is obtained by the calculation of the root hash and the hash of the previous block.
Illustratively, when the block link point generates a delete transaction based on the request information of the data delete request according to the data delete request input by the user, and sets a delete transaction identifier in the delete transaction. Thus, a delete transaction in the transaction identification block may be deleted. The means for authenticating the delete transaction based on the transaction information included in the delete transaction may be determining an authentication result based on a comparison of the delete transaction signature and the delete transaction identity information included in the delete transaction.
S120, if the verification is passed, determining a transaction to be deleted and a deletion mark according to the transaction information contained in the deletion transaction, wherein the deletion mark comprises: the transaction hash is to be deleted.
Wherein the deletion marker includes: the transaction to be deleted is hashed, the deletion mark is used for marking the deleted transaction to be deleted, the deletion mark can be stored in a block to which the transaction to be deleted belongs, and the form of the deletion mark is not limited in the embodiment of the invention.
Specifically, as shown in fig. 3, the transaction to be deleted is located based on the transaction information included in the transaction to be deleted, and the deletion mark corresponding to the transaction to be deleted is determined.
Illustratively, locating the transaction to be deleted based on the transaction hash to be deleted contained in the deletion transaction, and writing the transaction hash to be deleted into the deletion marker; or locating the block to be deleted based on the block number to be deleted contained in the deletion transaction, acquiring the transaction to be deleted from the block to be deleted, and writing the hash of the transaction to be deleted and other related information of the transaction to be deleted into the deletion mark, wherein the other related information of the transaction to be deleted can be deletion transaction identity information, deletion transaction hash and/or deletion transaction number.
S130, deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted.
As shown in fig. 2, the main reason that the blockchain has a natural property of being non-tamperable is that: the data on the block chain is connected in series through the Hash of the block, and the Hash of the current block is calculated according to the Hash of the previous block and the root Hash of Mei Gener trees of transactions in the current block. For deleting blocks of transaction data, the Hash of the transaction must be preserved so as not to violate the non-tamperable nature of the blockchain.
Therefore, after deleting the data of the transaction to be deleted in the block, the transaction to be deleted is determined to be the deleted transaction, and the deleted transaction is marked by adopting the deletion mark stored with the deleted transaction Hash, so that the Hash of the block is unchanged after the transaction data is deleted, and a new block can calculate the Hash of the new block according to the Hash written in the deletion mark, thereby ensuring the non-tamper property of the blockchain while deleting the transaction data on the blockchain.
According to the technical scheme, when the deletion transaction in the block is identified, the identity of the deletion transaction is verified according to the transaction information contained in the deletion transaction; if the verification is passed, determining a transaction to be deleted and a deletion mark according to transaction information contained in the deletion transaction, wherein the deletion mark comprises: hash of transaction to be deleted; deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted, and the deletion mark and the deletion transaction can be introduced, so that the deleted transaction and the deletion transaction can be mutually verified according to the deletion mark, and the problem of deleting the data on the data chain is solved on the basis of not changing the non-tamperable characteristic of the blockchain.
Example two
Fig. 4 is a flowchart of a data deleting method of a blockchain in a second embodiment of the present invention, which is optimized based on the above embodiment.
As shown in fig. 4, the method of this embodiment specifically includes the following steps:
S210, when the deleting transaction in the block is identified, the deleting transaction is authenticated according to the transaction information contained in the deleting transaction.
The deleting transaction information contained in the transaction includes: the method comprises the steps of transaction hash to be deleted, block number to be deleted, transaction identity information to be deleted, transaction signature to be deleted, transaction identification to be deleted and transaction number to be deleted.
The transaction hash to be deleted is a hash value obtained by calculating transaction data to be deleted through a hash algorithm; the block hash to be deleted is calculated by the root hash of Mei Gener tree of each transaction in the block to which the transaction to be deleted belongs and the previous block hash. The number of the block to be deleted is the number of the block to which the transaction to be deleted belongs; the deleted transaction signature is used for indicating the identity of a deleter, and the deleter generates a node for deleting the transaction; deleting the transaction identity information to verify the identity of the deleter, which may be a public key of the deleter; or may be the public key identification of the deleter, the public key needs to be obtained from the configuration or external system based on the public key identification.
Optionally, step S210 may include: step S211 to step S213:
s211, verifying the deleted transaction signature according to the deleted transaction identity information;
s212, if the deleted transaction identity information is consistent with the deleted transaction signature, judging whether the deleted transaction identity information is in a pre-stored deleted transaction authority list or not;
And S213, if the deleted transaction identity information is in a pre-stored deleted transaction authority list, the verification is passed.
Specifically, according to the identity information of the deleted transaction and the deleted transaction signature, the identity of the deleted transaction is verified, and whether the deleted transaction signature has the deleting authority is determined.
If the deleted transaction identity information is consistent with the deleted transaction signature, indicating that the identity verification of the deleted transaction is passed, further judging whether the deleted transaction identity information is in a pre-stored deleted transaction authority list, and if the deleted transaction identity information is in the pre-stored deleted transaction authority list, indicating that the node corresponding to the deleted transaction has the deleted authority, so that the verification is passed. If the deleted transaction identity information is inconsistent with the deleted transaction signature or the deleted transaction identity information is not in a pre-stored deleted transaction authority list, the transaction request of the deleted transaction cannot be executed.
S220, if the verification is passed, determining the block to be deleted according to the number of the block to be deleted, and obtaining the hash of the block to be deleted.
Specifically, if the identity verification of the deletion transaction is passed, it indicates that the transaction request of the deletion transaction can be executed, the block to be deleted is located according to the number of the block to be deleted included in the deletion transaction, and the hash of the block to be deleted is obtained from the block header of the block to be deleted.
And S230, if the hash of the block to be deleted is consistent with the hash of the block to be deleted calculated by the current block chain node, determining the transaction to be deleted in the block to be deleted according to the hash of the transaction to be deleted.
Specifically, whether the block hash to be deleted is consistent with the block hash to be deleted calculated by the current block chain node is judged, and if so, the transaction data in the block to be deleted is complete and is not tampered. And positioning the transaction to be deleted in the block to be deleted according to the transaction to be deleted hash in the deletion transaction.
S240, acquiring the deleted block number and the deleted block hash from the block where the deleted transaction is located; and determining a deletion mark corresponding to the transaction to be deleted according to the transaction hash to be deleted, the deletion block number, the deletion block hash and the deletion transaction number.
Specifically, according to the information of the delete transaction: deletion block number and deletion block hash, deletion transaction number, and information of the transaction to be deleted: and the transaction hash to be deleted, and determining a deletion mark for indicating the deletion transaction and transaction information of the transaction to be deleted.
S250, deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted.
For example, as shown in fig. 5, after locating the transaction to be deleted, deleting the data of the transaction to be deleted, and determining the deleted transaction to be deleted as the deleted transaction, marking the deleted transaction with a deletion flag including a hash of the transaction to be deleted, a deletion block number and a deletion block hash and a deletion transaction number.
According to the technical scheme, when the deletion transaction in the block is identified, the identity of the deletion transaction is verified according to the transaction information contained in the deletion transaction; if the verification is passed, determining a transaction to be deleted and a deletion mark according to transaction information contained in the deletion transaction, wherein the deletion mark comprises: hash of transaction to be deleted; deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted, and the deletion mark and the deletion transaction can be introduced, so that the deleted transaction and the deletion transaction can be mutually verified according to the deletion mark, and the problem of deleting the data on the data chain is solved on the basis of not changing the non-tamperable characteristic of the blockchain.
Optionally, identifying the delete transaction in the block includes:
When a block is received, extracting a block hash of the block;
judging whether the block hash is consistent with the block hash calculated by the current block chain node;
if yes, determining the transaction comprising the deletion transaction identifier in the block as a deletion transaction.
Specifically, in order to prevent data of the node block from being tampered maliciously, when the blockchain node receives the block, a blockhash is extracted from the block, if the blockhash is consistent with the blockhash calculated by the current blockchain node, whether the transaction in the block contains a deletion transaction identifier is searched in the block, and the transaction containing the deletion transaction identifier is determined as a deletion transaction.
Example III
Fig. 6 is a schematic structural diagram of a data deleting device of a blockchain according to a third embodiment of the present invention. The present embodiment may be applicable to the case of deleting transaction data on a blockchain, where the apparatus may be implemented in software and/or hardware, and the apparatus may be integrated in any device that provides a function of deleting data of a blockchain, as shown in fig. 6, where the apparatus for deleting data of a blockchain specifically includes: a verification module 310, a determination module 320, and a deletion module 330.
The verification module 310 is configured to, when a deletion transaction in a block is identified, perform identity verification on the deletion transaction according to transaction information included in the deletion transaction;
A determining module 320, configured to determine, if the verification is passed, a transaction to be deleted and a deletion flag according to the transaction information included in the deletion transaction, where the deletion flag includes: hash of transaction to be deleted;
And the deleting module 330 is configured to delete the data of the transaction to be deleted, and mark the deleted transaction based on the delete mark, where the deleted transaction is a deleted transaction to be deleted.
Optionally, the deleting the transaction information included in the transaction includes: the method comprises the steps of transaction hash to be deleted, block number to be deleted, transaction identity information to be deleted, transaction signature to be deleted, transaction identification to be deleted and transaction number to be deleted.
Optionally, the verification module 310 is specifically configured to:
verifying the deleted transaction signature according to the deleted transaction identity information;
if the deleted transaction identity information is consistent with the deleted transaction signature, judging whether the deleted transaction identity information is in a pre-stored deleted transaction authority list or not;
And if the deleted transaction identity information is in a pre-stored deleted transaction authority list, the verification is passed.
Optionally, the determining module 320 is specifically configured to:
determining a block to be deleted according to the number of the block to be deleted, and obtaining a hash of the block to be deleted;
And if the hash of the block to be deleted is consistent with the hash of the block to be deleted calculated by the current blockchain node, determining the transaction to be deleted in the block to be deleted according to the hash of the transaction to be deleted.
Optionally, the determining module 320 is further configured to:
acquiring the deleted block number and the deleted block hash from the block where the deleted transaction is located;
And determining a deletion mark corresponding to the transaction to be deleted according to the transaction hash to be deleted, the deletion block number, the deletion block hash and the deletion transaction number.
Optionally, the verification module 310 is specifically configured to:
When a block is received, extracting a block hash of the block;
judging whether the block hash is consistent with the block hash calculated by the current block chain node;
if yes, determining the transaction comprising the deletion transaction identifier in the block as a deletion transaction.
The product can execute the method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 7 is a schematic structural diagram of a terminal device in a fourth embodiment of the present invention. Fig. 7 shows a block diagram of an exemplary terminal device 12 suitable for use in implementing embodiments of the present invention. The terminal device 12 shown in fig. 7 is only an example, and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
As shown in fig. 7, the terminal device 12 is in the form of a general purpose computing device. The components of terminal device 12 may include, but are not limited to: one or more processors or processors 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processors 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Terminal device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by terminal device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. Terminal device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 7, commonly referred to as a "hard disk drive"). Although not shown in fig. 7, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
Terminal device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with terminal device 12, and/or any devices (e.g., network card, modem, etc.) that enable terminal device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. In the terminal device 12 of the present embodiment, the display 24 is not provided as a separate body but is embedded in the mirror surface, and the display surface of the display 24 and the mirror surface are visually integrated when the display surface of the display 24 is not displayed. Also, terminal device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, via network adapter 20. As shown, network adapter 20 communicates with other modules of terminal device 12 over bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with terminal device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processor 16 executes programs stored in the system memory 28 to perform various functional applications and data processing, such as implementing the blockchain data deletion method provided by embodiments of the present invention: when the deleting transaction in the block is identified, carrying out identity verification on the deleting transaction according to the transaction information contained in the deleting transaction; if the verification is passed, determining a transaction to be deleted and a deletion mark according to transaction information contained in the deletion transaction, wherein the deletion mark comprises: hash of transaction to be deleted; deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted.
Example five
A fifth embodiment of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a blockchain data deletion method as provided by all the embodiments of the present application: when the deleting transaction in the block is identified, carrying out identity verification on the deleting transaction according to the transaction information contained in the deleting transaction; if the verification is passed, determining a transaction to be deleted and a deletion mark according to transaction information contained in the deletion transaction, wherein the deletion mark comprises: hash of transaction to be deleted; deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted.
Any combination of one or more computer readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.
Claims (8)
1. A method for deleting data of a blockchain, comprising:
When the deleting transaction in the block is identified, carrying out identity verification on the deleting transaction according to the transaction information contained in the deleting transaction;
If the verification is passed, determining a transaction to be deleted and a deletion mark according to transaction information contained in the deletion transaction, wherein the deletion mark comprises: hash of transaction to be deleted;
deleting the data of the transaction to be deleted, and marking the transaction to be deleted based on the deletion mark, wherein the transaction to be deleted is the deleted transaction to be deleted;
The deletion mark is used for marking the deleted transaction to be deleted, and the deletion mark is stored in a block to which the transaction to be deleted belongs;
the deleting transaction information contained in the transaction includes: the method comprises the steps of transaction hash to be deleted, block number to be deleted, transaction identity information to be deleted, transaction signature to be deleted, transaction identifier to be deleted and transaction number to be deleted;
The transaction hash to be deleted is a hash value obtained by calculating transaction data to be deleted through a hash algorithm; the block hash to be deleted is obtained by calculating the root hash of Mei Gener trees of all transactions in the block to which the transaction to be deleted belongs and the previous block hash; the number of the block to be deleted is the number of the block to be deleted to which the transaction belongs; the delete transaction signature is used for indicating the identity of a deleter, and the deleter generates a node for deleting the transaction; the deleted transaction identity information is used for verifying the identity of the deleter and is a public key of the deleter or a public key identifier of the deleter, and if the deleted transaction identity information is the public key identifier of the deleter, the public key is acquired from the configuration or the external system based on the public key identifier.
2. The method of claim 1, wherein said authenticating said delete transaction based on transaction information contained in said delete transaction comprises:
verifying the deleted transaction signature according to the deleted transaction identity information;
if the deleted transaction identity information is consistent with the deleted transaction signature, judging whether the deleted transaction identity information is in a pre-stored deleted transaction authority list or not;
And if the deleted transaction identity information is in a pre-stored deleted transaction authority list, the verification is passed.
3. The method of claim 1, wherein the determining a transaction to be deleted from the transaction information contained in the deletion transaction comprises:
determining a block to be deleted according to the number of the block to be deleted, and obtaining a hash of the block to be deleted;
And if the hash of the block to be deleted is consistent with the hash of the block to be deleted calculated by the current blockchain node, determining the transaction to be deleted in the block to be deleted according to the hash of the transaction to be deleted.
4. The method of claim 1, wherein determining a delete marker from transaction information contained in the delete transaction comprises:
acquiring the block number to be deleted and the block hash to be deleted from the block where the deletion transaction is located;
and determining a deletion mark corresponding to the transaction to be deleted according to the transaction hash to be deleted, the block number to be deleted, the block hash to be deleted and the deletion transaction number.
5. The method of claim 1, wherein identifying a delete transaction in a block comprises:
When a block is received, extracting a block hash of the block;
judging whether the block hash is consistent with the block hash obtained by calculating the current block chain node;
if yes, determining the transaction comprising the deletion transaction identifier in the block as a deletion transaction.
6. A data deleting apparatus of a blockchain, comprising:
the verification module is used for carrying out identity verification on the deleted transaction according to the transaction information contained in the deleted transaction when the deleted transaction in the block is identified;
The determining module is configured to determine a transaction to be deleted and a deletion mark according to transaction information included in the deletion transaction if the verification is passed, where the deletion mark includes: hash of transaction to be deleted;
the deleting module is used for deleting the data of the transaction to be deleted and marking the transaction to be deleted based on the deleting mark, wherein the transaction to be deleted is the deleted transaction to be deleted;
The deletion mark is used for marking the deleted transaction to be deleted, and the deletion mark is stored in a block to which the transaction to be deleted belongs;
The deleting transaction information contained in the transaction includes: the method comprises the steps of transaction hash to be deleted, block number to be deleted, transaction identity information to be deleted, transaction signature to be deleted, transaction identifier to be deleted and transaction number to be deleted; the transaction hash to be deleted is a hash value obtained by calculating transaction data to be deleted through a hash algorithm; the block hash to be deleted is obtained by calculating the root hash of Mei Gener trees of all transactions in the block to which the transaction to be deleted belongs and the previous block hash; the number of the block to be deleted is the number of the block to be deleted to which the transaction belongs; the delete transaction signature is used for indicating the identity of a deleter, and the deleter generates a node for deleting the transaction; the deleted transaction identity information is used for verifying the identity of the deleter and is a public key of the deleter or a public key identifier of the deleter, and if the deleted transaction identity information is the public key identifier of the deleter, the public key is acquired from the configuration or the external system based on the public key identifier.
7. A terminal device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the blockchain data deletion method of any of claims 1-5 when the program is executed by the processor.
8. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a method of data deletion of a blockchain as in any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110976953.1A CN113627938B (en) | 2021-08-24 | 2021-08-24 | Data deleting method, device and equipment of block chain and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110976953.1A CN113627938B (en) | 2021-08-24 | 2021-08-24 | Data deleting method, device and equipment of block chain and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113627938A CN113627938A (en) | 2021-11-09 |
CN113627938B true CN113627938B (en) | 2024-05-28 |
Family
ID=78387598
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110976953.1A Active CN113627938B (en) | 2021-08-24 | 2021-08-24 | Data deleting method, device and equipment of block chain and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113627938B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106372868A (en) * | 2016-09-06 | 2017-02-01 | 联动优势科技有限公司 | Verification method and apparatus for transaction data written into block chain |
CN109299336A (en) * | 2018-09-30 | 2019-02-01 | 腾讯科技(深圳)有限公司 | Data back up method, device, storage medium and calculating equipment |
CN109460668A (en) * | 2018-11-16 | 2019-03-12 | 吉林多维达科技开发有限公司 | A kind of information processing system and method based on block chain |
CN109493044A (en) * | 2018-11-08 | 2019-03-19 | 深圳壹账通智能科技有限公司 | Block chain block delet method, device and terminal device |
CN109492049A (en) * | 2018-09-21 | 2019-03-19 | 上海点融信息科技有限责任公司 | Data processing, block generation and synchronous method for block chain network |
CN109934590A (en) * | 2019-03-21 | 2019-06-25 | 深圳市网心科技有限公司 | A kind of data processing method based on block chain, device, electronic equipment and medium |
CN110909000A (en) * | 2019-11-19 | 2020-03-24 | 深圳市网心科技有限公司 | Data processing method, system, device and computer readable storage medium |
CN111611260A (en) * | 2020-06-23 | 2020-09-01 | 上海优扬新媒信息技术有限公司 | Method and device for deleting block chain data |
CN111913978A (en) * | 2020-09-02 | 2020-11-10 | 上海优扬新媒信息技术有限公司 | Block deleting method, device and system |
-
2021
- 2021-08-24 CN CN202110976953.1A patent/CN113627938B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106372868A (en) * | 2016-09-06 | 2017-02-01 | 联动优势科技有限公司 | Verification method and apparatus for transaction data written into block chain |
CN109492049A (en) * | 2018-09-21 | 2019-03-19 | 上海点融信息科技有限责任公司 | Data processing, block generation and synchronous method for block chain network |
CN109299336A (en) * | 2018-09-30 | 2019-02-01 | 腾讯科技(深圳)有限公司 | Data back up method, device, storage medium and calculating equipment |
CN109493044A (en) * | 2018-11-08 | 2019-03-19 | 深圳壹账通智能科技有限公司 | Block chain block delet method, device and terminal device |
CN109460668A (en) * | 2018-11-16 | 2019-03-12 | 吉林多维达科技开发有限公司 | A kind of information processing system and method based on block chain |
CN109934590A (en) * | 2019-03-21 | 2019-06-25 | 深圳市网心科技有限公司 | A kind of data processing method based on block chain, device, electronic equipment and medium |
CN110909000A (en) * | 2019-11-19 | 2020-03-24 | 深圳市网心科技有限公司 | Data processing method, system, device and computer readable storage medium |
CN111611260A (en) * | 2020-06-23 | 2020-09-01 | 上海优扬新媒信息技术有限公司 | Method and device for deleting block chain data |
CN111913978A (en) * | 2020-09-02 | 2020-11-10 | 上海优扬新媒信息技术有限公司 | Block deleting method, device and system |
Also Published As
Publication number | Publication date |
---|---|
CN113627938A (en) | 2021-11-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108810006B (en) | Resource access method, device, equipment and storage medium | |
CN110414268B (en) | Access control method, device, equipment and storage medium | |
US9965644B2 (en) | Record level data security | |
WO2020134657A1 (en) | System log desensitization method, desensitization system, computer device, and storage medium | |
US20190130132A1 (en) | Runtime control of automation accuracy using adjustable thresholds | |
CN113704781B (en) | File secure transmission method and device, electronic equipment and computer storage medium | |
CN110597814B (en) | Structured data serialization and deserialization method and device | |
US10164777B2 (en) | Privacy control using unique identifiers associated with sensitive data elements of a group | |
CN111291339A (en) | Processing method, device and equipment of block chain data and storage medium | |
CN110543516A (en) | Intelligent contract processing method and device, computer equipment and storage medium | |
CN114021184A (en) | Data management method and device, electronic equipment and storage medium | |
CN112328486A (en) | Interface automation test method and device, computer equipment and storage medium | |
CN115329381A (en) | Sensitive data-based analysis and early warning method and device, computer equipment and medium | |
CN110070360B (en) | Transaction request processing method, device, equipment and storage medium | |
CN111859431A (en) | Electronic file signature method and device, electronic equipment and storage medium | |
CN109522683B (en) | Software tracing method, system, computer equipment and storage medium | |
CN110545542A (en) | Main control key downloading method and device based on asymmetric encryption algorithm and computer equipment | |
CN117195297B (en) | ERP-based data security and privacy protection system and method | |
CN112583805A (en) | Data processing method and device based on block chain, electronic equipment and storage medium | |
CN113627938B (en) | Data deleting method, device and equipment of block chain and storage medium | |
CN116702103A (en) | Database watermark processing method, database watermark tracing method and device | |
CN115086047B (en) | Interface authentication method and device, electronic equipment and storage medium | |
CN115658976A (en) | Equipment fingerprint analysis method and system based on locality sensitive hashing | |
CN115344852A (en) | Weak password detection method, device, equipment, storage medium and program product | |
CN114756837A (en) | Block chain-based digital content tracing method and system |
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 |