CN112037055A - Transaction processing method and device, electronic equipment and readable storage medium - Google Patents

Transaction processing method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN112037055A
CN112037055A CN202010828158.3A CN202010828158A CN112037055A CN 112037055 A CN112037055 A CN 112037055A CN 202010828158 A CN202010828158 A CN 202010828158A CN 112037055 A CN112037055 A CN 112037055A
Authority
CN
China
Prior art keywords
transaction
frozen
target
intelligent contract
freezing
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.)
Granted
Application number
CN202010828158.3A
Other languages
Chinese (zh)
Other versions
CN112037055B (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.)
Chengdu Quality Starker Technology Co Ltd
Original Assignee
Chengdu Quality Starker 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 Chengdu Quality Starker Technology Co Ltd filed Critical Chengdu Quality Starker Technology Co Ltd
Priority to CN202010828158.3A priority Critical patent/CN112037055B/en
Publication of CN112037055A publication Critical patent/CN112037055A/en
Application granted granted Critical
Publication of CN112037055B publication Critical patent/CN112037055B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention provides a transaction processing method, a transaction processing device, electronic equipment and a readable storage medium, and aims to improve the constraint force of a block chain network on transaction execution. The transaction processing method is applied to nodes in a block chain network, and comprises the following steps: receiving a plurality of transactions with sequential relation sent by a designated node in the blockchain network, wherein the plurality of transactions comprise a target transaction and a frozen transaction, the target transaction is a transaction executed depending on an intelligent contract, and the frozen transaction is used for enabling a target intelligent contract targeted by the frozen transaction to be frozen; and executing the plurality of transactions in sequence according to the sequence relation of the plurality of transactions, wherein before the target transaction is executed, whether the intelligent contract depended on by the target transaction is frozen or not is judged, and the target transaction is refused to be executed under the condition that the intelligent contract depended on by the target transaction is frozen.

Description

