CN110738497B - Data processing method and device, node equipment and storage medium - Google Patents

Data processing method and device, node equipment and storage medium Download PDF

Info

Publication number
CN110738497B
CN110738497B CN201911313426.1A CN201911313426A CN110738497B CN 110738497 B CN110738497 B CN 110738497B CN 201911313426 A CN201911313426 A CN 201911313426A CN 110738497 B CN110738497 B CN 110738497B
Authority
CN
China
Prior art keywords
transaction data
priority queue
priority
authenticated
transaction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911313426.1A
Other languages
Chinese (zh)
Other versions
CN110738497A (en
Inventor
李茂材
朱耿良
杨常青
刘区城
蓝虎
刘攀
周开班
时一防
王宗友
张劲松
黄焕坤
孔利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201911313426.1A priority Critical patent/CN110738497B/en
Publication of CN110738497A publication Critical patent/CN110738497A/en
Application granted granted Critical
Publication of CN110738497B publication Critical patent/CN110738497B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification

Abstract

The embodiment of the invention discloses a data processing method, a data processing device, node equipment and a storage medium, wherein the method comprises the following steps: acquiring transaction data to be authenticated from the transaction pool, and authenticating the transaction data; adding the authenticated transaction data into a priority queue, wherein the authenticated transaction data is added into a first priority queue, the first priority queue is sorted according to the electronic resource quantity related to the transaction data, and the transaction data with the larger electronic resource quantity is preferentially processed in the first priority queue; in response to a trigger event for uploading transaction data to a blockchain network, acquiring the transaction data from the first priority queue, and determining target transaction data according to the acquired transaction data; generating a target block, the target block comprising target transaction data; uploading the target block to the block chain network can improve the efficiency of uploading the transaction data to the block chain network.

Description

Data processing method and device, node equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data processing method and apparatus, a node device, and a storage medium.
Background
With the continuous development of the blockchain technology, based on the characteristic that data stored in a blockchain network cannot be tampered, the massive transaction data needing to ensure real data can be stored in the blockchain network, and the authenticity of the transaction data is ensured when the transaction data is stored. At present, after acquiring transaction data, a node may store the transaction data in a transaction pool of the node to wait for uploading to a block chain network for storage, and correspondingly, when chaining the transaction data in the transaction pool, the node may acquire a certain amount of transaction data from the transaction pool, authenticate and agree the transaction data, and realize chaining the transaction data after authentication and agree are completed. Therefore, based on the current process of uplink transaction data, a node may wait for a long time due to the delay of the acquisition thread when acquiring transaction data from the transaction data, so that the efficiency of uploading the transaction data to the blockchain network by the node is low.
Disclosure of Invention
The embodiment of the invention provides a data processing method, a data processing device, node equipment and a storage medium, which can improve the efficiency of uploading transaction data to a block chain network.
In one aspect, an embodiment of the present invention provides a data processing method based on a blockchain, where the data processing method is used in any node in a blockchain network, where the node includes a transaction pool, the transaction pool includes a priority queue, the priority queue includes a first priority queue, and the first priority queue is used to store transaction data that has passed authentication, and the method includes:
acquiring transaction data to be authenticated from the transaction pool, and authenticating the transaction data;
adding authenticated transaction data into the priority queue, wherein the authenticated transaction data is added into the first priority queue, the first priority queue is sorted according to the electronic resource amount related to the transaction data, and the transaction data with the larger electronic resource amount is preferentially processed in the first priority queue;
responding to a trigger event for uploading the transaction data to the blockchain network, acquiring the transaction data from the priority queue, and determining target transaction data according to the acquired transaction data;
generating a target tile, the target tile comprising the target transaction data;
uploading the target tiles to the blockchain network.
In another aspect, an embodiment of the present invention provides a data processing apparatus based on a blockchain, where the data processing apparatus is used in any node in a blockchain network, and the node includes a transaction pool, where the transaction pool includes a priority queue, and the priority queue includes a first priority queue, and the first priority queue is used to store transaction data that has passed authentication, and the apparatus includes:
the acquisition unit is used for acquiring the transaction data to be authenticated from the transaction pool;
the authentication unit is used for carrying out authentication processing on the transaction data;
the adding unit is used for adding transaction data passing authentication to the priority queue, wherein the transaction data passing authentication is added to the first priority queue, the first priority queue is sorted according to the electronic resource quantity related to the transaction data, and the transaction data with the larger electronic resource quantity is preferentially processed in the first priority queue;
the acquisition unit is further used for responding to a trigger event for uploading the transaction data to the blockchain network, acquiring the transaction data from the priority queue, and determining target transaction data according to the acquired transaction data;
a generating unit for generating a target block, the target block including the target transaction data;
and the uploading unit is used for uploading the target block to the block chain network.
In another aspect, an embodiment of the present invention provides a server, including a processor, an input device, an output device, and a memory, where the processor, the input device, the output device, and the memory are connected to each other, where the memory is used to store a computer program that supports a terminal to execute the foregoing method, where the computer program includes program instructions, and the processor is configured to call the program instructions to perform the following steps:
acquiring transaction data to be authenticated from the transaction pool, and authenticating the transaction data;
adding authenticated transaction data into the priority queue, wherein the authenticated transaction data is added into the first priority queue, the first priority queue is sorted according to the electronic resource amount related to the transaction data, and the transaction data with the larger electronic resource amount is preferentially processed in the first priority queue;
responding to a trigger event for uploading the transaction data to the blockchain network, acquiring the transaction data from the priority queue, and determining target transaction data according to the acquired transaction data;
generating a target tile, the target tile comprising the target transaction data;
uploading the target tiles to the blockchain network.
In yet another aspect, an embodiment of the present invention provides a computer-readable storage medium, in which computer program instructions are stored, and when executed by a processor, the computer program instructions are configured to perform the method for processing data based on a blockchain according to the first aspect.
In the embodiment of the present invention, a transaction pool in a node device (or node) includes a priority queue for storing authenticated transaction data, and the transaction pool includes a first priority queue, so that the node may obtain transaction data to be authenticated from the transaction pool and perform authentication processing on the transaction data, so that the authenticated transaction data may be added to the priority queue after the transaction data is authenticated, and when the authenticated transaction data is added to the priority queue, at least the authenticated transaction data is added to the first priority queue, so that when the node detects a trigger event for uploading transaction data to a blockchain network, the node may determine target transaction data according to the authenticated transaction data obtained from the first priority queue, so that after the node determines the target transaction data, the target block is directly generated to store the target transaction data, and further, the target block can be uploaded to a block chain network to realize uplink of the transaction data.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart diagram of a data processing method provided by an embodiment of the invention;
FIG. 2 is a schematic flow chart diagram of a data processing method according to another embodiment of the present invention;
FIG. 3a is a diagram illustrating a first priority queue according to an embodiment of the present invention;
FIG. 3b is a diagram of a second priority queue according to an embodiment of the present invention;
FIG. 4 is a schematic block diagram of a data processing apparatus provided by an embodiment of the present invention;
fig. 5 is a schematic block diagram of a node device according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a data processing method, which can be applied to any node in a block chain network, wherein the node comprises a transaction pool, the data processing method can enable any node to quickly generate a target block based on transaction data in the transaction pool and upload the generated target block to the block chain network, and the problem of starvation of an acquisition process caused by waiting of acquisition time when any node acquires the transaction data from the transaction pool to generate the target block can be avoided. Specifically, a node (i.e., any one of the above nodes) may first obtain transaction data to be authenticated from a transaction pool, so that the authentication processing may be performed on the transaction data, and after the node authenticates the transaction data, the authenticated transaction data may be added to a priority queue of the transaction pool.
The transaction pool comprises a pre-divided priority queue, in one embodiment, the transaction pool comprises a first priority queue, the authenticated transaction data is added to the first priority queue when the authenticated transaction data is stored in the priority queue, in addition, the transaction pool also comprises two pre-divided priority queues, namely a first priority queue and a second priority queue, and the authenticated transaction data is added to the first priority queue and the second priority queue when the authenticated transaction data is stored in the priority queue. The transaction data in the first priority queue is determined according to the first priority of the transaction data passing the authentication, and the transaction data in the second priority queue is determined according to the second priority of the transaction data passing the authentication. In one embodiment, the first priority is the amount of electronic resources (e.g., transaction fee, or commission fee, etc.) that the node can obtain when uploading authenticated transaction data to the blockchain network; the second priority is determined based on a time of receipt of the transaction data by the node and an amount of electronic resources available when uploading the transaction data to the blockchain network. Wherein, the authenticated transaction data is: and the electronic resource amount is a commission fee provided for the node for uploading the transaction data to the blockchain network, and the electronic resource amount can be electronic money, digital money, cryptocurrency and the like, and the electronic resource amount is electronic money amount, digital money amount, cryptocurrency amount and the like.
In one embodiment, the first priority may also be referred to as a first type of priority, the first type of priority is a priority for prioritizing the transaction data according to the commission fee, the second priority may also be referred to as a second type of priority, the second type of priority is a priority for prioritizing the transaction data according to the commission fee and the receiving time of the transaction data received by the transaction pool, and the first priority queue and the second priority queue are sorted according to the corresponding sorted priorities, the authenticated transaction data is added at least to the first priority queue, while in other embodiments, the transaction data may also be added to the second priority queue, e.g., when the total amount of transaction data in the first priority queue is greater than the total amount of transaction data in the second priority queue, only the authenticated transaction data may be stored in the second priority queue without storing the transaction data in the first priority queue, in addition, the transaction data passing the authentication can be simultaneously added into the first priority queue and the second priority queue according to the first priority and the second priority respectively. In one embodiment, when the node adds authenticated transaction data to the first priority queue and the second priority queue according to the first priority, the node may add the transaction data to the first priority queue according to the first priority of the transaction data and add the transaction data to the second priority queue according to the second priority of the transaction data; or, the node may also add authenticated transaction data to the first priority queue or the second priority queue according to the amount of transaction data in the first priority queue and the second priority queue. The transaction data in the first priority queue may be sorted in descending order according to the size of the first priority, and the transaction data stored in the second priority queue may be sorted in descending order according to the size of the second priority.
After the node adds the transaction data authenticated in the transaction pool to the priority queue in advance, further, when the node detects a trigger event for uploading the transaction data to the blockchain network, the node can determine target transaction data according to the transaction data acquired from the first priority queue, when the transaction pool includes two priority queues, the node can acquire the transaction data from the first priority queue and the second priority queue respectively, and determine the target transaction data according to the transaction data acquired from the first priority queue and the second priority queue, wherein the node can use the transaction data acquired from the first priority queue as the first transaction data, can also acquire the transaction data from the second priority queue, and use the transaction data acquired from the second priority queue as the second transaction data, and the acquired first transaction data and the second transaction data can determine the target transaction data, further, a target tile may be generated and a target chain tile may be generated based on the obtained target transaction data (including the first transaction data and the second transaction data), the target tile including the obtained target transaction data.
In one embodiment, the node may obtain the transaction data from the first priority queue and the second priority queue according to a certain selection policy, specifically, the selection policy may be a proportional selection policy, and based on the selection policy, the node may first determine a first selection proportion for selecting the transaction data from the first priority queue and a second selection proportion for selecting the transaction data from the second priority queue; according to the preset transaction data total amount required to be acquired and the first selection ratio, the preset transaction data total amount required to be acquired can be determined according to the service condition (for example, network bandwidth, network congestion condition, block chain service rule definition and/or transaction data amount in the transaction pool, etc.), the node may determine a first amount of the first transaction data to be obtained from the first priority queue, and may determine a second amount of the second transaction data to be obtained from the second priority queue based on the total amount of the transaction data and the second selection ratio, and further, the node may obtain first transaction data from the first priority queue according to the first amount and second transaction data from the second priority queue according to the second amount, and may generate a target block to store the first transaction data and the second transaction data.
When the node acquires the first transaction data from the first priority queue according to the first quantity, the first transaction data of the first quantity can be acquired from the first priority queue according to the sequence from the big to the small of the corresponding first priority, similarly, when the node acquires the second transaction data from the second priority queue according to the second quantity, the second transaction data of the second quantity can be acquired from the second priority queue according to the sequence from the big to the small of the corresponding second priority, or the node can randomly select the first transaction data of the first quantity from the first priority queue and the second transaction data of the second quantity from the second priority queue.
After the node acquires the first transaction data from the first priority queue and acquires the second transaction data from the second priority queue, the node may determine repeat transaction data from the first transaction data (or the second transaction data), where the repeat transaction data is the transaction data added to the first priority queue and added to the second priority queue, and in order to avoid that the transaction data stored in the target block includes repeat transaction data, the node may delete the repeat transaction data in the first transaction data or delete the repeat transaction data in the second transaction data, and after deleting the repeat transaction data, generate the target block to store the first transaction data and the second transaction data from which the repeat transaction data is deleted, thereby achieving fast acquisition of the first transaction data and the second transaction data from different priority queues, and effectively avoiding a process waiting problem in a transaction data acquisition process, thereby avoiding the process starvation problem caused by the waiting of the acquisition process of the transaction data.
Referring to fig. 1, it is a schematic flowchart of a data processing method provided in an embodiment of the present invention, where the method may be applied to the above-mentioned node, where the node is any node in a blockchain network, the node includes a transaction pool, the transaction pool includes pre-divided priority queues, the priority queues include first priority queues, and the first priority queues are used for storing transaction data that has passed authentication, as shown in fig. 1, the method includes:
s101, obtaining the transaction data to be authenticated from the transaction pool, and authenticating the transaction data.
According to an embodiment of the application, submitted transaction data that is not yet authenticated may be obtained from a transaction pool for authentication before a triggering event for uploading the transaction data to a blockchain network. It can be understood that when the transaction data is submitted to the transaction pool, the transaction data which is not authenticated (i.e. the transaction data to be authenticated) can be obtained from the transaction pool and authenticated, and the authentication can be completed in the mode at the fastest speed, and the mode can ensure that the transaction data is authenticated in time under the condition that the transaction speed of the transaction pool is faster; or, the node can also periodically obtain the transaction data which is not authenticated from the transaction pool, and authenticate the transaction data, and the batch authentication is carried out in the mode, so that the system resources can be saved; or, the node may further obtain transaction data that is not authenticated from the transaction pool according to the authentication trigger event, and authenticate the transaction data, in an embodiment, the node may preset different authentication trigger events to trigger authentication processing on the transaction data, where the trigger event may be, for example, triggering authentication processing on the transaction data to be authenticated when the number of the transaction data to be authenticated reaches a certain proportion of the total number of the transaction data in the transaction pool, or triggering authentication processing on the transaction data to be authenticated when an instruction to authenticate the transaction data to be authenticated in the transaction pool is received, and based on a different trigger mechanism to authenticate the transaction data to be authenticated, flexibility of the system may be enhanced.
S102, storing the authenticated transaction data into the priority queue.
In one embodiment, the node may store the authenticated transaction data in a priority queue, wherein the authenticated transaction data is added to at least a first priority queue, the first priority queue is sorted according to an amount of electronic resources related to the transaction data, and the transaction data with the larger amount of electronic resources in the first priority queue is processed preferentially. Since the transaction data stored in the priority queue (e.g., the first priority queue) is authenticated transaction data, when subsequently uplink transaction data is transmitted, the node can directly upload the transaction data acquired from the priority queue to the blockchain network without performing the step of authenticating the transaction data after acquiring the transaction data from the priority queue, thereby effectively improving the efficiency of uploading the transaction data to the blockchain network.
In one embodiment, after the transaction pool receives the transaction data, if the transaction data is to-be-authenticated transaction data, the node may perform authentication processing on the transaction data, where the authentication processing includes: and decrypting the data to be authenticated encrypted by the private key by using the public key, and determining that the authentication of the transaction data to be authenticated is passed if the decryption is passed. Aiming at any transaction data received by a transaction pool, the node can perform authentication processing on any transaction data in advance, store the transaction data passing the authentication processing into a priority queue and wait for uplink in the priority queue, and can understand that the transaction data passing the authentication in the transaction pool is stored in the priority queue, the transaction data to be authenticated is stored in a storage space except the priority queue in the transaction pool, the priority queue in the transaction pool realizes the partition of the transaction data according to the authentication, and when the node acquires the transaction data from the transaction pool for uplink, the node can acquire the transaction data from the priority queue in the transaction pool and directly upload the transaction data to a block chain network after acquiring the transaction data, so that the uploading efficiency of the transaction data can be improved.
S103, in response to a trigger event for uploading the transaction data to the blockchain network, acquiring the transaction data from the first priority queue, and determining target transaction data according to the acquired transaction data.
In an embodiment, after receiving transaction data, a node in a blockchain network may upload the received transaction data to the blockchain network in real time, or the node may upload the transaction data to the blockchain network periodically according to a preset time period, and correspondingly, the node may determine to receive a trigger event for uploading the transaction data to the blockchain network when receiving the transaction data, or the node may also determine to receive a trigger event for uploading the transaction data to the blockchain network when the preset time period is reached. In one embodiment, the node may further determine that a trigger event for uploading the transaction data to the blockchain network is received after detecting that the current node state is an idle state or the node stores historical transaction data to the blockchain network. Specifically, the triggering event may be that a preset time period is detected to arrive, or transaction data is received, or a current node state is detected to be an idle state, and the like, and when the triggering event occurs, the transaction pool receives an instruction to generate a blockchain block from the transaction data in the transaction pool, and upload the blockchain block into a blockchain network.
After the node determines that a trigger event for uploading the transaction data to the blockchain network is received, in one embodiment, in order to upload the transaction data to the blockchain network, the node may generate a target block for including the transaction data, and in a process of generating the target block by the node, a certain amount of authenticated transaction data may be further acquired from a transaction pool.
In one embodiment, after receiving the trigger event, the node may determine target transaction data according to the transaction data obtained from the first priority queue, wherein, when the priority queue only comprises a first priority queue, the transaction data acquired by the node from the first priority queue is the target transaction data, when the transaction pool includes a first priority queue and a second priority queue, the node may obtain transaction data from the first priority queue and the second priority queue as target transaction data, specifically, the node may select a first amount of transaction data from the first priority queue as first transaction data according to a set first selection ratio, and a second amount of transaction data may be selected from the second priority queue as second transaction data according to the second selection ratio, therefore, the target transaction data can be determined according to the acquired first transaction data and the acquired second transaction data. In this embodiment, the first selection ratio and the second selection ratio may be ratios relative to a total amount of transaction data to be uploaded into the blockchain network, a value of each selection ratio may be, for example, a value between 0 and 1, and a sum of values of each selection ratio may be 1. In an embodiment, after the node acquires the transaction data from the first priority queue and the second priority queue respectively to determine target transaction data, since the acquired target transaction data is authenticated transaction data in the transaction pool, after the node acquires the target transaction data, the node may directly upload the target transaction data to the block link network, that is, turn to execute step S104 and step S105.
In one embodiment, the first priority queue may be sorted according to the amount of electronic resources (i.e., commission fees) that can be obtained when the corresponding transaction data is uploaded to the blockchain network, and the node may use the amount of electronic resources that can be obtained when the transaction data is uploaded as the first priority of the corresponding transaction data, so that the authenticated transaction data in the transaction pool may be sorted from high to low according to the first priority to obtain the first priority queue, for example, if the authenticated transaction data in the transaction pool includes transaction data 1 and transaction data 2, if the amount of electronic resources that the node can obtain when the transaction data 1 is uploaded to the blockchain network is a, the amount of electronic resources that can obtain when the transaction data 2 is uploaded to the blockchain network is b, and the value of a is greater than the value of b, the first priority corresponding to the transaction data 1 is higher than the first priority corresponding to the transaction data 2, therefore, the ordering of the transaction data 1 in the first priority queue precedes the ordering of the transaction data 2 in the first priority queue. In one embodiment, if the first priority queue includes transaction data 1-N, a first priority corresponding to each transaction data is determined according to an amount of electronic resources provided by the transaction data 1-N, so as to determine an order of the transaction data in the first priority queue, where the first priority queue may be denoted as { transaction data 1, transaction data 2, transaction data 3, …, transaction data N }. In one embodiment, the electronic resource amount provided by the transaction data 1 is greater than the electronic resource amount provided by the transaction data 2, and the electronic resource amount provided by the transaction data 2 is greater than the electronic resource amount provided by the transaction data 3, and so on, correspondingly, the node may obtain the first transaction data according to the size of the electronic resource amount that can be obtained by uploading the transaction data, that is, the first transaction data is obtained according to the size of the electronic resource amount that is provided for the node when uploading the transaction data to the blockchain network.
In an embodiment, if the uploading sequence of the authenticated transaction data in the transaction pool to the blockchain network is determined only according to the size of the electronic resource amount provided to the node, the transaction data uploaded to the transaction pool may be caused to be unable to be uploaded to the blockchain network for a long time due to the fact that the provided electronic resource amount is too small, so that a second priority queue may further be included in the transaction pool, the transaction data in the second priority queue is sorted according to the electronic resource amount that can be acquired by the node when the corresponding transaction data is uploaded to the blockchain network, and the receiving time of the transaction data received by the transaction pool, so that the transaction data uploaded to the transaction pool can be timely uploaded to the blockchain network.
In one embodiment, the transaction data in the second priority queue may be received according to the amount of electronic resources provided by each transaction data and the receiving time of the transaction pool for receiving the transaction data, and the node may first: and receiving time (electronic resource amount + 1) to obtain a second priority corresponding to each transaction data in the transaction pool, and determining a second priority queue and the sequence of each transaction data in the second priority queue according to the second priority. For example, if the transaction data 3 and the transaction data 4 in the transaction pool pass authentication, if the second priority corresponding to the transaction data 3 is determined to be c according to the amount of the electronic resource provided by the transaction data 3 and the receiving time when the transaction pool receives the transaction data 3, and meanwhile, if the second priority corresponding to the transaction data 4 is determined to be d according to the amount of the electronic resource provided by the transaction data 4 and the receiving time when the transaction pool receives the transaction data 4, and c is smaller than d, the transaction data 3 is sorted behind the transaction data 4 in the second priority queue.
In an embodiment of the present invention, the transaction pool may further include a third priority queue, where the third priority queue may be sorted according to an urgency level of each authenticated transaction data in the transaction pool, and may select transaction data from the third priority queue as third transaction data according to a corresponding selection policy, and the like. After the transaction pool determines the transaction data uploaded to the blockchain network, step S104 may be performed instead.
S104, generating a target block, wherein the target block comprises the target transaction data.
And S105, uploading the target block to the block chain network.
In step S104 and step S105, after the node acquires transaction data from the first priority queue and the second priority queue, if the acquired transaction data includes first transaction data acquired from the first priority queue and second transaction data acquired from the second priority queue, the node may determine repeat transaction data from the first transaction data and the second transaction data, and generate a target block after deleting the repeat transaction data, where the repeat transaction data is the transaction data acquired from the first priority queue and the transaction data acquired from the second priority queue. After the node generates the target block, the target block can be uploaded to a block chain network for storage, so as to realize uplink storage of transaction data in the transaction pool.
In the embodiment of the present invention, a transaction pool in a node device (or node) includes a priority queue for storing authenticated transaction data, and the transaction pool includes a first priority queue, so that the node may obtain transaction data to be authenticated from the transaction pool and perform authentication processing on the transaction data, so that the authenticated transaction data may be added to the priority queue after the transaction data is authenticated, and when the authenticated transaction data is added to the priority queue, at least the authenticated transaction data is added to the first priority queue, so that when the node detects a trigger event for uploading transaction data to a blockchain network, the node may determine target transaction data according to the authenticated transaction data obtained from the first priority queue, so that after the node determines the target transaction data, the target block is directly generated to store the target transaction data, further, the target block can be uploaded to a block chain network to realize chain linking of the transaction data, so that the node can directly upload the transaction data after acquiring the transaction data, the chain linking efficiency of the transaction data is improved, meanwhile, the transaction data in the priority queue passes authentication, so that the node does not need to wait for a verification process of the transaction data after acquiring the transaction data, and the problem of process starvation caused by time waiting can be solved.
Please refer to fig. 2, which is a flowchart illustrating a data processing method according to another embodiment of the present invention, where the data processing method is also applicable to any node (or node device) in a blockchain network, the node includes a transaction pool, the transaction pool includes a priority queue, the priority queue includes a first priority queue, and the first priority queue is used for storing authenticated transaction data, and the method may include steps S201 to S206.
S201, obtaining the transaction data to be authenticated from the transaction pool, and authenticating the transaction data.
S202, obtaining attribute information of the transaction data passing the authentication, and determining the first priority and the second priority of the transaction data passing the authentication according to the attribute information.
S203, adding the authenticated transaction data into the first priority queue and the second priority queue according to the first priority and the second priority of the authenticated transaction data.
In steps S201 to S203, for any transaction data authenticated in the transaction pool, the attribute information includes priority information, the node, when determining the attribute information of the transaction data, the amount of electronic resources obtained when uploading the authenticated transaction data to the blockchain network may be determined first, and determining a reception time at which the transaction pool receives the authenticated transaction data, and further, after the node determines that the authenticated transaction data is uploaded to the block chain network and correspondingly submitted to the electronic resource amount of the node and the receiving time of the transaction pool for receiving the authenticated transaction data, the node may determine a first priority of the authenticated transaction data in the first priority queue based on the amount of electronic resources, and determining a second priority of the authenticated transaction data in the second priority queue according to the electronic resource amount and the receiving time.
In one embodiment, a first priority determined by the node is used for ordering the authenticated transaction data in the first priority queue, and a second priority determined by the node is used for ordering the authenticated transaction data in the second priority queue, where it is understood that when the authenticated transaction data is arranged in the first priority queue according to the first priority and when the authenticated transaction data is arranged in the second priority queue according to the second priority, the positions of the transaction data in the first priority queue and the second priority queue are different, respectively. The first priority queue may be sorted based on { electronic resource amount X }, where X is any natural number greater than 0, and the second priority queue may be sorted based on { reception time × (electronic resource amount + 1) }.
In an embodiment, the first priority queue and the second priority queue in the transaction pool may directly store authenticated transaction data, or may store identification information of the authenticated transaction data, and correspondingly, when the node acquires transaction data from the first priority queue and the second priority queue, the authenticated transaction data stored in the priority queue may be directly extracted as the first transaction data and the second transaction data, respectively, or the node may also extract identification information of the transaction data corresponding to the authentication from the priority queue, and further acquire the authenticated transaction data from the transaction pool as the first transaction data and the second transaction data according to the identification information.
In an embodiment, after determining the attribute information of the authenticated transaction data, the node may further add the authenticated transaction data to a first priority queue according to the attribute information, and may also add the authenticated transaction data to a second priority queue, that is, the authenticated transaction data may be added to the first priority queue and the second priority queue at the same time, and specifically, the node may add the authenticated transaction data to the first priority queue according to the first priority; and the node can add the authenticated transaction data into the second priority queue according to the second priority. It can be understood that, for any authenticated transaction data in the transaction pool, the authenticated transaction data may be added to the first priority queue and the second priority queue according to the first priority and the second priority corresponding to the authenticated transaction data, respectively, where the node may directly add the authenticated transaction data to the first priority queue and the second priority queue, or add identification information corresponding to the authenticated transaction data to the first priority queue and the second priority queue.
For example, assuming that the number of authenticated transaction data in the transaction pool is N, the authenticated transaction data includes transaction data 1, transaction data 2, …, and transaction data N, where N is a positive integer greater than or equal to 1, if the amount of electronic resources provided to the node when uploading to the blockchain network according to the authenticated transaction data, the node may determine a first priority corresponding to each of the N transaction data according to the amount of electronic resources provided by each of the N transaction data, so as to obtain a first priority queue by sorting the N transaction data according to the first priority, where the first priority queue may be { transaction data 1, transaction data 2, transaction data 3, …, transaction data N }. Correspondingly, according to the amount of electronic resources provided by the N transaction data and the receiving time of each transaction data received by the transaction pool, a second priority corresponding to each of the N transaction data can be determined, so that the N transaction data can be sorted according to the second priority to obtain a second priority queue, which can be { transaction data N, transaction data N-1, transaction data 3, …, transaction data 1}, for example.
In one embodiment, after determining the attribute information of the authenticated transaction data, the node adds the authenticated transaction data to the first priority queue and the second priority queue at the same time according to the attribute information, or adds the authenticated transaction data to one of the first priority or the second priority according to the attribute information. Before adding authenticated transaction data into a priority queue, the node can also acquire the total amount of the transaction data in the first priority queue and the total amount of the transaction data in the second priority queue; thus, the priority queue to which the authenticated transaction data is added can be determined according to the total amount of transaction data in the first priority queue and the total amount of transaction data in the second priority queue, and specifically, when the total amount of transaction data in the first priority queue is greater than the total amount of transaction data in the second priority queue, the authenticated transaction data can be stored in the second priority queue; or when the total transaction data amount in the first priority queue is less than or equal to the total transaction data amount in the second priority queue, adding the authenticated transaction data into the first priority queue. The node may proceed to step S204 after adding each authenticated transaction data in the transaction pool to the first priority queue and/or the second priority queue.
S204, in response to a trigger event for uploading the transaction data to the blockchain network, acquiring the transaction data from the first priority queue, and determining target transaction data according to the acquired transaction data.
In one embodiment, the priority queue may include a first priority queue and a second priority queue, and therefore, the target transaction data determined by the node may include transaction data obtained from the first priority queue and transaction data obtained from the second priority queue, so that the target transaction data may be determined based on the transaction data obtained from the first priority queue and the transaction data obtained from the second priority queue. The node can firstly determine a selection strategy for acquiring the authenticated transaction data from the first priority queue and the second priority queue when acquiring the transaction data from the first priority queue and the second priority queue; further, first transaction data may be obtained from the first priority queue and second transaction data may be obtained from the second priority queue according to the selection policy, so that the first transaction data and the second transaction data may be used as target transaction data. The selection strategy comprises a first selection proportion corresponding to a first priority queue and a second selection proportion corresponding to a second priority queue, and when the node acquires first transaction data from the first priority queue according to the selection strategy and acquires second transaction data from the second priority queue, the node can acquire the total amount of the transaction data to be uploaded to the blockchain network after determining the first selection proportion and the second selection proportion according to the selection strategy, wherein the total amount of the transaction data can be the number of transactions which are allowed to be uploaded to the blockchain network by a transaction pool in the node; furthermore, the node can determine a first quantity according to the total transaction data amount and the first selection proportion, and determine a second quantity according to the total transaction data amount and the second selection proportion; the node may obtain a first amount of transaction data from the first priority queue as first transaction data after determining the first amount, and may obtain a second amount of transaction data from the second priority queue as second transaction data after determining the second amount.
In one embodiment, the transaction data stored in the first priority queue is sorted in descending order with a first priority from high to low, the transaction data stored in the second priority queue is sorted in descending order with a second priority from high to low, the first priority refers to the size of the electronic resource amount obtained when the transaction data is uploaded, and the second priority is determined according to the receiving time of the transaction data received by the node and the electronic resource amount obtained when the transaction data is uploaded to the blockchain network. When the node acquires a first amount of transaction data from the first priority queue as first transaction data and a second amount of transaction data from the second priority queue as second transaction data, the node may acquire the first amount of transaction data from the first priority queue as the first transaction data in the order from the first priority level to the lower level; when the second amount of transaction data is obtained from the second priority queue as the second transaction data, the second amount of transaction data may be obtained from the second priority queue in an order from the higher priority to the lower priority as the second transaction data.
In one embodiment, if the first priority queue is { transaction data 1, transaction data 2, transaction data 3, …, transaction data N }, the second priority queue is { transaction data N, transaction data N-1, transaction data 3, …, transaction data 1}, the total amount of transaction data to be uploaded into the blockchain network is assumed to be 100, and the selection policy indicates that the first selection ratio corresponding to the first priority queue is 80% and the second selection ratio corresponding to the second priority queue is 20%, the node may determine that the first amount of transaction data obtained from the first priority queue is 80 and the second amount of transaction data obtained from the second priority queue is 20. Further, the node may obtain the first 80 ranked transaction data from the first priority queue { transaction data 1, transaction data 2, transaction data 3, …, transaction data N } as the first transaction data and obtain the first 20 transaction data from the second priority queue { transaction data N, transaction data N-1, transaction data 3, …, transaction data 1} as the second transaction data.
In one embodiment, when detecting a change in the total amount of the transaction data in the first priority queue and the second priority queue, the node may dynamically adjust the selection policy for the transaction data, so as to adjust the first selection ratio and the second selection ratio, where the node may adjust the first selection ratio and the second selection ratio according to the total amount of the transaction data in the first priority queue and the total amount of the transaction data in the second priority queue, specifically, when detecting that the total amount of the transaction data in the first priority queue increases and the total amount of the transaction data in the second priority queue decreases, to avoid a problem that the transaction data cannot be obtained in time due to a long-time waiting delay of the node caused by the decrease in the transaction data in the second priority queue when the node selects the transaction data according to the original selection policy, the node may adjust the selection policy to increase the first selection ratio and decrease the second selection ratio. Or when the node detects that the total amount of the transaction data in the first priority queue is reduced and the total amount of the transaction data in the second priority queue is increased, the node indicates that the transaction data selected by the node according to the electronic resource amount submitted to the node is more, so that the node can correspondingly reduce the first selection proportion and increase the second selection proportion in order to avoid the situation that the transaction data added into the transaction pool waits in the transaction pool for a long time and cannot be uploaded to the block link network.
In one embodiment, after acquiring the transaction data (including the first transaction data and the second transaction data) from the priority queue as the target transaction data according to the selection policy, the node may proceed to perform step S205 and step S206.
S205, generating a target block, where the target block includes the target transaction data.
S206, upload the target block to the blockchain network.
In steps S205 and S206, the number of the first transaction data and the number of the second transaction data obtained from the first priority queue and the second priority queue by the node are multiple, the node may determine, before generating the target block, duplicate transaction data from the first transaction data, where the duplicate transaction data is obtained from the first priority queue and the second priority queue by the node, and the node may delete the duplicate transaction data obtained from the first priority queue or delete the duplicate transaction data obtained from the second priority queue in order to avoid occupation of memory resources of the target block for duplicate storage of the transaction data by the target block.
In one embodiment, when the node stores a first priority queue and a second priority queue in a transaction pool, if the first priority queue is { transaction data 1, transaction data 2, transaction data 3, …, transaction data N }, and the second priority queue is { transaction data N, transaction data N-1, transaction data 3, …, transaction data 1}, wherein the first priority queue may be as shown in fig. 3a, and the second priority queue may be as shown in fig. 3b, after the node acquires transaction data from the first priority queue as first transaction data according to a selection policy and acquires transaction data from the second priority queue as second transaction data, the node may determine duplicate transaction data in the acquired first transaction data and second transaction data, such as transaction data 3, and further, and after deleting the transaction data 3 acquired from the first priority queue or deleting the transaction data 3 acquired from the second priority queue, the node can acquire the transaction data which is used for being stored in a target block and uploaded to a block chain network.
In the embodiment of the invention, the node can authenticate the transaction data to be authenticated in the transaction pool and determine the attribute information of the transaction data after the authentication is passed, so that the transaction data can be added into the corresponding priority queue based on the attribute information, when the node receives a trigger event for uploading the transaction data to the block chain network, the node can acquire the transaction data from the first priority queue according to the selection strategy after determining the selection strategy of the transaction data, and can determine the target transaction data according to the transaction data acquired from the first priority queue, further, the node can generate a target block to store the target transaction data and upload the target block to the block chain network, and because the transaction pool in the node is divided into the priority queues in advance, the node can acquire the transaction data from the priority queue quickly, and the uplink storage of the transaction data is realized, so that the problem of process waiting caused by waiting for the acquisition of the transaction data in the process of acquiring the transaction data can be effectively avoided.
Based on the description of the foregoing data processing method embodiment, an embodiment of the present invention further provides a data processing apparatus, which may be a computer program (including a program code) running in the foregoing node device. The operation control apparatus may perform the data processing method as described in fig. 1 and 2, referring to fig. 4, the data processing apparatus includes: the device comprises an acquisition unit 401, an authentication unit 402, an adding unit 403, a generating unit 404 and an uploading unit 405.
An obtaining unit 401, configured to obtain transaction data to be authenticated from the transaction pool;
an authentication unit 402, configured to perform authentication processing on the transaction data;
an adding unit 403, configured to add authenticated transaction data to the priority queue, where the authenticated transaction data is added to the first priority queue, the first priority queue is sorted according to an amount of electronic resources related to the transaction data, and in the first priority queue, the transaction data with the larger amount of electronic resources is processed preferentially;
the obtaining unit 401 is further configured to, in response to a trigger event for uploading the transaction data to the blockchain network, obtain the transaction data from the first priority queue, and determine target transaction data according to the obtained transaction data;
a generating unit 404, configured to generate a target block, where the target block includes the target transaction data;
an upload unit 405, configured to upload the target block to the blockchain network.
In one embodiment, the priority queues further include a second priority queue, where the first priority queue is used to store authenticated transaction data with a first priority, the second priority queue is used to store authenticated transaction data with a second priority, the first priority refers to a size of an electronic resource amount obtained when the transaction data is uploaded, the second priority is determined according to a receiving time when the transaction data is received by the node and the electronic resource amount obtained when the transaction data is uploaded to the blockchain network,
the adding the authenticated transaction data into the priority queue further comprises: adding the authenticated transaction data to the second priority queue,
the obtaining unit 401 is specifically configured to:
determining a selection strategy for acquiring the authenticated transaction data from the first priority queue and the second priority queue; acquiring first transaction data from the first priority queue according to the selection strategy, and acquiring second transaction data from the second priority queue; and determining the target transaction data according to the first transaction data and the second transaction data.
In one embodiment, the selection policy includes a first selection ratio corresponding to the first priority queue and a second selection ratio corresponding to the second priority queue;
the obtaining unit 401 is specifically configured to:
acquiring the total amount of transaction data to be uploaded to the block chain network;
determining a first quantity according to the total transaction data amount and the first selection proportion, and determining a second quantity according to the total transaction data amount and the second selection proportion;
and acquiring the first amount of transaction data from the first priority queue as first transaction data, and acquiring the second amount of transaction data from the second priority queue as second transaction data.
In one embodiment, the transaction data stored in the first priority queue is sorted in descending order of the first priority, and the transaction data stored in the second priority queue is sorted in descending order of the second priority;
the obtaining unit 401 is specifically configured to:
acquiring the first amount of transaction data from the first priority queue as first transaction data according to the sequence of the first priority from high to low;
and acquiring the second amount of transaction data from the second priority queue as second transaction data according to the sequence of the second priority from high to low.
In one embodiment, the apparatus further comprises: an adjusting unit 406.
An adjusting unit 406, configured to adjust the first selection ratio and the second selection ratio according to a total amount of transaction data in the first priority queue and a total amount of transaction data in the second priority queue.
In an embodiment, the adjusting unit 406 is specifically configured to:
when detecting that the total amount of the transaction data in the first priority queue is increased and the total amount of the transaction data in the second priority queue is decreased, increasing the first selection proportion and decreasing the second selection proportion;
and when the total amount of the transaction data in the first priority queue is reduced and the total amount of the transaction data in the second priority queue is increased, reducing the first selection proportion and increasing the second selection proportion.
In one embodiment, the authenticated transaction data is further added to the second priority queue, wherein the first priority queue is configured to store authenticated transaction data at a first priority level, the second priority queue is configured to store authenticated transaction data at a second priority level,
the adding unit 403 is specifically configured to:
acquiring attribute information of transaction data passing authentication, and determining the first priority and the second priority of the transaction data passing authentication according to the attribute information;
and adding the authenticated transaction data into the first priority queue and the second priority queue according to the first priority and the second priority of the authenticated transaction data.
In an embodiment, the adding unit 403 is specifically configured to:
determining the electronic resource amount obtained when the authenticated transaction data is uploaded to a block chain network, and determining the receiving time of the transaction pool for receiving the authenticated transaction data;
determining the first priority of the transaction data passing the authentication in the first priority queue according to the electronic resource amount; and the number of the first and second groups,
and determining the second priority of the authenticated transaction data in the second priority queue according to the electronic resource amount and the receiving time.
In an embodiment, the adding unit 403 is specifically configured to:
adding the authenticated transaction data into the first priority queue according to the first priority; and the number of the first and second groups,
and adding the transaction data passing the authentication into the second priority queue according to the second priority.
In an embodiment, the obtaining unit 401 is further configured to obtain a total amount of transaction data in the first priority queue and a total amount of transaction data in the second priority queue;
the adding unit 403 is specifically configured to:
and when the total transaction data amount in the first priority queue is less than or equal to the total transaction data amount in the second priority queue, adding authenticated transaction data into the first priority queue.
In an embodiment, the adding unit 403 is further configured to: and when the total transaction data amount in the first priority queue is larger than that in the second priority queue, storing the authenticated transaction data into the second priority queue.
In one embodiment, the first transaction data and the second transaction data are respectively plural in number; the device further comprises: a determination unit 407 and a deletion unit 408.
A determining unit 407, configured to determine repeated transaction data from the first transaction data, where the repeated transaction data is obtained from the first priority queue and obtained from the second priority queue;
a deleting unit 408, configured to delete the repeat transaction data acquired from the first priority queue, or delete the repeat transaction data acquired from the second priority queue.
In this embodiment of the present invention, the transaction pool includes a priority queue for storing authenticated transaction data, the transaction pool includes a first priority queue, the obtaining unit 401 may obtain transaction data to be authenticated from the transaction pool, so that the authenticating unit 402 may perform authentication processing on the transaction data, so that the adding unit 403 may add the transaction data to the priority queue after the authentication on the transaction data is passed, and when the adding unit 403 adds the authenticated transaction data to the priority queue, at least the authenticated transaction data is added to the first priority queue, so that when a trigger event for uploading the transaction data to the blockchain network is detected, the obtaining unit 401 may determine target transaction data according to the authenticated transaction data obtained from the first priority queue, so that after the target transaction data is determined, the generating unit 404 may directly generate a target block to store the target transaction data, and further, the uploading unit 405 may upload the target block to a block chain network to implement uplink of the transaction data, so that the node may directly upload the transaction data after acquiring the transaction data, thereby improving uplink efficiency of the transaction data.
Fig. 5 is a schematic block diagram of a structure of a node device according to an embodiment of the present invention, where the node device may be a server device or a terminal device, and the node device is the node. The node device in the embodiment of the present invention shown in fig. 5 may include: one or more processors 501; one or more input devices 502, one or more output devices 503, and memory 504. The processor 501, the input device 502, the output device 503, and the memory 504 are connected by a bus 505. The memory 504 is used to store a computer program comprising program instructions and the processor 501 is used to execute the program instructions stored by the memory 504.
The memory 504 may include volatile memory (volatile memory), such as random-access memory (RAM); the memory 504 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a solid-state drive (SSD), etc.; the memory 504 may also comprise a combination of the above-described types of memory.
The processor 501 may be a Central Processing Unit (CPU). The processor 501 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or the like. The PLD may be a field-programmable gate array (FPGA), a General Array Logic (GAL), or the like. The processor 501 may also be a combination of the above structures.
In one embodiment, the processor 501 is configured to call the program instructions to perform:
acquiring transaction data to be authenticated from the transaction pool, and authenticating the transaction data;
adding authenticated transaction data into the priority queue, wherein the authenticated transaction data is added into the first priority queue, the first priority queue is sorted according to the electronic resource amount related to the transaction data, and the transaction data with the larger electronic resource amount is preferentially processed in the first priority queue;
responding to a trigger event for uploading the transaction data to the blockchain network, acquiring the transaction data from the priority queue, and determining target transaction data according to the acquired transaction data;
generating a target tile, the target tile comprising the target transaction data;
uploading the target tiles to the blockchain network.
In one embodiment, the priority queues further include a second priority queue, where the first priority queue is used to store authenticated transaction data with a first priority, the second priority queue is used to store authenticated transaction data with a second priority, the first priority refers to a size of an electronic resource amount obtained when the transaction data is uploaded, the second priority is determined according to a receiving time when the transaction data is received by the node and the electronic resource amount obtained when the transaction data is uploaded to the blockchain network,
the adding the authenticated transaction data into the priority queue further comprises: adding the authenticated transaction data into the second priority queue;
the processor 501 is configured to call the program instructions, and is further configured to perform:
determining a selection strategy for acquiring the authenticated transaction data from the first priority queue and the second priority queue; acquiring first transaction data from the first priority queue according to the selection strategy, and acquiring second transaction data from the second priority queue; and determining the target transaction data according to the first transaction data and the second transaction data.
In one embodiment, the selection policy includes a first selection ratio corresponding to the first priority queue and a second selection ratio corresponding to the second priority queue;
the processor 501 is configured to call the program instructions for performing:
acquiring the total amount of transaction data to be uploaded to the block chain network;
determining a first quantity according to the total transaction data amount and the first selection proportion, and determining a second quantity according to the total transaction data amount and the second selection proportion;
and acquiring the first amount of transaction data from the first priority queue as first transaction data, and acquiring the second amount of transaction data from the second priority queue as second transaction data.
In one embodiment, the transaction data stored in the first priority queue is sorted in descending order of the first priority, and the transaction data stored in the second priority queue is sorted in descending order of the second priority;
the processor 501 is configured to call the program instructions for performing:
acquiring the first amount of transaction data from the first priority queue as first transaction data according to the sequence of the first priority from high to low;
and acquiring the second amount of transaction data from the second priority queue as second transaction data according to the sequence of the second priority from high to low.
In one embodiment, the processor 501 is configured to call the program instructions to perform:
and adjusting the first selection proportion and the second selection proportion according to the total amount of the transaction data in the first priority queue and the total amount of the transaction data in the second priority queue.
In one embodiment, the processor 501 is configured to call the program instructions to perform:
when detecting that the total amount of the transaction data in the first priority queue is increased and the total amount of the transaction data in the second priority queue is decreased, increasing the first selection proportion and decreasing the second selection proportion;
and when the total amount of the transaction data in the first priority queue is reduced and the total amount of the transaction data in the second priority queue is increased, reducing the first selection proportion and increasing the second selection proportion.
In one embodiment, the authenticated transaction data is further added to the second priority queue, wherein the first priority queue is configured to store authenticated transaction data at a first priority level, the second priority queue is configured to store authenticated transaction data at a second priority level, and the processor 501 is configured to call the program instructions to perform:
acquiring attribute information of transaction data passing authentication, and determining the first priority and the second priority of the transaction data passing authentication according to the attribute information;
and adding the authenticated transaction data into the first priority queue and the second priority queue according to the first priority and the second priority of the authenticated transaction data.
The processor 501 is configured to call the program instructions for performing:
determining the electronic resource amount obtained when the authenticated transaction data is uploaded to a block chain network, and determining the receiving time of the transaction pool for receiving the authenticated transaction data;
determining the first priority of the transaction data passing the authentication in the first priority queue according to the electronic resource amount; and the number of the first and second groups,
and determining the second priority of the authenticated transaction data in the second priority queue according to the electronic resource amount and the receiving time.
In one embodiment, the processor 501 is configured to call the program instructions to perform:
adding the authenticated transaction data into the first priority queue according to the first priority; and the number of the first and second groups,
and adding the transaction data passing the authentication into the second priority queue according to the second priority.
In one embodiment, the priority queues further comprise a second priority queue, wherein the first priority queue is configured to store authenticated transaction data at a first priority level and the second priority queue is configured to store authenticated transaction data at a second priority level, and the processor 501 is configured to call the program instructions to perform:
acquiring the total amount of transaction data in the first priority queue and the total amount of transaction data in the second priority queue;
and when the total transaction data amount in the first priority queue is less than or equal to the total transaction data amount in the second priority queue, adding authenticated transaction data into the first priority queue.
In one embodiment, the processor 501 is configured to call the program instructions to perform:
and when the total transaction data amount in the first priority queue is larger than that in the second priority queue, storing the authenticated transaction data into the second priority queue.
In one embodiment, the first transaction data and the second transaction data are respectively plural in number;
the processor 501 is configured to call the program instructions for performing:
determining repeated transaction data from the first transaction data, wherein the repeated transaction data is obtained from the first priority queue and is obtained from the second priority queue;
deleting the repeat transaction data obtained from the first priority queue or deleting the repeat transaction data obtained from the second priority queue.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the invention has been described with reference to a particular embodiment, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (15)

1. A data processing method for use at any node in a blockchain network, the node comprising a transaction pool including a priority queue including a first priority queue for storing authenticated transaction data, the method comprising:
acquiring transaction data to be authenticated from the transaction pool, and performing authentication processing on the transaction data to be authenticated;
adding authenticated transaction data into the priority queue, wherein the authenticated transaction data is added into the first priority queue, the first priority queue is sorted according to the electronic resource amount related to the authenticated transaction data, and the transaction data with the larger electronic resource amount is preferentially processed in the first priority queue;
responding to a trigger event for uploading the transaction data passing the authentication to the blockchain network, acquiring the transaction data passing the authentication from the first priority queue, and determining target transaction data according to the acquired transaction data passing the authentication;
generating a target tile, the target tile comprising the target transaction data;
uploading the target tiles to the blockchain network.
2. The method according to claim 1, wherein the priority queue further comprises a second priority queue, wherein the first priority queue is used for storing authenticated transaction data with a first priority, the second priority queue is used for storing authenticated transaction data with a second priority, the first priority refers to a size of an electronic resource amount obtained when the authenticated transaction data is uploaded, the second priority is determined according to a receiving time of the authenticated transaction data received by the node and an electronic resource amount obtained when the authenticated transaction data is uploaded to the blockchain network,
the adding the authenticated transaction data into the priority queue further comprises: adding the authenticated transaction data to the second priority queue,
the acquiring the transaction data passing the authentication from the first priority queue and determining target transaction data according to the acquired transaction data passing the authentication comprises: determining a selection strategy for acquiring the authenticated transaction data from the first priority queue and the second priority queue; acquiring first transaction data from the first priority queue according to the selection strategy, and acquiring second transaction data from the second priority queue; and determining the target transaction data according to the first transaction data and the second transaction data.
3. The method according to claim 2, wherein the selection policy includes a first selection ratio corresponding to the first priority queue and a second selection ratio corresponding to the second priority queue;
the acquiring first transaction data from the first priority queue and acquiring second transaction data from the second priority queue according to the selection strategy includes:
acquiring the total amount of transaction data to be uploaded to the block chain network;
determining a first quantity according to the total transaction data amount and the first selection proportion, and determining a second quantity according to the total transaction data amount and the second selection proportion;
and acquiring the first amount of transaction data from the first priority queue as first transaction data, and acquiring the second amount of transaction data from the second priority queue as second transaction data.
4. The method of claim 3, wherein the transaction data stored in the first priority queue is sorted in descending order of the first priority and the transaction data stored in the second priority queue is sorted in descending order of the second priority;
the obtaining the first amount of transaction data from the first priority queue as first transaction data and the second amount of transaction data from the second priority queue as second transaction data includes:
acquiring the first amount of transaction data from the first priority queue as first transaction data according to the sequence of the first priority from high to low;
and acquiring the second amount of transaction data from the second priority queue as second transaction data according to the sequence of the second priority from high to low.
5. The method of claim 3, further comprising:
and adjusting the first selection proportion and the second selection proportion according to the total amount of the transaction data in the first priority queue and the total amount of the transaction data in the second priority queue.
6. The method of claim 5, wherein adjusting the first selection ratio and the second selection ratio according to the total amount of transaction data in the first priority queue and the total amount of transaction data in the second priority queue comprises:
when detecting that the total amount of the transaction data in the first priority queue is increased and the total amount of the transaction data in the second priority queue is decreased, increasing the first selection proportion and decreasing the second selection proportion;
and when the total amount of the transaction data in the first priority queue is reduced and the total amount of the transaction data in the second priority queue is increased, reducing the first selection proportion and increasing the second selection proportion.
7. The method of claim 1, wherein the authenticated transaction data is further added to a second priority queue, wherein the first priority queue is configured to store authenticated transaction data at a first priority level, wherein the second priority queue is configured to store authenticated transaction data at a second priority level, and wherein adding authenticated transaction data to the priority queue comprises:
acquiring attribute information of transaction data passing authentication, and determining the first priority and the second priority of the transaction data passing authentication according to the attribute information;
and adding the authenticated transaction data into the first priority queue and the second priority queue according to the first priority and the second priority of the authenticated transaction data.
8. The method of claim 7, wherein said determining the first priority and the second priority of the authenticated transaction data based on the attribute information comprises:
determining the electronic resource amount obtained when the authenticated transaction data is uploaded to a block chain network, and determining the receiving time of the transaction pool for receiving the authenticated transaction data;
determining the first priority of the transaction data passing the authentication in the first priority queue according to the electronic resource amount; and the number of the first and second groups,
and determining the second priority of the authenticated transaction data in the second priority queue according to the electronic resource amount and the receiving time.
9. The method of claim 8, wherein adding the authenticated transaction data to the first priority queue and the second priority queue based on the first priority and the second priority of the authenticated transaction data comprises:
adding the authenticated transaction data into the first priority queue according to the first priority; and the number of the first and second groups,
and adding the transaction data passing the authentication into the second priority queue according to the second priority.
10. The method of claim 2, wherein prior to adding authenticated transaction data to the priority queue, the method further comprises:
acquiring the total amount of transaction data in the first priority queue and the total amount of transaction data in the second priority queue;
adding authenticated transaction data into the priority queue, including:
and when the total transaction data amount in the first priority queue is less than or equal to the total transaction data amount in the second priority queue, adding authenticated transaction data into the first priority queue.
11. The method of claim 10, further comprising:
and when the total transaction data amount in the first priority queue is larger than that in the second priority queue, storing the authenticated transaction data into the second priority queue.
12. The method according to claim 2, wherein the first transaction data and the second transaction data are plural in number, respectively; before the generating the target block, the method further includes:
determining repeated transaction data from the first transaction data, wherein the repeated transaction data is obtained from the first priority queue and is obtained from the second priority queue;
deleting the repeat transaction data obtained from the first priority queue or deleting the repeat transaction data obtained from the second priority queue.
13. A data processing apparatus for use at any node in a blockchain network, the node comprising a transaction pool including a priority queue including a first priority queue for storing authenticated transaction data, the apparatus comprising:
the acquisition unit is used for acquiring the transaction data to be authenticated from the transaction pool;
the authentication unit is used for carrying out authentication processing on the transaction data to be authenticated;
the adding unit is used for adding the transaction data passing the authentication to the priority queue, wherein the transaction data passing the authentication is added to the first priority queue, the first priority queue is sorted according to the electronic resource quantity related to the transaction data passing the authentication, and the transaction data with the larger electronic resource quantity is preferentially processed in the first priority queue;
the obtaining unit is further configured to obtain the authenticated transaction data from the first priority queue in response to a trigger event that uploads the authenticated transaction data to the blockchain network, and determine target transaction data according to the obtained authenticated transaction data;
a generating unit for generating a target block, the target block including the target transaction data;
and the uploading unit is used for uploading the target block to the block chain network.
14. A node device comprising a processor, a memory and a communication interface, the processor, the memory and the communication interface being interconnected, wherein the memory is configured to store computer program instructions and the processor is configured to execute the program instructions to implement the method of any one of claims 1-12.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-12.
CN201911313426.1A 2019-12-19 2019-12-19 Data processing method and device, node equipment and storage medium Active CN110738497B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911313426.1A CN110738497B (en) 2019-12-19 2019-12-19 Data processing method and device, node equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911313426.1A CN110738497B (en) 2019-12-19 2019-12-19 Data processing method and device, node equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110738497A CN110738497A (en) 2020-01-31
CN110738497B true CN110738497B (en) 2020-03-31

Family

ID=69274613

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911313426.1A Active CN110738497B (en) 2019-12-19 2019-12-19 Data processing method and device, node equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110738497B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339086B (en) * 2020-02-18 2021-04-20 腾讯科技(深圳)有限公司 Block processing method, and data query method and device based on block chain
CN111400043A (en) * 2020-03-13 2020-07-10 杭州复杂美科技有限公司 Transaction pool management method, device and storage medium
CN111415259B (en) * 2020-03-26 2024-02-06 杭州复杂美科技有限公司 Transaction queuing method, device and storage medium
CN111600720B (en) * 2020-05-20 2021-09-28 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and readable storage medium
CN111638963A (en) * 2020-06-08 2020-09-08 杭州复杂美科技有限公司 Transaction pool dynamic control method, device and storage medium
CN113435886A (en) * 2020-11-30 2021-09-24 陈素华 Transaction processing method based on cloud computing
CN113256877B (en) * 2020-12-31 2024-02-02 深圳怡化电脑股份有限公司 Banknote information management method, banknote information management device, banknote information management storage medium, and computer device
CN116542668A (en) * 2022-01-25 2023-08-04 腾讯科技(深圳)有限公司 Block chain-based data processing method, equipment and readable storage medium
CN115271746B (en) * 2022-09-27 2023-01-31 江苏荣泽信息科技股份有限公司 Block chain transaction sequencing method with priority

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10438275B2 (en) * 2016-09-28 2019-10-08 Paypal, Inc. Method, medium, and system for managing de-queueing operations of transaction queues
CN106886890B (en) * 2017-02-07 2020-07-17 杭州溪塔科技有限公司 Block chain-based timed transaction execution method
KR102053630B1 (en) * 2018-03-13 2020-01-22 주식회사 웨이투빗 Method for processing transactions using blockchain, and transaction management server using the same
CN108512775A (en) * 2018-04-16 2018-09-07 杭州秘猿科技有限公司 A kind of method and device of sequence transaction queue
US10657052B2 (en) * 2018-04-25 2020-05-19 Dell Products, L.P. Information handling system with priority based cache flushing of flash dual in-line memory module pool
CN109710387B (en) * 2018-12-06 2020-12-15 成都佰纳瑞信息技术有限公司 Policy engine for block chain transaction priority ordering and use method thereof
CN109669789A (en) * 2018-12-10 2019-04-23 杭州复杂美科技有限公司 Transaction queuing strategy, trading pit storage method, equipment and storage medium
CN110278256B (en) * 2019-06-13 2021-12-14 魏松杰 Block link point access uplink method, related equipment and system

Also Published As

Publication number Publication date
CN110738497A (en) 2020-01-31

Similar Documents

Publication Publication Date Title
CN110738497B (en) Data processing method and device, node equipment and storage medium
Shah et al. The MDS queue: Analysing the latency performance of erasure codes
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
CN101547159B (en) Method and device for preventing network congestion
CN110248417B (en) Resource allocation method and system for communication service in power Internet of things
CN110555079B (en) Data processing method, device, equipment and storage medium
CN111641563B (en) Flow self-adaption method and system based on distributed scene
WO2022267715A1 (en) Oracle machine node screening method and apparatus, and storage medium and electronic apparatus
CN111565154A (en) Image identification request processing method and device, computer equipment and storage medium
US20150304227A1 (en) Queue Management Method and Apparatus
CN111538572A (en) Task processing method, device, scheduling server and medium
CN116703601B (en) Data processing method, device, equipment and storage medium based on block chain network
KR20230073315A (en) Resource scheduling method and system, electronic device, and computer readable storage medium
CN113961334B (en) Task processing method, device, equipment and storage medium
CN114675845A (en) Information age optimization method and device, computer equipment and storage medium
CN113778685A (en) Unloading method for urban gas pipe network edge computing system
CN112181672B (en) Block chain data processing method, block chain system and computer storage medium
CN114531401A (en) Token bucket flow limiting method based on priority
CN110618966A (en) Message processing method and device and electronic equipment
CN113132324B (en) Sample identification method and system
CN116401071B (en) Resource allocation method and system for edge calculation
CN115987685B (en) Cloud service data sharing method and system
CN117319422B (en) Block chain blocking method and system for Internet of things data in urban planning field
Mišić et al. Fast Cycle Multiple Entry PBFT Consensus
CN111865829B (en) Encryption and decryption method and device for service 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
GR01 Patent grant
GR01 Patent grant