CN115934849B - Method, device, node and storage medium for block workload certification consensus - Google Patents

Method, device, node and storage medium for block workload certification consensus Download PDF

Info

Publication number
CN115934849B
CN115934849B CN202310231449.8A CN202310231449A CN115934849B CN 115934849 B CN115934849 B CN 115934849B CN 202310231449 A CN202310231449 A CN 202310231449A CN 115934849 B CN115934849 B CN 115934849B
Authority
CN
China
Prior art keywords
block
vacation
data
contract
contribution
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
CN202310231449.8A
Other languages
Chinese (zh)
Other versions
CN115934849A (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.)
Anhui Zhongke Lattice Technology Co ltd
Original Assignee
Anhui Zhongke Lattice Technology 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 Anhui Zhongke Lattice Technology Co ltd filed Critical Anhui Zhongke Lattice Technology Co ltd
Priority to CN202310231449.8A priority Critical patent/CN115934849B/en
Publication of CN115934849A publication Critical patent/CN115934849A/en
Application granted granted Critical
Publication of CN115934849B publication Critical patent/CN115934849B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a workload proving consensus method, a device, a node and a storage medium of a block, wherein whether consensus is achieved is judged by judging whether data of an extra field of the block is cold data or not so as to execute a memory space vacation rewriting contract prestored in the block, judging the type of a vacation rewriting method of a caller according to the memory space vacation rewriting contract, accumulating contribution data of the contract caller according to the type of the method, constructing the contribution data into a contribution model, extracting contribution factors of the contribution model and introducing a workload proving function, and finally judging whether the consensus is achieved or not by judging whether the maximum value of the workload proving function exceeds the hash value of a block head of the block.

Description