Transaction processing method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a transaction processing method and apparatus, an electronic device, and a readable storage medium.
Background
The blockchain technology is built on a transmission network (also called blockchain network), distributed node equipment (hereinafter referred to as nodes) in the transmission network generates and updates data by a preset consensus strategy through running a blockchain program, verifies and stores the data by using a chained data structure, and finally realizes a data tamper-proof mechanism.
The block chain technology can be applied to various service scenes, such as the financial field, the electronic commerce field, the commodity or raw material tracing field, the electronic evidence storage field and the like.
In the related art, each node in a blockchain network carries out a service by performing a transaction. Where the execution of certain transactions relies on smart contracts. In some scenarios, a smart contract may be interpreted as: a computer protocol intended to propagate, verify or execute contracts in an informative manner, allowing trusted transactions to be conducted without third parties. However, in the prior art, due to insufficient supervision measures of the intelligent contracts during the release, some intelligent contracts which do not meet the supervision requirements are deployed to the blockchain network. Relying on these smart contracts to execute transactions also often causes some unlawful problems or results in loss of participants to the transaction. In summary, in the prior art, the block chain network has insufficient constraint capability on the transaction execution process during the transaction execution, and the practicability of the block chain network is to be improved.
Disclosure of Invention
Embodiments of the present invention provide a transaction processing method, an apparatus, an electronic device, and a readable storage medium, which are used to improve a constraint force of a blockchain network on transaction execution. The specific technical scheme is as follows:
in a first aspect of embodiments of the present invention, there is provided a transaction processing method applied to a node in a blockchain network, the method including:
receiving a plurality of transactions with sequential relation sent by a designated node in the blockchain network, wherein the plurality of transactions comprise a target transaction and a frozen transaction, the target transaction is a transaction executed depending on an intelligent contract, and the frozen transaction is used for enabling a target intelligent contract targeted by the frozen transaction to be frozen;
and executing the plurality of transactions in sequence according to the sequence relation of the plurality of transactions, wherein before the target transaction is executed, whether the intelligent contract depended on by the target transaction is frozen or not is judged, and the target transaction is refused to be executed under the condition that the intelligent contract depended on by the target transaction is frozen.
In a second aspect of the embodiments of the present invention, there is provided a transaction processing apparatus applied to a node in a blockchain network, the apparatus including:
a transaction receiving module, configured to receive multiple transactions with a sequential relationship sent by a designated node in the blockchain network, where the multiple transactions include a target transaction and a frozen transaction, the target transaction is a transaction executed depending on an intelligent contract, and the frozen transaction is used to freeze a target intelligent contract for the frozen transaction;
the transaction execution module is used for sequentially executing the plurality of transactions according to the sequence relation of the plurality of transactions;
wherein the transaction execution module comprises: a target transaction execution unit to: before executing the target transaction, judging whether the intelligent contract depended on by the target transaction is frozen or not, and refusing to execute the target transaction if the intelligent contract depended on by the target transaction is frozen.
In a third aspect of the embodiments of the present invention, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor is used for realizing the transaction processing method provided by any embodiment of the invention when the program stored on the memory is executed.
In a fourth aspect of the embodiments of the present invention, there is provided a computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the transaction processing method provided by any of the embodiments of the present invention.
In the invention, a plurality of transactions with time sequence relation sent by a designated node are received by the nodes in the block chain network, including a frozen transaction and a target transaction. Wherein the freeze transaction is used to cause the corresponding smart contract to be frozen. Before executing the target transaction, whether the intelligent contract depended on by the target transaction is frozen or not needs to be judged, and the target transaction is refused to be executed under the condition that the intelligent contract depended on by the target transaction is frozen. Therefore, supervision and freezing of the intelligent contract can be realized through freezing the transaction. And after a certain intelligent contract is frozen, the transaction executed depending on the intelligent contract is not executed. Therefore, the block chain network has stronger constraint force on transaction execution, can play the role of monitoring intelligent contracts and transactions, and has stronger practicability.
In addition, the plurality of transactions received by the node have a sequential relationship, and the node executes the transactions in sequence according to the sequential relationship. Therefore, each node in the block chain network executes each transaction in sequence according to the same sequence relation, and each node is ensured to execute the frozen transaction and the target transaction according to the same sequence. The following situations are avoided: a part of nodes execute the frozen transaction firstly and then execute the target transaction, and the target transaction is refused to be executed to obtain a processing result of target transaction execution failure; and the other part of nodes execute the target transaction firstly and then execute the frozen transaction to obtain a processing result of successful execution of the target transaction. Therefore, the invention ensures the unity of the transaction execution results of each node by limiting the transaction execution sequence, is beneficial to reducing the transaction error rate and improving the consensus success rate of the block chain network.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a schematic diagram of a block chain network according to an embodiment of the present invention;
FIG. 2 is a flow chart of a transaction processing method according to an embodiment of the invention;
FIG. 3 is a flow diagram of a process for freezing a privilege configuration transaction as contemplated by an embodiment of the present invention;
FIG. 4 is a schematic diagram of a transaction processing device according to an embodiment of the invention;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The blockchain technology is built on a transmission network (also called blockchain network), distributed node equipment (hereinafter referred to as nodes) in the transmission network generates and updates data by a preset consensus strategy through running a blockchain program, verifies and stores the data by using a chained data structure, and finally realizes a data tamper-proof mechanism.
In the related art, each node in a blockchain network carries out a service by performing a transaction. Where the execution of certain transactions relies on smart contracts. In some scenarios, a smart contract may be interpreted as: a computer protocol intended to propagate, verify or execute contracts in an informative manner, allowing trusted transactions to be conducted without third parties. However, in the prior art, due to insufficient supervision measures of the intelligent contracts during the release, some intelligent contracts which do not meet the supervision requirements are deployed to the blockchain network. Relying on these smart contracts to execute transactions also often causes some unlawful problems or results in loss of participants to the transaction. In summary, in the prior art, the block chain network has insufficient constraint capability on the transaction execution process during the transaction execution, and the practicability of the block chain network is to be improved.
Therefore, the invention provides a transaction processing method, a transaction processing device, an electronic device and a readable storage medium through the following embodiments, and aims to improve the constraint force of a block chain network on transaction execution.
Referring to fig. 1, fig. 1 is a schematic diagram of a block chain network according to an embodiment of the present invention. As shown in fig. 1, the blockchain network includes a plurality of distributed node devices (hereinafter, simply referred to as nodes), each for running a blockchain program. The plurality of nodes include a master node, which is a node selected from the plurality of nodes. Optionally, in some embodiments, the master node is not fixed and the blockchain network periodically re-elects the master node.
When a service is developed using the block chain network shown in fig. 1, a plurality of different services can be simultaneously developed within the same period of time. Illustratively, as shown in fig. 1, node 1 obtains a transaction a associated with service a. The transaction a may be sent to the node 1 by the client side, or the transaction a may also be automatically generated by the node 1, which is not limited in the present invention. In response to the acquisition of transaction a, node 1 sends transaction a to the nodes specified in the traffic voting rule (e.g., node 3, node 5, and node 7) for traffic voting according to the preset traffic voting rule. These nodes vote on transaction a and return the result of the vote to node 1. And each node votes for the transaction a, and represents whether the node approves to execute the transaction a. And the node 1 collects the service voting result of each node on the transaction a, packages the transaction a and the service voting result of each node on the transaction a and submits the packaged transaction voting result to the master node. The specific process of service voting is not shown in fig. 1 to simplify the drawing.
As shown in fig. 1, node 4 obtains a transaction B associated with service B. The transaction b may be sent to the node 4 by the client side, or the transaction b may also be automatically generated by the node 4, which is not limited in the present invention. In response to the acquisition of transaction b, node 4 sends transaction b to the nodes specified in the traffic voting rules (e.g., node 3, node 5, and node 7) for traffic voting according to the preset traffic voting rules. These nodes vote on transaction b and return the result of the vote to node 4. And each node votes for the transaction b, and represents whether the node approves to execute the transaction b. The node 4 collects the service voting result of each node for the transaction b, and packages and submits the transaction b and the service voting result of each node for the transaction b to the master node. The specific process of service voting is not shown in fig. 1 to simplify the drawing.
In this manner, the master node may sequentially receive multiple transactions submitted by each node. The master node may rank the multiple transactions that arrive sequentially according to the chronological order of arrival of the transactions and distribute the ranked multiple transactions (including transaction a and transaction b) to all nodes in one or batch. In a specific implementation of the present invention, the host node receives the transactions sequentially, and after each transaction is received by the host node, the transaction is arranged to be subsequent to the last received transaction. When the number of transactions arranged in the master node reaches a preset number (e.g., 100), the master node transmits the 100 transactions to each node (including the master node itself). Thus, each node receives 100 transactions having a sequential relationship.
After each node receives 100 transactions with the sequence relation, the 100 transactions are executed in sequence according to the sequence relation of the 100 transactions. Wherein each node needs to verify the traffic voting results of each transaction before executing the transaction. Specifically, the node judges whether the transaction can be executed according to a preset service consensus rule and a service voting result of the transaction, and executes the transaction when the transaction is determined to be executable. After each transaction is executed by each node, the transaction execution result of the transaction is recorded into a block of the node, and the transaction execution results recorded in the block have a sequence which is consistent with the execution sequence of the transactions. When the transaction execution result recorded in the block meets a preset condition, the node performs block consensus with other nodes in the block chain network based on a preset consensus strategy, and accesses the block into a block chain of the block chain network under the condition that the block consensus passes.
For example, the business consensus rule may be: if all the service voting results of one transaction are characterized: in favor of executing the transaction, it is determined that the transaction can be executed. Or exemplarily, if the service voting result exceeding the preset proportion in all the service voting results of one transaction is characterized: in favor of executing the transaction, it is determined that the transaction can be executed. It should be noted that the specific content of the business consensus rule is not limited in the present invention.
For example, the "preset condition" in the above "when the transaction execution result recorded in the block satisfies the preset condition" may be: the block has recorded the transaction execution results of all transactions in the current batch, for example, the block has recorded the transaction execution results of 100 transactions (100 is the transaction amount of the current batch). Or, for example, the preset condition may be: the tile has recorded a specified number of transaction execution results, e.g., the tile has recorded 50(50 is the specified number) transaction execution results. The present invention is not limited to the specific contents of the preset conditions.
For example, the preset consensus policy may be: each node calculates a total hash value for all transaction execution results in the block, and each node compares whether the calculated hash values are equal to each other; if the hash values exceeding the preset proportion in all the hash values are consistent, for example, more than 80% of the hash values in all the hash values are consistent, the blocks with consistent hash values are identified together through the blocks. Each of these blocks is accessed to the blockchain by its corresponding node. For other blocks, because the hash values of the other blocks are inconsistent with the hash values of the vast majority of blocks, it indicates that the transaction execution results recorded in the other blocks are inconsistent with the transaction execution results recorded in the vast majority of blocks, and further indicates that errors may occur in nodes corresponding to the other blocks during transaction execution, so that offline processing can be performed on the nodes.
It should be noted that, in the service development process, the service voting step and the service voting verification step are equivalent to adding service consensus on the basis of the block consensus. In this case, if a plurality of nodes join together, it is necessary to pass not only the examination of block consensus but also the examination of service consensus, which is advantageous in reducing the possibility of node join together and further improving the security of service development. However, it should be added that, in the specific implementation of the present invention, the above-mentioned service voting step and service voting verification step may be omitted.
The present invention provides a blockchain network and a process for conducting a service using the blockchain network. The present invention provides a transaction processing method based on the blockchain network by embodiments, and the following embodiments may include some or all of the technical features in the above embodiments, specifically, please refer to the following.
Referring to fig. 2, fig. 2 is a flowchart of a transaction processing method according to an embodiment of the present invention, where the transaction processing method is applied to a node in a blockchain network, and may be specifically any node. As shown in fig. 2, the transaction processing method includes the following steps:
step S21: receiving a plurality of transactions with sequential relation sent by a designated node in the block chain network, wherein the plurality of transactions comprise a target transaction and a frozen transaction, the target transaction is a transaction executed depending on the intelligent contract, and the frozen transaction is used for enabling the target intelligent contract targeted by the frozen transaction to be frozen.
Wherein the designated node may be a master node in a blockchain network, as shown in fig. 1. In addition, the designated node may also be other nodes designated in advance in the blockchain network.
As previously described, the plurality of transactions are sent by the designated node at one time; or the plurality of transactions are sent by the designated node in a plurality of batches in sequence, and each batch comprises part of the transactions.
Taking the specific node as the master node as an example, in the specific implementation of the present invention, as described above, the master node sequentially receives transactions, and after each transaction is received by the master node, the transaction is arranged to be after the last received transaction. When the number of transactions arranged in the master node reaches a preset number (e.g., 100), the master node transmits the 100 transactions to each node (including the master node itself). Thus, each node receives 100 transactions having a sequential relationship. Thereafter, the master node will still receive the transactions in succession, and in the same manner, the master node will rank the transactions that are received in succession, and when the number of transactions ranked in the master node again reaches a preset number (e.g., 100), the master node will send the 100 transactions to each node (including the master node itself). Thus, each node receives another batch of 100 transactions having a sequential relationship.
Normally, each node in the blockchain network will continuously receive transaction batches sent by the master node, each transaction batch includes 100 transactions, and the 100 transactions have a sequential relationship. In some cases, such as where the master node receives the target transaction and the frozen transaction within a short time, the target transaction and the frozen transaction are likely to occur in the same transaction batch. In other cases, such as where the master node receives the target transaction and the frozen transaction sequentially over a large time span, the target transaction and the frozen transaction are likely to occur in different transaction batches, respectively.
It should be noted that, in general, the number of target transactions is usually much larger than the number of frozen transactions. The reason for this is that many transactions in the blockchain network are executed depending on the corresponding smart contracts, and these transactions are regarded as target transactions, and therefore the number of target transactions is large. Fewer instances of the need to freeze smart contracts are common and therefore fewer frozen transactions are generated. It should be added that the above-mentioned case is a normal case, but the possibility of generating exceptional cases, such as the number of frozen transactions being greater than the number of target transactions, is not excluded. Therefore, neither the normal case nor the exceptional case should be excluded from the protection of the present invention.
Step S22: and executing the plurality of transactions in sequence according to the sequence relation of the plurality of transactions, wherein before the target transaction is executed, whether the intelligent contract depended on by the target transaction is frozen or not is judged, and the target transaction is refused to be executed under the condition that the intelligent contract depended on by the target transaction is frozen.
In the specific implementation of the invention, at the specified position of the transaction structure of the target transaction, the contract identifier of the intelligent contract depended on by the target transaction is filled, and the contract identifier may be a contract address specifically. In this manner, the node may first detect whether the contract identifier is filled at a specified location of the transaction structure for each transaction before processing the transaction to determine whether the transaction is a target transaction. If the contract identification is not populated at the specified location of the transaction structure for the transaction, it is determined that the transaction does not belong to the target transaction. Determining that the transaction belongs to the target transaction if the contract identification is filled at the specified location of the transaction structure for the transaction.
In the concrete implementation of the invention, a contract state list is stored in the block chain, and the state of each intelligent contract is recorded in the contract state list. Specifically, the contract status manifest includes a plurality of pieces of key-value data. Each piece of key-value data corresponds to an intelligent contract, wherein the key is a contract identifier of the intelligent contract, and the value is state information of the intelligent contract. The state information of the intelligent contract is specifically "enabled" or "frozen". If the state information value corresponding to a certain intelligent contract is "enabled", it indicates that the intelligent contract is not frozen. And if the state information value corresponding to a certain intelligent contract is "frozen", the intelligent contract is indicated to be frozen.
Thus, when the node determines that a transaction is a target transaction (i.e., a transaction executed depending on an intelligent contract) before executing the transaction, it needs to use a contract identifier carried in the transaction as an index and search a value corresponding to the contract identifier from a contract state list. If the value found is "enabled", then the intelligent contract on which the transaction depends is not frozen, and the transaction can continue to be executed. If the found value is 'frozen', the intelligent contract which is depended by the transaction is already frozen, so that the transaction can be refused to be executed, and the execution result of the execution failure of the transaction can be directly generated.
By processing the transactions in the manner of steps S21 and S22 described above, the frozen transactions may be used to cause the corresponding smart contracts to be frozen, whereas before a target transaction is executed, it is necessary to determine whether the smart contract on which the target transaction depends is frozen and, in the event that the smart contract on which the target transaction depends is frozen, to refuse to execute the target transaction. Therefore, supervision and freezing of the intelligent contract can be realized through freezing the transaction. And after a certain intelligent contract is frozen, the transaction executed depending on the intelligent contract is not executed. Therefore, the block chain network has stronger constraint force on transaction execution, can play the role of monitoring intelligent contracts and transactions, and has stronger practicability.
In addition, the plurality of transactions received by the node have a sequential relationship, and the node executes the transactions in sequence according to the sequential relationship. Therefore, each node in the block chain network executes each transaction in sequence according to the same sequence relation, and each node is ensured to execute the frozen transaction and the target transaction according to the same sequence. The following situations are avoided: a part of nodes execute the frozen transaction firstly and then execute the target transaction, and the target transaction is refused to be executed to obtain a processing result of target transaction execution failure; and the other part of nodes execute the target transaction firstly and then execute the frozen transaction to obtain a processing result of successful execution of the target transaction. Therefore, the invention ensures the unity of the transaction execution results of each node by limiting the transaction execution sequence, is beneficial to reducing the transaction error rate and improving the consensus success rate of the block chain network.
In addition, in the invention, whether the intelligent contract depending on the target transaction is frozen or not is judged by the node before the target transaction is executed, but whether the intelligent contract depending on the target transaction is frozen or not is not judged by the appointed node when the transactions are sequenced. The method has the advantages that if the intelligent contracts depending on the target transaction are judged whether to be frozen or not when the transactions are sequenced through the designated nodes, the following conditions can occur: the appointed node sends a plurality of transactions of the previous batch to each node (including the appointed node) for execution, and the transactions of the previous batch comprise the frozen transactions. When a plurality of transactions of the current batch are assembled and sequenced by the designated node, a target transaction is received, and the intelligent contract depended by the target transaction is the intelligent contract required to be frozen by the frozen transaction. If the other thread of the designated node does not finish the execution of the frozen transaction, the designated node obtains the unfrozen judgment result when judging whether the intelligent contract depending on the target transaction is frozen, so that the target transaction is executed. As such, the effectiveness of the frozen transaction is reduced. In the invention, whether the intelligent contract depending on the target transaction is frozen or not is judged by the node before the target transaction is executed, so that the condition can be effectively avoided, and the effectiveness of the frozen transaction is improved.
Optionally, in some embodiments of the present invention, as described above, after each transaction is executed by a node, the node records the transaction execution result of the transaction into a block, where each transaction execution result recorded in the block has an order, and the order is consistent with the execution order of each transaction. And performing block consensus with other nodes in the block chain network based on a preset consensus strategy under the condition that the transaction execution result recorded in the block meets a preset condition, and accessing the block into a block chain of the block chain network under the condition that the block consensus passes.
For the specific description of the above embodiments, refer to the above, and the detailed description of the present invention is omitted here for the sake of avoiding repetition.
Optionally, in some embodiments of the present invention, the plurality of transactions received by the node may include a contract deployment transaction, and the contract deployment transaction carries a contract identifier (e.g., a contract address) of a contract to be deployed. After executing the contract deployment transaction, each node will register the contract identifier carried in the contract deployment transaction into the contract state manifest to update the contract state manifest, and mark the state information corresponding to the contract identifier as "enabled". In addition, the node also takes the updated contract state list as a transaction execution result to be stored in the block for subsequent consensus.
Optionally, in some embodiments of the present invention, at least a contract identifier (e.g., a contract address) of a target intelligent contract is carried in the frozen transaction, where the target intelligent contract refers to: the frozen transaction requires a frozen smart contract. When executing the frozen transaction, the node specifically queries the state information corresponding to the contract identifier from the contract state list according to the contract identifier carried in the frozen transaction, and updates the state information to be "frozen", thereby updating the contract state list. In this manner, execution of the frozen transaction is completed. In addition, the node also takes the updated contract state list as a transaction execution result to be stored in the block for subsequent consensus.
Optionally, in some embodiments of the invention, to ensure the security of frozen transactions, malicious freezing of smart contracts by a perpetrator is prevented, resulting in the blocking of normal transactions. In the invention, the freezing authority can be configured in advance, and the freezing transaction can be carried: initiator identity information of the frozen transaction, and a digital signature of the frozen transaction. Before executing the frozen transaction, the node firstly queries a public key corresponding to the identity information of an initiator from a plurality of pre-stored public keys according to the identity information of the initiator carried by the frozen transaction; then, based on the inquired public key, the digital signature of the frozen transaction is subjected to signature verification, so that the following verification is carried out: and whether the actual initiator of the frozen transaction is the initiator corresponding to the initiator identity information carried by the frozen transaction is determined.
If the frozen transaction passes signature verification, it indicates that the actual initiator of the frozen transaction is indeed the initiator corresponding to the initiator identity information carried by the frozen transaction, so that the frozen transaction can be continuously processed. If the frozen transaction fails signature verification, it indicates that the actual initiator of the frozen transaction is not the initiator corresponding to the initiator identity information carried by the frozen transaction, so that execution of the frozen transaction can be refused, and in addition, an execution result of transaction execution failure can be directly generated.
And under the condition that the frozen transaction can be continuously processed, namely the actual initiator of the frozen transaction is determined to be the initiator corresponding to the initiator identity information carried by the frozen transaction, continuously judging whether the initiator has the freezing permission. If the initiator has the freeze right, it is determined that the frozen transaction can be executed. If the initiator does not have the freeze right, execution of the frozen transaction is denied.
For ease of understanding, assume that P1(P1 may be either a node or a client) generated a frozen transaction. P1 to declare that the frozen transaction was issued by itself, P1 populates the frozen transaction with the identity information of P1. In addition, P1 signs the frozen transaction with its own private key, resulting in a digital signature of the frozen transaction.
The frozen transactions are eventually routed through the blockchain network to the respective nodes of the blockchain network. Each node first extracts the identity information of P1 from the frozen transaction before executing the frozen transaction. And then, according to the identity information of P1, acquiring a public key corresponding to P1, and performing signature verification on the digital signature of the frozen transaction by using the public key. Since P1 previously used its own private key when signing, the digital signature can be verified when the node signed and verified with the corresponding public key of P1.
After the digital signature verification passes, the node concludes that the confirmation of the frozen transaction was issued by P1. Next, the node queries whether P1 has the freeze right. If P1 has the freeze right, the node executes the frozen transaction. If P1 does not have the freeze right, the node does not perform the frozen transaction.
Or for ease of understanding, assume that P8(P8 may be either a node or a client) generated a frozen transaction. Further assume that P8 is a wrongdoer, and P8 has no freeze right. P8 in order to freeze a certain intelligent contract, P8 states that the frozen transaction is issued by P2(P2 has the freezing right), and P8 fills the identity information of P2 in the frozen transaction. In addition, since the frozen transaction needs to carry a digital signature, P8 signs the frozen transaction with its own private key, resulting in a digital signature of the frozen transaction.
The frozen transactions are eventually routed through the blockchain network to the respective nodes of the blockchain network. Before executing the frozen transaction, each node firstly extracts the identity information of P2 from the frozen transaction, then acquires the public key corresponding to P2 according to the identity information of P2, and uses the public key to perform signature verification on the digital signature of the frozen transaction. Since P8 previously used its own private key (i.e., the private key of P8) when signing, the digital signature would not pass verification when the node signed verification with the corresponding public key of P2.
Since the digital signature cannot be verified, the node concludes that the frozen transaction was not issued by P2, but was issued by P2 as spoofed by a perpetrator. As such, the node refuses to execute the frozen transaction.
It can be seen that in the above-described embodiment of the present invention, the authenticity of the identity of the frozen transaction initiator is first checked, thereby filtering out frozen transactions sent by counterfeiters. Then, under the condition that the identity of the frozen transaction initiator is real, whether the initiator has the freezing authority is further judged, and the frozen transaction is executed under the condition that the initiator has the freezing authority. Therefore, the safety of the frozen transaction can be effectively improved, and the malicious freezing of the intelligent contract by a malicious person to prevent the normal transaction from being blocked.
To implement the processes described in the above embodiments, the following are exemplary:
the freeze transaction may carry: initiator identity information of the frozen transaction, and a digital signature of the frozen transaction.
Before executing the frozen transaction, the node performs signature verification on the digital signature of the frozen transaction by using a public key corresponding to the initiator identity information carried by the frozen transaction; under the condition that the signature verification is passed, judging whether the initiator has the freezing authority or not according to a preset first freezing authority list and the identity information of the initiator; in the event that the initiator does not have a freeze right, refusing to perform the freeze transaction.
One or more pieces of identity information are recorded in the first frozen permission list, and a main body (such as a node or a client) corresponding to the identity information has a frozen permission. The first frozen permission list is applicable to frozen transactions of any intelligent contract, in other words, for freezing of any intelligent contract, the first frozen permission list needs to be queried to verify whether the initiator has the frozen permission. For the convenience of understanding, before the node processes the frozen transaction X (which is used for freezing the intelligent contract X), if the digital signature of the frozen transaction X passes the signature verification, it is queried whether the initiator identity information carried by the frozen transaction X is recorded in the first frozen permission list, so as to determine whether the initiator has the frozen permission. Before the node processes the frozen transaction Y (the frozen transaction is used for freezing the intelligent contract Y), if the digital signature of the frozen transaction Y passes signature verification, whether the initiator identity information carried by the frozen transaction Y is recorded in the first frozen permission list or not is also inquired so as to judge whether the initiator has the frozen permission or not.
Or to implement the procedures described in the above embodiments, by way of example:
each intelligent contract is respectively corresponding to a respective second freezing authority list, and the freezing transaction carries: contract identification of a target smart contract for which the frozen transaction is intended, originator identity information of the frozen transaction, and a digital signature of the frozen transaction.
Before executing the frozen transaction, the node performs signature verification on the digital signature of the frozen transaction by using a public key corresponding to the initiator identity information carried by the frozen transaction; under the condition that the signature verification is passed, determining a second freezing authority list of the intelligent contract corresponding to the contract identification according to the contract identification carried by the freezing transaction; judging whether the initiator has the freezing authority or not according to the determined second freezing authority list and the identity information of the initiator; in the event that the initiator does not have a freeze right, refusing to perform the freeze transaction.
Wherein, different intelligent contracts respectively correspond to different second freezing permission lists. Different freezing authorities can be configured for different intelligent contracts, so that the flexibility and the applicability of intelligent contract freezing operation are improved.
Each second frozen permission list is recorded with one or more pieces of identity information, and a main body (such as a node or a client) corresponding to the identity information has the freezing permission of the intelligent contract corresponding to the second frozen permission list. For convenience of understanding, it is assumed that the intelligent contract M corresponds to the second frozen permission list M, and the second frozen permission list M records therein the identity information of P1, P2 and P4, which means that P1, P2 and P4 have frozen permissions on the intelligent contract M. And assuming that the intelligent contract N corresponds to the second freezing right list N, and the identity information of P2, P3 and P4 is recorded in the second freezing right list N, it indicates that P2, P3 and P4 have the freezing right to the intelligent contract N.
Before the node processes the frozen transaction M (the frozen transaction is used for freezing the intelligent contract M), if the digital signature of the frozen transaction M passes signature verification, a second frozen permission list M is determined from a plurality of second frozen permission lists according to the contract identifier M carried in the frozen transaction M. And then inquiring whether the initiator identity information carried by the frozen transaction M is recorded in the second frozen permission list M or not so as to judge whether the initiator has the frozen permission or not. Before the node processes the frozen transaction N (the frozen transaction is used for freezing the intelligent contract N), if the digital signature of the frozen transaction N passes signature verification, a second frozen permission list N is determined from a plurality of second frozen permission lists according to the contract identification N carried in the frozen transaction N. And then inquiring whether the initiator identity information carried by the frozen transaction N is recorded in the second frozen permission list N so as to judge whether the initiator has the frozen permission.
Optionally, in some embodiments of the present invention, the freezing authority of each smart contract may also be configured. In the concrete implementation:
the multiple transactions received by the node may further include a frozen permission configuration transaction, where the frozen permission configuration transaction carries: the frozen right configures a contract identification of a target smart contract for which the transaction is intended, and identity information of a proposed administrator.
When the node executes the frozen permission configuration transaction, as shown in fig. 3, the following steps are specifically executed:
step S31: and according to the contract identification carried by the freezing authority configuration transaction, judging whether the intelligent contract corresponding to the contract identification corresponds to a second freezing authority list.
Step S32: and under the condition that the intelligent contract corresponding to the contract identifier does not correspond to a second freezing authority list, judging whether identity information of a proposed manager carried by the freezing authority configuration transaction belongs to identity information of a preset manager or not, if so, establishing a second freezing authority list for the intelligent contract corresponding to the contract identifier, and recording the identity information of the proposed manager carried by the freezing authority configuration transaction in the second freezing authority list.
Step S33: and under the condition that the intelligent contract corresponding to the contract identification corresponds to a second freezing authority list, judging whether the identity information of the proposed managers carried in the freezing authority configuration transaction belongs to the identity information of the preset managers, if so, updating the original identity information recorded in the second freezing authority list into the identity information of the proposed managers carried in the freezing authority configuration transaction.
Wherein, by executing step S31, it is determined whether the target intelligent contract for which the frozen right configuration transaction is aimed corresponds to the corresponding second frozen right list. If yes, go to step S33; if not, step S32 is executed.
Wherein, step S32 is executed to establish a corresponding second frozen permission list for the smart contract for which no corresponding second frozen permission list exists. In other words, for smart contracts for which no freeze permissions have been configured, the corresponding freeze permissions are configured. And during the execution of step S32, it is necessary to determine whether the identity information of the proposed administrator carried by the frozen right configuration transaction all belongs to the identity information of the preset administrator, so as to avoid giving the frozen right to a subject not belonging to the preset administrator, which may cause the frozen right to leak and cause a security problem.
Wherein the identity information in the second frozen permission list is updated for the smart contract that already has the corresponding second frozen permission list by executing step S33. In other words, the freeze permission is updated for the smart contract for which the freeze permission has been configured. And during the execution of step S33, it is necessary to determine whether the identity information of the proposed administrator carried by the frozen right configuration transaction all belongs to the identity information of the preset administrator, so as to avoid giving the frozen right to a subject not belonging to the preset administrator, which may cause the frozen right to leak and cause a security problem.
For convenience of understanding, it is assumed that the default managers include P1, P2, P3, P4, P5 and P6, and the identity information of the default managers is pre-configured in the blockchain network. Assume again that the publisher of the intelligent contract F issues a frozen right configuration transaction F for the intelligent contract F after issuing the intelligent contract F. The frozen right configuration transaction F carries: contract identification F, and drawing up identity information of managers P1, P2, P3, P4, P5, P8 and the like. When the node processes the freezing authority configuration transaction F, firstly, a contract identifier F is extracted from the freezing authority configuration transaction F, and then whether a second freezing authority list F exists is inquired by taking the contract identifier F as an index. Assuming that the second freeze permission list F is not queried, it is determined that the intelligent contract F has not configured a freeze permission. In this way, the node extracts the identity information of proposed managers P1, P2, P3, P4, P5, P8 and the like from the frozen right configuration transaction F, and the node determines whether the proposed manager belongs to a preset manager or not based on the identity information of each proposed manager. Since the proposed manager P8 does not belong to the preset manager, in order to prevent the frozen right to the intelligent contract F from being leaked to the proposed manager P8, the node may refuse to execute the frozen right configuration transaction F and feed back the reason for the refusal to execute to the publisher.
Assume again that the issuer of the intelligent contract F reissues the frozen right configuration transaction F' for the intelligent contract F after receiving the reason for the refusal of execution. The frozen right configuration transaction F' carries: contract identification F, and the identity information of the proposed managers P1, P2, P3, P4, P5 and the like. When the node processes the freezing authority configuration transaction F ', firstly, a contract identifier F is extracted from the freezing authority configuration transaction F', and then whether a second freezing authority list F exists is inquired by taking the contract identifier F as an index. Assuming that the second freeze permission list F is not queried, it is determined that the intelligent contract F has not configured a freeze permission. In this way, the node extracts the identity information of the proposed managers P1, P2, P3, P4, P5 and the like from the frozen authority configuration transaction F', and the node determines whether the proposed manager belongs to the preset manager or not based on the identity information of each proposed manager. Since all proposed managers belong to the preset manager, the node continues to execute the frozen privilege configuration transaction F'. Specifically, the node establishes a second freezing authority list F for the intelligent contract F, and the second freezing authority list F records identity information of proposed managers P1, P2, P3, P4, P5 and the like.
Assuming again that after a period of time, the publisher of the intelligent contract F suspects that the preset supervisor P2 has a prejudice against the intelligent contract F, the preset supervisor P2 often performs some negative operation on the intelligent contract F, such as freezing the intelligent contract F. To this end, the publisher of the intelligent contract F may issue the frozen right configuration transaction F "for the intelligent contract F again. The frozen right configuration transaction F' carries: contract identification F, and the identity information of proposed managers P1, P3, P4, P5, etc. When the node processes the freezing authority configuration transaction F ', firstly, a contract identifier F is extracted from the freezing authority configuration transaction F', and then whether a second freezing authority list F exists is inquired by taking the contract identifier F as an index. Assuming that the second freezing right list F is queried, it is determined that the intelligent contract F has been configured with freezing rights. In this way, the node extracts the identity information of the proposed managers P1, P3, P4, P5 and the like from the frozen authority configuration transaction F ″, and the node determines whether the proposed manager belongs to a preset manager or not based on the identity information of each proposed manager. Since all proposed managers belong to the preset manager, the node continues to execute the frozen permission configuration transaction F ". Specifically, the node updates the original identity information in the second freezing permission list f (i.e., the identity information of P1, P2, P3, P4, P5, and the like) to the identity information of P1, P3, P4, P5, and the like.
In addition, when the invention is implemented, certain measures can be taken to limit: the node executes the frozen permission configuration transaction only if the originator of the frozen permission configuration transaction is the issuer of the respective smart contract. In other words, only the publisher of a certain intelligent contract is allowed to initiate a frozen-rights configuration transaction for that intelligent contract. For convenience of understanding, if the node receives the frozen permission configuration transaction for the intelligent contract F, the node needs to verify whether the frozen permission configuration transaction is initiated by the issuer of the intelligent contract F, if so, the frozen permission configuration transaction is continuously executed, and if not, the frozen permission configuration transaction is refused to be executed. In this way, the malicious person can be prevented from freely configuring the freezing authority of the intelligent contract.
By way of example, the measures that can be taken include the following steps:
when an intelligent contract is successfully issued, the node can record the corresponding relationship between the issuer identity information of the intelligent contract and the intelligent contract. For example, the corresponding relation is represented by Px-G, and the corresponding relation Px-G indicates that the publisher Px publishes the intelligent contract G. Before executing the frozen permission configuration transaction, the node extracts the identity information carried by the frozen permission configuration transaction, acquires a corresponding public key according to the identity information, and then performs signature verification on the digital signature of the frozen permission configuration transaction by using the acquired public key, thereby judging whether the identity information carried by the frozen permission configuration transaction is real. The principle of this verification process is the same as that described above for the verification process of the frozen transaction digital signature.
And under the condition that the digital signature passes verification, extracting identification information and identity information carried by the frozen authority configuration transaction, and judging whether the block chain records the corresponding relation between the two, thereby determining whether the frozen authority configuration transaction is sent by a publisher of a corresponding intelligent contract. Assuming that the identification information is G and the identity information is Px, since the block chain records the corresponding relation Px-G, the condition that the frozen authority configuration transaction is sent by the publisher of the intelligent contract G is determined. In this manner, the frozen right configuration transaction may be executed against the smart contract G.
Optionally, in some embodiments of the present invention, the device for monitoring the smart contract may be a node in a blockchain network. In the concrete implementation:
the node displays the state information of the intelligent contract, and the state information of one intelligent contract is used for representing whether the intelligent contract is frozen or not; the node responds to the freezing operation of a target user for a target intelligent contract, and generates a freezing transaction for the target intelligent contract, wherein the target user is a user passing identity authentication, and the freezing transaction carries identity information of the target user or identity information of the node; the node signs the frozen transaction by using the private key of the target user or the private key of the node to obtain a digital signature of the frozen transaction; and submitting the generated frozen transaction and the digital signature thereof to the designated node by the node.
Illustratively, part of nodes in the blockchain network are used for monitoring the intelligent contracts, and the nodes can show the state information of each intelligent contract to users through a human-computer interaction interface. For example, the nodes may display to the user a contract status list as described in some embodiments above, in which the contract identification (e.g., contract address) of each intelligent contract and the status information (e.g., frozen or enabled) of each intelligent contract are recorded. The user may make a freeze operation via an input device (e.g., mouse, keyboard, touch screen, microphone) of the node to instruct the node to generate a freeze transaction for the target smart contract. In this manner, the node generates a frozen transaction for the target smart contract in response to the user's freeze operation.
In addition, as described in some embodiments above, before submitting the frozen transaction to a designated node (e.g., a master node), the node may also send the frozen transaction to a node specified in the traffic voting rules for traffic voting according to a preset traffic voting rule. And after the node obtains the service voting result, packaging and submitting the service voting result and the frozen transaction to a specified node.
Based on the same inventive concept, the embodiment of the invention also provides a transaction processing device. Referring to fig. 4, fig. 4 is a schematic diagram of a transaction processing device according to an embodiment of the present invention, which is applied to a node in a blockchain network. As shown in fig. 4, the apparatus includes:
a transaction receiving module 41, configured to receive a plurality of transactions with a sequential relationship sent by a specified node in the blockchain network, where the plurality of transactions includes a target transaction and a frozen transaction, the target transaction is a transaction executed in dependence on an intelligent contract, and the frozen transaction is used to freeze a target intelligent contract for which the frozen transaction is intended;
a transaction executing module 42, configured to sequentially execute the multiple transactions according to the sequence relationship of the multiple transactions;
wherein the transaction execution module comprises: a target transaction execution unit 42-1, the target transaction execution unit 42-1 to: before executing the target transaction, judging whether the intelligent contract depended on by the target transaction is frozen or not, and refusing to execute the target transaction if the intelligent contract depended on by the target transaction is frozen.
Optionally, the plurality of transactions are sent by the designated node at one time; or the plurality of transactions are sent by the designated node in a plurality of batches in sequence, and each batch comprises part of the transactions.
Optionally, the apparatus further comprises:
the result recording module is used for recording the transaction execution result of the transaction into a block after each transaction is executed, wherein each transaction execution result recorded in the block has a sequence, and the sequence is consistent with the execution sequence of each transaction;
and the block consensus module is used for performing block consensus with other nodes in the block chain network based on a preset consensus strategy under the condition that the transaction execution result recorded in the block meets a preset condition, and accessing the block into the block chain of the block chain network under the condition that the block consensus passes.
Optionally, the frozen transaction carries: the identity information of the initiator of the frozen transaction and the digital signature of the frozen transaction;
the transaction execution module includes: a first frozen transaction execution unit to: before executing the frozen transaction, utilizing a public key corresponding to initiator identity information carried by the frozen transaction to carry out signature verification on a digital signature of the frozen transaction; under the condition that the signature verification is passed, judging whether the initiator has the freezing authority or not according to a preset first freezing authority list and the identity information of the initiator; in the event that the initiator does not have a freeze right, refusing to perform the freeze transaction.
Optionally, each intelligent contract corresponds to a respective second frozen permission list, and the frozen transaction carries: contract identification of a target intelligent contract for which the frozen transaction is directed, originator identity information of the frozen transaction, and a digital signature of the frozen transaction;
the transaction execution module includes: a second frozen transaction execution unit to: before executing the frozen transaction, utilizing a public key corresponding to initiator identity information carried by the frozen transaction to carry out signature verification on a digital signature of the frozen transaction; under the condition that the signature verification is passed, determining a second freezing authority list of the intelligent contract corresponding to the contract identification according to the contract identification carried by the freezing transaction; judging whether the initiator has the freezing authority or not according to the determined second freezing authority list and the identity information of the initiator; in the event that the initiator does not have a freeze right, refusing to perform the freeze transaction.
Optionally, the multiple transactions further include a frozen permission configuration transaction, where the frozen permission configuration transaction carries: the freezing authority configures contract identification of a target intelligent contract for which the transaction is aimed and identity information of a proposed manager;
the transaction execution module includes: a permission configuration transaction execution unit, the permission configuration transaction execution unit to:
according to the contract identification carried by the freezing authority configuration transaction, judging whether the intelligent contract corresponding to the contract identification corresponds to a second freezing authority list or not;
under the condition that the intelligent contract corresponding to the contract identification does not correspond to a second freezing authority list, judging whether identity information of a proposed manager carried by the freezing authority configuration transaction belongs to identity information of a preset manager or not, if so, establishing a second freezing authority list for the intelligent contract corresponding to the contract identification, wherein the second freezing authority list records the identity information of the proposed manager carried by the freezing authority configuration transaction;
and under the condition that the intelligent contract corresponding to the contract identification corresponds to a second freezing authority list, judging whether the identity information of the proposed managers carried in the freezing authority configuration transaction belongs to the identity information of the preset managers, if so, updating the original identity information recorded in the second freezing authority list into the identity information of the proposed managers carried in the freezing authority configuration transaction.
Optionally, the apparatus further comprises:
the information display module is used for displaying the state information of the intelligent contracts, and the state information of one intelligent contract is used for representing whether the intelligent contract is frozen or not;
the frozen transaction generating module is used for responding to the freezing operation of a target user for a target intelligent contract and generating a frozen transaction for the target intelligent contract, wherein the target user is a user authenticated by identity, and the frozen transaction carries identity information of the target node or identity information of the node;
the signature module is used for signing the frozen transaction by using a private key of the target user or a private key of the node to obtain a digital signature of the frozen transaction;
and the transaction submitting module is used for submitting the generated frozen transaction and the digital signature thereof to the specified node.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Based on the same inventive concept, an embodiment of the present invention further provides an electronic device, as shown in fig. 5, including a processor 501, a communication interface 502, a memory 503, and a communication bus 504, where the processor 501, the communication interface 502, and the memory 503 complete communication with each other through the communication bus 504.
The memory 503 is used for storing computer programs;
the processor 501 is configured to implement the following steps when executing the program stored in the memory 503:
receiving a plurality of transactions with sequential relation sent by a designated node in the blockchain network, wherein the plurality of transactions comprise a target transaction and a frozen transaction, the target transaction is a transaction executed depending on an intelligent contract, and the frozen transaction is used for enabling a target intelligent contract targeted by the frozen transaction to be frozen;
and executing the plurality of transactions in sequence according to the sequence relation of the plurality of transactions, wherein before the target transaction is executed, whether the intelligent contract depended on by the target transaction is frozen or not is judged, and the target transaction is refused to be executed under the condition that the intelligent contract depended on by the target transaction is frozen.
Alternatively, the processor 501 is configured to execute the program stored in the memory 503 to implement the steps of the transaction processing method provided by the above other method embodiments of the present invention.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute the transaction processing method of any one of the above embodiments.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the transaction processing method of any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A transaction processing method applied to a node in a blockchain network, the method comprising:
receiving a plurality of transactions with sequential relation sent by a designated node in the blockchain network, wherein the plurality of transactions comprise a target transaction and a frozen transaction, the target transaction is a transaction executed depending on an intelligent contract, and the frozen transaction is used for enabling a target intelligent contract targeted by the frozen transaction to be frozen;
and executing the plurality of transactions in sequence according to the sequence relation of the plurality of transactions, wherein before the target transaction is executed, whether the intelligent contract depended on by the target transaction is frozen or not is judged, and the target transaction is refused to be executed under the condition that the intelligent contract depended on by the target transaction is frozen.
2. The method of claim 1, wherein the plurality of transactions are sent at one time by the designated node; or the plurality of transactions are sent by the designated node in a plurality of batches in sequence, and each batch comprises part of the transactions.
3. The method of claim 2, further comprising:
after each transaction is executed, recording the transaction execution result of the transaction into a block, wherein each transaction execution result recorded in the block has a sequence, and the sequence is consistent with the execution sequence of each transaction;
and performing block consensus with other nodes in the block chain network based on a preset consensus strategy under the condition that the transaction execution result recorded in the block meets a preset condition, and accessing the block into a block chain of the block chain network under the condition that the block consensus passes.
4. The method of claim 1, wherein the frozen transaction carries: the identity information of the initiator of the frozen transaction and the digital signature of the frozen transaction;
before executing the frozen transaction, utilizing a public key corresponding to initiator identity information carried by the frozen transaction to carry out signature verification on a digital signature of the frozen transaction; under the condition that the signature verification is passed, judging whether the initiator has the freezing authority or not according to a preset first freezing authority list and the identity information of the initiator; in the event that the initiator does not have a freeze right, refusing to perform the freeze transaction.
5. The method of claim 1, wherein each smart contract has a respective second frozen list of permissions corresponding thereto, and wherein the frozen transactions carry: contract identification of a target intelligent contract for which the frozen transaction is directed, originator identity information of the frozen transaction, and a digital signature of the frozen transaction;
before executing the frozen transaction, utilizing a public key corresponding to initiator identity information carried by the frozen transaction to carry out signature verification on a digital signature of the frozen transaction; under the condition that the signature verification is passed, determining a second freezing authority list of the intelligent contract corresponding to the contract identification according to the contract identification carried by the freezing transaction; judging whether the initiator has the freezing authority or not according to the determined second freezing authority list and the identity information of the initiator; in the event that the initiator does not have a freeze right, refusing to perform the freeze transaction.
6. The method of claim 5, further comprising a frozen permission configuration transaction in the plurality of transactions, the frozen permission configuration transaction carrying: the freezing authority configures contract identification of a target intelligent contract for which the transaction is aimed and identity information of a proposed manager;
when the frozen permission configuration transaction is executed, the following steps are specifically executed:
according to the contract identification carried by the freezing authority configuration transaction, judging whether the intelligent contract corresponding to the contract identification corresponds to a second freezing authority list or not;
under the condition that the intelligent contract corresponding to the contract identification does not correspond to a second freezing authority list, judging whether identity information of a proposed manager carried by the freezing authority configuration transaction belongs to identity information of a preset manager or not, if so, establishing a second freezing authority list for the intelligent contract corresponding to the contract identification, wherein the second freezing authority list records the identity information of the proposed manager carried by the freezing authority configuration transaction;
and under the condition that the intelligent contract corresponding to the contract identification corresponds to a second freezing authority list, judging whether the identity information of the proposed managers carried in the freezing authority configuration transaction belongs to the identity information of the preset managers, if so, updating the original identity information recorded in the second freezing authority list into the identity information of the proposed managers carried in the freezing authority configuration transaction.
7. The method according to claim 4 or 5, characterized in that the method further comprises:
displaying the state information of the intelligent contracts, wherein the state information of one intelligent contract is used for representing whether the intelligent contract is frozen or not;
generating a frozen transaction aiming at a target intelligent contract in response to the freezing operation of a target user aiming at the target intelligent contract, wherein the target user is a user passing identity authentication, and the frozen transaction carries identity information of the target user or identity information of a node;
signing the frozen transaction by using the private key of the target user or the private key of the node to obtain a digital signature of the frozen transaction;
and submitting the generated frozen transaction and the digital signature thereof to the designated node.
8. A transaction processing apparatus, for use in a node in a blockchain network, the apparatus comprising:
a transaction receiving module, configured to receive multiple transactions with a sequential relationship sent by a designated node in the blockchain network, where the multiple transactions include a target transaction and a frozen transaction, the target transaction is a transaction executed depending on an intelligent contract, and the frozen transaction is used to freeze a target intelligent contract for the frozen transaction;
the transaction execution module is used for sequentially executing the plurality of transactions according to the sequence relation of the plurality of transactions;
wherein the transaction execution module comprises: a target transaction execution unit to: before executing the target transaction, judging whether the intelligent contract depended on by the target transaction is frozen or not, and refusing to execute the target transaction if the intelligent contract depended on by the target transaction is frozen.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
the memory is used for storing a computer program;
the processor, when executing a program stored in the memory, is adapted to perform the method steps of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 7.
CN202010828158.3A 2020-08-17 2020-08-17 Transaction processing method, device, electronic equipment and readable storage medium Active CN112037055B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010828158.3A CN112037055B (en) 2020-08-17 2020-08-17 Transaction processing method, device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010828158.3A CN112037055B (en) 2020-08-17 2020-08-17 Transaction processing method, device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN112037055A true CN112037055A (en) 2020-12-04
CN112037055B CN112037055B (en) 2023-05-05

