CN117911148A - Method, device, system and storage medium for determining transaction validity - Google Patents

Method, device, system and storage medium for determining transaction validity Download PDF

Info

Publication number
CN117911148A
CN117911148A CN202311846832.0A CN202311846832A CN117911148A CN 117911148 A CN117911148 A CN 117911148A CN 202311846832 A CN202311846832 A CN 202311846832A CN 117911148 A CN117911148 A CN 117911148A
Authority
CN
China
Prior art keywords
transaction
account
service
information
blockchain
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.)
Pending
Application number
CN202311846832.0A
Other languages
Chinese (zh)
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.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian 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 Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202311846832.0A priority Critical patent/CN117911148A/en
Publication of CN117911148A publication Critical patent/CN117911148A/en
Pending legal-status Critical Current

Links

Landscapes

  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the application provides a method, equipment, a system and a storage medium for determining transaction legitimacy, which relate to the technical field of blockchain and comprise the following steps: and receiving first position information and first identification information of a first transaction, which are sent by other node equipment in the blockchain network, wherein the first position information is used for indicating the position of the identification information of the transaction in a first service account. And acquiring a first service account from the blockchain according to the first position information. Searching in the first business account according to the first position information and the first identification information to determine the validity of the first transaction. This scheme is used to reduce the additional overhead and time spent in determining the legitimacy of a transaction.

Description