Method, device, node and storage medium for block workload certification consensus
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a workload certification consensus method, device, node, and storage medium for a block.
Background
The block chain is a chain composed of a plurality of blocks, each block stores certain information, the blocks are connected into a chain according to the time sequence generated by each block, the chain is stored in all servers, and the whole block chain is safe as long as one server in the whole system can work. These servers, referred to as nodes in the blockchain system, provide storage space and computational support for the entire blockchain system. If the information in the blockchain is to be modified, half or more nodes must be informed of the consent and modify the information in all nodes, which are typically held in different subject hands, so it is an extremely difficult matter to tamper with the information in the blockchain. Compared with the traditional network, the blockchain has two main core characteristics: firstly, the data is difficult to tamper, and secondly, the data is decentralised. Based on the two characteristics, the information recorded by the blockchain is more real and reliable, and can help solve the problem that people are not trusted each other.
After the blockchain is continuously connected to the blockchain through newly discovered blocks to form a long chain, the blocks with low access frequency in the blockchain are increased, so that the response speed of the blockchain is reduced and the block resources are wasted.
Disclosure of Invention
The invention mainly aims to provide a block workload proving consensus method, a device, nodes and a storage medium, which are used for solving the problems of slow response speed and resource waste of a block chain caused by chain length and cold data in the prior art.
In order to achieve the above purpose, the present invention provides the following technical solutions:
a workload proof consensus method for a block, the consensus method based on a vacation rewrite contribution of a storage space of the block, the block based on a blockchain on which a storage space vacation rewrite contract is preset, the consensus method comprising:
judging whether extra data of the block is cold data or not according to a vacation function of the storage space vacation overwriting contract;
if yes, acquiring a transaction event based on the storage space vacation rewrite contract in a transaction list of the block, and identifying the transaction event as a space vacation rewrite event;
acquiring the space vacation rewrite event and judging the method type of the space vacation rewrite event;
if the method type is vacation, adding 1 to the first contribution data of the caller address accounts of all nodes of the block respectively;
if the method type is overwriting, adding 1 to second contribution data of caller address accounts of all nodes of the block respectively;
constructing a contribution model according to the first contribution data or the second contribution data of the same caller address account;
obtaining a contribution factor of the contribution model to be substituted into a workload proving function;
judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block;
if yes, judging that the workload is the consensus.
In some embodiments, determining whether the extra data of the block is cold data, before comprising:
judging whether an account of an owner of the block is a contract caller of the storage space vacation rewrite contract;
if yes, extra data of the block are obtained.
In some embodiments, acquiring extra data for the block, before, includes:
judging whether the contract caller owns the block or not;
if yes, judging whether the account of the contract caller meets the vacation fee for paying the block;
if yes, extra data of the block are obtained.
In some implementations, transaction events based on the storage space vacation rewrite contract in a transaction list of the block are obtained and identified as space vacation rewrite events, followed by; the method for acquiring the space vacation rewrite event and judging the space vacation rewrite event comprises the following steps:
triggering a chameleon hash trapdoor of the block to be transferred between a vacator and a rewriter of the block;
judging whether the contract caller owns the block or not;
if yes, judging whether the contract caller is a local node or not;
if yes, the vacator encrypts the chameleon hash trapdoor and sends the chameleon hash trapdoor to the rewriter.
In some embodiments, the vacator encrypts the chameleon hash trapdoor and sends to the rewriter, after which it comprises:
and acquiring the chameleon Hash trapdoor and modifying the extra data according to a chameleon Hash collision algorithm.
In some embodiments, determining whether the contract caller owns the block, then comprises:
judging whether the maximum space of vacation extra preset by the contract caller exceeds the set size of the block or not;
if not, judging whether the contract caller meets the vacation cost of the block;
if yes, extra data of the block are obtained.
In some embodiments, determining whether the extra data of the block is cold data, before comprising:
judging whether the vacation and rewriting records of the block exist in the storage space vacation and rewriting contract;
if yes, a data modification event is generated and sent to the contract caller.
In order to achieve the above purpose, the present invention further provides the following technical solutions:
a workload certification consensus device for a block, the workload certification consensus device applied to a blockchain node, the workload certification consensus device comprising:
the cold data judging module is used for judging whether extra data of the block are cold data or not;
the contract execution module is used for executing the storage space vacation rewrite contract if the extra data of the block is cold data;
the acquisition and identification module is used for acquiring transaction events based on the storage space vacation rewrite contract in the transaction list of the block and identifying the transaction events as space vacation rewrite events;
the acquisition and judgment module is used for acquiring the space vacation rewriting event and judging the method type of the space vacation rewriting event;
the vacation data modification module is used for adding 1 to the first contribution data of the caller address accounts of all nodes of the block if the method type is vacation;
the rewriting data modification module is used for adding 1 to the second contribution data of the caller address accounts of all nodes of the block if the method type is rewriting;
the contribution model construction module is used for constructing a contribution model according to the first contribution data or the second contribution data of the same caller address account;
the contribution factor acquisition module is used for acquiring the contribution factors of the contribution model to be substituted into the workload proving function;
the numerical value judging module is used for judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block;
and the consensus judging module is used for judging that the workload proving consensus exists if the maximum value of the workload proving function exceeds the hash value of the block head of the block.
In order to achieve the above purpose, the present invention further provides the following technical solutions:
a blockchain node comprising a processor, a storage medium and a bus, the storage medium storing program instructions executable by the processor, the processor in communication with the storage medium via the bus when the blockchain gateway is running, the processor executing the program instructions to perform a workload certification consensus method for a block as described above when executed.
In order to achieve the above purpose, the present invention further provides the following technical solutions:
a storage medium having stored therein program instructions which when executed by a processor implement a method of workload certification consensus enabling implementation of blocks as described above.
The invention judges whether the data of extra field of the block is cold data or not to execute the memory space vacation rewrite contract prestored in the block, judges the vacation rewrite method type of the caller according to the memory space vacation rewrite contract, accumulates the contribution data of the contract caller according to the method type, constructs the contribution data into a contribution model, extracts the contribution factor of the contribution model and introduces a workload proving function, finally judges whether consensus is reached or not by judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block, and the invention vacates and rewrites new data of the block space where the cold data is positioned, optimally stores and introduces the contribution factor, reduces unnecessary calculation power consumption and simultaneously ensures the safety.
Drawings
FIG. 1 is a flowchart illustrating steps of one embodiment of a workload certification consensus method for a block of the present application;
FIG. 2 is a schematic diagram of functional modules of an embodiment of a workload certification consensus apparatus according to the present application;
FIG. 3 is a schematic diagram illustrating one embodiment of a blockchain node of the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The terms "first," "second," "third," and the like in this application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "first," "second," and "third" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise. All directional indications (such as up, down, left, right, front, back … …) in the embodiments of the present application are merely used to explain the relative positional relationship, movement, etc. between the components in a particular gesture (as shown in the drawings), and if the particular gesture changes, the directional indication changes accordingly. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
Before further describing embodiments of the present application in detail, the terms and expressions that are referred to in the embodiments of the present application are described, and are suitable for the following explanation.
1) A Blockchain (Blockchain) is a storage structure of encrypted, chained data information and related information formed by blocks (blocks).
2) A blockchain network (blockchain network) incorporates new blocks into a collection of nodes of a blockchain in a consensus manner.
3) Smart contracts (Smart contacts), also known as chain codes (Chaincode) or application codes, are deployed in nodes of a blockchain network, where the nodes execute received smart contracts, such as storage space vacation rewrite contracts, to update or query key values of a state database for data.
4) Consensus (Consensus) is a process in a blockchain network for agreeing on vacation or overwriting in blocks among the involved nodes, the agreed blocks being appended to the tail of the blockchain, and mechanisms for implementing Consensus include workload certification (PoW, proofofWork), equity certification (PoS, proofofStake), share authorization certification (DPoS, delegatedProof-of-state), elapsed time quantity certification (PoET, proofofElapsedTime), and the like.
5) Hash function (HashFunction), a function commonly used in cryptography (unlike encryption techniques, independent of functions other than asymmetric encryption and symmetric encryption, an input message of arbitrary size
Figure SMS_1
Through hash function->
Figure SMS_4
Mapping to an output value of fixed length +.>
Figure SMS_6
Is commonly called->
Figure SMS_2
Is a hash value or hash digest, i.e. +.>
Figure SMS_5
The hash function has collision resistance, for different messages +.>
Figure SMS_7
And->
Figure SMS_8
Cannot collide with the same hash value +.>
Figure SMS_3
6) The chameleon hash function (chameleon hash function) is a hash function with trapdoors, and for the chameleon hash function, if trapdoor information is known, collision of any input data can be calculated efficiently, namely, input is changed to any value under the condition that the hash value output by the hash function is not changed.
As shown in fig. 1, one embodiment of the present application provides a workload proof consensus method for a block, the consensus method is based on a vacation rewrite contribution of a storage space of the block, the block is based on a blockchain, and a storage space vacation rewrite contract is preset on the blockchain, the consensus method includes the following steps:
step S1, judging whether extra data of the block is cold data according to a vacation function of the storage space vacation and rewriting contract, and if the extra data is cold data, executing step S2.
Preferably, the blocks in the blockchain are cold data, i.e., data with low on-chain access frequency (which may be below a preset threshold for, e.g., one natural year), such as data backup and archive data, etc.
Specifically, one block includes a block header and a block body. The block header includes a parent block hash value, version, timestamp, difficulty, nonce, merkle root.
Wherein the parent block hash value is used to link a previous block; the version corresponds to the number of the block; the time stamp is used for recording the time of the generation of the block; the difficulty is the difficulty coefficient scoring of the arithmetic questions of the block; nonce is a random number used to prove workload difficulty; the Merkle root is a total hash value used to verify a block transaction. The block includes Merkle trees of all transaction information.
Step S2, executing the storage space vacation rewriting contract.
Preferably, the memory vacation overwrite is about contract information pre-stored by the caller within the block.
Step S3, acquiring transaction events based on the storage space vacation rewriting contracts in the transaction list of the block, and identifying the transaction events as space vacation rewriting events.
Preferably, the event parameters are mainly caller address, method type (vacation or overwriting), hash value of block to be vacated.
Step S4, acquiring a space vacation rewrite event and judging the method type of the space vacation rewrite event, if the method type is vacation, executing step S41; if the method type is overwriting, step S42 is performed.
Step S41, add 1 to the first contribution data of the caller address account of each node of the block.
Step S42, add 1 to the second contribution data of the caller address account of each node of the block.
Specifically, the structure of the contribution data is:
Figure SMS_9
;
the first contribution data is:
Figure SMS_10
the second contribution data is:
Figure SMS_11
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_12
block address for caller, ++>
Figure SMS_13
For the first contribution data +.>
Figure SMS_14
For the number of contribution of vacation +.>
Figure SMS_15
For the second contribution data +.>
Figure SMS_16
The number of contributions to overwriting.
Preferably, the first contribution data may be understood as the number of vacated contributions and the second contribution data may be understood as the number of rewritten contributions.
And S5, constructing a contribution model according to the first contribution data or the second contribution data of the same caller address account.
Specifically, the contribution model is
Figure SMS_17
And S6, obtaining a contribution factor of the contribution model, and substituting the contribution factor into the workload demonstration function.
Specifically, the contribution factor is
Figure SMS_18
Specifically, the workload certification function is:
Figure SMS_19
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_20
is the maximum target value of the blockchain, i.e. the +.>
Figure SMS_21
Value->
Figure SMS_22
,/>
Figure SMS_23
Is the difficulty value of the block.
Step S7, judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block, if the maximum value of the workload proving function exceeds the hash value of the block head of the block, executing step S71.
Step S71, it is determined that the workload is a consensus.
Further, in order to ensure the security of the block, before step S1, the method includes the following steps:
step S11, judging whether the account of the owner of the block is the contract caller of the storage space vacation overwriting contract, if the account of the owner of the block is the contract caller of the storage space vacation overwriting contract, executing step S12.
Step S12, extra data of the block is acquired.
Further, to further ensure the security of the block, before step S12, the method includes:
step S201, determine whether the contract caller owns the block, if so, execute step S202.
Preferably, with respect to contract invoker determination, the vacation function invoker in the contract is the block owner that needs to be determined, i.e., the vacation person. While the overwriting function caller in the contract needs to be judged as not being the block owner (to obtain the contribution value for preventing the account malicious operation).
Step S202, judging whether the account of the contract caller meets the vacation fee for paying the block, if the account of the contract caller meets the vacation fee for paying the block, executing step S12.
Further, to facilitate editing of the tile in the caller-specified user group, after step S3 and before step S4, the method includes:
step S301, the chameleon hash trapdoor of the block is triggered between the vacator and the rewriter of the block.
Step S302, determine whether the contract caller owns the block, and if the contract caller owns the block, execute step S303.
Step S303, judging whether the contract caller is a local node, if so, executing step S304.
Step S304, the vacator encrypts the chameleon hash trapdoor and sends the chameleon hash trapdoor to the rewriter.
Further, in order to facilitate editing of the block in the caller-specified user group, after step S304, the method includes:
step S401, acquiring a chameleon Hash trapdoor and modifying extra data according to a chameleon Hash collision algorithm.
Further, to ensure the fluency of vacation or overwriting, after steps S201 and 302, both include:
step S501 is executed to determine whether the maximum space of vacation extra preset by the contract caller exceeds the set size of the block, and if the maximum space of vacation extra preset by the contract caller does not exceed the set size of the block, step S502 is executed.
Step S502, judging whether the contract caller meets the vacation cost of the block, if the contract caller meets the vacation cost of the block, executing step S12.
Step S12, extra data of the block is acquired.
Further, to prevent the same block from being repeatedly vacated or rewritten, before step S1, it includes:
step S601, it is determined whether there is a vacation and overwriting record of a block in the storage space vacation and overwriting contract, and if there is a vacation and overwriting record of a block in the storage space vacation and overwriting contract, step S602 is executed.
Step S602, a data modification event is generated and sent to the contract caller.
Judging whether data of an extra field of a block is cold data or not to execute a memory space vacation rewrite contract prestored in the block, judging the vacation rewrite method type of a caller according to the memory space vacation rewrite contract, accumulating contribution data of the contract caller according to the method type, constructing the contribution data into a contribution model, extracting contribution factors of the contribution model, introducing a workload proving function, and finally judging whether consensus is achieved or not by judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block; the invention vacates and rewrites new data in the block space where the cold data is located, optimizes storage, introduces contribution factors, reduces unnecessary calculation power consumption, and ensures safety.
As shown in fig. 2, an embodiment of the present application provides a workload proof consensus device for a block, where the workload proof consensus device is applied to a blockchain node, and the workload proof consensus device includes a cold data judging module 1, a contract executing module 2, an acquiring and identifying module 3, an acquiring and judging module 4, a vacation data modifying module 5, a rewriting data modifying module 6, a contribution model constructing module 7, a contribution factor acquiring module 8, a numerical judging module 9, and a consensus judging module 10.
The cold data judging module 1 is used for judging whether extra data of the block are cold data or not; the contract execution module 2 is configured to execute a storage space vacation rewrite contract if extra data of the block is cold data; the acquisition and identification module 3 is used for acquiring transaction events based on the memory space vacation rewriting contracts in the transaction list of the block and identifying the transaction events as space vacation rewriting events; the acquisition and judgment module 4 is used for acquiring the space vacation rewriting event and judging the method type of the space vacation rewriting event; the vacation data modification module 5 is configured to add 1 to the first contribution data of the caller address accounts of the nodes of the block if the method type is vacation; the rewriting data modification module 6 is configured to add 1 to the second contribution data of the caller address account of each node of the block if the method type is rewriting; the contribution model construction module 7 is used for constructing a contribution model according to the first contribution data or the second contribution data of the same caller address account; the contribution factor acquisition module 8 is used for acquiring contribution factors of the contribution model to be substituted into the workload demonstration function; the numerical value judging module 9 is used for judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block; the consensus judgment module 10 is configured to judge that the workload certification consensus is determined if the maximum value of the workload certification function exceeds the hash value of the block header of the block.
Preferably, in order to facilitate implementation of the method in the foregoing embodiment by a modular device, this embodiment preferably integrates the foregoing modules into three main modules, including a storage space vacation overwrite contract main module, a contract event driven main module, and a workload proof consensus main module of a contribution model.
Specifically, the present embodiment describes the three main modules in three parts:
1. storage space vacation overwriting contract master module:
the module is a source of parameters in the contribution model, is a preset memory space vacation rewrite contract, and mainly comprises a vacation method, a rewrite method, a space vacation rewrite event and the like.
A vacation function is a called contract method that the owner of a determined block on the chain vacates the extra field space of the block. First, the method needs to determine whether the owner account of the block to be vacated is the contract caller of the contract. Next, it is determined whether the extra data of the block belongs to cold data (for example, the block is a one year old block). Finally, it is also necessary to determine whether the maximum space of vacation extra given by the caller exceeds the block set size. In addition, the method requires the caller to give a vacation fee.
The rewrite function is a method by which a method caller rewrites a vacated block. In the method, it is required to determine whether the caller is not the owner of the vacation block and whether the paid fee satisfies the vacation fee of the vacation block.
The data modification function is a method for a method caller to input a vacated block hash and new data to modify the data in the vacated block. In the method, it is required to determine whether there is a vacation and overwrite recording of the vacation block in the contract. If the record exists, the data modification event is thrown.
The space vacation overwrite event is thrown by the vacation function and the overwrite function. The event parameters are mainly caller address, method type (vacation or overwriting), vacation chunk hash.
The data modification event is thrown from the data modification function. The time parameter mainly comprises the hash of the vacated block and the new data to be updated of the vacated block.
2. The contract event drives the master:
the module listens to the memory space vacation rewrite contract transaction event, i.e. space vacation rewrite event, in the transaction list of the determined block to trigger the transfer of the chameleon hash trapdoor of the vacation block and the update contribution data between the vacator and the rewriter (vacator and rewriter: the vacation method and the caller of the rewrite method of the same vacation block).
The chameleon Hash trapdoor transfer module is used for judging whether a vacation block owner is a local node after each node/consensus node of the block chain subscribes to a space vacation rewriting event and the method type in the event is rewriting. If so, the node (or called a vacator) encrypts the chameleon hash trapdoor in a chain or in a chain-down manner and then transmits the encrypted chameleon hash trapdoor to the caller (or called a rewriter) in the event. The rewriter obtains the chameleon hash trapdoor, and modifies the extra field content in the block under the condition of not changing the block hash by utilizing the chameleon hash collision algorithm. And finally, calling a data modification function in the contract, and throwing out a data modification event so that each node updates the new block extra data.
And the contribution data updating module updates contribution data for the caller address account according to the caller address and the method type in the event after each node/consensus node of the blockchain subscribes to the space vacation overwriting event, and adds 1 to the first contribution data of the caller address account in the event if the method type in the event is vacation. If the method type in the event is overwriting, each node adds 1 to the second contribution data of the caller address account in the event.
3. Workload proof consensus master module of contribution model:
the module builds a contribution model based primarily on the contribution data, and further improves the workload certification consensus as a factor in the workload certification objective function.
And the contribution model building module is used for building a contribution model by using the first contribution data and the second contribution data.
The workload demonstration function construction module is used for obtaining a contribution factor obtained by the contribution model as a part of the workload demonstration function.
It should be noted that, the apparatus in this embodiment is implemented based on the method in the foregoing embodiment, and the expansion part and the description part of this embodiment refer to the foregoing method embodiment, which is not described in detail.
Judging whether data of an extra field of a block is cold data or not to execute a memory space vacation rewrite contract prestored in the block, judging the vacation rewrite method type of a caller according to the memory space vacation rewrite contract, accumulating contribution data of the contract caller according to the method type, constructing the contribution data into a contribution model, extracting contribution factors of the contribution model, introducing a workload proving function, and finally judging whether consensus is achieved or not by judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block; the invention vacates and rewrites new data in the block space where the cold data is located, optimizes storage, introduces contribution factors, reduces unnecessary calculation power consumption, and ensures safety.
As shown in fig. 3, one embodiment of the present application provides a blockchain node 100 that includes one or more processors 1001, a storage medium 1002, and a bus, where the storage medium stores program instructions executable by the processors, when the blockchain gateway is running, the processors communicate with the storage medium through the bus, and the processors execute the program instructions to perform the workload certification consensus method for the blocks as described above.
By way of example, and one processor is taken as an example, the processor and the storage medium may be coupled by a bus or other means. The storage medium is used as a non-volatile computer readable storage medium, and can be used for storing a non-volatile software program, a non-volatile computer executable program and modules, such as program instructions/modules corresponding to the workload proof consensus method in the embodiments of the present application. The processor executes the workload proof consensus method of the blocks of the above embodiments or the various functional applications and data processing in the workload proof consensus device of the blocks of the above embodiments by running non-volatile software programs, instructions and modules stored in a storage medium. The storage medium may include a high-speed random access storage medium, and may also include a non-volatile storage medium, such as at least one magnetic disk storage medium, flash memory device, or other non-volatile solid state storage medium. In some embodiments, the storage medium may optionally include remote storage media relative to the processor, the remote storage media being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. Program instructions/modules are stored in a storage medium that, when executed by one or more processors, perform the methods of workload proof consensus for blocks in any of the method embodiments described above, e.g., to thereby perform the methods of workload proof consensus for blocks of the various embodiments described above, or various functional applications and data processing of the blockchain node evolution device of the various embodiments described above.
The processor may also be referred to as a CPU (Central Processing Unit ). The processor may be an integrated circuit chip having signal processing capabilities. The processor may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, or discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein the storage medium includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or Processor (Processor) to perform all or part of the steps of a method described in various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only memory (ROM), a random access memory (RAM, randomAccessMemory), a magnetic disk, an optical disk, or other various media capable of storing program codes, or a terminal device such as a computer, a server, a mobile phone, a tablet, or the like.
In the several embodiments provided in the present application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of elements is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., multiple elements or components may be combined or integrated into another system, 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 forms.
In addition, each functional unit in each embodiment 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 software functional units. The foregoing is only the embodiments of the present application, and is not intended to limit the scope of the patent application, and all equivalent structures or equivalent processes using the contents of the specification and drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the patent protection of the present application.
The embodiments of the invention have been described in detail above, but they are merely examples, and the invention is not limited to the above-described embodiments. It will be apparent to those skilled in the art that any equivalent modifications or substitutions to this invention are within the scope of the invention, and therefore, all equivalent changes and modifications, improvements, etc. that do not depart from the spirit and scope of the principles of the invention are intended to be covered by this invention.