Family

ID=73578227

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010828158.3A Active CN112037055B (en) 2020-08-17 2020-08-17 Transaction processing method, device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112037055B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112767043A (en) * 2021-01-26 2021-05-07 中国人寿保险股份有限公司上海数据中心 Multi-platform integration system and method based on block chain and storage medium
CN114422151A (en) * 2022-03-29 2022-04-29 北京微芯感知科技有限公司 Method and system for expanding transaction number in block

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107464118A (en) * 2017-08-16 2017-12-12 济南浪潮高新科技投资发展有限公司 A kind of data trade method based on block chain intelligence contract
CN107562513A (en) * 2017-07-18 2018-01-09 杭州趣链科技有限公司 A kind of management method of the intelligent contract life cycle based on JAVA
CN108965399A (en) * 2018-06-25 2018-12-07 百度在线网络技术(北京)有限公司 Execution method, apparatus, equipment and the storage medium of intelligent contract
CN109345388A (en) * 2018-09-20 2019-02-15 百度在线网络技术(北京)有限公司 Block chain intelligence contract verification method, device and storage medium
CN110070349A (en) * 2018-01-22 2019-07-30 厦门本能管家科技有限公司 A kind of quick transfer account method establishing both sides' contract and freezing
CN110597916A (en) * 2019-09-21 2019-12-20 腾讯科技(深圳)有限公司 Data processing method and device based on block chain, storage medium and terminal
US20190392178A1 (en) * 2018-06-26 2019-12-26 bootstrap legal Inc. Method and System for Monitoring a Smart Contract on a Distributed Ledger
US20200167503A1 (en) * 2019-05-30 2020-05-28 Alibaba Group Holding Limited Managing a smart contract on a blockchain
CN111222160A (en) * 2019-12-30 2020-06-02 联动优势(北京)数字科技有限公司 Intelligent contract execution method and system
CN111415260A (en) * 2020-03-26 2020-07-14 杭州复杂美科技有限公司 Intelligent contract popularization method, equipment and storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562513A (en) * 2017-07-18 2018-01-09 杭州趣链科技有限公司 A kind of management method of the intelligent contract life cycle based on JAVA
CN107464118A (en) * 2017-08-16 2017-12-12 济南浪潮高新科技投资发展有限公司 A kind of data trade method based on block chain intelligence contract
CN110070349A (en) * 2018-01-22 2019-07-30 厦门本能管家科技有限公司 A kind of quick transfer account method establishing both sides' contract and freezing
CN108965399A (en) * 2018-06-25 2018-12-07 百度在线网络技术(北京)有限公司 Execution method, apparatus, equipment and the storage medium of intelligent contract
US20190392178A1 (en) * 2018-06-26 2019-12-26 bootstrap legal Inc. Method and System for Monitoring a Smart Contract on a Distributed Ledger
CN109345388A (en) * 2018-09-20 2019-02-15 百度在线网络技术(北京)有限公司 Block chain intelligence contract verification method, device and storage medium
US20200167503A1 (en) * 2019-05-30 2020-05-28 Alibaba Group Holding Limited Managing a smart contract on a blockchain
CN110597916A (en) * 2019-09-21 2019-12-20 腾讯科技(深圳)有限公司 Data processing method and device based on block chain, storage medium and terminal
CN111222160A (en) * 2019-12-30 2020-06-02 联动优势(北京)数字科技有限公司 Intelligent contract execution method and system
CN111415260A (en) * 2020-03-26 2020-07-14 杭州复杂美科技有限公司 Intelligent contract popularization method, equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112767043A (en) * 2021-01-26 2021-05-07 中国人寿保险股份有限公司上海数据中心 Multi-platform integration system and method based on block chain and storage medium
CN112767043B (en) * 2021-01-26 2024-05-24 中国人寿保险股份有限公司上海数据中心 Multi-platform integration system, method and storage medium based on blockchain
CN114422151A (en) * 2022-03-29 2022-04-29 北京微芯感知科技有限公司 Method and system for expanding transaction number in block
CN114422151B (en) * 2022-03-29 2022-07-05 北京微芯感知科技有限公司 Method and system for expanding transaction number in block