Method, device, system and storage medium for determining transaction validity
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, apparatus, system, and storage medium for determining validity of a transaction.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like, and has the characteristics of decentralization, non-falsification of information, openness, anonymity and the like, and has been widely developed and applied in recent years. Typically, transactions on the blockchain are independent of each other and have no relevance. And a series of transactions are usually required to be executed under one service, and the correlation between multiple transactions under the same service needs to be established, that is, the correlation between multiple transactions depends on an application layer of a centralization mode.
After a certain node device in the blockchain network performs a transaction under a certain service, other node devices need to verify whether the transaction is legal, i.e. determine whether the transaction is successfully performed and stored in the blockchain. In the related art, whether a plurality of transactions under the current service are legal or not is verified, and multiple interactions between an application layer and a blockchain are needed, so that the interaction burden of the application layer and the blockchain is increased, additional expense and time consumption are caused, and the use experience of a user is affected.
Disclosure of Invention
The embodiment of the application provides a method, equipment, system and storage medium for determining transaction legitimacy, which are used for reducing the additional expenditure and time consumption caused by determining the transaction legitimacy.
In a first aspect, an embodiment of the present application provides a method for determining validity of a transaction, the method including: and receiving first position information and first identification information of a first transaction, which are sent by other node equipment in the blockchain network, wherein the first position information is used for indicating the position of the identification information of the transaction in a first service account. And acquiring a first service account from the blockchain according to the first position information. Searching in the first business account according to the first position information and the first identification information to determine the validity of the first transaction.
The embodiment of the application provides a method for determining the validity of a transaction, which needs to verify the validity of one transaction in a blockchain after the transaction is executed, so that first position information and first identification information of the first transaction sent by other node equipment in the blockchain network can be received without acquiring the information of the first transaction from an application layer; in addition, a first business account is acquired from the blockchain according to the first position information, and the legitimacy of the first transaction is determined by searching in the first business account according to the first position information and the first identification information, so that interaction with an application layer is reduced to acquire the information of the first transaction; based on the above, the method provided by the embodiment of the application can acquire the information of the first transaction and the first service account through interaction with the blockchain, so as to determine the validity of the first transaction. Therefore, the method provided by the embodiment of the application can reduce the additional expenditure and time consumption caused by determining the validity of the transaction.
In one possible implementation manner of the present application, receiving first location information and first identification information of a first transaction sent by other node devices in a blockchain network includes: based on a block chain consensus mechanism, first position information and first identification information of a first transaction sent by other node equipment in a block chain network are received.
In one possible implementation manner of the present application, searching in the first service account according to the first location information and the first identification information to determine the validity of the first transaction includes: and determining whether the identification information corresponding to the first position information in the first service account is consistent with the first identification information. If so, determining that the first transaction is legal. If the first transaction is inconsistent, determining that the first transaction is illegal.
In one possible implementation manner of the present application, the identification information is a hash value, the first identification information is a first hash value, the first service account includes a first merck tree, the first location information is first index information, and the first merck tree records the hash value of the transaction under the first service according to the index information. Determining whether the identification information corresponding to the first position information in the first service account is consistent with the first identification information includes: and determining the node of the first transaction in the first merck tree and the hash value corresponding to the node according to the first hash value and the first index information. A hash value of a root path of the node is determined. And determining a target hash value according to the hash value corresponding to the node and the hash value of the root path. It is determined whether the target hash value is consistent with the first hash value.
In one possible implementation manner of the present application, the method provided by the embodiment of the present application further includes: identification information of all transactions in the first service account is obtained.
In one possible implementation manner of the present application, the first location information includes first account information, where the first account information is used to represent an identity of the first service account. According to the first position information, acquiring the first service account from the blockchain comprises: and acquiring a first service account from the blockchain according to the first account information.
In a second aspect, an embodiment of the present application provides a method of recording a transaction, the method comprising: an execution request is received, the execution request being for requesting execution of a first transaction under a first service. And responding to the execution request, and acquiring a first service account corresponding to the first service from the blockchain through the first transaction. A first transaction is performed. And if the first transaction is successfully executed, recording the first identification information of the first transaction in the first service account. And sending first position information and first identification information to other node equipment in the blockchain network, wherein the first position information is used for determining the position of the first identification information in the first service account.
The embodiment of the application provides a method for recording transaction, which provides a concept of a business account on a blockchain level, and under the condition that a first transaction under one business is successfully executed, first identification information of the first transaction can be recorded in a corresponding first business account through a first business identification, so that the establishment of the relevance between the first transaction and other business transactions in the first business account is realized. The embodiment of the application can bind the first service account with related transactions under the service under the condition of not changing the block chain bottom database, thereby realizing the relevance among a plurality of transactions under one service on the block chain level.
In one possible implementation of the present application, sending first location information and first identification information to other node devices in a blockchain network includes: and sending the first position information and the first identification information to other node equipment in the blockchain network based on a blockchain consensus mechanism.
In one possible implementation of the present application, the first transaction includes first account information, where the first account information is used to characterize an identity of the first service account. Acquiring a first service account corresponding to a first service from a blockchain through a first transaction, wherein the first service account comprises: and carrying out hash calculation on the first account information to obtain a first account address. And acquiring a first service account from the blockchain through the first account address.
In one possible implementation manner of the present application, before the first service account is obtained from the blockchain through the first account address, the method provided by the embodiment of the present application further includes: and if the fact that the service account corresponding to the first account address does not exist is detected, generating a first service account corresponding to the first account information.
In a possible implementation manner of the present application, the first transaction further includes at least one second account information, where each account information corresponds to one second service account, and the method provided by the embodiment of the present application further includes: and respectively carrying out hash calculation on each second account information to obtain at least one second account address. And respectively acquiring corresponding second business accounts according to the second account addresses. And respectively recording the first identification information in each second service account.
In a third aspect, an embodiment of the present application provides a device for determining validity of a transaction, where the device for determining validity of a transaction may implement a method in the first aspect or any possible implementation manner of the first aspect, and thus may also implement beneficial effects in the first aspect or any possible implementation manner of the first aspect. The means for determining validity of the transaction may be the first node device, or may be means for supporting the first node device to implement the first aspect or any possible implementation of the first aspect, e.g. applied to a chip or a control circuit in the first node device. The device for determining the validity of the transaction can realize the method through software, hardware or through hardware executing corresponding software.
As an example, an embodiment of the present application provides an apparatus for determining validity of a transaction, where the apparatus for determining validity of a transaction is a first node device or a chip applied in the first node device, and the apparatus for determining validity of a transaction includes: the first receiving unit is used for receiving first position information and first identification information of a first transaction, which are sent by other node equipment in the blockchain network, based on a blockchain consensus mechanism, wherein the first position information is used for indicating the position of the identification information of the transaction in a first service account. The first obtaining unit is used for obtaining a first business account from the blockchain according to the first position information. And the determining unit is used for searching in the first business account according to the first position information and the first identification information so as to determine the validity of the first transaction.
In one possible implementation manner of the present application, the determining unit is further configured to determine whether the identification information corresponding to the first location information in the first service account is consistent with the first identification information.
In one possible implementation manner of the present application, the determining unit is further configured to determine, according to the first hash value and the first index information, a node of the first transaction in the first merck tree and a hash value corresponding to the node.
In one possible implementation manner of the present application, the determining unit is further configured to determine a hash value of a root path of the node, determine a target hash value according to the hash value corresponding to the node and the hash value of the root path, and determine whether the target hash value is consistent with the first hash value.
In a possible implementation manner of the present application, the first obtaining unit is further configured to obtain identification information of all transactions in the first service account.
In one possible implementation manner of the present application, the first obtaining unit is further configured to obtain, according to the first account information, a first service account from the blockchain.
In a fourth aspect, embodiments of the present application provide a device for recording transactions, where the device for recording transactions may implement the method of the second aspect or any possible implementation manner of the second aspect, and thus may also implement the beneficial effects of the second aspect or any possible implementation manner of the second aspect. The means for recording the transaction may be the second node device, or may be means for supporting the second node device to implement the second aspect or any possible implementation of the second aspect, e.g. applied to a chip or a control circuit in the second node device. The means for recording transactions may implement the above method by software, hardware, or by hardware executing corresponding software.
As an example, an embodiment of the present application provides an apparatus for recording a transaction, which is a second node device or a chip applied in the second node device, including: and the second receiving unit is used for receiving an execution request, wherein the execution request is used for requesting to execute the first transaction under the first service. And the second acquisition unit is used for responding to the execution request and acquiring a first service account corresponding to the first service from the blockchain through the first transaction. And the execution unit is used for executing the first transaction. And the recording unit is used for recording the first identification information of the first transaction in the first service account if the first transaction is successfully executed. And the sending unit is used for sending the first position information and the first identification information to other node equipment in the blockchain network based on a blockchain consensus mechanism, wherein the first position information is used for indicating the position of the first identification information in the first service account.
In one possible implementation manner of the present application, the second obtaining unit is further configured to perform hash computation on the first account information to obtain a first account address, and obtain the first service account from the blockchain through the first account address.
In one possible implementation manner of the present application, the second obtaining unit is further configured to generate a first service account corresponding to the first account information if it is detected that the service account corresponding to the first account address does not exist.
In one possible implementation manner of the present application, the second obtaining unit is further configured to perform hash computation on each second account information to obtain at least one second account address. And respectively acquiring corresponding second business accounts according to the second account addresses.
In a possible implementation manner of the present application, the recording unit is further configured to record the first identification information in each of the second service accounts, respectively.
In a fifth aspect, embodiments of the present application provide a computer readable storage medium having stored therein a computer program or instructions which, when run on a computer, cause the computer to perform a method of determining validity of a transaction as described in any one of the possible implementations of the first aspect to the first aspect.
In a sixth aspect, embodiments of the present application provide a computer readable storage medium having stored therein a computer program or instructions which, when run on a computer, cause the computer to perform a method of recording a transaction as described in any one of the possible implementations of the second aspect to the second aspect.
In a seventh aspect, embodiments of the present application provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform a method of determining validity of a transaction as described in the first aspect or in various possible implementations of the first aspect.
In an eighth aspect, embodiments of the present application provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform a method of recording transactions as described in the second aspect or in various possible implementations of the second aspect.
In a ninth aspect, embodiments of the present application provide an apparatus for determining validity of a transaction for implementing various methods in various possible designs of the first aspect or any one of the first aspects. The means for determining validity of the transaction may be the first node device described above, or an apparatus comprising the first node device described above, or a component (e.g. a chip) for use in the first node device.
In a tenth aspect, embodiments of the present application provide an apparatus for recording transactions for implementing various methods in the various possible designs of the second aspect or any of the second aspects described above. The means for recording the transaction may be the second node device described above, or an apparatus comprising the second node device described above, or a component (e.g. a chip) for use in the second node device.
The apparatus for determining validity of a transaction described in the ninth aspect or the apparatus for recording a transaction described in the tenth aspect includes respective modules, units, which implement the above method, and the modules, units may be implemented by hardware, software, or implemented by hardware executing respective software. The hardware or software includes one or more modules or units corresponding to the functions described above.
In an eleventh aspect, an embodiment of the present application provides a node apparatus, including: at least one processor and a communication interface. Wherein the processor, when the node device is running, executes instructions or programs stored in the node device to cause the node device to perform the method of any of the various possible designs of any of the first or second aspects as described above. For example, the node device may be the first node device, or a component applied in the first node device. For example, the node device may be the second node device, or a component applied in the second node device.
It should be understood that the communication apparatus described in the eleventh aspect may further include: a bus and a memory for storing code and data. Optionally, at least one processor communication interface and the memory are coupled to each other.
In a twelfth aspect, embodiments of the present application provide a chip comprising a processor and a communication interface, the communication interface and the processor being coupled, the processor being configured to execute a computer program or instructions to implement the method of determining validity of a transaction described in the first aspect or in various possible implementations of the first aspect. The communication interface is used for communicating with other modules outside the chip.
In a thirteenth aspect, embodiments of the present application provide a chip comprising a processor and a communication interface, the communication interface and the processor being coupled, the processor being for running a computer program or instructions to implement a method of logging transactions as described in the second aspect or in various possible implementations of the second aspect. The communication interface is used for communicating with other modules outside the chip.
In a fourteenth aspect, an embodiment of the present application provides a blockchain network system, the system including: a plurality of node devices. A first node device of the plurality of node devices is adapted to perform a method of determining validity of a transaction as described in the first aspect or in various possible implementations of the first aspect, and a second node device is adapted to perform a method of recording a transaction as described in the second aspect or in various possible implementations of the second aspect.
Drawings
Fig. 1 is a schematic structural diagram of a service account according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a business transaction according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a block chain network system according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
FIG. 5 is an interactive schematic diagram of a method for determining validity of a transaction according to an embodiment of the present application;
FIG. 6 is a schematic diagram of storing a transaction hash value according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a business transaction for obtaining a business account according to an embodiment of the present application;
FIG. 8 is a schematic diagram of an apparatus for determining validity of a transaction according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an apparatus for recording transactions according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Before describing the embodiments of the present application, the following definitions are first applied to the related terms related to the present application:
(1) Business (business): traffic is a behavior that is relative to the outside of the blockchain, under each of which multiple transactions may be formed. For example, the business may be insurance purchasing, and then the business may include transaction actions such as insurance policy application, insurance policy issuing, and the like, so as to form a transaction under the business.
(2) Business account (business account): a blockchain account type, each service account having a unique service identification. The service account can bind a plurality of service transactions, and the bound service transactions can be indexed by service identifiers, i.e. one service account is one link-down service.
Illustratively, as shown in the schematic structure of the service account in fig. 1, the service account may include: account address, account status, list of business transactions, and merck tree of business transactions. The account address is used for representing the position of the business account in the blockchain; the account state is used for managing the service account so as to detect whether the service account is in a normal running state or not; the business transaction list and business transaction merck tree are used to store hash values of a series of business transactions bound by a business account.
(3) Business transaction (business transaction): business transactions refer to related transactions generated under a business. A service may consist of a series of service transactions that have an association when executed on a blockchain. For example, there is a certain order of execution between these business transactions. These business transactions may be bound by a business identity, a business account corresponding to the business.
By way of example, as shown in the architectural schematic of the business transaction of fig. 2, the business transaction may include: transaction initiation account address (from), transaction target address (to), transaction random number (nonce), transaction transfer value (value), transaction specific content (input), transaction Type (Business Tx Type) and Business ID List (Business ID List). The business transaction type is a business type corresponding to the business transaction.
(4) Service identification (business ID): for representing a service account, the service transaction including the service identity may also be bound to the corresponding service account.
(5) Consensus mechanism: the node devices in the blockchain complete verification and validation of the transaction by voting. For example, when a certain node device successfully executes a transaction, other node devices in the blockchain need to verify the transaction to determine the validity of the transaction, i.e. whether the transaction is stored in the blockchain.
(6) Hash value (Hash Code): the hash value is a decimal integer, and the output value obtained by performing hash operation with the data of the transaction as input is used for uniquely identifying a transaction in the blockchain.
(7) Merck tree (MERKLE TREE): also referred to as a hash tree, is a persistent data structure that may be used to implement aggregation and mapping to represent hash tables in purely functional programming.
(8) Hash algorithm: an algorithm for mapping arbitrary length data to fixed length data. The step of processing the data according to the hash algorithm may be: and (5) hash calculation. The hash algorithm has the following characteristics: irreversibility: the original data cannot be back-deduced from the hash value. Uniqueness: different input data will produce different hash values. Fixed length: the length of the hash value is fixed regardless of the length of the input data. Common hash algorithms include MD4, MD5, SHA series, etc.
Typically, transactions on the blockchain are independent of each other and have no relevance. Thus, business transactions stored in a blockchain may be packed in different blocks, which may be far apart. While a series of transactions typically need to be performed under one service, a correlation between multiple transactions under the same service needs to be established. The correlation of multiple transactions is typically established in the related art by saving hash values of the multiple transactions at the application layer (business layer).
As an example, where multiple transactions under the same service are performed in a blockchain, a user may find the transactions through the service at the application layer. However, since the transactions in the blockchain are independent of each other, multiple transactions cannot be bound together by the concept of business, and thus the user cannot find the association between these transactions in the blockchain.
After a certain node device in the blockchain network performs a transaction under a certain service, other node devices need to verify whether the transaction is legal or not, that is, determine whether the transaction is successfully performed and stored in the blockchain, due to a consensus mechanism of the blockchain. In the related art, whether a plurality of transactions under the current service have validity is verified, and multiple interactions between an application layer and a blockchain are required. For example, the user first needs to determine from the application layer whether the transaction was successfully performed. And under the condition that the transaction is successfully executed, interacting with an application layer to acquire the hash value of the transaction. The user then queries in the blockchain through the hash value of the transaction to determine whether the transaction is stored in the blockchain, thereby verifying whether the transaction is legitimate.
It will be appreciated that multiple interactions with the application layer and blockchain are required when the user determines whether the transaction is legitimate. Such an approach can burden the application layer to interact with the blockchain and create additional overhead and time consuming, thereby affecting the user's use experience.
Furthermore, in the related art, since the manner of establishing the association of multiple transactions under one service at the application layer is too dependent on the application layer of the centralization pattern, a data security problem of the blockchain may occur. Such as modification of data at the application layer, may occur, thereby affecting data security.
Based on this, embodiments of the present application provide a method, apparatus, system, and storage medium for determining validity of a transaction, which is used to solve the additional overhead and time consumed in determining validity of a transaction in the related art. Through adding the concept of the business account in the blockchain, associating (aggregating) a plurality of transactions of the business account corresponding to the business through the business identifier; based on the position information and the identification information sent by other node equipment, searching is carried out in the first service account to determine the validity of the first transaction.
Before describing the method for determining validity of a transaction provided by the embodiment of the present application, a blockchain network system related to the method provided by the present application may be introduced.
Illustratively, as shown in FIG. 3, FIG. 3 illustrates a blockchain network system 300 that includes a plurality of node devices. For example, the plurality of node devices include: node device 301, node device 302, node device 303, node device 304, a.the., node device n, etc.
The node device may be, for example, an electronic device such as a computer, a mobile phone, or a server, which is not limited in the embodiment of the present application.
Wherein any two nodes in the blockchain network system 300 may communicate with each other. By way of example, the communication connection between any two node devices may be a wired communication connection, such as an Ethernet (Ethernet) connection or the like; the wireless communication connection may also be a wireless communication connection, for example, a Wi-Fi (Wireless Fidelity) connection, a BlueTooth (BT) connection, a Near Field Communication (NFC) connection, and the like, which is not specifically limited in the embodiment of the present application.
By way of example, the structure of each node device in the blockchain network system 300 may refer to fig. 4.
As an example, as shown in fig. 4, fig. 4 is a schematic structural diagram of a node device provided in an embodiment of the present application, as shown in fig. 4, where the node device includes: a processor 401, a communication line 402, at least one communication interface (illustrated by way of example as communication interface 403 in fig. 4).
Processor 401 may be a general purpose central processing unit (Central Processing Unit, CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the programs of the present application.
Communication line 402 may include a pathway to transfer information between the aforementioned components.
Communication interface 403 for information interaction with other means, e.g. means using any transceiver or the like, for communication with other devices or communication networks, such as ethernet, radio access network (Radio Access Network, RAN), wireless local area network (Wireless Local Area Networks, WLAN), etc.
Optionally, the test apparatus 400 may further comprise a memory 404.
The memory 404 may be, but is not limited to, read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (Random Access Memory, RAM) or other type of dynamic storage device that can store information and instructions, as well as electrically erasable programmable read-only memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-only memory, EEPROM), compact disc read-only memory (Compact Discread-only memory) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 404 may be self-contained and may be coupled to the processor 401 via a communication link 402. Memory 404 may also be integrated with processor 401.
The memory 404 is used for storing computer-executable instructions for executing the present application, and is controlled by the processor 401. The processor 401 is configured to execute computer-executable instructions stored in the memory 404, thereby implementing a method for determining validity of a transaction or a method for recording a transaction according to an embodiment of the present application described below.
Alternatively, the computer-executable instructions in the embodiments of the present application may be referred to as application program codes, which are not particularly limited in the embodiments of the present application.
In a particular implementation, processor 401 may include one or more CPUs, such as CPU0 and CPU1 of FIG. 4, as an embodiment.
In a specific implementation, the node device may include multiple processors, such as processor 401 and processor 405 in fig. 4, as an embodiment. Each of these processors may be a Single-core (Single-CPU) processor or may be a Multi-core (Multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In the embodiment of the present application, the specific structure of the execution subject of the method of determining the validity of a transaction is not particularly limited as long as communication can be performed with the method of determining the validity of a transaction according to the embodiment of the present application by running a program in which the code of the method of determining the validity of a transaction of the embodiment of the present application is recorded. For example, the execution body of the method for determining the validity of a transaction provided in the embodiment of the present application may be a functional module in a node device that can call a program and execute the program, or an apparatus, such as a chip, applied to the node device for determining the validity of a transaction. The following embodiments describe an example in which an execution subject of a method of determining validity of a transaction is a node device.
It should be explained that, in order to better describe the method for determining validity of a transaction provided by the embodiment of the present application, the method for recording a transaction provided by the embodiment of the present application may be combined.
In the embodiment of the present application, the specific structure of the execution subject of the method of determining the validity of the transaction or the method of recording the transaction is not particularly limited as long as communication can be performed with the method of determining the validity of the transaction or the method of recording the transaction according to the embodiment of the present application by running a program in which the code of the method of determining the validity of the transaction or the method of recording the transaction of the embodiment of the present application is recorded. For example, the execution subject of the method for determining validity of a transaction or the method for recording a transaction provided in the embodiment of the present application may be a functional module in a node device that can call a program and execute the program, or an apparatus, such as a chip, applied to the node device for determining validity of a transaction.
The execution body of the method of determining validity of a transaction in the following embodiments will be described by taking the first node device as an example, and the execution body of the method of recording a transaction will be described by taking the second node device as an example.
As shown in fig. 5, fig. 5 shows an interactive schematic diagram of a method for determining validity of a transaction according to an embodiment of the present application, where the method includes the following steps 506 to 508. It should be noted that, steps 501 to 507 shown in fig. 5 may be used to describe a method for recording a transaction according to an embodiment of the present application.
Step 501, the second node device receives an execution request.
Wherein the execution request is for requesting execution of a first transaction under a first service.
It should be explained that, in the embodiment of the present application, the first transaction is a service transaction generated under the first service.
By way of example, the first service may be a purchase insurance, transfer, or the like. In the case where the first transaction is a transfer, the first transaction may be a transaction involved under the transfer transaction.
The execution request may be an execution request initiated by a user, or may be an execution request generated by the second node device automatically identifying the first transaction, which is not particularly limited in the present application.
Step 502, the second node device responds to the execution request and obtains a first service account corresponding to the first service from the blockchain through the first transaction.
It should be explained that the business account is one type of account that can be applied to the blockchain provided by the present application. The service account is distinguished from other account types in the related art, such as a basic account type in which a user holds a private key, or a contract account type derived from the basic account type, etc. The basic account and the contract account are the prior account types in the blockchain, and the business account are in a level relation. The account is a storage model on the blockchain, all data can be mounted under a certain account, for example, a common account is used for storing data of a blockchain user, a contract account is used for storing all data under a certain contract, and a business account is a newly added account type and is specially used for storing transaction hash values under the business.
It will be appreciated that the first service account may be used to store a hash value of a service transaction associated with the first service, such that all service transactions associated with the first service may be obtained through the first service account, and any one or more service transactions associated with the first service may be found in the first service account to verify the legitimacy of any one or more service transactions. Reference is made to the following for specific details, and no further description is given here.
The second node device may obtain, from the blockchain, a first service account corresponding to the first service identifier through the first service identifier carried by the first transaction.
It will be appreciated that each service account in the present application has a service identity that has multiple functions. First, the service identifier may be used to indicate a type of service corresponding to the corresponding service account, such as whether the service account is a transfer service or an insurance service. Second, the service identifier may be used to uniquely identify the corresponding service account, so that the corresponding service account may be obtained from the blockchain through the service identifier. Third, the service identifier may be used to represent a type of service corresponding to the service transaction. For example, a business transaction carrying a business identifier 1 may represent that the business transaction corresponds to business a. Fourth, the service identifier may bind the service account with a plurality of service transactions associated with the service. For example, the service account a has a service identifier 1, and the service transactions a1 to a10 carry the service identifier 1 corresponding to the service a. Thus, the business account a is obtained from the blockchain through the business identifier 1 carried by any corresponding business transaction (such as the business transaction a 1).
Step 503, the second node device performs the first transaction.
The second node device may execute a plurality of service transactions including the first transaction, where the service transactions other than the first transaction may be service transactions of the same first service as the first transaction or service transactions under other services different from the first service, which is not limited in particular in the embodiment of the present application.
Step 504, if the first transaction is executed successfully, the second node device records the first identification information of the first transaction in the first service account.
For example, the first identification information may refer to a hash value of the first transaction. It will be appreciated that the hash value of the first transaction is unique in that the hash value of each transaction generated in the blockchain is different. Each hash value stored in the first business account may then correspond to a single transaction. In this way, if the first identification information is queried in the first service account, it may be determined that the first transaction is a service account bound to the first service account, or it may be determined that the first transaction is stored in the blockchain.
It should be explained that, if the first transaction fails to be executed, the second node device determines that the first transaction is an illegal transaction. Without the illegal transaction affecting the data on the blockchain, the second node device may not perform the step of recording the first transaction in the first business account.
It can be understood that, through steps 501 to 504 in the embodiment of the present application, the second node device may record the identification information of the service transactions in the corresponding service account under the condition that multiple service transactions under one service are successfully executed, so as to establish the association between multiple transactions under one service. The embodiment of the application can provide the concept of the business account on the blockchain level under the condition of not changing the database of the blockchain bottom layer; and the first identification information of the first transaction is recorded in the first service account through the service identification, so that the first service account and related transactions under the service are bound, and the relevance among a plurality of transactions under one service is realized on a blockchain level.
In addition, due to the characteristic of the decentralization mode, the data stored in the blockchain cannot be modified, and the relevance among the transactions is stored in a decentralization mode by establishing the relevance among the transactions in the blockchain, so that the safety and the reliability of the data can be ensured.
Based on the above steps 501 to 504, the following embodiments provide a method for determining the validity of the first transaction by other node devices (first node devices) in the blockchain.
Step 505, the second node device sends the first location information and the first identification information to the first node device in the blockchain network based on a blockchain consensus mechanism. Correspondingly, the first node equipment receives first position information and first identification information of a first transaction sent by second node equipment in the blockchain network based on a blockchain consensus mechanism.
The first location information is used for determining the location of the first identification information in the first service account.
It should be explained that the first node device may be other node devices than the second node device in the blockchain network. The second node device may determine that the first transaction is legitimate if the first transaction is successfully performed. Because of the co-knowledge mechanism of the blockchain, other node devices (first node devices) in the blockchain network also need to verify the validity of the first transaction, in other words, the other node devices need to determine whether the transaction is stored in the blockchain.
It is understood that the first node device may receive the first location information and the first identification information of the first transaction from the second node device in the blockchain. Compared with the prior art, the method provided by the embodiment of the application can reduce the interaction times with the application layer when the first node equipment needs to acquire the first identification information of the first transaction from the application layer, thereby reducing the additional expenditure and time consumption caused by the first node equipment when determining the validity of the first transaction.
The manner in which the first node device interacts with the second node device in the blockchain may be implemented by a contract call manner or by a common transaction manner, which is not particularly limited in the embodiment of the present application.
Step 506, the first node device obtains a first service account from the blockchain according to the first location information.
It should be explained that, since the first location information is used to indicate the location of the first identification information in the first service account, the first location information may also include the first service identification used when the first service account is acquired. In this way, the first node device may obtain the first service account from the blockchain according to the first service identifier included in the first location information.
Step 507, the first node device searches in the first service account according to the first location information and the first identification information to determine the validity of the first transaction.
As one example, the second node device may record a first hash value of the first transaction in a business transaction list of the first business account. In this way, the first location information may be used to determine location information of the first hash value in the first list of business transactions. For example, the first location information may represent location information of the first hash value in the first service transaction list, and then the first node device may perform a lookup in the first service transaction list in the first service account according to the location information.
As another example, the second node device may record the first hash value of the first transaction in a first merck tree of the first business account. In this way, the first location information may be used to determine the location of the first hash value in the first merck tree.
It should be explained that, in the case where the first hash value is recorded in the first merck tree, the first location information may represent location information of the first hash value in the first service transaction list, or may represent location information of the first hash value in the first merck tree. For example, the first merck tree corresponds to the location information recorded by each hash value in the first business transaction list. Thus, when the first location information represents index information in the first list of business transactions, the first node device may perform a lookup in the first merck tree based on the index information. For another example, when the first location information indicates node information in the first merck tree, the first node device may perform a search in the first merck tree according to the node information.
It may be appreciated that in the embodiment of the present application, the first node device receives first location information and first identification information of the second node device from the blockchain; receiving a first service account from the blockchain through the first location information; and searching in the first service account according to the first position information and the first identification information to determine the validity of the first transaction. In this way, interaction of the first node device with the application layer may be reduced.
The embodiment of the application provides a method for determining the validity of a transaction, which can receive first position information and first identification information of the first transaction sent by other node equipment in a blockchain network without acquiring the information of the first transaction from an application layer because of a blockchain consensus mechanism, namely other node equipment is required to verify the validity of one transaction in the blockchain after the execution of the transaction; in addition, a first business account is acquired from the blockchain according to the first position information, and the legitimacy of the first transaction is determined by searching in the first business account according to the first position information and the first identification information, so that interaction with an application layer is reduced to acquire the information of the first transaction; based on the above, the method provided by the embodiment of the application can acquire the information of the first transaction and the first service account through interaction with the blockchain, so as to determine the validity of the first transaction. Therefore, the method provided by the embodiment of the application can reduce the additional expenditure and time consumption caused by determining the validity of the transaction.
In one possible embodiment of the present application, the first transaction includes first account information (first service identifier), where the first account information is used to characterize the identity of the first service account. The step 502 includes: and the second node equipment performs hash calculation on the first account information to obtain a first account address. The second node device obtains a first service account from the blockchain through the first account address. It will be appreciated that the account address is a unique identification of an account.
For example, the first account information (first service identification) may be used to determine that the first transaction is associated with a first service account, or is a service transaction performed under the first service.
It should be explained that the account information is the service identifier described above. The first account information is the first service identifier described above. For unified description, account information is described below in terms of service identification.
Illustratively, the second node device may perform a hash operation on the first service identifier (e.g., the first service identifier may be 18E14A7B6a307F426a94F8114701E7C8E774E7F9a47E2C2035DB29a 206321725) to obtain a fixed-length first account address, e.g., the first service account address may be 1A1zP1eP5QGefi2DMPTfTL SLmv7DivfNa. The hash algorithm used in the hash calculation may be MD4, MD5, etc., which is not particularly limited in the embodiment of the present application.
In this embodiment, the second node device performs hash calculation on the first account information to obtain the first account address, and then, according to the first account address, the first service account can be accurately obtained, so that the accuracy of obtaining the first service account can be further improved on the basis of ensuring the privacy of the first service account.
In one possible embodiment of the present application, before the second node device obtains the first service account from the blockchain through the first account address, the method provided by the embodiment of the present application further includes: and if the second node equipment detects that the service account corresponding to the first account address does not exist, generating a first service account corresponding to the first account information.
For example, when receiving an execution request for executing a first transaction under a first service, the second node device needs to determine whether a corresponding first service account exists in a first service identifier in the blockchain. And if the second node equipment detects that the service account corresponding to the first service identifier exists in the blockchain, the second node equipment can acquire the first service account. If the second node device detects that the service account corresponding to the first account address does not exist, the second node device can generate a first service account corresponding to the first service identifier, and then acquire the first service account. The second node device may generate the first service account corresponding to the first service identifier by performing hash computation on the first service identifier in an execution process of the blockchain execution engine, to generate the first account address. The second node device then generates a first service account in the first account address of the blockchain.
In this embodiment, the second node device generates the first service account corresponding to the first account information, so that the first account information has the corresponding first service account, in other words, the first service has the corresponding first service account in the blockchain, and further, the hash value of the first transaction is recorded.
In a possible embodiment of the present application, the first transaction further includes at least one second account information. Each account information corresponds to a second service account, and the method provided by the embodiment of the application further comprises the following steps: and the second node equipment respectively carries out hash calculation on each second account information to obtain at least one second account address. And the second node equipment respectively acquires corresponding second service accounts according to the second account addresses. The second node device records the first identification information in each second service account respectively.
It should be explained that, as shown in the schematic structure of the service transaction shown in fig. 2, the service identifier list in the service transaction includes a plurality of service identifiers, each service identifier is used for representing a service, and a service account can be bound. Thus, the first transaction may further comprise at least one second service identity (second account information), each of which may correspond to one of the second service accounts. For example, the second service identifier may be service identifier 2 and service identifier 3.
In other words, the first transaction may be a transaction performed under a plurality of different services, for example, the first transaction may be a purchase insurance service (service b) or a transfer service (service c). In this way, the second node device may perform hash computation on the service identifier 2 and the service identifier 3 respectively to obtain an account address ba corresponding to the service identifier 2, and an account address ca corresponding to the service identifier 3, and then obtain a service account b corresponding to the service identifier 2 and a service account c corresponding to the service identifier 3. The second node device may record the first hash value of the first transaction in the service account b and the service account c, respectively, after performing the first transaction.
In this embodiment, since the first transaction may include a plurality of service identifiers, and different service identifiers correspond to different services, the second node device may record the hash value of the first transaction in the service account corresponding to each service identifier after the first transaction is successfully executed, so as to further improve efficiency and reliability of recording the service transaction.
In one possible embodiment of the present application, the step 506 of including the first account information (the first service identifier) in the first location information includes: and the first node equipment acquires a first service account from the blockchain according to the first account information.
The first location information may also include a first service identifier of the first service account, so that the first node device may obtain the first service account. Then, the first node device determines a corresponding hash value according to the position information (first index information) of the first transaction in the first service account in the first position information.
For example, the first node device may perform hash calculation on the first service identifier to obtain an account address corresponding to the first service identifier. The first node device then obtains a first service account from the blockchain based on the account address.
In this embodiment, the first node device obtains the first service account according to the first service identifier included in the first location information, so that the number of interactions between the first node device and the second node device can be reduced, and verification of validity of the transaction can be performed quickly.
In one possible embodiment of the present application, the step 507 includes: the first node device determines whether the identification information (hash value) corresponding to the first location information in the first service account is identical to the first identification information (first hash value). If the first transaction is consistent, the first node device determines that the first transaction is legal. If the first transaction is inconsistent, the first node device determines that the first transaction is illegal.
It is understood that the first node device determines whether the first transaction is legitimate by comparing whether the hash value stored on the first location information in the first service account is consistent with the first hash value of the first transaction. In other words, the first node device may determine whether the first transaction is stored in the blockchain by determining whether the stored hash value is consistent with the first hash value.
In one possible embodiment of the present application, the identification information is a hash value, the first identification information is a first hash value, the first location information is first index information, the first service account includes a first merck tree, and the first merck tree records the hash value of the transaction under the first service according to the index information. In the above step, the first node device determining whether the identification information corresponding to the first location information in the first service account is consistent with the first identification information includes: the first node device determines a node of the first transaction in the first merck tree and a hash value corresponding to the node according to the first hash value and the first index information. A hash value of a root path of the node is determined. And the first node equipment determines a target hash value according to the hash value corresponding to the node and the hash value of the root path. The first node device determines whether the target hash value is consistent with the first hash value.
The first business account may include, for example, a first business transaction list and a first merck tree. As shown in fig. 6, the first service transaction list may record a hash value of each transaction under the first service according to the index information. Taking tx1 as an example of the hash value transaction 1, for example, the first service transaction list stores tx1, tx2, tx3, & gt, tx n. Wherein, index information of tx1 is index 0, index information of tx2 is index 1, index information of tx3 is index 2. Accordingly, the first merck tree may record the hash value of the transaction under the first service according to the index information, such as the left node record tx1 of root1, the right node record tx2 of root1, the left node record tx3 of root2, and the right node record tx4 of root 2.
For example, the second node device may record the hash value of the first transaction in the service transaction list of the first service account and/or in a merck tree (first merck tree) of the first service account. It should be explained that after a new node is added to the first merck tree, a rebalancing process of the merck tree may occur. After the rebalancing process is completed, the first merck tree may obtain a hash value of the root path of the merck tree. The hash value of the root path may be used to represent a unique identification of all business transactions under the first business account. It should be explained that if other node devices (such as the second node device) query the hash value of any service transaction in the first merck tree, whether any service transaction is legal or not may be determined according to the hash value of the root path and the hash value of any service transaction.
Continuing with the above example of FIG. 6, the first index information is taken as index 0. For example, the second node device may record the first hash value in a service transaction list of the first service account and/or the first merck tree, where the first index information is index:0. The second node device transmits the first hash value and the first index information (index: 0) to the first node device. According to the first index information (index: 0), the first node device finds that a node in the first merck tree is a left node of root1, and determines that the left node of root1 corresponds to tx1. The second node device may determine the target hash value based on tx1 and the hash value of the root path of the node. The first node device then determines whether the target hash value matches the first hash value to determine whether the first transaction is legitimate.
In this embodiment, it is understood that the calculation of the first merck tree requires knowledge of the location of the node where the first transaction is located. The first node device may determine location information (first index information) of the first transaction through a service transaction list of the first service account. Therefore, the second node device only needs to send the first position information and the first hash value to the first node device, so that the first node device can determine the validity of the first transaction without telling other business transaction hash values. This may increase the security of the query. In addition, compared with the way of traversing in the business transaction list of the first business account, the way of determining the validity of the first transaction through the first merck tree can realize the effect of rapidly verifying the validity.
In one possible embodiment of the present application, the method provided by the embodiment of the present application further includes: the first node device obtains identification information of all transactions in the first service account.
As an example, as shown in fig. 7, the first node device may obtain the first service account from the blockchain based on a first service identification (service identification 1) of the first service transaction. The first node device may then obtain hash values (e.g., tx1, tx2, tex, txn) of all transactions in the first service account from a list of service transactions for the first service account or a first merck tree.
As another example, the first node device may obtain the first service identifier through any one of the first service accounts (e.g., the first transaction).
In this embodiment, the first node device may quickly obtain the identification information of all transactions under the first service from the first service account, and may also reduce the number of interactions with the application layer, so as to improve the efficiency of querying the transaction of the service.
In the embodiment of the application, the second node equipment can record the first hash value of the first transaction record in the first service account in the blockchain, so that the second node equipment can correlate (aggregate) a plurality of service transactions under the first service through the first service account, and thus the correlation of the plurality of service transactions under the first service can be recorded in the blockchain; because the second node device can determine the position information of each business transaction in the first business account, when the first node device verifies the validity of the first transaction, the first position information and the first hash value of the second node device in the blockchain can be received; then according to the first position information and the first hash value, inquiring is carried out on the first business account to verify the validity of the first transaction, compared with the mode that the first hash value is required to be obtained from an application layer in the related art, and then the first transaction is searched in a blockchain to verify the validity of the first transaction, the embodiment of the application does not need to reduce the extra expenditure and time consumption caused by determining the validity of the transaction; in addition, the first node device may also obtain hash values of all transactions under the first service in the first service account according to the first service identifier, so as to further improve the response speed when obtaining the transactions under the first service.
The scheme of the embodiment of the application is mainly introduced from the interaction angle among the network elements. It will be appreciated that each device, e.g., first node device, second node device, etc., includes corresponding structures and/or software modules for performing the respective functions in order to achieve the above-described functionality. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can be used for dividing the functional units according to the method example of the first node equipment and the second node equipment, for example, each functional unit can be divided corresponding to each function, and two or more functions can be integrated in one processing unit. The integrated units may be implemented in hardware or in software functional units. It should be noted that, in the embodiment of the present application, the division of the units is schematic, which is merely a logic function division, and other division manners may be implemented in actual practice.
The method according to the embodiment of the present application is described above with reference to fig. 1 to 7, and the apparatus for performing the method according to the embodiment of the present application is described below. It will be appreciated by those skilled in the art that the method and apparatus may be combined and referred to each other, and that the communication apparatus provided in the embodiments of the present application may perform the steps performed by the first node device in the method for determining validity of a transaction and the second node device in the method for recording a transaction.
In the case of an integrated unit, fig. 8 shows the apparatus for determining validity of a transaction according to the above embodiment, where the apparatus for determining validity of a transaction may be the first node device or may be an apparatus applied to the first node device, such as a chip or a processing circuit, and the apparatus for determining validity of a transaction may include: a first receiving unit 810, a first acquiring unit 820, and a determining unit 830.
In an alternative implementation, the means for determining validity of the transaction may further comprise a storage unit for storing program code and data of the first communication means.
As an example, the means for determining validity of the transaction is the first node device or a chip applied in the first node device. The first receiving unit 810 is configured to receive, based on a blockchain consensus mechanism, first location information and first identification information of a first transaction, where the first location information is used to represent a location of the identification information of the transaction in a first service account, where the first location information is sent by other node devices in a blockchain network. The first obtaining unit 820 is configured to obtain a first service account from the blockchain according to the first location information. The determining unit 830 is configured to search in the first service account according to the first location information and the first identification information, so as to determine validity of the first transaction.
In a possible implementation manner of the present application, the determining unit 830 is further configured to determine whether the identification information corresponding to the first location information in the first service account is consistent with the first identification information.
In a possible implementation manner of the present application, the determining unit 830 is further configured to determine, according to the first hash value and the first index information, a node of the first transaction in the first merck tree and a hash value corresponding to the node.
In one possible implementation manner of the present application, the determining unit 830 is further configured to determine a hash value of a root path of the node, determine a target hash value according to the hash value corresponding to the node and the hash value of the root path, and determine whether the target hash value is consistent with the first hash value.
In one possible implementation of the present application, the first obtaining unit 820 is further configured to obtain identification information of all transactions in the first service account.
In one possible implementation of the present application, the first obtaining unit 820 is further configured to obtain the first service account from the blockchain according to the first account information.
The determining unit 830 may be a processor or a controller, for example, a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs a computational function, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so forth. The communication module may be a transceiver, a transceiver circuit, a communication interface, or the like. The memory module may be a memory.
In the case of an integrated unit, fig. 9 shows an apparatus for recording a transaction according to the above embodiment, which may be the second node device, or may be an apparatus applied to the second node device, such as a chip or a processing circuit, and the apparatus includes: a second receiving unit 910, a second acquiring unit 920, an executing unit 930, a recording unit 940, and a transmitting unit 950.
In an alternative implementation, the second communication device may further include a storage unit for storing program code and data of the second communication device.
As an example, the second communication apparatus is a second node device, or a chip applied in the second node device. The second receiving unit 910 is configured to receive an execution request, where the execution request is used to request to execute a first transaction under a first service. The second obtaining unit 920 is configured to obtain, in response to the execution request, a first service account corresponding to the first service from the blockchain through the first transaction. An execution unit 930 for executing the first transaction. And a recording unit 940, configured to record the first identification information of the first transaction in the first service account if the execution of the first transaction is successful. The sending unit 950 is configured to send, based on a blockchain consensus mechanism, first location information and first identification information to other node devices in the blockchain network, where the first location information is used to indicate a location of the first identification information in the first service account.
In one possible implementation manner of the present application, the second obtaining unit 920 is further configured to perform hash calculation on the first account information to obtain a first account address, and obtain the first service account from the blockchain through the first account address.
In one possible implementation manner of the present application, the second obtaining unit 920 is further configured to generate a first service account corresponding to the first account information if it is detected that the service account corresponding to the first account address does not exist.
In a possible implementation manner of the present application, the second obtaining unit 920 is further configured to perform hash computation on each second account information to obtain at least one second account address. And respectively acquiring corresponding second business accounts according to the second account addresses.
In a possible implementation manner of the present application, the recording unit 940 is further configured to record the first identification information in each of the second service accounts, respectively.
The execution unit 930 or the recording unit 940 may be a processor or a controller, for example, a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs a computational function, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so forth. The communication module may be a transceiver, a transceiver circuit, a communication interface, or the like. The memory module may be a memory.
Alternatively, the structure of the node device as shown in fig. 4 may further include a memory, which may be a read-only memory (ROM) or other type of static storage device that may store static information and instructions, a random access memory (random access memory, RAM) or other type of dynamic storage device that may store information and instructions, or an electrically erasable programmable read-only memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-only memory, EEPROM), a compact disc (compact disc read-only memory, CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory may be stand alone and be coupled to the processor via a communication line. The memory may also be integrated with the processor.
The memory is used for storing computer executing instructions for executing the scheme of the application, and the processor is used for controlling the execution. The processor is configured to execute computer-executable instructions stored in the memory, thereby implementing a method for determining validity of a transaction or a method for recording a transaction according to an embodiment of the present application.
Alternatively, the computer-executable instructions in the embodiments of the present application may be referred to as application program codes, which are not particularly limited in the embodiments of the present application.
In one aspect, a computer readable storage medium is provided having instructions stored therein that, when executed, perform the functions as performed by the first node device of fig. 5.
In one aspect, a computer readable storage medium is provided having instructions stored therein that, when executed, implement the functionality performed by a second node device as in fig. 5.
In one aspect, a computer program product comprising instructions is provided, the computer program product comprising instructions which, when executed, perform the functions as performed by the first node device in fig. 5.
In yet another aspect, a computer program product comprising instructions is provided, the computer program product comprising instructions which, when executed, implement the functions as performed by the second node device in fig. 5.
In yet another aspect, an embodiment of the present application provides a chip for use in a first node device, the chip including at least one processor and a communication interface, the communication interface being coupled to the at least one processor, the processor being configured to execute instructions to perform functions as performed by the first node device in fig. 5.
In one aspect, a chip for use in a second node device is provided, the chip comprising at least one processor and a communication interface coupled to the at least one processor, the processor for executing instructions to perform functions as performed by the second node device in fig. 5.
In the above embodiments, it may be implemented in whole or in part 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 programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are performed in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, a network device, a user device, or other programmable apparatus. The computer program or instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer program or instructions may be transmitted from one website site, computer, server, or data center to another website site, computer, server, or data center by wired or wireless means. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that integrates one or more available media. The usable medium may be a magnetic medium, e.g., floppy disk, hard disk, tape; but also optical media such as digital video discs (digital video disc, DVD); but also semiconductor media such as Solid State Drives (SSDs) STATE DRIVE.
Although the application has been described herein in connection with various embodiments, other variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed application, from a review of the figures, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps, and the "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.
Although the application has been described in connection with specific features and embodiments thereof, it will be apparent that various modifications and combinations can be made without departing from the spirit and scope of the application. Accordingly, the specification and drawings are merely exemplary illustrations of the present application as defined in the appended claims and are considered to cover any and all modifications, variations, combinations, or equivalents that fall within the scope of the application. It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (12)

1.A method of determining legitimacy of a transaction, comprising:
Receiving first position information and first identification information of a first transaction, which are sent by other node equipment in a blockchain network, wherein the first position information is used for determining the position of the identification information of the transaction in a first service account;
Acquiring the first business account from a blockchain according to the first position information;
And searching in the first business account according to the first position information and the first identification information to determine the validity of the first transaction.
2. The method of claim 1, wherein the looking up in the first service account to determine the validity of the first transaction based on the first location information and the first identification information comprises:
determining whether identification information corresponding to the first position information in the first service account is consistent with the first identification information;
if the first transaction is consistent, determining that the first transaction is legal;
If the first transaction is inconsistent, determining that the first transaction is illegal.
3. The method according to claim 2, wherein the identification information is a hash value, the first identification information is a first hash value, the first service account includes a first merck tree, the first location information is first index information, and the first merck tree records the hash value of the transaction under the first service according to the index information;
The determining whether the identification information corresponding to the first location information in the first service account is consistent with the first identification information includes:
determining a node of the first transaction in the first merck tree and a hash value corresponding to the node according to the first hash value and the first index information;
determining a hash value of a root path of the node;
Determining a target hash value according to the hash value corresponding to the node and the hash value of the root path;
determining whether the target hash value is consistent with the first hash value.
4. A method of recording transactions, comprising:
Receiving an execution request, wherein the execution request is used for requesting to execute a first transaction under a first service;
Responding to the execution request, and acquiring a first service account corresponding to the first service from a blockchain through the first transaction;
Executing the first transaction;
if the first transaction is successfully executed, recording first identification information of the first transaction in the first service account;
And based on a block chain consensus mechanism, sending first position information and the first identification information to other node equipment in a block chain network, wherein the first position information is used for determining the position of the first identification information in the first service account.
5. The method of claim 4, wherein the first transaction includes first account information, the first account information being used to characterize an identity of the first business account; the obtaining, by the first transaction, a first service account corresponding to the first service from a blockchain includes:
Carrying out hash calculation on the first account information to obtain a first account address;
and acquiring the first business account from the blockchain through the first account address.
6. The method of claim 5, wherein prior to obtaining the first service account from the blockchain via the first account address, the method further comprises:
And if the fact that the service account corresponding to the first account address does not exist is detected, generating the first service account corresponding to the first account information.
7. The method of any of claims 4-6, wherein the first transaction further includes at least one second account information, each of the account information corresponding to a second service account, the method further comprising:
respectively carrying out hash calculation on each piece of second account information to obtain at least one second account address;
respectively acquiring the corresponding second business accounts according to the second account addresses;
And respectively recording the first identification information in each second service account.
8. An apparatus for determining validity of a transaction, comprising:
The first receiving unit is used for receiving first position information and first identification information of a first transaction, which are sent by other node equipment in the blockchain network, based on a blockchain consensus mechanism, wherein the first position information is used for indicating the position of the identification information of the transaction in a first service account;
The first acquisition unit is used for acquiring the first service account from the blockchain according to the first position information;
And the determining unit is used for searching in the first business account according to the first position information and the first identification information so as to determine the validity of the first transaction.
9. An apparatus for recording transactions, comprising:
The second receiving unit is used for receiving an execution request, wherein the execution request is used for requesting to execute a first transaction under a first service;
The second acquisition unit is used for responding to the execution request and acquiring a first service account corresponding to the first service from a blockchain through the first transaction;
An execution unit for executing the first transaction;
a recording unit, configured to record first identification information of the first transaction in the first service account if the execution of the first transaction is successful;
And the sending unit is used for sending first position information and the first identification information to other node equipment in the blockchain network based on a blockchain consensus mechanism, wherein the first position information is used for indicating the position of the first identification information in the first service account.
10. A node device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-3 or the method according to any of claims 4-7 when executing the computer program.
11. A blockchain network system comprising a plurality of node devices for implementing the method of any of claims 1-7.
12. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the method of any one of claims 1-3 or the method of any one of claims 4-7.
CN202311846832.0A 2023-12-28 2023-12-28 Method, device, system and storage medium for determining transaction validity Pending CN117911148A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311846832.0A CN117911148A (en) 2023-12-28 2023-12-28 Method, device, system and storage medium for determining transaction validity

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311846832.0A CN117911148A (en) 2023-12-28 2023-12-28 Method, device, system and storage medium for determining transaction validity

Publications (1)

Publication Number Publication Date
CN117911148A true CN117911148A (en) 2024-04-19

Family

ID=90693815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311846832.0A Pending CN117911148A (en) 2023-12-28 2023-12-28 Method, device, system and storage medium for determining transaction validity

Country Status (1)

Country Link
CN (1) CN117911148A (en)

Similar Documents

Publication Publication Date Title
US10693716B2 (en) Blockchain based device management
US11470092B2 (en) Expendable network access
US11539701B2 (en) Network access point
US11489693B2 (en) Home network access
JP7421771B2 (en) Methods, application servers, IOT devices and media for implementing IOT services
KR101956486B1 (en) Method and system for facilitating terminal identifiers
CN112153085A (en) Data processing method, node and block chain system
CN111461723A (en) Data processing system, method and device based on block chain
CN113098861B (en) Active identification carrier, authentication method thereof and service platform
JP2019524016A (en) Methods for managing the status of connected devices
US20210158353A1 (en) Methods, systems, apparatuses, and devices for processing request in consortium blockchain
US20180310173A1 (en) Information processing apparatus, information processing system, and information processing method
EP4030803A1 (en) Method and system for secure iot device onboarding using a blockchain network
US11777742B2 (en) Network device authentication
CN117911148A (en) Method, device, system and storage medium for determining transaction validity
CN113010377A (en) Method and device for collecting operation logs of operation
JP5636394B2 (en) Information processing apparatus, information processing method, and program
CN116634025B (en) Method, equipment, system and storage medium for determining transaction sequence
JP2021530169A (en) Extensible certificate management system architecture
CN114546927B (en) Data transmission method, core, computer readable medium, and electronic device
KR102515721B1 (en) Non-fungible password authentication supproting method using one time password for authentication based on blockchain and apparatus therefor
US20240069909A1 (en) Software bill of materials handshake for cloud-based code execution
CN111131254B (en) File processing method, block chain node, block chain and storage medium
CN110287265B (en) Login request processing method and device, server and readable storage medium
CN117896386A (en) Method, device, equipment and storage medium for acquiring blockchain data

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