Claims (10)

1. A workload proof consensus method for a block, the consensus method being based on a vacation rewrite contribution of a storage space of the block, the block being based on a blockchain on which a storage space vacation rewrite contract is preset, the consensus method comprising:
judging whether extra data of the block is cold data or not according to a vacation function of the storage space vacation overwriting contract;
if yes, acquiring a transaction event based on the storage space vacation rewrite contract in a transaction list of the block, and identifying the transaction event as a space vacation rewrite event;
acquiring the space vacation rewrite event and judging the method type of the space vacation rewrite event;
if the method type is vacation, adding 1 to the first contribution data of the caller address accounts of all nodes of the block respectively;
if the method type is overwriting, adding 1 to second contribution data of caller address accounts of all nodes of the block respectively;
constructing a contribution model according to the first contribution data or the second contribution data of the same caller address account;
obtaining a contribution factor of the contribution model to be substituted into a workload proving function;
judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block;
if yes, judging that the workload is the consensus.
2. The workload certification consensus method according to claim 1, wherein determining whether extra data of the block is cold data, before, comprises:
judging whether an account of an owner of the block is a contract caller of the storage space vacation rewrite contract;
if yes, extra data of the block are obtained.
3. The workload certification consensus method according to claim 2, wherein the acquiring extra data of the block is preceded by:
judging whether the contract caller owns the block or not;
if yes, judging whether the account of the contract caller meets the vacation fee for paying the block;
if yes, extra data of the block are obtained.
4. The workload certification consensus method according to claim 2, wherein a transaction event based on the storage space vacation rewrite contract in a transaction list of the block is obtained and identified as a space vacation rewrite event, followed by; the method for acquiring the space vacation rewrite event and judging the space vacation rewrite event comprises the following steps:
triggering a chameleon hash trapdoor of the block to be transferred between a vacator and a rewriter of the block;
judging whether the contract caller owns the block or not;
if yes, judging whether the contract caller is a local node or not;
if yes, the vacator encrypts the chameleon hash trapdoor and sends the chameleon hash trapdoor to the rewriter.
5. A workload certification consensus method according to claim 4 and wherein the vacator encrypts the chameleon hash trapdoor and sends to the rewriter, and thereafter comprising:
and acquiring the chameleon Hash trapdoor and modifying the extra data according to a chameleon Hash collision algorithm.
6. The workload certification consensus method according to claim 3, wherein determining whether the contract caller owns the block, thereafter, comprises:
judging whether the maximum space of vacation extra preset by the contract caller exceeds the set size of the block or not;
if not, judging whether the contract caller meets the vacation cost of the block;
if yes, extra data of the block are obtained.
7. The workload certification consensus method according to claim 2, wherein determining whether the extra data of the block is cold data, before, comprises:
judging whether the vacation and rewriting records of the block exist in the storage space vacation and rewriting contract;
if yes, a data modification event is generated and sent to the contract caller.
8. A workload certification consensus apparatus for a block, the workload certification consensus apparatus being applied to a blockchain node, the workload certification consensus apparatus comprising:
the cold data judging module is used for judging whether extra data of the block are cold data or not;
the contract execution module is used for executing a storage space vacation rewriting contract if the extra data of the block is cold data;
the acquisition and identification module is used for acquiring transaction events based on the storage space vacation rewrite contract in the transaction list of the block and identifying the transaction events as space vacation rewrite events;
the acquisition and judgment module is used for acquiring the space vacation rewriting event and judging the method type of the space vacation rewriting event;
the vacation data modification module is used for adding 1 to the first contribution data of the caller address accounts of all nodes of the block if the method type is vacation;
the rewriting data modification module is used for adding 1 to the second contribution data of the caller address accounts of all nodes of the block if the method type is rewriting;
the contribution model construction module is used for constructing a contribution model according to the first contribution data or the second contribution data of the same caller address account;
the contribution factor acquisition module is used for acquiring the contribution factors of the contribution model to be substituted into the workload proving function;
the numerical value judging module is used for judging whether the maximum value of the workload proving function exceeds the hash value of the block head of the block;
and the consensus judging module is used for judging that the workload proving consensus exists if the maximum value of the workload proving function exceeds the hash value of the block head of the block.
9. A blockchain node comprising a processor, a storage medium, and a bus, the storage medium storing program instructions executable by the processor, the processor in communication with the storage medium via the bus when the blockchain gateway is running, the processor executing the program instructions to perform the workload certification consensus method for the block of any of claims 1 to 7 when executed.
10. A storage medium having stored therein program instructions which when executed by a processor implement a method of workload certification consensus enabling implementation of the blocks of any of claims 1 to 7.
CN202310231449.8A 2023-03-13 2023-03-13 Method, device, node and storage medium for block workload certification consensus Active CN115934849B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310231449.8A CN115934849B (en) 2023-03-13 2023-03-13 Method, device, node and storage medium for block workload certification consensus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310231449.8A CN115934849B (en) 2023-03-13 2023-03-13 Method, device, node and storage medium for block workload certification consensus