Also Published As

Publication number Publication date
CN112037055B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
CN110727712B (en) Data processing method and device based on block chain network, electronic equipment and storage medium
CN110800005B (en) Split, licensed and distributed ledger
CN109257334B (en) Block chain-based data uplink system, method and storage medium
CN110569658B (en) User information processing method and device based on blockchain network, electronic equipment and storage medium
CN111079136B (en) Fog computing intrusion detection feature sharing system based on block chain technology
CN112241919B (en) Multi-domain blockchain network with data flow control
CN110598434B (en) House information processing method and device based on blockchain network, electronic equipment and storage medium
CN110266872B (en) Address book data management and control method and device, cloud address book system, computer equipment and computer readable storage medium
CN111523890A (en) Data processing method and device based on block chain, storage medium and equipment
CN110908786A (en) Intelligent contract calling method, device and medium
CN113723962B (en) Block chain authority management method and block chain system
CN110674128A (en) On-chain remediation of block chains
CN112671881B (en) Node organization management method and device, electronic equipment and readable storage medium
US11343313B1 (en) Fault tolerant periodic leader rotation for blockchain
CN115605868A (en) Cross-network identity provisioning
JP2022525551A (en) Preventing erroneous transmission of copies of data records to distributed ledger systems
CN112037055A (en) Transaction processing method and device, electronic equipment and readable storage medium
CN112712452A (en) Approval information processing method and device based on block chain
CN114401091B (en) Device cross-domain authentication management method and device based on block chain
CN111769956B (en) Service processing method, device, equipment and medium
CN112837023A (en) Business collaboration platform, method and device of organization and electronic equipment
CN112037062A (en) Transaction consensus method, device, electronic equipment and readable storage medium
CN112269838A (en) Block chain-based supervision method and device, electronic equipment and storage medium
CN112039893B (en) Private transaction processing method and device, electronic equipment and readable storage medium
CN114978651A (en) Privacy calculation evidence storage method and device, electronic equipment and storage medium

Legal Events

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