Publications (2)

Publication Number Publication Date
CN115934849A CN115934849A (en) 2023-04-07
CN115934849B true CN115934849B (en) 2023-05-30

Family

ID=85825532

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310231449.8A Active CN115934849B (en) 2023-03-13 2023-03-13 Method, device, node and storage medium for block workload certification consensus

Country Status (1)

Country Link
CN (1) CN115934849B (en)

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111047454A (en) * 2019-12-10 2020-04-21 山东浪潮人工智能研究院有限公司 Block chain-based open-source community code contribution incentive method and equipment
CN111209346B (en) * 2020-04-24 2020-07-28 腾讯科技(深圳)有限公司 Block chain data archiving method and device and computer readable storage medium
CN113553378A (en) * 2020-10-20 2021-10-26 支付宝(杭州)信息技术有限公司 Block chain data deleting method and device
CN112988073B (en) * 2021-03-26 2022-07-19 中国人民解放军国防科技大学 Stepped data storage method and system capable of reducing block chain storage overhead
CN113781214A (en) * 2021-08-25 2021-12-10 安徽中科晶格技术有限公司 Packaging method, device and equipment for promoting transaction TPS (transaction transfer protocol) based on PoW (PoW)
CN114385668A (en) * 2022-01-13 2022-04-22 中国平安人寿保险股份有限公司 Cold data cleaning method, device, equipment and storage medium
CN114579563A (en) * 2022-01-27 2022-06-03 上海树图区块链研究院 Method, system and storage medium for saving storage overhead of block chain link points
CN115037755B (en) * 2022-04-27 2023-04-07 东北大学 Block chain lightweight storage method based on data redistribution and dynamic node strategy

Also Published As

Publication number Publication date
CN115934849A (en) 2023-04-07

Similar Documents

Publication Publication Date Title
EP4024812A1 (en) Smart contract-based data processing method, and device and storage medium
CN111414210B (en) Method, apparatus and computer readable storage medium for generating side chains based on main chains
WO2018119587A1 (en) Data processing method, device, and system, and information acquisition apparatus
JP6905059B2 (en) Systems and methods for detecting replay attacks
WO2018126837A1 (en) Blockchain-based data processing method, device and system
CN111309711A (en) Cross-block-chain data migration method, device, equipment and storage medium
CN108805569A (en) Transaction processing method and device, electronic equipment based on block chain
CN108053239B (en) Sensor network sharing method based on block chain
EP3639465A1 (en) Improved hardware security module management
CN108764870A (en) Transaction processing method and device, electronic equipment based on block chain
EP3779760B1 (en) Blockchain-based data processing method and apparatus, and electronic device
CN109242500A (en) Block chain transaction validation verification method, apparatus and storage medium
CN110569251A (en) Data processing method, related equipment and computer readable storage medium
CN111445333A (en) Block generation method and device, computer equipment and storage medium
KR20200012705A (en) Apparatus for managing group of nodes which comprises transaction of dual signature based on group key on blockchain network and computing apparatus
CN110597839A (en) Transaction data processing method, device, equipment and storage medium
Cullen et al. Distributed ledger technology for IoT: Parasite chain attacks
CN110597918A (en) Account management method and device and computer readable storage medium
WO2021174778A1 (en) Blockchain secure transaction method, computer device, and readable storage medium
CN110599349A (en) Data processing method based on block chain network, related equipment and storage medium
CN110879826A (en) Credit blacklist sharing method and device based on block chain
CN110717761B (en) Data processing method and device and computer storage medium
CN108833133A (en) Network configuration management method, apparatus and storage medium based on system for cloud computing
CN110941672A (en) Household registration management method, device, equipment and storage medium
CN115934849B (en) Method, device, node and storage medium for block workload certification consensus

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