WO2023020233A1 - 基于区块链的数据处理方法、装置、设备及存储介质 - Google Patents

基于区块链的数据处理方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023020233A1
WO2023020233A1 PCT/CN2022/108482 CN2022108482W WO2023020233A1 WO 2023020233 A1 WO2023020233 A1 WO 2023020233A1 CN 2022108482 W CN2022108482 W CN 2022108482W WO 2023020233 A1 WO2023020233 A1 WO 2023020233A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
business
chain
consensus
blockchain
Prior art date
Application number
PCT/CN2022/108482
Other languages
English (en)
French (fr)
Inventor
朱耿良
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to EP22857546.0A priority Critical patent/EP4318362A1/en
Publication of WO2023020233A1 publication Critical patent/WO2023020233A1/zh
Priority to US18/323,120 priority patent/US20230299984A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • 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
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/08Auctions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1059Inter-group management mechanisms, e.g. splitting, merging or interconnection of groups
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/46Secure multiparty computation, e.g. millionaire problem
    • H04L2209/466Electronic auction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the present application relates to the field of computer technology, in particular to a blockchain-based data processing method, a blockchain-based data processing device, a blockchain-based data processing device, a computer-readable storage medium, and A blockchain-based data computer program product.
  • blockchain is widely used in asset transfer, business data storage and other aspects due to its traceability.
  • the blockchain node After the blockchain node generates business data, it uploads the business data to the chain to ensure that the business data is traceable (that is, it cannot be tampered with after being on the chain).
  • the business data requested to be chained within a period of time is usually packaged in a block for chaining.
  • Practice has found that since a cross-chain business may be associated with multiple pieces of business data, the efficiency of processing cross-chain business is low.
  • a blockchain-based data processing method device, device, storage medium, and computer program product are provided.
  • the embodiment of the present application provides a blockchain-based data processing method
  • the blockchain contains at least one block
  • the blockchain is located in the blockchain network
  • the blockchain network includes a witness sub-network and a consensus Sub-network
  • the witness sub-network contains at least one business node
  • the consensus sub-network contains at least two consensus clusters
  • each consensus cluster includes multiple bookkeeping nodes
  • each consensus cluster recommends a bookkeeping node in its respective consensus cluster as a representative Node
  • the representative nodes of each consensus cluster form the consensus committee of the block chain
  • the method is executed by the first representative node in the consensus committee, and the first representative node is any representative node in the consensus committee
  • the data processing method is executed by computer equipment ,include:
  • the target block waiting for consensus in the blockchain network; the target block is generated based on cross-chain business data;
  • the on-chain instruction information indicates that the type of the next block to be on-chain in the blockchain is a joint exclusive type
  • the target block will be added to the blockchain as the next block to be on-chain in the blockchain;
  • Type blocks are used to store independent cross-chain business.
  • the embodiment of the present application provides a block chain-based data processing device, the block chain contains at least one block; the block chain is located in the block chain network, and the block chain network includes a witness sub-network and a consensus Sub-network, the witness sub-network contains at least one business node; the consensus sub-network contains at least two consensus clusters; each consensus cluster includes multiple bookkeeping nodes, and each consensus cluster recommends a bookkeeping node in its respective consensus cluster as a representative node; the representative nodes of each consensus cluster form the consensus committee of the blockchain; the data processing device can be carried in the first representative node in the consensus committee, and the first representative node is any representative node in the consensus committee; the data processing device ,include:
  • the obtaining unit is used to obtain the on-chain instruction information of the blockchain, and the on-chain instruction information is used to indicate the type of the next blockchain block to be uploaded; and is used to obtain the target block waiting for consensus in the blockchain network ;
  • the target block is generated based on cross-chain business data;
  • the processing unit is used to add the target block to the blockchain as the next block to be linked in the blockchain if the linking instruction information indicates that the type of the next block to be linked in the blockchain is a common exclusive type ; Among them, the block of common exclusive type is used to store independent cross-chain business.
  • this application provides a data processing device based on block chain, which includes:
  • processors for loading and executing computer readable instructions
  • a computer-readable storage medium where computer-readable instructions are stored in the computer-readable storage medium, and when the computer-readable instructions are executed by a processor, the above-mentioned blockchain-based data processing method is implemented.
  • the present application provides a non-volatile computer-readable storage medium storing computer-readable instructions, the computer-readable storage medium storing computer-readable instructions, the computer-readable instructions being adapted to be loaded by a processor and Execute the above-mentioned blockchain-based data processing method.
  • the present application provides a computer program product
  • the computer program product includes computer readable instructions
  • the computer readable instructions are stored in a computer readable storage medium.
  • the processor of the computer device reads the computer-readable instructions from the computer-readable storage medium, and the processor executes the computer-readable instructions, so that the computer device executes the above-mentioned blockchain-based data processing method.
  • Figure 1a shows a schematic diagram of the architecture of a data sharing system provided by an exemplary embodiment of the present application
  • Figure 1b shows a schematic structural diagram of a block chain provided by an exemplary embodiment of the present application
  • Fig. 1c shows a schematic flow chart of generating a block provided by an exemplary embodiment of the present application
  • Figure 1d shows a schematic diagram of a two-layer network architecture provided by an exemplary embodiment of the present application
  • Figure 1e shows a schematic diagram of another two-layer network architecture provided by an exemplary embodiment of the present application
  • Figure 1f shows a scene architecture diagram of an electronic invoice service based on a two-layer network provided by an exemplary embodiment of the present application
  • Fig. 2 shows a schematic flow diagram of a blockchain-based data processing method provided by an exemplary embodiment of the present application
  • FIG. 3 shows a schematic flow diagram of another blockchain-based data processing method provided by an exemplary embodiment of the present application
  • Fig. 4 shows a schematic diagram of a blockchain-based data processing scenario provided by an exemplary embodiment of the present application
  • Fig. 5 shows a schematic structural diagram of a blockchain-based data processing device provided by an exemplary embodiment of the present application
  • Fig. 6 shows a schematic structural diagram of a blockchain-based data processing device provided by an exemplary embodiment of the present application.
  • block chain is a computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. new application model. It is essentially a decentralized database, which is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of the information ( anti-counterfeiting) and generate the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the blockchain network can be understood as a data sharing system 100.
  • the data sharing system 100 can refer to a system for data sharing between nodes.
  • An exemplary structure of the data sharing system 100 can be seen in FIG. 1a;
  • the data sharing system 100 refers to a system for sharing data between nodes.
  • the data sharing system may include multiple nodes 101, and the multiple nodes 101 may refer to various clients in the data sharing system.
  • Each node 101 can receive input information during normal operation, and maintain shared data in the data sharing system based on the received input information.
  • there may be an information connection between each node in the data sharing system there may be an information connection between each node in the data sharing system, and information transmission may be performed between nodes through the above information connection.
  • nodes in the data sharing system when any node in the data sharing system receives input information, other nodes in the data sharing system will obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that in the data sharing system The data stored on all nodes are consistent.
  • each node in the data sharing system there is a node ID corresponding to it, and each node in the data sharing system can store the node IDs of other nodes in the data sharing system, so that according to the node IDs of other nodes, Broadcast the generated blocks to other nodes in the data sharing system.
  • Each node can maintain a node ID list as shown in the following table, and store the node name and node ID in the node ID list.
  • the node identification can be an IP (Internet Protocol, a protocol interconnected between networks) address and any other information that can be used to identify the node; for example, the node identification can also be a binary sequence code (such as 110001110), as shown In 1, only the IP address is used as an example for illustration:
  • Every node in the data sharing system stores an identical blockchain.
  • the blockchain is composed of multiple blocks. See Figure 1b.
  • the blockchain is composed of multiple blocks.
  • the founding block includes a block header and a block body.
  • the block header stores input information characteristic values, version numbers, and timestamps.
  • the input information is stored in the block body; the next block of the founding block takes the founding block as the parent block, and the next block also includes the block header and the block body, and the current block is stored in the block header
  • the stored block data is associated, which ensures the security of the input information in the block.
  • SHA256 is the eigenvalue algorithm used to calculate the eigenvalue
  • version (version number) is the version information of the relevant block protocol in the blockchain
  • prev_hash is the block header eigenvalue of the parent block of the current block
  • merkle_root is the input information
  • ntime is the update time of the update timestamp
  • nbits is the current difficulty, which is a fixed value for a period of time, and will be determined again after a fixed period of time
  • x is a random number
  • TARGET is the threshold of the feature value, the feature The value threshold can be determined according to nbits.
  • the node where the blockchain is located broadcasts the newly generated block to other nodes in the data sharing system where it is located according to the node identification of other nodes in the data sharing system, and other nodes perform consensus verification on the newly generated block , and add the newly generated block to its stored blockchain after completing the consensus verification.
  • the nodes can perform consensus verification on the newly generated blocks through the consensus algorithm.
  • the consensus algorithm can include but not limited to:
  • Proof of work refers to the measurement method set by the system (such as the aforementioned data sharing system) to achieve a certain goal.
  • a simple understanding is a proof to confirm the workload. In essence, whoever does more work has a better chance of getting extra rewards. Proof of work is commonly known as "mining”. Through AND or operation, a random number that meets the rules is calculated, that is, the right to bookkeeping is obtained this time, and the data that needs to be recorded in this round is issued. After verification by other nodes in the blockchain network store together. This makes the workload proof have the following advantages: complete decentralization, and nodes are free to enter and exit.
  • the DPos share authorization certification mechanism is similar to board voting. People who hold electronic resources vote for a certain number of nodes, and perform verification and bookkeeping on their behalf. In order to motivate more people to participate in the election, the system will generate a small amount of electronic resources as rewards.
  • the DPos share authorization proof mechanism is to allow everyone who holds BitShares to vote, resulting in 101 representatives, which we can understand as 101 supernodes or mining pools, and the rights of these 101 supernodes are completely independent from each other. equal. From a certain point of view, the DPos share authorization proof mechanism is a bit like a parliamentary system or a people's congress system.
  • the pbft Byzantine fault-tolerant algorithm is a consensus algorithm based on message passing.
  • the algorithm reaches consensus through three stages, and these stages may be repeated due to failure. Specifically, assuming that the total number of nodes is 3f+1, and f is a Byzantine error node, first, when the node finds that the leader (such as a representative node, accounting node or super node) is doing evil, it elects other replicas (nodes) through the algorithm as leader. Secondly, the leader broadcasts its selected value (value) to other replica nodes through the pre-prepare (pre-prepare) message. If other replica nodes accept it, they will send the prepare (prepare) message, and if they do not accept it, they will not send it.
  • the leader such as a representative node, accounting node or super node
  • the Paxos algorithm is a two-stage algorithm, which mainly has three types of roles, proposer (proposer), acceptor (receiver), and learner (learner).
  • the proposer proposes a proposal, the acceptor agrees or rejects it, and the learner obtains the final value after reaching a consensus.
  • the Paxos algorithm includes two phases, which are: 1 Preparation phase: the proposer selects a proposal number n and sends the prepare (preparation) request to a majority of the acceptors; after the acceptor receives the prepare request, if the proposal number is greater than it already For all prepare requests that are replied, the acceptor will reply to the proposer with the proposal it accepted last time, and promise not to reply to proposals smaller than n.
  • 2Approval stage When a proposer receives most acceptors’ replies to the prepare request, it enters the approval stage; it will send an accept (accept) request to the acceptors that reply to the prepare request, including the number n and value (if there is no accepted value , then it can freely decide the value); on the premise of not violating its commitment to other proposers, the acceptor accepts the request after receiving the accept request.
  • the Paxos algorithm is suitable for a simple fault-tolerant model, that is, there may only be failed or faulty nodes in the system, and there are no malicious nodes. If the number of failed nodes is x (x is a positive integer), then only the number of unfailed nodes is x+1. Maintain the normal operation of the system.
  • the Raft algorithm contains three roles: follower, candidate and leader.
  • a node can only be in one of these three states at a certain moment, and these three roles can be converted to each other as time and conditions change.
  • the initial state of all nodes is follower.
  • the follower who has not received the heartbeat packet after the timeout will turn into a candidate and broadcast a voting request.
  • the node that has won the majority of votes will become a leader.
  • Whoever sends out the first round of voting will benefit. Nodes will only give one vote.
  • the leader node periodically sends heartbeat packets to other nodes, and the failure of the leader node will trigger a new round of voting.
  • the embodiment of this application provides a double-layer chain, through P2P (Peer to Peer, point-to-point)
  • P2P Peer to Peer, point-to-point
  • the network forms a two-layer network architecture of "witness sub-network-consensus sub-network".
  • the P2P network is a network of point-to-point connections, and each node connected by point-to-point connection is called a peer node.
  • the P2P network is based on a specific network protocol, so that there is no need for a central node to maintain the network state between the peer nodes.
  • Each node maintains the node state of the entire network and its communication with adjacent nodes The connection status of neighboring nodes.
  • Figure 1d shows an architecture diagram of a two-layer network provided by an exemplary embodiment of the present application
  • the blockchain network includes a witness subnetwork and a consensus subnetwork, and service nodes are deployed on In the witness sub-network, the consensus sub-network is deployed with accounting nodes running the blockchain consensus protocol; the witness sub-network and the consensus sub-network interact through the routing boundary indicated by the dotted line.
  • the business nodes in the witness sub-network mainly perform business execution and do not participate in the bookkeeping consensus, and obtain block header data and partially authorized and visible block data from the consensus sub-network through identity authentication.
  • the consensus sub-network is the core network in the blockchain network, which is used for bookkeeping consensus on the blockchain network.
  • the witness sub-network and the consensus sub-network are in different network environments, the witness sub-network is in the public network, and the consensus sub-network is in the private network. Since the consensus sub-network is in a relatively secure private network, there is a consensus mechanism for mutual access to ensure security, and no additional identity management and network control are required.
  • the business nodes are in the public network and may be accessed by other uncertain network terminals. Therefore, the behavior of business nodes and other possible nodes accessing the consensus sub-network needs to be strictly controlled.
  • these bookkeeping nodes in the consensus sub-network can also be divided into multiple consensus clusters, that is, multiple consensus clusters can be deployed in the consensus sub-network, and each consensus cluster can include At least one accounting node.
  • Consensus clusters can be divided according to different rules. The rules can include: division according to business types, such as accounting nodes that process business data of the same business type are divided into the same consensus cluster; The distance divides the consensus cluster, such as dividing two or more accounting nodes whose distance is less than the distance threshold into the same consensus cluster, and so on.
  • the architecture of the two-layer blockchain network can be changed to Figure 1e.
  • the blockchain network includes a witness subnetwork and a consensus subnetwork, and multiple consensus subnetworks are deployed in the consensus subnetwork.
  • Cluster each consensus cluster contains at least one bookkeeping node; any business node in the witness subnetwork can carry out information connection with the bookkeeping node deployed by a certain consensus cluster in the consensus subnetwork.
  • each consensus cluster can be used to provide consensus services for business data of one or more business types.
  • Consensus cluster 1 in Figure 1e can be a cluster that provides consensus services for business data of the invoice business type, that is, each accounting node in the consensus cluster 1 only performs consensus processing for invoice data;
  • consensus cluster 2 can be for A cluster that provides consensus services for business data of the credit investigation type, that is, each accounting node in the consensus cluster 2 only conducts consensus processing for business data related to credit investigation; and so on.
  • each consensus cluster jointly maintains a blockchain in the blockchain network, which is called the main chain, which contains all the information of all business ecology in the blockchain network.
  • each consensus cluster can organize its own business blockchain sub-chain, and the blockchain sub-chain in each consensus cluster only contains the information of each consensus cluster's own business.
  • Each consensus cluster can recommend a bookkeeping node as a representative node in their respective consensus clusters; among them, the representative node not only participates in the consensus processing of the blockchain sub-chain in the consensus cluster to which it belongs, but also participates in the consensus on the main chain deal with.
  • the non-representative nodes in the consensus cluster that is, the accounting nodes other than the representative nodes in the consensus cluster, only participate in the consensus processing of the blockchain sub-chains within the consensus cluster.
  • the representative nodes elected by each consensus cluster jointly form the consensus committee of the main chain, and jointly carry out consensus processing on the main chain.
  • the blockchain network includes: business layer, routing proxy layer, and core consensus network layer.
  • the business layer, routing proxy layer, and core consensus network layer form the entire blockchain business system; among them, 1 business layer
  • the business layer includes at least one business node.
  • the business node can be an SPV node.
  • the SPV node maintains a normal unstructured P2P network.
  • the business node can handle (local tax bureau) taxation, bills (enterprise billing), payment (corporate capital flow) and other services.
  • the core consensus network layer is in the consensus sub-network.
  • the core consensus network layer includes various consensus clusters, such as consensus cluster 102, consensus cluster 103, ..., etc., and each consensus cluster maintains the block chain sub-chain in the cluster, for example , the consensus cluster 102 maintains the core chain 1 in the cluster, and the consensus cluster 103 maintains the core chain 2 in the cluster.
  • the routing proxy layer includes at least one proxy node, which can provide routing services, authentication services, certificate cache services, peer-to-peer (P2P) services, etc.; wherein, the certificate cache service involves a certificate system (PKI, Public Key Infrastructure).
  • PKI Public Key Infrastructure
  • a certificate is the identity proof of a public key owner, which is issued by an authority (CA).
  • asymmetric encryption and digital signature for information can be realized.
  • the information interaction between the business layer and the core consensus network layer is through the routing proxy layer, that is, the business layer submits business operation interactions to the core consensus network layer through the routing proxy layer, so that the routing proxy layer isolates the business layer from the core consensus network layer effect.
  • This solution can be executed by the first representative node in the consensus committee shown in Figure 1e, and the first representative node can be any representative node in the consensus committee.
  • the representative node may specifically be a terminal device or a server.
  • the terminal equipment may include but not limited to: smart phones (such as Android mobile phones, IOS mobile phones, etc.), tablet computers, portable personal computers, mobile Internet devices (Mobile Internet Devices, MID for short), etc. Do limited.
  • the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, intermediate Cloud servers for basic cloud computing services such as email service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platforms, which are not limited in this embodiment of the application.
  • cloud services cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, intermediate Cloud servers for basic cloud computing services such as email service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platforms, which are not limited in this embodiment of the application.
  • the blockchain contains at least one block, such as M interlinked blocks, where M is a positive integer;
  • the blockchain is located in the blockchain network, see Figure 1e, the blockchain network Including the witness sub-network and the consensus sub-network, the witness sub-network contains at least one business node;
  • the consensus sub-network contains at least two consensus clusters, for example, it can contain N consensus clusters, N is an integer greater than 1;
  • each consensus cluster consists of multiple Accounting nodes, each consensus cluster recommends an accounting node as a representative node in its own consensus cluster, then N consensus clusters can recommend N representative nodes;
  • N representative nodes form the consensus committee of the blockchain; based on
  • the data processing method of the blockchain is executed by the first representative node in the consensus committee, and the first representative node is any representative node in the consensus committee;
  • the general principle of the data processing scheme based on the blockchain is as follows:
  • the first representative node obtains the uplink indication information of the M+1th block of the blockchain, and the uplink indication information is used to indicate the next block to be uplinked in the blockchain, that is, the M+1th block
  • the type of the block such as common exclusive type, exclusive type, common type, etc.
  • the on-chain indication information of the M+1th block is generated based on the auction result information of the M+1th block
  • the M+1th block The bidding result information of the block is processed by consensus on the bidding information of the M+1th block by each representative node in the blockchain network (for example, according to the bidding information, it is determined that the second party with the proposal authority of the M+1th block representative node); the auction result information of the M+1th block carries the type of the M+1th block; the bidding information is in the process of uploading the Mth block (consensus) If the representative node that needs to bid for the M+1th block broadcasts to other representative nodes in the blockchain network, the bidding information is used to bid for the proposal authority of
  • the first representative node obtains the target block waiting for consensus in the blockchain network.
  • the target block is the representative node that has obtained the proposal authority of the M+1 block in the blockchain network.
  • the business data to be linked to the +1 block (that is, the business data indicated by the representative node in the bidding information that needs to be packaged in the M+1th block) is packaged and broadcast to the blockchain network of each representative node.
  • the consensus verification of the target block is performed according to the consensus rules of the common exclusive type (that is, each representative node independently checks the block according to the consensus rules The target block is verified, and then the final verification result is determined according to its own verification result and the verification results of the target block broadcast by other representative nodes in the blockchain network); among them, the common exclusive type of block is used to store Independent cross-chain business, each cross-chain business is an independent cross-chain business, each cross-chain business is participated by at least two business parties, and each business party will provide at least one piece of business data to be deposited (that is, each Co-exclusive blocks are used to store business data associated with a cross-chain business); consensus rules are used to verify whether the target block meets the on-chain conditions (such as verifying whether the business data in the target block belongs to the same cross-chain business) Chain business, whether the business party of the target block matches the identifiers of multiple co-exclusive parties of the M+1th block indicated
  • the target block passes the consensus verification, the target block is added to the blockchain as the M+1th block (that is, the target block is uploaded to the chain to obtain an updated blockchain).
  • the on-chain instruction information of the M+1th block of the blockchain is obtained, and the target block waiting for consensus in the blockchain network, if the on-chain instruction information indicates the M+1th block
  • the type of the common exclusive type is the common exclusive type
  • the consensus verification of the target block will be performed according to the common exclusive type consensus rules.
  • the common exclusive type of block is used to store independent cross-chain services. If the target block passes the consensus verification, the target block The block is added to the blockchain as the M+1th block. It can be seen that when it comes to cross-chain interaction, the relevant business data of independent cross-chain business is stored in one block through common exclusive blocks, which can improve the verification of multiple blocks when verifying cross-chain business. In this way, the verification efficiency of cross-chain business is improved, and the processing efficiency of cross-chain business is improved.
  • the embodiment of this application proposes a more detailed block chain-based data processing method.
  • the block chain-based data processing method proposed in the embodiment of this application will be described below in conjunction with the accompanying drawings for details.
  • Fig. 2 shows a schematic flow diagram of a block chain-based data processing method provided by an exemplary embodiment of the present application; wherein, the block chain contains at least one interlinked block; the block chain is located in the block chain
  • the blockchain network includes a witness subnetwork and a consensus subnetwork.
  • the witness subnetwork includes at least one business node; the consensus subnetwork includes at least two consensus clusters; each consensus cluster includes multiple bookkeeping nodes , each consensus cluster recommends a bookkeeping node as a representative node in its respective consensus cluster; the representative nodes of each consensus cluster form the consensus committee of the blockchain; the data processing method based on the blockchain is determined by the first representative in the consensus committee Node execution, the first representative node is any representative node in the consensus committee; the data processing method based on blockchain may include but not limited to steps S201-S203:
  • the on-chain indication information is used to indicate the information of the next block to be on-chain in the blockchain, specifically indicating the type of the next block to be on-chain, such as common exclusive type, exclusive type, common type, etc.
  • the block chain contains M interlinked blocks, M is an integer greater than 1, the consensus sub-network contains N consensus clusters, and N is an integer greater than 1, then N consensus clusters recommend N Represents a node.
  • the chaining instruction information can indicate the type of the M+1th block, such as the common exclusive type , exclusive type, common type, etc.; the on-chain instruction information of the M+1th block is generated based on the auction result information of the M+1th block; the auction result information of the M+1th block is generated by the district
  • Each representative node in the block chain network performs consensus processing on the bidding information of the M+1th block (such as determining the second representative node with the proposal authority of the M+1th block according to the bidding information); the Mth The bidding result information of the +1 block carries the type of the M+1th block.
  • the bidding information is broadcast by the representative node that needs to bid for the next block to other representative nodes in the blockchain network during the process of uploading the current block.
  • the bidding information is broadcast by the representative node that needs to bid for the M+1th block to other representative nodes in the blockchain network during the chaining (consensus) process of the Mth block.
  • the bidding information carries the relevant information of the business data that needs to be packaged in the M+1th block (such as the business data packaged in the M+1th block quantity, the identification of the business party associated with the M+1th block, the type of business data packaged in the M+1th block, etc.); the representative node that has obtained the proposal authority of the M+1th block can According to the bidding information of the representative node, the target block waiting for consensus is generated (that is, the business data reported in the bidding information is packaged to generate the target block waiting for consensus).
  • the first representative node is specifically a computer device, and the computer device obtains the uplink indication information of the blockchain.
  • the uplink indication information is used to indicate the type of the next block to be uplinked in the blockchain.
  • the indication information can determine the type of the next block that needs to be uploaded in the blockchain.
  • the target block waiting for consensus is obtained by packaging the block data to be linked to the next block to be linked by the representative node with the proposal authority of the block.
  • the target block is generated based on the cross-chain business data, that is, the target block is obtained by packaging the business data of the cross-chain business.
  • each cross-chain business is an independent cross-chain business, and each cross-chain business is participated by at least two business parties, and each business party will provide at least one piece of business data to be deposited, that is to say, each common exclusive type
  • the block is used to store the business data associated with a cross-chain business.
  • the target block waiting for consensus can be the block associated with the M+1th block to be on-chain
  • the block data that is, the business data indicated by the representative node in the bidding information that needs to be packaged in the M+1th block
  • the representative node with the proposal authority for the block is obtained from the blockchain network
  • the representative node of the packaging authority to the M+1th block that is, the authority to generate the target block waiting for consensus).
  • the representative node with the proposal authority can obtain the deposit information of one or more business data associated with the M+1th block from the resource pool of the blockchain network, specifically including cross-chain business data, and generate target blocks waiting for consensus based on the certificate information of these business data.
  • the representative node with the proposal authority After the representative node with the proposal authority generates the target block, it will broadcast the target block to each representative node in the blockchain network.
  • the first representative node can obtain the waiting consensus through the broadcast of the representative node with the proposal authority target block.
  • the computer device obtains the target block waiting for consensus in the blockchain network.
  • the target block can be generated by the representative node with the proposal authority according to the cross-chain business data, and the representative node with the proposal authority can generate the target block Broadcasting is performed so that the target block is obtained by the computer device.
  • on-chain indication information indicates that the type of the next block to be on-chain in the blockchain is a common exclusive type, then add the target block to the blockchain as the next block to be on-chain in the blockchain; wherein, Co-exclusive blocks are used to store independent cross-chain services.
  • the types of blocks can include co-exclusive types, and each co-exclusive type of block is used to store an independent cross-chain business.
  • Each cross-chain business is an independent cross-chain business, each cross-chain business is participated by at least two business parties, and each business party will provide at least one piece of business data to be deposited
  • the block is used to store the business data associated with a cross-chain business); for example, business party A and business party B participate in cross-chain business 1, business party B and business party C participate in cross-chain business 2, business party A, business Party B and business party C jointly participate in cross-chain business 3, then cross-chain business 1-cross-chain business 3 are three independent cross-chain businesses, that is to say, cross-chain business 1-cross-chain business 3 are stored in three different In the block of common exclusive type, the business data associated with cross-chain business 1 cannot be stored in the block used to store the business data associated with cross-chain business 2 or cross-chain business 3.
  • the business data associated with cross-chain business 2 Data cannot be stored in the block used to store the business data associated with cross-chain business 1 or cross-chain business 3
  • the business data associated with cross-chain business 3 cannot be stored in the block used to store cross-chain business 1 or cross-chain business 2 In the block of business data.
  • the computer The device can add the target block to the blockchain as the next block to be uploaded to the blockchain, so as to process the target block on the chain.
  • the computer equipment can perform consensus verification on the target block according to the consensus rules of the common exclusive type, and after the consensus verification is passed, the target block is added to the blockchain as the next block to be uploaded to the block chain. On the block chain, so as to ensure the accuracy of the block chain.
  • the consensus rules are used to verify whether the target block meets the on-chain conditions, and the on-chain conditions can be determined according to the on-chain instruction information (such as verifying whether the business data in the target block belongs to the same cross-chain business, the target block’s Whether the business party matches the identifiers of multiple co-exclusive parties of the M+1th block indicated by the uplink indication information, etc.).
  • the first representative node verifies the target block according to the consensus rules, and then according to its own verification results and the target block broadcast by other representative nodes in the blockchain network except the first representative node
  • the verification result determines the final consensus verification result.
  • Passing the consensus verification of the target block means that the first representative node determines that the target block satisfies On-chain conditions.
  • the first representative node records the target block as the M+1th block of the blockchain.
  • the target block generated according to the cross-chain business data is added to the blockchain, which can avoid separate processing of multiple blocks during cross-chain business processing. Carry out cross-chain business data processing, effectively realize the isolation processing of cross-chain business, reduce the interactive processing between multiple blocks, thereby improving the processing efficiency of cross-chain business.
  • the on-chain instruction information of the blockchain is obtained, and the target block generated according to the cross-chain business data waiting for consensus in the blockchain network is obtained. If the on-chain instruction information indicates that the next blockchain to be on-chain If the block type is a common and exclusive type used to store independent cross-chain services, then the target block will be added to the blockchain as the next block to be uploaded to the blockchain. It can be seen that when it comes to cross-chain interaction, storing the relevant business data of independent cross-chain business in one block through the block of common exclusive type can improve the processing of cross-chain business. In this case, the relevant business data in the chain is interactively processed, thereby improving the processing efficiency of cross-chain business.
  • the target block is added to the blockchain as the next block to be on-chain in the blockchain above, including: if the on-chain indication information indicates that the type of the next block to be on-chain in the blockchain is a common exclusive type, then the target block will be verified by consensus according to the consensus rules of the common exclusive type; if the target block passes the consensus If it is verified, the target block will be added to the blockchain as the next block to be uploaded to the blockchain.
  • the consensus rules are used to verify whether the target block meets the on-chain conditions.
  • the on-chain conditions can be determined according to the on-chain instruction information, such as including but not limited to checking whether the business data in the target block belong to the same cross-chain Whether the business, the business party of the target block matches the identifiers of multiple co-exclusive parties of the M+1th block indicated by the on-chain instruction information, etc.
  • the target block passing the consensus verification means that the first representative node determines that the target block satisfies the above requirements based on its own verification results and the verification results of the target block broadcast by other representative nodes in the blockchain network except the first representative node. If the chain condition is met, the target block can be chained into the blockchain.
  • the computer device can query the joint exclusive Type consensus rules.
  • the computer equipment performs consensus verification on the target block according to the consensus rules of the common exclusive type. If the consensus verification passes, the computer equipment adds the target block to the blockchain as the next block to be uploaded to the blockchain. In this way, the on-chain processing of the target block is realized.
  • the computer device performs consensus verification on the target block according to the consensus rules of the common exclusive type, and adds the target block to the block chain when the consensus verification passes, so as to ensure that the target block meets the on-chain conditions , which ensures the success rate of uploading the target block to the chain.
  • Fig. 3 shows a schematic flow chart of another blockchain-based data processing method provided by an exemplary embodiment of the present application; wherein, the blockchain contains M interlinked blocks, and M is a positive integer;
  • the block chain is located in the block chain network.
  • the block chain network includes a witness sub-network and a consensus sub-network.
  • the witness sub-network contains at least one business node; the consensus sub-network contains N consensus clusters, where N is greater than 1 Integer; each consensus cluster is composed of multiple bookkeeping nodes, and each consensus cluster recommends a bookkeeping node as a representative node in its own consensus cluster; N representative nodes form the consensus committee of the blockchain; the method is determined by the consensus committee Executed by the first representative node, the first representative node is any representative node in the consensus committee; the blockchain-based data processing method may include but not limited to steps S301-S305:
  • the auction result information is used to indicate the second representative node that has obtained the proposal authority for the next block to be uploaded in the blockchain, and the second representative node Submitted bidding information for the next block to be uploaded on the blockchain.
  • the auction result information of the next block to be uploaded in the blockchain is obtained by consensus processing of the bidding information of the next block to be uploaded in the blockchain by each representative node in the blockchain network.
  • the information is determined to be submitted by the second representative node that has the proposal authority for the next block to be uploaded.
  • the auction result information may indicate the second representative node that has obtained the proposal authority for the next block to be uploaded in the blockchain, and the bidding information submitted by the second representative node for the next block to be uploaded in the blockchain.
  • the auction result information of the M+1th block is processed by consensus on the bidding information of the M+1th block by each representative node in the blockchain network (for example, according to The bidding information is obtained after determining the second representative node with the proposal authority of the M+1th block); the bidding result information of the M+1th block carries the type of the M+1th block.
  • the bidding information is broadcasted by the representative node that needs to bid for the M+1th block to other representative nodes in the blockchain network during the chaining (consensus) process of the Mth block.
  • the bidding information is used for Proposal authority to bid for the M+1th block (bid for a block of exclusive type or co-exclusive type); the bidding information carries relevant information about the business data that needs to be packaged in the M+1th block (such as packaged in The number of business data in the M+1th block, the identification of the business party associated with the M+1th block, the type of business data packaged in the M+1th block, etc.); get the M+th
  • the representative node with the proposal authority of 1 block can generate the target block waiting for consensus according to the bidding information of the representative node (that is, pack the business data reported in the bidding information to generate the target block waiting for consensus); for example, When the representative node 1 needs to deposit the 1000 business data to be deposited associated with the representative node, it broadcasts the bidding information 1 to the consensus committee
  • the bidding transaction specifies the identity of the representative node requesting the proposal authority of the M+1th block, and the amount of business data to be stored in the M+1th block.
  • the consensus committee agrees on the bidding transaction, whether the number of business data to be stored in the resource pool meets the specified number of the bidding transaction; for example, suppose the bidding transaction specifies that the second representative node should be in the M+1th block Putting in 1000 exclusive type business data, the consensus committee’s consensus on the auction transaction includes: checking whether there are more than 1000 exclusive type business data or common type business data from the second representative node in the transaction pool.
  • the business parties participating in the cross-chain business will randomly negotiate a representative node, carrying the signatures of each business party participating in the cross-chain business, to bid for a common exclusive type of area piece.
  • the bidding information includes the identification of the business party that jointly occupies the M+1th block, the amount of business data that each business party needs to put in the M+1th block, etc.; for example, consensus cluster 1-consensus cluster 3 jointly participated in the completion of the cross-chain business 1, and the consensus cluster 1-consensus cluster 3 can determine the representative node 1 of the consensus cluster 1 through negotiation to represent the consensus cluster 1-consensus cluster 3 to apply for storing cross-chain business 1
  • the representative node of the block of the common exclusive type of business data, the bidding information 1 generated by representative node 1 includes the identification of the representative node of consensus cluster 1-consensus cluster 3, and consensus cluster 1-consensus cluster 3 (that is, each business party ) the amount of business data that needs to be placed in the M+1th block, etc.
  • the bidding information includes at least one of the quantity of business data to be packaged in the next block to be uploaded on the blockchain, the business party ID associated with the business data, or the type of business data.
  • the target block also stores the business data to be deposited for each business party among multiple business parties.
  • the target block is associated with the target business, and the service party ID associated with the business data refers to the target business ID.
  • the type of business data refers to the type of cross-chain business data to be packaged in the next blockchain block to be uploaded.
  • the bidding information includes at least one of the quantity of business data to be packaged in the next blockchain block to be uploaded, the business party identifier associated with the business data, or the type of business data. According to the bidding information, it can Generate corresponding on-chain instruction information to perform consensus verification on the target block through the on-chain instruction information to ensure the accuracy of cross-chain business data processing.
  • the bidding information includes the waiting time and the amount of bidding resources, and the bidding result information.
  • the consensus committee checks the bidding information based on the waiting time and the amount of bidding resources in the bidding information, and when the consensus of the bidding information Generated after the verification is successful.
  • the consensus committee conducts a consensus check on the bidding information based on the waiting time and the amount of bidding resources in the bidding information sent by each representative node (such as checking whether there is a pending auction indicated by the bidding information in the resource pool in the blockchain network. certificate business data, whether the number of certificate business data to be stored in the resource pool in the blockchain network satisfies the quantity indicated by the bidding information, etc.).
  • the bidding information can include the identification of the business parties participating in the cross-chain business, and the number of business data that each business party needs to package in the M+1th block.
  • the consensus The committee can check whether the business party indicated by the bidding information participates in the cross-chain business, and can also check with each business party whether the amount of business data that needs to be packaged in the M+1th block is accurate, etc.
  • the bidding information consensus verification is successful, the bidding result information is generated.
  • the consensus committee based on the waiting time and the amount of bidding resources in the bidding information, the consensus committee generates the bidding result information after performing consensus verification on the bidding information, thereby ensuring the authority and validity of the bidding result information and ensuring Data processing is carried out in an orderly manner.
  • the bidding information is at least obtained through a weighted operation based on the waiting time and the amount of bidding resources.
  • the bidding information includes the waiting time and the amount of bidding resources.
  • the bidding information can be calculated according to the waiting time, the amount of bidding resources and their corresponding weights, and then summed.
  • the waiting time is inversely proportional to the amount of bidding resources (that is, the longer the waiting time , the less bidding resources are required, and the shorter the waiting time, the more bidding resources are required).
  • the waiting time refers to the length of time from the time when the target representative node requests to obtain the proposal permission of the block to the current moment (the target representative node has not obtained the proposal permission of the block during the period), and the target representative node can be any representative node in the formula committee ;For example, if the representative node 1 requested to obtain the proposal permission of the block 10 minutes ago, and the representative node 1 did not obtain the proposal permission of the block within 10 minutes, the waiting time of the representative node 1 is 10 minutes; It means that node 2 requested to obtain the proposal authority of the block 30 minutes ago, and it means that node 2 obtained the proposal authority of the block 17 minutes ago, and obtained the proposal authority of the block again 8 minutes ago, which means that node 2 is waiting The duration is 8 minutes.
  • Bidding resources can be set according to actual conditions. For example, bidding resources can be composed of one or more of the following: physical resources, virtual items, the number of business data to be deposited, and so on.
  • the bidding information is obtained through the weighted calculation of the waiting time and the amount of bidding resources, so that the waiting time and the amount of bidding resources can be effectively balanced to ensure the distribution effect of the proposal authority and ensure the orderly processing of data based on the blockchain. .
  • the bidding information is obtained by performing weighted calculations according to weights corresponding to the waiting time, bidding resource amount, and service priority.
  • Different representative nodes can correspond to different priorities (taking the tax bureau as an example, the business (billing) priority of the national tax bureau is higher than the business (billing) priority of the municipal tax bureau, and the business (bill) priority of the municipal tax bureau higher than the business (invoicing) priority of the county-level tax bureau), the higher the business priority, the greater the corresponding weight, and the bidding information can be obtained through the calculation of the waiting time, the amount of bidding resources, and the weight corresponding to the business priority.
  • the bidding information is obtained by weighting the waiting time and the amount of bidding resources according to the weight corresponding to the business priority, so that the business priority can be used to effectively balance the waiting time and the amount of bidding resources to ensure the authority of the proposal
  • the distribution effect ensures the orderly progress of data processing based on blockchain.
  • the bidding resource corresponding to the bidding resource amount includes at least one of physical resources, virtual items, or the quantity of business data to be deposited.
  • the amount of bidding resources corresponding to the amount of bidding resources can be set according to actual needs, specifically including but not limited to the number of physical resources, virtual items, or business data to be deposited. By setting different bidding resources, it can be applied to different application scenarios, thereby expanding the applicable scenarios of the blockchain-based data method.
  • the first representative node and the second representative node are different representative nodes.
  • Obtaining the auction result information of the next block to be uploaded in the blockchain including: in the process of consensus on the block at the end of the blockchain, receiving the submission of the second representative node for the next pending block in the blockchain.
  • the bidding information of the block on the chain, the bidding information is used to request the proposal permission of the next block to be chained in the blockchain; to perform consensus verification on the bidding information; and to receive the bidding result information broadcast by the consensus committee.
  • the end position refers to the position of the last block in the blockchain.
  • the block at the end of the blockchain is the Mth block. blocks.
  • the first representative node receives the bidding information for the M+1th block submitted by the second representative node, and the bidding information is used for Request to obtain the proposal permission of the M+1th block; the first representative node performs consensus verification on the bidding information, and receives the bidding result information broadcast by the consensus committee (other representative nodes except the first representative node), and will repeat
  • the bidding result information with the highest rate is determined as the final bidding result information; for example, suppose that among the bidding result information obtained by the first representative node, the repetition rate of bidding result information 1 generated according to bidding information 1 is 95%, and the repetition rate of bidding result information 1 generated according to bidding information 2 The repetition rate of the bidding result information 2 is 3%, and the repetition rate of the bidding result information 3
  • the first representative node when the first representative node and the second representative node are different representative nodes, the first representative node receives the bidding information of the second representative node, and performs consensus verification based on the bidding information to receive the broadcasted bidding result Information, so as to ensure that the obtained auction result information is broadcast by the second representative node with proposal authority, and ensure the accuracy of the auction result information.
  • the first representative node and the second representative node are the same representative node.
  • the bidding information for the next block to be uploaded to the blockchain is submitted to the consensus committee, and the bidding information is used to request the next blockchain to be uploaded Proposal permissions for chain blocks; consensus verification of bidding information; and receiving bidding result information broadcast by the consensus committee.
  • the end position refers to the position of the last block on the chain in the blockchain.
  • the first representative node submits bidding information for the M+1th block to the consensus committee, and the bidding information is used to request to obtain the Proposal authority for M+1 blocks; the first representative node conducts consensus verification on the bidding information, and receives the bidding result information broadcast by the consensus committee (other representative nodes except the first representative node), and the one with the highest repetition rate
  • the bidding result information is determined as the final bidding result information.
  • the broadcasted bidding result information is received, so as to ensure that the obtained bidding result information is Broadcasted by the first representative node with proposal authority to ensure the accuracy of the auction result information.
  • the first representative node determines the second representative node (that is, the representative node with the authority to propose the M+1th block) according to the bidding result information, and generates the second representative node according to the bidding information broadcast by the second representative node.
  • the on-chain indication information of the M+1 block for example, the first representative node can directly use the bidding information broadcast by the second representative node as the on-chain indication information of the M+1th block; Extract part of the data from the broadcast bidding information (such as the identification of the business party associated with the M+1th block, the number of business data to be deposited by each business party, etc.), and generate the M+1th block based on the extracted data On-chain instruction information of the block.
  • the on-chain instruction information is generated, specifically using the information submitted by the second representative node indicated by the bidding result information for the next block to be chained in the blockchain
  • the auction information of the block generates on-chain indication information, which can accurately obtain the on-chain indication information of the next block to be on-chain in the blockchain, so as to accurately determine the type of the next block to be on-chain in the blockchain.
  • generating the link indication information of the next block to be linked in the blockchain according to the bidding result information includes: extracting the bidding information from the bidding result information; On-chain indication information of a block to be on-chain.
  • the auction result information carries the auction information
  • the computer device extracts the auction information from the obtained auction result information, and generates the on-chain indication information of the next blockchain block to be uploaded based on the obtained auction information, so as to pass
  • the on-chain indication information determines the type of the next block to be on-chain in the blockchain.
  • by extracting the bidding information from the bidding result information to generate on-chain instruction information it is possible to determine the type of the next block to be on-chain in the blockchain according to the bidding information submitted by the second representative node with proposal authority , to ensure that the next block to be uploaded in the blockchain can be processed in an orderly manner.
  • the first representative node and the second representative node are different representative nodes, and the first representative node obtains the target block waiting for consensus broadcast by the second representative node.
  • the first representative node and the second representative node are the same representative node, and the first representative node obtains the cross-chain business data of each business party of the target business from the resource pool in the blockchain network, And generate the target block according to the cross-chain business data of each business party.
  • the first representative node determines whether the auction transaction result information is packaged in the Mth block during the consensus process of the Mth block. If the auction transaction result information is packaged in the Mth block, then According to the auction transaction result information, the on-chain instruction information of the M+1th block is generated.
  • the first representative node obtains the cross-chain business data of each business party of the target business from the resource pool in the blockchain network, and generates the target block, so that the efficient processing of the cross-chain business data can be realized.
  • the M+1th block can only store the exclusive type of business data and common type of business data (preferentially put exclusive type of business data, and then put in common type of business data to fill the target block (that is, the number of business data in the M+1th block satisfies the above The number indicated by the chain indication message)).
  • a bidding resource deduction service for the M+1th block is added, and the deduction service and business data are packaged into a target block.
  • the M+1th block can only store the cross-chain business indicated by the bidding transaction result information Associated co-exclusive business data.
  • the M+1th block is used to store normal type business data in the resource pool, and Transactions such as global on-chain configuration updates.
  • the smart contract is changed, and the changed smart contract is used to determine the type of the target block as Ordinary type (that is, after T blocks of exclusive type or common exclusive type are continuously generated in the blockchain, a block of ordinary type must be generated), and T is a positive integer.
  • Exclusive type of business data exclusive type of business data can only be placed in exclusive type blocks.
  • Business data of the common exclusive type it can only be placed in the block of the common exclusive type, and the block of the common exclusive type is used to store the data of the common exclusive type associated with the cross-chain business jointly participated by 2 to N business parties business data.
  • the co-exclusive type of business data associated with the cross-chain business can be a specially marked business data, which carries the blockchain sub-chain (private chain maintained by each consensus cluster) of the party participating in the cross-chain business Identification, the identification of each business party (such as the address of each business party, and the signature information of each business party, etc.).
  • Ordinary type business data Ordinary type business data can be placed in both common type blocks and exclusive type blocks. When placed in exclusive type blocks, its priority Business data below the exclusive type.
  • Consensus verification of the target block according to the consensus rules of the co-exclusive type includes the first representative node verifying the validity of the target block according to the on-chain instruction information, and the consensus committee determines the final consensus verification result based on voting.
  • Consensus verification of the target block according to the consensus rules of the common exclusive type may include one or more of the following implementation methods:
  • the target block is associated with the target business, and the target block is used to store the cross-chain business data of the target business; consensus verification is performed on the target block according to the consensus rules of the common exclusive type, including: verification Whether the target business is an independent cross-chain business; if the target business is an independent cross-chain business, it is determined that the target block passes the consensus verification.
  • the computer equipment of the first representative node checks whether the target business is an independent cross-chain business; specifically, the computer equipment of the first representative node can check whether the business data of the target business is the business data of the common exclusive type, if the business of the target business If the data is not the business data of the co-exclusive type, it is determined that the target business is not an independent cross-chain business, and the target block has not passed the consensus verification; if the business data of the target business is the business data of the co-exclusive type, it is determined that the target block has passed the consensus verification After verification, the target block can be added to the blockchain.
  • the computer device can also check whether the identification of the business party of the target business carried in the business data of the target business matches; if the business data of the target business carries If the identity of the business party of the target business matches, it is determined that the target business is an independent cross-chain business, and the target block passes the consensus verification; if the business data of the target business does not match the identity of the business party of the target business, it is determined that the target The business is an independent cross-chain business, and the target block passes the consensus verification; for example, if the target business is participated by business party A and business party B, if the business data of business party A carries the identity of business party B (and business party A) , and the business data of business party B carries the identification of business party A (and business party B), it is determined that the target business is an independent cross-chain business, and the target block passes the consensus verification; correspondingly, if the business data of business party A Carry the identification of business
  • the computer device verifies the target business associated with the target block, so as to determine whether the target business is an independent cross-chain business, realizes the verification of the target block, and ensures that the target block meets the requirements of the next chain to be uploaded.
  • the business condition of the block which ensures the accuracy of the next block added to the blockchain.
  • the target block is associated with the target business, and the target block stores the identifications of multiple business parties participating in the target business; the on-chain indication information is also used to indicate the next blockchain area to be on-chain Identification of multiple co-exclusive parties to a block.
  • the first representative node checks whether the identifiers of multiple business parties in the target block are consistent with the identifiers of multiple co-exclusive parties in the next block to be linked in the blockchain.
  • There are M blocks in the blockchain Specifically, it can be determined whether the identifiers of multiple co-exclusive parties in the M+1th block are consistent with those of the multiple business parties in the target block; If the identifiers of multiple business parties in the target block are consistent with those of multiple co-exclusive parties in the M+1th block, the target block will not pass the consensus verification.
  • Consensus verification for example, if the target block stores the identity of business party 1 and business party 2 participating in the target business, and the on-chain instruction information indicates that the identity of the co-exclusive party of the M+1th block is the business party 1 and business party 2, the first representative node determines that the target block has passed the consensus verification and can add the target block to the blockchain.
  • the computer device checks the identification of the business party of the target business associated with the target block, so as to determine the identification of multiple business parties in the target block and the multiple business parties of the next block to be linked in the blockchain.
  • the identification of the co-exclusive party is consistent, and the verification of the target block is realized to ensure that the target block meets the conditions of the business party of the next block to be chained, and to ensure the accuracy of the next block added to the blockchain.
  • the target block also stores the business data to be deposited for each of the multiple business parties; the on-chain indication information is also used to indicate the occupancy quantity of each of the multiple joint exclusive parties .
  • the target block also includes: obtaining the certificate to be stored for each business party in the target block The quantity of business data; check whether the quantity of business data to be deposited by each business party matches the corresponding quantity occupied by each co-exclusive party; if the quantity of business data to be deposited by each business party matches the corresponding If the occupancy quantity of the co-exclusive party matches, the step of judging and determining that the target block passes the consensus verification is continued.
  • the first representative node obtains the number of business data to be deposited by each business party in the target block (such as counting the number of business data to be deposited by each business party in the target block), and checks that each business party Whether the number of business data to be deposited for certificates matches the corresponding number of occupancy of each common exclusive party (for example, checking the number of business data to be deposited by each business party in the target block and the corresponding occupancy of each common exclusive party) whether the number is the same), if the number of business data to be deposited by each business party matches the corresponding occupied quantity of each co-exclusive party; then the target block passes the consensus verification; if there is at least one The amount of business data does not match the amount occupied by the corresponding co-exclusive party; it is determined that the target block has not passed the consensus verification.
  • the target block stores two pieces of business data to be deposited by business party 1 and one piece of data to be deposited by business party 2, and the on-chain instruction information indicates that the number of occupied by business party 1 is 2, and that of business party 2 is 1, the first representative node determines that the target block has passed the consensus verification.
  • the computer device checks the number of business data to be deposited by each business party stored in the target block, thereby determining the number of business data to be deposited by each business party in the target block, and The number of occupancy of each co-exclusive party of the next block to be chained in the blockchain is matched to realize the verification of the target block and ensure that the target block conforms to the requirements of the business data to be deposited in the next block to be chained. A quantity condition that ensures the accuracy of the next block added to the blockchain.
  • the target block is associated with the target business, and the target business is participated by multiple business parties.
  • a business party refers to a consensus cluster in the consensus sub-network; the target block also stores multiple business party Each business party's business data to be stored; each business party maintains a block chain sub-chain (that is, each consensus cluster maintains a private chain for storing business data in the consensus cluster).
  • Consensus verification is performed on the target block according to the consensus rules of the co-exclusive type, including: checking whether the business data to be deposited by each business party in the target block has been stored in each business party’s respective blockchain sub-chain; If the business data to be deposited of each business party in the target block has been stored in each business party's respective blockchain sub-chain, it is determined that the target block passes the consensus verification.
  • the first representative node checks whether the business data to be deposited of each business party in the target block has been stored in each business party's respective block chain sub-chain (for example, the first representative node sends a confirmation to each business party information to confirm that the business data to be deposited by each business party has been stored in each business party’s respective blockchain sub-chain); if the business data to be deposited by each business party in the target block has been stored in each In the respective blockchain sub-chains of two business parties, it is determined that the target block has passed the consensus verification; if there is at least one business party in the target block whose business data to be deposited is not stored in the respective blockchain sub-chains of the business party , it is determined that the target block has not passed the consensus verification.
  • the computer device checks whether the business data to be deposited in the target block has been stored in the respective blockchain sub-chains of each business party to ensure that the data stored in the respective blockchain sub-chains of each business party has been stored There is corresponding business data to be deposited to ensure that the target block meets the sub-chain storage conditions of the business data to be deposited in the next block to be uploaded to ensure the accuracy of the next block added to the blockchain.
  • the M+1th block carries the type identifier of the block and the identifier of the business party associated with the M+1th block.
  • the process of adding a new block to the blockchain is as follows:
  • the second representative node of the M+1th block generates the target block to be consensus
  • the second representative node of the M+1th block broadcasts the target block to be consensused to other representative nodes in the consensus committee except the second representative node;
  • the representative nodes in the consensus committee verify the target block to be agreed upon, and broadcast their respective verification results to other representative nodes in the consensus committee (such as voting for the verification results approved by themselves);
  • Each representative node in the consensus committee collects the votes of other representative nodes in the consensus committee, and broadcasts the collected voting results greater than the proportional threshold (such as 2/3);
  • Each representative node in the consensus committee collects the voting results of other representative nodes in the consensus committee. If the proportion of votes obtained by the verification result indicating that the target block to be consensus is verified is greater than the ratio threshold (such as 2/3) , it means that the consensus of the target block to be agreed is passed;
  • the target block is taken as the M+1th block in the blockchain, and the second representative node corresponding to the M+2th block is determined according to the consensus auction result information.
  • FIG. 4 shows a schematic diagram of a blockchain-based data processing scenario provided by an exemplary embodiment of the present application.
  • the consensus sub-network includes N consensus clusters, and N is an integer greater than 1.
  • Each consensus cluster contained in the consensus sub-network can elect a bookkeeping node as a representative node, and N representative nodes form a consensus committee , the consensus committee maintains a block chain 401 of the consensus sub-network, and the block chain 401 is the main chain in the block chain network.
  • N consensus clusters can bid for the proposal permission of the blockchain network.
  • the consensus cluster with the proposal permission is responsible for generating the target block to be consensus
  • the consensus cluster with the proposal permission is responsible for generating the target block to be consensus
  • the consensus cluster with the proposal permission The representative node is responsible for broadcasting the target block to be consensused to each representative node in the consensus committee, and the consensus process is carried out by the consensus committee.
  • block A1 in blockchain 401 is broadcast by the representative nodes in consensus cluster 3 to each representative node in the consensus committee
  • block C1 in blockchain 401 is broadcast by representative nodes in consensus cluster 1 To each representative node in the consensus committee.
  • the business data of the entire consensus sub-network can be recorded in the blockchain maintained by the consensus committee, which facilitates the management and review of business data provided by different consensus clusters in the entire consensus sub-network.
  • each consensus cluster can also maintain its own blockchain sub-chain, which only contains its own business blocks, which is convenient for the consensus cluster to manage its own business data.
  • the new block when a new block is generated in the consensus cluster, the new block can anchor the previous block generated in the consensus cluster to realize the organization of the blockchain sub-chain of the consensus cluster.
  • Consensus cluster 1 shown in FIG. 4 consensus cluster 1 can organize its own block chain sub-chain 402, which includes block C1 and block C2 generated in consensus cluster 1; wherein, in the consensus When block C2 is generated in cluster 1, block C2 can anchor the previous block C1 of blockchain sub-chain 401 in consensus cluster 1, that is, block C2 records the previous block of blockchain sub-chain 402 in consensus cluster 1.
  • the block C2 can also anchor the previous block in the block chain 401, and block 2 records the block chain
  • the hash value (prehash) of block D1 in 401 that is, the hash value of block D1.
  • each consensus cluster can organize its own blockchain sub-chain through the subprehash in the block to facilitate the management of business data in the cluster, and the consensus committee can maintain the blockchain of the entire consensus sub-network, which is convenient for Unified management and review of business data for the entire consensus sub-network.
  • each consensus cluster in the consensus sub-network can also perform cross-chain interaction (that is, perform cross-chain business). specifically:
  • Consensus Cluster 3 and Consensus Cluster 4 is an independent cross-chain business, and the business data of the co-exclusive type associated with this independent cross-chain business can only be placed in a separate co-exclusive type of area In the block, business data of common exclusive type associated with multiple independent cross-chain businesses cannot be mixed and packaged together;
  • consensus cluster 3 Since the cross-chain business involves multi-party confirmation, as shown in Figure 4, in consensus cluster 3, A2 is added to the blockchain sub-chain maintained by the consensus cluster, and consensus cluster 4 is added to the consensus cluster to maintain B2 After the sub-chain of the blockchain, consensus cluster 3 and consensus cluster 4 need to wait for the A2+B2 block consensus on the main chain of the blockchain to pass before they can continue to add new blocks to the sub-chain of the blockchain they maintain.
  • the consensus algorithm is bound to the blockchain electronic invoice processing logic, and each billing agency (local tax bureaus in different provinces and cities) obtains the opportunity to generate blocks by broadcasting bidding information to the consensus committee.
  • each billing agency local tax bureaus in different provinces and cities
  • the consensus committee In the process of consensus on the Nth block of the blockchain, it will be decided who will bid for the N+1 block.
  • the representative nodes of different tax bureaus such as SPV nodes
  • they will broadcast bidding information to the consensus committee to bid for an exclusive type of block.
  • the representative node that obtains the proposal authority for the next block will pay a certain amount of bidding resources according to the waiting time after bidding for an exclusive type of block (waiting time).
  • the weight and bidding resource scheme can be designed according to actual needs), the exclusive type of block will all pack the exclusive type of business data (billing data) and common type of business data (billing data) associated with the representative node .
  • the business data of a single consensus cluster (corresponding organization) can be uploaded to the chain in batches, and exclusive blocks can allow a single representative node to store the associated business data in the In a single block, it is convenient for subsequent verification and auditing.
  • Exclusive blocks can better isolate the business data of different representative nodes and better protect privacy.
  • irrelevant blocks can be quickly skipped through the blockchain sub-chains maintained by each consensus cluster to improve efficiency and query efficiency.
  • the bidding method can effectively meet the needs of representative nodes that need to upload a large amount of business data to the chain as soon as possible.
  • the required bidding resources can be calculated as a whole through the waiting time to ensure the overall efficiency and fairness of the blockchain network.
  • this application not only provides a feasible multi-business interaction scheme, but also guarantees the independence of each cross-chain business data through a common exclusive type of block.
  • the blockchain sub-chain maintained by a consensus cluster can effectively synchronize cross-chain data related to itself.
  • Practice has proved that the solution has good scalability and is suitable for scenarios where there are multiple consensus clusters in the blockchain network and different cross-chain services are continuously added.
  • FIG. 5 shows a schematic structural diagram of a blockchain-based data processing device provided by an exemplary embodiment of the present application.
  • the device can be mounted on the representative node shown in FIG. 1 e .
  • the block chain-based data processing device shown in FIG. 5 can be used to perform some or all of the functions in the method embodiments described above in FIG. 2 and FIG. 3 .
  • the blockchain contains at least one block; the blockchain is located in the blockchain network, and the blockchain network includes a witness sub-network and a consensus sub-network.
  • the witness sub-network includes at least one business node; the consensus sub-network includes at least two Consensus clusters; each consensus cluster includes multiple bookkeeping nodes, and each consensus cluster recommends a bookkeeping node as a representative node in its own consensus cluster; representative nodes of each consensus cluster form the consensus committee of the blockchain; data processing
  • the device can be mounted on the first representative node in the consensus committee, and the first representative node is any representative node in the consensus committee; please refer to Figure 5, and the detailed description of each unit is as follows:
  • the obtaining unit 501 is used to obtain the on-chain instruction information of the blockchain, and the on-chain instruction information is used to indicate the type of the next blockchain block to be on-chain; and is used to obtain the target area waiting for consensus in the blockchain network block; the target block is generated based on cross-chain business data; and
  • the processing unit 502 is configured to add the target block to the blockchain as the next block to be linked in the blockchain if the linking instruction information indicates that the type of the next block to be linked in the blockchain is a common exclusive type above; among them, the block of common exclusive type is used to store independent cross-chain business.
  • the processing unit 502 is further configured to perform consensus on the target block according to the consensus rules of the common exclusive type if the on-chain indication information indicates that the type of the next block to be on-chain in the blockchain is the common exclusive type Verification; if the target block passes the consensus verification, the target block will be added to the blockchain as the next block to be uploaded to the blockchain.
  • the target block is associated with the target business, and the target block is used to store the cross-chain business data of the target business; the processing unit 502 is also used to check whether the target business is an independent cross-chain business; if the target If the business is an independent cross-chain business, it is determined that the target block passes the consensus verification.
  • the target block is associated with the target business, and the target block stores the identifications of multiple business parties participating in the target business; the on-chain indication information is also used to indicate the next block to be on-chain in the blockchain The identifiers of multiple common exclusive parties; the processing unit 502 is also used to check whether the identifiers of multiple business parties in the target block are consistent with the identifiers of multiple common exclusive parties of the next block to be uploaded in the blockchain; If the identifications of multiple business parties in the target block are consistent with the identifications of multiple co-exclusive parties in the next block to be linked in the blockchain, it is determined that the target block passes the consensus verification.
  • the target block also stores the business data to be deposited for each of the multiple business parties; the on-chain indication information is also used to indicate the occupation of each of the multiple joint exclusive parties Quantity; the processing unit 502 is also used to obtain the quantity of business data to be deposited by each business party in the target block; check the quantity of business data to be deposited by each business party and the corresponding occupation quantity of each common exclusive party Whether it matches; if the number of business data to be deposited by each business party matches the corresponding number of occupancy by each co-exclusive party, then continue to execute the step of determining that the target block passes the consensus verification.
  • the target block is associated with the target business, and the target business is participated by multiple business parties.
  • a business party refers to a consensus cluster in the consensus sub-network; the target block also stores the The business data to be deposited of each business party; each business party maintains a block chain sub-chain; the processing unit 502 is also used to check whether the business data to be deposited of each business party in the target block has been stored in each in the respective blockchain sub-chains of each business party; if the business data to be deposited by each business party in the target block has been stored in each business party’s respective blockchain sub-chain, then it is determined that the target block is verified by consensus test.
  • the acquiring unit 501 is also used to acquire the bidding result information of the next block to be linked in the blockchain, and the bidding result information is used to indicate the right to obtain the proposal authority of the next block to be linked in the blockchain.
  • the acquiring unit 501 is also configured to receive the next block to be uploaded in the blockchain submitted by the second representative node during the process of consensus on the block at the end of the blockchain.
  • Auction information the auction information is used to request the proposal permission of the next blockchain block to be uploaded; to perform consensus verification on the auction information; and to receive the auction result information broadcast by the consensus committee.
  • the acquisition unit 501 is also used to submit For the bidding information of the next block to be chained in the blockchain, the bidding information is used to request the proposal authority for the next block to be chained in the blockchain; to perform consensus verification on the bidding information; and to receive the Auction result information.
  • the obtaining unit 501 is further configured to extract the bidding information from the bidding result information; according to the extracted bidding information, generate uplink indication information of the next block to be uplinked in the blockchain.
  • the bidding information includes at least one of the quantity of business data to be packaged in the next block to be uploaded on the blockchain, the business party ID associated with the business data, or the type of business data.
  • the bidding information includes the waiting time and the amount of bidding resources; the bidding result information is that the consensus committee performs consensus verification on the bidding information based on the waiting time and the amount of bidding resources in the bidding information, and when the consensus of the bidding information Generated after the verification is successful.
  • the bidding resource corresponding to the bidding resource amount includes at least one of physical resources, virtual items, or the quantity of business data to be deposited.
  • the target block is associated with the target business, and the target business is participated by multiple business parties; if the first representative node and the second representative node are the same node, the processing unit 502 is also used to: The cross-chain business data of each business party of the target business is obtained from the resource pool in the chain network, and the target block is generated according to the cross-chain business data of each business party.
  • step S201 and step S202 shown in FIG. 2 may be executed by the acquiring unit 501 shown in FIG. 5
  • step S203 may be executed by the processing unit 502 shown in FIG. 5
  • step S301 and step S303 shown in FIG. 3 may be executed by the acquisition unit 501 shown in FIG. 5
  • step S302 , step S304 and step S305 may be executed by the processing unit 502 shown in FIG. 5 .
  • Each unit in the block chain-based data processing device shown in Figure 5 can be separately or all combined into one or several other units to form, or one (some) units can be further divided into functional units Multiple smaller units can realize the same operation without affecting the realization of the technical effects of the embodiments of the present application.
  • the above-mentioned units are divided based on logical functions.
  • the functions of one unit may also be realized by multiple units, or the functions of multiple units may be realized by one unit.
  • the blockchain-based data processing device may also include other units.
  • these functions may also be implemented with the assistance of other units, and may be implemented cooperatively by multiple units.
  • a general-purpose computing device such as a computer including processing elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM) and storage elements.
  • CPU central processing unit
  • RAM random access storage medium
  • ROM read-only storage medium
  • Run computer programs capable of performing the steps involved in the corresponding methods as shown in Figure 2 and Figure 3, to construct a block chain-based data processing device as shown in Figure 5, and to realize The blockchain-based data processing method of the embodiment of this application.
  • the computer program can be recorded on, for example, a computer-readable recording medium, loaded into the above-mentioned computing device via the computer-readable recording medium, and executed therein.
  • the business data of a single consensus cluster (corresponding organization) can be uploaded to the chain in batches, and exclusive blocks can allow a single representative node to store the associated business data in the In a single block, it is convenient for subsequent verification and auditing.
  • Exclusive blocks can better isolate the business data of different representative nodes and better protect privacy.
  • irrelevant blocks can be quickly skipped through the blockchain sub-chains maintained by each consensus cluster to improve efficiency and query efficiency.
  • the bidding method can effectively meet the needs of representative nodes that need to upload a large amount of business data to the chain as soon as possible.
  • the required bidding resources can be calculated as a whole through the waiting time to ensure the overall efficiency and fairness of the blockchain network.
  • this application not only provides a feasible multi-business interaction scheme, but also guarantees the independence of each cross-chain business data through a common exclusive type of block.
  • the blockchain sub-chain maintained by a consensus cluster can effectively synchronize cross-chain data related to itself.
  • Practice has proved that the solution has good scalability and is suitable for scenarios where there are multiple consensus clusters in the blockchain network and different cross-chain services are continuously added.
  • FIG. 6 shows a schematic structural diagram of a blockchain-based data processing device provided by an exemplary embodiment of the present application.
  • the blockchain-based data processing device includes at least processing device 601, communication interface 602 and memory 603.
  • the processor 601, the communication interface 602 and the memory 603 may be connected through a bus or in other ways.
  • the processor 601 or central processing unit (Central Processing Unit, CPU)) is the calculation core and control core of the terminal, which can analyze various instructions in the terminal and process various data of the terminal.
  • CPU Central Processing Unit
  • the CPU can use It is used to analyze the power-on/off instructions sent by the user to the terminal, and control the terminal to perform power-on/off operations; another example: the CPU can transmit various interactive data between the internal structures of the terminal, and so on.
  • the communication interface 602 can optionally include standard wired interfaces and wireless interfaces (such as WI-FI, mobile communication interfaces, etc.), which can be used to send and receive data under the control of the processor 601; the communication interface 602 can also be used for internal data transfer of the terminal transmission and interaction.
  • the memory 603 (Memory) is a storage device in the terminal, and is used to store programs and data.
  • the memory 603 here may include not only a built-in memory of the terminal, but also an extended memory supported by the terminal.
  • the memory 603 provides a storage space, which stores the operating system of the terminal, which may include but not limited to: Android system, iOS system, Windows Phone system, etc., which is not limited in this application.
  • the embodiment of the present application also provides a computer-readable storage medium (Memory).
  • the computer-readable storage medium is a memory device in a terminal, and is used to store computer-readable instructions and data. It can be understood that the computer-readable storage medium here may not only include a built-in storage medium in the terminal, but also include an extended storage medium supported by the terminal.
  • the computer-readable storage medium provides storage space, and the storage space stores the processing system of the terminal.
  • one or more computer-readable instructions adapted to be loaded and executed by the processor 601 are also stored in the storage space, and these computer-readable instructions may be one or more computer programs (including program codes).
  • the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory; A computer-readable storage medium for the aforementioned processor.
  • the computer-readable storage medium stores one or more computer-readable instructions; the processor 601 loads and executes the one or more computer-readable instructions stored in the computer-readable storage medium to implement Corresponding steps in the above embodiments of the blockchain-based data processing method.
  • the embodiment of the present application also provides a non-volatile computer-readable storage medium storing computer-readable instructions, one or more computer-readable instructions are stored in the computer-readable storage medium, one or more computer-readable instructions
  • the block chain-based data processing method suitable for being loaded by a processor and executing the above method embodiment.
  • the embodiment of the present application also provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute the blockchain-based data processing method of the above method embodiment.
  • the embodiment of the present application also provides a computer program product or computer program, where the computer program product or computer program includes computer-readable instructions, and the computer-readable instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer-readable instructions from the computer-readable storage medium, and the processor executes the computer-readable instructions, so that the computer device executes the above-mentioned blockchain-based data processing method.
  • the steps in the methods of the embodiments of the present application can be adjusted, combined and deleted according to actual needs.
  • the modules in the device of the embodiment of the present application can be combined, divided and deleted according to actual needs.
  • Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the readable storage medium can be Including: flash disk, read-only memory (Read-Only Memory, ROM), random access device (Random Access Memory, RAM), magnetic disk or optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Security & Cryptography (AREA)
  • Signal Processing (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Technology Law (AREA)
  • Mathematical Physics (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

一种基于区块链的数据处理方法,由计算机设备执行,包括:获取所述区块链的上链指示信息,上链指示信息用于指示区块链下一个待上链区块的类型(S201);获取区块链网络中等待共识的目标区块;目标区块是根据跨链业务数据生成的(S202);及若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则将目标区块作为区块链下一个待上链区块添加至区块链上;其中,共同独占类型的区块用于存储独立跨链业务(S203)。

Description

基于区块链的数据处理方法、装置、设备及存储介质
本申请要求于2021年08月18日提交中国专利局、申请号为2021109485046、发明名称为“基于区块链的数据处理方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及一种基于区块链的数据处理方法、一种基于区块链的数据处理装置、一种基于区块链的数据处理设备、一种计算机可读存储介质以及一种基于区块链的数据计算机程序产品。
背景技术
随着计算机技术的不断发展,区块链以其可追溯的特点被广泛应用于资产转移、业务数据存储等方面。以业务数据存储为例,区块链节点在生成业务数据后,将该业务数据上链,以确保该业务数据可追溯(即上链之后无法被篡改)。在实际应用中,对业务数据进行上链时,通常是将一个时间段内请求上链的业务数据打包在一个区块中进行上链。实践发现,由于一个跨链业务可能关联多条业务数据,在对跨链业务进行处理的效率较低。
发明内容
根据本申请的各种实施例,提供了一种基于区块链的数据处理方法、装置、设备、存储介质及计算机程序产品。
一方面,本申请实施例提供了一种基于区块链的数据处理方法,区块链上包含至少一个区块;区块链位于区块链网络中,区块链网络包括见证子网络和共识子网络,见证子网络包含至少一个业务节点;共识子网络包含至少两个共识集群;每个共识集群包括多个记账节点,每个共识集群在各自的共识集群内推举一个记账节点作为代表节点;各个共识集群的代表节点组成区块链的共识委员会;方法由共识委员会中的第一代表节点执行,第一代表节点是共识委员会中的任一个代表节点;该数据处理方法由计算机设备执行,包括:
获取区块链的上链指示信息,上链指示信息用于指示区块链下一个待上链区块的类型;
获取区块链网络中等待共识的目标区块;目标区块是根据跨链业务数据生成的;及
若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则将目标区块作为区块链下一个待上链区块添加至区块链上;其中,共同独占类型的区块用于存储独立跨链业务。
一方面,本申请实施例提供了一种基于区块链的数据处理装置,区块链上包含至少一个区块;区块链位于区块链网络中,区块链网络包括见证子网络和共识子网络,见证子网络包含至少一个业务节点;共识子网络包含至少两个共识集群;每个共识集群包括多个记账节点,每个共识集群在各自的共识集群内推举一个记账节点作为代表节点;各个共识集群的代表节点组成区块链的共识委员会;数据处理装置可以搭载在共识委员会中的第一代表节点中,第一代表节点是共识委员会中的任一个代表节点;该数据处理装置,包括:
获取单元,用于获取区块链的上链指示信息,上链指示信息用于指示区块链下一个待上链区块的类型;以及用于获取区块链网络中等待共识的目标区块;目标区块是根据跨链业务数据生成的;及
处理单元,用于若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则 将目标区块作为区块链下一个待上链区块添加至区块链上;其中,共同独占类型的区块用于存储独立跨链业务。
相应地,本申请提供了一种基于区块链的数据处理设备,该设备包括:
一个或多个处理器,用于加载并执行计算机可读指令;及
计算机可读存储介质,该计算机可读存储介质中存储有计算机可读指令,该计算机可读指令被处理器执行时,实现上述基于区块链的数据处理方法。
相应地,本申请提供了一种存储有计算机可读指令的非易失性计算机可读存储介质,计算机可读存储介质存储有计算机可读指令,该计算机可读指令适于由处理器加载并执行上述基于区块链的数据处理方法。
相应地,本申请提供了一种计算机程序产品,该计算机程序产品包括计算机可读指令,该计算机可读指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机可读指令,处理器执行该计算机可读指令,使得该计算机设备执行上述基于区块链的数据处理方法。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1a示出了本申请一个示例性实施例提供的一种数据共享系统的架构示意图;
图1b示出了本申请一个示例性实施例提供的一种区块链的结构示意图;
图1c示出了本申请一个示例性实施例提供的一种生成区块的流程示意图;
图1d示出了本申请一个示例性实施例提供的一种双层网络的架构示意图;
图1e示出了本申请一个示例性实施例提供的另一种双层网络的架构示意图;
图1f示出了本申请一个示例性实施例提供的一种基于双层网络的电子发票业务的场景架构图;
图2示出了本申请一个示例性实施例提供的一种基于区块链的数据处理方法的流程示意图;
图3示出了本申请一个示例性实施例提供的另一种基于区块链的数据处理方法的流程示意图;
图4示出了本申请一个示例性实施例提供的一种基于区块链的数据处理场景的示意图;
图5示出了本申请一个示例性实施例提供的一种基于区块链的数据处理装置的结构示意图;
图6示出了本申请一个示例性实施例提供的一种基于区块链的数据处理设备的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例涉及区块链技术,下面对区块链技术的相关术语及概念进行简要介绍:区块链(Blockchain),是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。其本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于校验其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层。
区块链网络可以理解为一个数据共享系统100,数据共享系统100可是指用于进行节点与节点之间数据共享的系统,该数据共享系统100的一种示例性结构可参见图1a;如图1a所示,数据共享系统100是指用于进行节点与节点之间数据共享的系统,该数据共享系统中可以包括多个节点101,多个节点101可以是指数据共享系统中各个客户端。每个节点101在进行正常工作可以接收到输入信息,并基于接收到的输入信息维护该数据共享系统内的共享数据。为了保证数据共享系统内的信息互通,数据共享系统中的每个节点之间可以存在信息连接,节点之间可以通过上述信息连接进行信息传输。例如,当数据共享系统中的任意节点接收到输入信息时,数据共享系统中的其它节点便根据共识算法获取该输入信息,将该输入信息作为共享数据中的数据进行存储,使得数据共享系统中全部节点上存储的数据均一致。
对于数据共享系统中的每个节点,均具有与其对应的节点标识,而且数据共享系统中的每个节点均可以存储有数据共享系统中其它节点的节点标识,以便后续根据其它节点的节点标识,将生成的区块广播至数据共享系统中的其它节点。每个节点中可维护一个如下表所示的节点标识列表,将节点名称和节点标识对应存储至该节点标识列表中。其中,节点标识可为IP(Internet Protocol,网络之间互联的协议)地址以及其它任一种能够用于标识该节点的信息;例如,节点的标识还可以是二进制序列码(如110001110),表1中仅以IP地址为例进行说明:
表1
节点名称 节点标识
节点1 117.114.151.174
节点2 117.116.189.145
节点X(X为正整数) xx.xxx.xxx.xxx
数据共享系统中的每个节点均存储一条相同的区块链。区块链由多个区块组成,参见图1b,区块链由多个区块组成,创始块中包括区块头和区块主体,区块头中存储有输入信息特征值、版本号、时间戳和难度值,区块主体中存储有输入信息;创始块的下一区块以创始块为父区块,下一区块中同样包括区块头和区块主体,区块头中存储有当前区块的输入信息特征值、父区块的区块头特征值、版本号、时间戳和难度值,并以此类推,使得区块链中每个区块中存储的区块数据均与父区块中存储的区块数据存在关联,保证了区块中输入信息的安全性。
在生成区块链中的各个区块时,参见图1c,区块链所在的节点在接收到输入信息时,对输入信息进行校验,完成校验后,将输入信息存储至内存池中,并更新其用于记录输入信息的哈希树;之后,将更新时间戳更新为接收到输入信息的时间,并尝试不同的随机数,多次进行特征值计算,使得计算得到的特征值可以满足下述公式:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
其中,SHA256为计算特征值所用的特征值算法;version(版本号)为区块链中相关区块协 议的版本信息;prev_hash为当前区块的父区块的区块头特征值;merkle_root为输入信息的特征值;ntime为更新时间戳的更新时间;nbits为当前难度,在一段时间内为定值,并在超出固定时间段后再次进行确定;x为随机数;TARGET为特征值阈值,该特征值阈值可以根据nbits确定得到。
这样,当计算得到满足上述公式的随机数时,便可将信息对应存储,生成区块头和区块主体,得到当前区块。随后,区块链所在节点根据数据共享系统中其它节点的节点标识,将新生成的区块广播给其所在的数据共享系统中的其它节点,由其它节点对新生成的区块进行共识校验,并在完成共识校验后将新生成的区块添加至其存储的区块链中。其中,节点可通过共识算法对新生成的区块进行共识校验,共识算法可包括但不限于:
1)Pow(Proof-of-Work,工作量证明):
工作量证明是指系统(如前述的数据共享系统)为达到某一目标而设置的度量方法。简单理解就是一份证明,用来确认工作量。本质是谁做的工作多,谁就更有机会获得额外奖励。工作量证明俗称“挖矿”,通过与或运算,计算出一个满足规则的随机数,即获得本次记账权,发出本轮需要记录的数据,区块链网络中的其他节点校验后一起存储。这使得工作量证明具有如下优势:完全去中心化,节点自由进出。
2)Pos(proof-of-stake,权益证明):
Pos权益证明是Pow工作量证明的一种升级共识机制;具体地,谁持有电子资源的时间越长(持有电子资源的时间长度=持有电子资源的数量*持有电子资源的时间),谁更有机会获取区块的记账权,其中,电子资源可以是指以电子形式存储于电子账户中、且能够通过互联网进行流通的资源;根据每个节点所占电子资源的比例和时间;等比例的降低挖矿难度,从而加快找随机数的速度。Pos权益证明在一定程度上缩短了共识达成的时间,但仍然需要挖矿。
3)DPos(Delegated Proof of Stake,委托权益证明)股份授权证明机制:
DPos股份授权证明机制类似于董事会投票,持有电子资源的人投出一定数量的节点,代理他们进行校验和记账。为了激励更多人参与竞选,系统会生成少量电子资源作为奖励。DPos股份授权证明机制是让每一个持有比特股的人进行投票,由此产生101位代表,我们可以将其理解为101个超级节点或者矿池,而这101个超级节点彼此的权利是完全相等的。从某种角度来看,DPos股份授权证明机制有点像是议会制度或人民代表大会制度。如果选出的代表不能履行他们的职责(当轮到他们时,没能生成区块),那么这些代表会被除名,网络会选出新的超级节点来取代他们。这使得DPos股份授权证明机制能够大幅缩小参与校验和记账节点的数量,可以达到秒级的共识校验,但整个共识机制还是依赖于电子资源。
4)pbft(Practical Byzantine Fault Tolerance,拜占庭容错算法):
pbft拜占庭容错算法是一种基于消息传递的一致性算法,算法经过三个阶段达成一致性,这些阶段可能因为失败而重复进行。具体地,假设节点总数为3f+1,f为拜赞庭错误节点,首先,当节点发现leader(如代表节点、记账节点或超级节点)作恶时,通过算法选举其他的replica(节点)为leader。其次,leader通过pre-prepare(预准备)消息把它选择的value(值)广播给其他replica节点,其他的replica节点如果接受则发送prepare(准备)消息,如果不接受则不发送。其次,一旦2f个节点接受prepare消息,则节点发送commit(确认)消息。最后,当2f+1个节点接受commit消息后,代表该value值被确定。上述过程使得pbft拜占庭容错算法能够共识各 节点由业务的业务方或者监管方组成,安全性与稳定性由业务相关方保证;并且,共识的时延大约在2~5秒钟,基本达到商用实时处理的要求,提高共识效率,可满足高频交易量的需求。
5)Paxos(一种分布式算法)算法:
Paxos算法是一种两阶段算法,主要有三类角色,proposer(提议者)、acceptor(接受者)、learner(学习者)。proposer提出议案,acceptor同意或拒绝,learner则是获取达成共识后的最终值。Paxos算法包括两个阶段,分别为:①准备阶段:proposer选择一个提案编号n并将prepare(准备)请求发送给acceptors中的一个多数派;acceptor收到prepare请示后,如果提案的编号大于它已经回复的所有prepare请示,则acceptor将自己上次接受的提案回复给proposer,并承诺不再回复小于n的提案。②批准阶段:当一个proposer收到了多数acceptors对prepare请示的回复后,就进入批准阶段;它要向回复prepare请求的acceptors发送accept(接受)请求,包括编号n和value(如果没有已经接受的value,那么它可以自由决定value);在不违背自己向其他proposer的承诺的前提下,acceptor收到accept请求后即接受这个请求。
Paxos算法适用于简单容错模型,即系统中只可能存在失效或故障节点,不存在恶意节点,如果失效节点数为x(x为正整数),则只需要未失效节点数为x+1就能维持系统的正常工作。
6)Raft(一种分布式共识算法)算法:
Raft算法包含三种角色,分别是:跟随者(follower),候选人(candidate)和领导者(leader)。一个节点在某一时刻只能是这三种状态的其中一种,这三种角色是可以随着时间和条件的变化而互相转换的。所有的节点初始状态都为follower,超时未收到心跳包的follower将变身candidate并广播投票请求,获得多数投票的节点将化身leader,这一轮投票的过程是谁先发出谁有利,每个节点只会给出一次投票。leader节点周期性给其他节点发送心跳包,leader节点失效将会引发新一轮的投票过程。
实际应用中,当区块链被应用于一些场景中时,例如:票据业务场景,或者商业机构等的数据存储场景等等;在这些场景下,区块链网络中并非所有的节点都有足够的资源和必要性成为参与区块链共识的节点。而出于对数据的安全性考虑,在区块链体系中涉及安全性高的相关数据时,也不适用普遍的数据对等的区块链部署方式。为了适应业务需求(如内外网,业务网,办公网分隔等),并进一步提高数据的安全性和保密性,本申请实施例提供了一种双层链,通过P2P(Peer to Peer,点对点)网络形成“见证子网络-共识子网络”的双层网络架构,其中,P2P网络是一种点对点连接的网络,点对点连接的各个节点称为对等节点。P2P网络基于一类特定的网络协议,使得对等节点之间不需要一个中心节点来维护网络状态,每个节点通过和相邻节点之间的广播交互,来维护全网的节点状态及其与相邻节点的连接状态。
图1d示出了本申请一个示例性实施例提供的一种双层网络的架构图;如图1d所示,区块链网络包括见证子网络和共识子网络,业务节点部署在处于公网的见证子网络中,共识子网络中部署有运行区块链共识协议的记账节点;见证子网络和共识子网络通过虚线所表示的路由边界进行交互。其中,见证子网络中的业务节点主要进行业务执行,不参与记账共识,并通过身份认证的方式从共识子网络中获得区块头数据和部分授权可见的区块数据。共识子网络是区块链网络中的核心网络,用于对区块链网络进行记账共识。通常来说,见证子网络和共识子网络处在不同网络环境下,见证子网络处于公有网络中,而共识子网络处于私有网络中。由于共识子网络处于相对安全的私有网络中,其互相访问本就有共识机制保证安全,不需要额外加入身份管理 和网络控制。而业务节点处于公共网络中,可能会被其它不确定的网络终端访问,因此业务节点以及其它可能的节点接入共识子网络中的行为需要被严格控制。
在一种可行的实现方式中,共识子网络中的这些记账节点还可以被划分为多个共识集群,也就是说,共识子网络中可部署多个共识集群,每个共识集群中可包括至少一个记账节点。共识集群可以是根据不同规则划分的,该规则可包括:根据业务类型划分,如处理相同业务类型的业务数据的记账节点被划分至同一个共识集群;再如,根据记账节点之间的距离划分共识集群,如将距离小于距离的阈值的两个及以上的记账节点划分至同一个共识集群,等等。在此实现方式下,双层结构的区块链网络的架构可变化为图1e,如图1e所示,区块链网络包括见证子网络和共识子网络,共识子网络中部署有多个共识集群,每个共识集群内包含至少一个记账节点;见证子网络中的任一业务节点可以与共识子网络中某一共识集群所部署的记账节点进行信息连接。假设图1e所示的共识集群是按照业务类型划分的,则每个共识集群可以用于为一种或多种业务类型的业务数据提供共识服务。例如:图1e中的共识集群1可以是专为发票业务类型的业务数据提供共识服务的集群,即该共识集群1内的各个记账节点仅针对发票数据进行共识处理;共识集群2可以是为征信业务类型的业务数据提供共识服务的集群,即该共识集群2内的各个记账节点仅针对与征信相关的业务数据进行共识处理;等等。
在图1e所示的架构中,各个共识集群共同维护区块链网络中的一条区块链,该区块链称为主链,其包含区块链网络中所有业务生态的全部信息。而每个共识集群内部又可以组织自身业务的区块链子链,每个共识集群内的区块链子链则仅包含各共识集群自身业务的信息。各个共识集群可以在各自的共识集群内可推举一个记账节点作为代表节点;其中,代表节点既参与对自身所属的共识集群内的区块链子链的共识处理,同时又参与对主链的共识处理。而共识集群中的非代表节点,即该共识集群中除代表节点以外的其他记账节点,只参与对共识集群内部的区块链子链进行共识处理。共识子网络中,每个共识集群推举出来的代表节点共同组成主链的共识委员会,共同对主链进行共识处理。
以区块链网络是为电子发票提供共识服务的网络为例,本申请实施例提出的双层网络的场景架构示意图可参见图1f。如图1f所示,区块链网络包括:业务层、路由代理层以及核心共识网络层,业务层、路由代理层以及核心共识网络层组成了整个完整区块链业务体系;其中,①业务层处于见证子网络中,业务层包括至少一个业务节点,该业务节点具体可以是SPV节点,SPV节点维持正常的无结构P2P网络,业务节点可以处理(地方税局)税务、票据(企业开票)、支付(企业资金流动)等业务。②核心共识网络层处于共识子网络中,核心共识网络层包括各个共识集群,如共识集群102、共识集群103、……、等等,每个共识集群维护本集群内的区块链子链,例如,共识集群102维护本集群内的核心链1,共识集群103维护本集群内的核心链2。③路由代理层中包括至少一个代理节点,代理节点可以提供路由服务、认证服务、证书缓存服务、点对点(P2P)服务等;其中,证书缓存服务涉及证书体系(PKI,Public Key Infrastructure),在证书体系中,证书是一个公钥拥有者的身份证明,由权威机构进行颁发(CA)。基于公钥证书体系可以实现非对称加密和对于信息的数字签名。业务层和核心共识网络层之间通过路由代理层进行信息交互,即业务层通过路由代理层向核心共识网络层提交业务操作交互,这样路由代理层对于业务层和核心共识网络层起到了隔离的作用。
基于上述对本申请实施例涉及的双层网络的基本结构的相关介绍,下面简单介绍本申请实 施例基于上述双层网络结构提出的基于区块链的数据处理方案,能够提高跨链业务的处理效率。该方案可以由图1e所示的共识委员会中的第一代表节点执行,该第一代表节点可以是共识委员会中的任一个代表节点。代表节点具体可以是终端设备或者服务器。其中,终端设备可以包括但不限于:智能手机(如Android手机、IOS手机等)、平板电脑、便携式个人计算机、移动互联网设备(Mobile Internet Devices,简称MID)等设备,本申请实施例对此不做限定。服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN(Content Delivery Network,内容分发网络)、以及大数据和人工智能平台等基础云计算服务的云服务器,本申请实施例对此不做限定。
在具体实现中,区块链上包含至少一个区块,如可以包含M个相互链接的区块,M为正整数;区块链位于区块链网络中,请参见图1e,区块链网络包括见证子网络和共识子网络,见证子网络包含至少一个业务节点;共识子网络包含至少两个共识集群,如可以包含N个共识集群,N为大于1的整数;每个共识集群由多个记账节点组成,每个共识集群在各自的共识集群内推举一个记账节点作为代表节点,则N个共识集群可以推举出N个代表节点;N个代表节点组成区块链的共识委员会;基于区块链的数据处理方法由共识委员会中的第一代表节点执行,第一代表节点是共识委员会中的任一个代表节点;基于区块链的数据处理方案的大致原理如下:
(1)第一代表节点获取区块链的第M+1个区块的上链指示信息,上链指示信息用于指示区块链下一个待上链区块,即第M+1个区块的类型(如共同独占类型、独占类型、普通类型等);第M+1个区块的上链指示信息是根据第M+1个区块的竞拍结果信息生成的;第M+1个区块的竞拍结果信息是由区块链网络中各个代表节点对第M+1个区块的竞拍信息进行共识处理(如根据竞拍信息确定具有第M+1个区块的提案权限的第二代表节点)后得到的;第M+1个区块的竞拍结果信息携带第M+1个区块的类型;竞拍信息是在对第M个区块进行上链(共识)的过程中,由需要竞拍第M+1个区块的代表节点向区块链网络中的其他代表节点广播的,竞拍信息用于竞拍第M+1个区块的提案权限;竞拍信息中携带需要打包在第M+1个区块中的业务数据的相关信息(如打包在第M+1个区块中的业务数据的数量、第M+1个区块关联的业务方的标识、打包在第M+1个区块中的业务数据的类型等);获得第M+1个区块的提案权限的代表节点可以根据该代表节点的竞拍信息生成等待共识的目标区块(即对竞拍信息中报备的业务数据进行打包,生成等待共识的目标区块)。
(2)第一代表节点获取区块链网络中等待共识的目标区块,该目标区块是由区块链网络中获取到第M+1个区块的提案权限的代表节点,对第M+1个区块关联的待上链的业务数据(即该代表节点在竞拍信息中指示的需要打包在第M+1个区块中的业务数据)进行打包后,广播给区块链网络中的各个代表节点的。
(3)若上链指示信息指示第M+1个区块的类型为共同独占类型,则按照共同独占类型的共识规则对目标区块进行共识校验(即每个代表节点单独根据共识规则对目标区块进行校验,再根据自身校验结果以及区块链网络中其他代表节点广播的目标区块的校验结果确定最终的校验结果);其中,共同独占类型的区块用于存储独立跨链业务,每个跨链业务都是一个独立跨链业务,每个跨链业务由至少两个业务方参与,每个业务方会提供至少一条待存证业务数据(也就是说每个共同独占类型的区块用于存放一个跨链业务所关联的业务数据);共识规则用于校验目 标区块是否满足上链条件(如校验目标区块中的业务数据是否属于同一个跨链业务、目标区块的业务方与上链指示信息所指示的第M+1个区块的多个共同独占方的标识是否匹配等)。
(4)若目标区块通过共识校验,则将目标区块作为第M+1个区块添加至区块链上(即对目标区块进行上链,得到更新后的区块链)。
本申请实施例中,获取区块链的第M+1个区块的上链指示信息,以及区块链网络中等待共识的目标区块,若上链指示信息指示第M+1个区块的类型为共同独占类型,则按照共同独占类型的共识规则对目标区块进行共识校验,共同独占类型的区块用于存储独立跨链业务,若目标区块通过共识校验,则将目标区块作为第M+1个区块添加至区块链上。可见,在涉及到跨链交互时,通过共同独占类型的区块将独立跨链业务的相关业务数据存储在一个区块中,可以改善在对跨链业务进行校验时需要对多个区块中的相关业务数据进行校验的情况,进而提高跨链业务的校验效率,提高了跨链业务的处理效率。
基于上述描述的基于区块链的数据处理方案,本申请实施例提出更为详细的基于区块链的数据处理方法,下面将结合附图对本申请实施例提出的基于区块链的数据处理方法进行详细介绍。
图2示出了本申请一个示例性实施例提供的一种基于区块链的数据处理方法的流程示意图;其中,区块链上包含至少一个相互链接的区块;区块链位于区块链网络中,请参见图1e,区块链网络包括见证子网络和共识子网络,见证子网络包含至少一个业务节点;共识子网络包含至少两个共识集群;每个共识集群包括多个记账节点,每个共识集群在各自的共识集群内推举一个记账节点作为代表节点;各个共识集群的代表节点组成区块链的共识委员会;基于区块链的数据处理方法由共识委员会中的第一代表节点执行,第一代表节点是共识委员会中的任一个代表节点;该基于区块链的数据处理方法可包括但不限于步骤S201-S203:
S201、获取区块链的上链指示信息,上链指示信息用于指示区块链下一个待上链区块的类型。
上链指示信息用于指示区块链下一个待上链区块的信息,具体指示下一个待上链区块的类型,如共同独占类型、独占类型、普通类型等。在具体应用中,区块链上包含M个相互链接的区块,M为大于1的整数,共识子网络包含N个共识集群,N为大于1的整数,则N个共识集群推举出N个代表节点。即区块链中已经存在有M个区块,下一个待上链区块为第M+1个区块,则上链指示信息可以指示第M+1个区块的类型,如共同独占类型、独占类型、普通类型等;第M+1个区块的上链指示信息是根据第M+1个区块的竞拍结果信息生成的;第M+1个区块的竞拍结果信息是由区块链网络中各个代表节点对第M+1个区块的竞拍信息进行共识处理(如根据竞拍信息确定具有第M+1个区块的提案权限的第二代表节点)后得到的;第M+1个区块的竞拍结果信息携带第M+1个区块的类型。
其中,竞拍信息是在对当前区块进行上链的过程中,由需要竞拍下一个区块的代表节点向区块链网络中的其他代表节点广播的,如区块链中存在M个区块时,竞拍信息是在对第M个区块进行上链(共识)的过程中,由需要竞拍第M+1个区块的代表节点向区块链网络中的其他代表节点广播的,竞拍信息用于竞拍第M+1个区块的提案权限;竞拍信息中携带需要打包在第M+1个区块中的业务数据的相关信息(如打包在第M+1个区块中的业务数据的数量、第M+1个区块关联的业务方的标识、打包在第M+1个区块中的业务数据的类型等);获得第M+1个区 块的提案权限的代表节点可以根据该代表节点的竞拍信息生成等待共识的目标区块(即对竞拍信息中报备的业务数据进行打包,生成等待共识的目标区块)。
具体地,第一代表节点具体为计算机设备,计算机设备获取区块链的上链指示信息,该上链指示信息用于指示区块链下一个待上链区块的类型,计算机设备根据上链指示信息可以确定需要在区块链中进行上链处理的下一个区块的类型。
S202、获取区块链网络中等待共识的目标区块;目标区块是根据跨链业务数据生成的。
等待共识的目标区块是由区块具有提案权限的代表节点对下一个待上链区块关联的待上链的区块数据进行打包得到的。目标区块根据跨链业务数据生成,即目标区块是对跨链业务的业务数据进行打包得到的。其中,每个跨链业务都是一个独立跨链业务,每个跨链业务由至少两个业务方参与,每个业务方会提供至少一条待存证业务数据,也就是说每个共同独占类型的区块用于存放一个跨链业务所关联的业务数据。具体地,区块链中存在M个区块,上链指示信息指示了第M+1个区块的类型时,等待共识的目标区块可以是第M+1个区块关联的待上链的区块数据(即该代表节点在竞拍信息中指示的需要打包在第M+1个区块中的业务数据)进行打包得到的;区块具有提案权限的代表节点是区块链网络中获取到第M+1个区块的打包权限(即生成等待共识的目标区块的权限)的代表节点。
在一种实施方式中,具有提案权限的代表节点可以从区块链网络的资源池中获取与第M+1个区块关联的一个或多个业务数据的存证信息,具体包括跨链业务数据,并根据这些业务数据的存证信息生成等待共识的目标区块。
具有提案权限的代表节点在生成目标区块后,会将该目标区块广播给区块链网络中的各个代表节点,第一代表节点可以通过区块具有提案权限的代表节点的广播获取等待共识的目标区块。
具体地,计算机设备获取区块链网络中等待共识的目标区块,目标区块可以是具有提案权限的代表节点根据跨链业务数据生成的,具有提案权限的代表节点可以将生成的目标区块进行广播,从而由计算机设备获得目标区块。
S203、若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则将目标区块作为区块链下一个待上链区块添加至区块链上;其中,共同独占类型的区块用于存储独立跨链业务。
区块的类型可以包括共同独占类型,每个共同独占类型的区块用于存储一个独立跨链业务。每个跨链业务都是一个独立跨链业务,每个跨链业务由至少两个业务方参与,每个业务方会提供至少一条待存证业务数据(也就是说每个共同独占类型的区块用于存放一个跨链业务所关联的业务数据);例如,业务方A和业务方B参与了跨链业务1,业务方B和业务方C参与了跨链业务2,业务方A,业务方B和业务方C共同参与了跨链业务3,则跨链业务1-跨链业务3为三个独立跨链业务,也就是说跨链业务1-跨链业务3存储在三个不同的共同独占类型的区块中,跨链业务1关联的业务数据不能存储在用于存储跨链业务2或跨链业务3关联的业务数据的区块中,同理,跨链业务2关联的业务数据不能存储在用于存储跨链业务1或跨链业务3关联的业务数据的区块中,跨链业务3关联的业务数据不能存储在用于存储跨链业务1或跨链业务2关联的业务数据的区块中。
具体地,在区块链下一个待上链区块的类型为共同独占类型时,表明需要在区块链中共识 的下一个区块用于存储独立跨链业务的跨链业务数据,则计算机设备可以将目标区块作为区块链下一个待上链区块添加至区块链上,从而将目标区块进行上链处理。在具体实现时,计算机设备可以按照共同独占类型的共识规则对目标区块进行共识校验,并在共识校验通过后,将目标区块作为区块链下一个待上链区块添加至区块链上,从而确保区块上链的准确性。其中,共识规则用于校验目标区块是否满足上链条件,上链条件可以根据上链指示信息确定(如校验目标区块中的业务数据是否属于同一个跨链业务、目标区块的业务方与上链指示信息所指示的第M+1个区块的多个共同独占方的标识是否匹配等)。
在一种实施方式中,第一代表节点根据共识规则对目标区块进行校验,再根据自身校验结果以及区块链网络中,除第一代表节点以外的其他代表节点广播的目标区块的校验结果确定最终的共识校验结果。目标区块通过共识校验是指:第一代表节点根据自身校验结果以及区块链网络中,除第一代表节点以外的其他代表节点广播的目标区块的校验结果确定目标区块满足上链条件。第一代表节点将目标区块记录为区块链的第M+1个区块。在区块链下一个待上链区块为共同独占类型时,将根据跨链业务数据生成的目标区块添加至区块链上,可以在跨链业务处理时,避免对多个区块分别进行跨链业务数据处理,有效实现跨链业务的隔离处理,减少多个区块间的交互处理,从而提高跨链业务的处理效率。
本申请实施例中,获取区块链的上链指示信息,以及区块链网络中等待共识的根据跨链业务数据生成的目标区块,若上链指示信息指示区块链下一个待上链区块的类型为用于存储独立跨链业务的共同独占类型,则将目标区块作为区块链下一个待上链区块添加至区块链上。可见,在涉及到跨链交互时,通过共同独占类型的区块将独立跨链业务的相关业务数据存储在一个区块中,可以改善在对跨链业务进行处理时,需要对多个区块中的相关业务数据进行交互处理的情况,进而提高跨链业务的处理效率。
在一个实施例中,若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则将目标区块作为区块链下一个待上链区块添加至区块链上,包括:若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则按照共同独占类型的共识规则对目标区块进行共识校验;若目标区块通过共识校验,则将目标区块作为区块链下一个待上链区块添加至区块链上。
其中,共识规则用于校验目标区块是否满足上链条件,上链条件可以根据上链指示信息确定,如可以包括但不限于包括校验目标区块中的业务数据是否属于同一个跨链业务、目标区块的业务方与上链指示信息所指示的第M+1个区块的多个共同独占方的标识是否匹配等。目标区块通过共识校验是指第一代表节点根据自身校验结果以及区块链网络中,除第一代表节点以外的其他代表节点广播的目标区块的校验结果确定目标区块满足上链条件,则可以将目标区块上链到区块链中。
具体地,在确定上链指示信息指示区块链下一个待上链区块的类型为共同独占类型时,表明下一个待上链区块需要携带跨链业务数据,则计算机设备可以查询共同独占类型的共识规则。计算机设备按照共同独占类型的共识规则,对目标区块进行共识校验,若共识校验通过,则计算机设备将目标区块作为区块链下一个待上链区块添加至区块链上,从而实现对目标区块的上链处理。
本实施例中,计算机设备按照共同独占类型的共识规则对目标区块进行共识校验,在共识 校验通过时将目标区块添加到区块链上,从而可以确保目标区块满足上链条件,保证了将目标区块进行上链处理的成功率。
图3示出了本申请一个示例性实施例提供的另一种基于区块链的数据处理方法的流程示意图;其中,区块链上包含M个相互链接的区块,M为正整数;区块链位于区块链网络中,请参见图1e,区块链网络包括见证子网络和共识子网络,见证子网络包含至少一个业务节点;共识子网络包含N个共识集群,N为大于1的整数;每个共识集群由多个记账节点组成,每个共识集群在各自的共识集群内推举一个记账节点作为代表节点;N个代表节点组成区块链的共识委员会;方法由共识委员会中的第一代表节点执行,第一代表节点是共识委员会中的任一个代表节点;该基于区块链的数据处理方法可包括但不限于步骤S301-S305:
S301、获取区块链下一个待上链区块的竞拍结果信息,竞拍结果信息用于指示获得区块链下一个待上链区块的提案权限的第二代表节点,以及由第二代表节点提交的针对区块链下一个待上链区块的竞拍信息。
其中,区块链下一个待上链区块的竞拍结果信息,是由区块链网络中各个代表节点对区块链下一个待上链区块竞拍信息进行共识处理后得到的,具体根据竞拍信息确定具有下一个待上链区块的提案权限的第二代表节点提交得到。竞拍结果信息可以指示获得区块链下一个待上链区块的提案权限的第二代表节点,以及由第二代表节点提交的针对区块链下一个待上链区块的竞拍信息。在区块链中存在M个区块时,第M+1个区块的竞拍结果信息是由区块链网络中各个代表节点对第M+1个区块的竞拍信息进行共识处理(如根据竞拍信息确定具有第M+1个区块的提案权限的第二代表节点)后得到的;第M+1个区块的竞拍结果信息携带第M+1个区块的类型。
竞拍信息是在对第M个区块进行上链(共识)的过程中,由需要竞拍第M+1个区块的代表节点向区块链网络中的其他代表节点广播的,竞拍信息用于竞拍第M+1个区块的提案权限(竞拍一个独占类型或者共同独占类型的区块);竞拍信息中携带需要打包在第M+1个区块中的业务数据的相关信息(如打包在第M+1个区块中的业务数据的数量、第M+1个区块关联的业务方的标识、打包在第M+1个区块中的业务数据的类型等);获得第M+1个区块的提案权限的代表节点可以根据该代表节点的竞拍信息生成等待共识的目标区块(即对竞拍信息中报备的业务数据进行打包,生成等待共识的目标区块);例如,代表节点1在需要对该代表节点关联的1000个待存证业务数据进行存证时,向共识委员会广播竞拍信息1,竞拍信息1用于指示代表节点1请求获得第M+1个区块的提案权限,竞拍信息1中包括代表节点需要存储在第M+1个区块中的业务数据的数量,代表节点1的标识(如地址、签名等),以及用于竞拍第M+1个区块的竞拍资源;若代表节点1获取到第M+1个区块的提案权限,则代表节点1根据竞拍信息1中所指示的需要存储在第M+1个区块中的业务数据的数量,生成待共识的目标区块。
在一种具体实现方式中,竞拍交易中指定请求获得第M+1个区块的提案权限的代表节点的标识,以及要存放在第M+1个区块中的业务数据的数量。共识委员会对竞拍交易进行共识时,资源池中的待存证业务数据的数量是否满足这个竞拍交易的指定数量;例如,假设竞拍交易指定了第二代表节点要在第M+1个区块中放入1000个独占类型的业务数据,则共识委员会对竞拍交易进行共识包括:检查交易池中是否存在1000个以上的来源于第二代表节点的独占类型的业务数据或者普通类型的业务数据。此外,还可以校验智能合约中该竞拍交易对应的代表节点 目前的权限合法性(例如,校验代表节点维护的区块链子链中最后一个区块中的业务数据是否成功上链至共识委员会共同维护的公有区块链中)。
在跨链情况下,多个共识集群完成跨链业务交互之后,参与跨链业务的业务方随机协商一个代表节点,携带参与跨链业务的各业务方的签名,来竞拍一个共同独占类型的区块。竞拍信息中包括共同独占第M+1个区块的业务方的标识,每个业务方需要在第M+1个区块中放入的业务数据的数量等;例如,共识集群1-共识集群3共同参与完成了跨链业务1,共识集群1-共识集群3可以通过协商将共识集群1的代表节点1,确定为用于代表共识集群1-共识集群3申请用于存储跨链业务1相关的业务数据的共同独占类型的区块的代表节点,代表节点1生成的竞拍信息1中包括共识集群1-共识集群3的代表节点的标识,以及共识集群1-共识集群3(即各个业务方)需要在第M+1个区块中放入的业务数据的数量等。
在一个实施例中,竞拍信息包括待打包在区块链下一个待上链区块中的业务数据的数量、业务数据关联的业务方标识或业务数据的类型中的至少一项。
其中,目标区块还存储有多个业务方中每个业务方的待存证业务数据,待打包在区块链下一个待上链区块中的业务数据的数量,是指多个共同独占方中每个共同独占方的占用数量。目标区块与目标业务相关联,业务数据关联的业务方标识是指目标业务的标识。业务数据的类型是指待打包在区块链下一个待上链区块中的跨链业务数据的类型。
本实施例中,竞拍信息包括待打包在区块链下一个待上链区块中的业务数据的数量、业务数据关联的业务方标识或业务数据的类型中的至少一项,根据竞拍信息可以生成相应的上链指示信息,以通过上链指示信息对目标区块进行共识校验,确保跨链业务数据处理的准确性。
在一种实施方式中,竞拍信息包括等待时长和竞拍资源量,竞拍结果信息,是共识委员会基于竞拍信息中的等待时长和竞拍资源量,对竞拍信息进行共识校验,且当竞拍信息的共识校验成功后生成的。
具体地,共识委员会基于各个代表节点发送的竞拍信息中的等待时长和竞拍资源量对竞拍信息进行共识校验(如校验区块链网络中的资源池中是否存在竞拍信息所指示的待存证业务数据,区块链网络中的资源池中待存证业务数据的数量是否满足竞拍信息所指示的数量等)。以共同独占类型的区块的竞拍信息为例,竞拍信息中可以包括参与跨链业务的业务方的标识,以及各个业务方需要打包在第M+1个区块中的业务数据的数量,共识委员会可以核对竞拍信息所指示的业务方是否参与该跨链业务,还可以向各个业务方核对需要打包在第M+1个区块中的业务数据的数量是否准确等等。当竞拍信息共识校验成功后,生成竞拍结果信息。在一个实施例中,当存在多个代表节点竞拍一个区块时,根据等待时长和竞拍资源量计算竞拍总量,竞拍信息中对竞拍总量最大的竞拍信息进行共识校验;例如,设竞拍总量的运算规则为竞拍总量=(等待时长+竞拍资源量)*业务优先级对应的权值,国家税务局的等待时长为3分钟,竞拍资源量为97,业务优先级对应的权值为0.8;市级税务局的等待时长为5分钟,竞拍资源量为145,业务优先级对应的权值为0.5;县级税务局的等待时长为20分钟,竞拍资源量为180,业务优先级对应的权值为0.3;则国家税务局的竞拍总量=(3+97)*0.8=80,市级税务局的竞拍总量=(5+145)*0.5=75,县级税务局的的竞拍总量=(20+180)*0.3=60,由于80>75>60,因此对国家税务局广播的竞拍信息进行共识校验,若该竞拍信息共识校验通过,则根据该竞拍信息生成竞拍结果信息。
本实施例中,由共识委员会基于竞拍信息中的等待时长和竞拍资源量,对竞拍信息进行共 识校验后生成竞拍结果信息,从而确保了竞拍结果信息的权威有效性,能够保证基于区块链数据处理的有序进行。
在一个实施例中,等待时长和竞拍资源量呈负相关关系;竞拍信息至少根据等待时长和竞拍资源量进行加权运算得到。
竞拍信息包括等待时长和竞拍资源量,竞拍信息可以根据等待时长和竞拍资源量与各自对应的权值进行运算后求和得到,简单来说等待时长与竞拍资源量成反比(即等待时长越长,则所需的竞拍资源量越少,等待时长越短,则所需的竞拍资源量越多)。其中,等待时长是指目标代表节点从请求获取区块的提案权限开始到当前时刻的时长(期间目标代表节点未获得区块的提案权限),目标代表节点可以是公式委员会中的任一个代表节点;例如,若代表节点1在10分钟前请求获取区块的提案权限,且代表节点1在10分钟内未获得区块的提案权限,则代表节点1的等待时长为10分钟;又例如,若代表节点2在30分钟前请求获取区块的提案权限,且代表节点2在17分钟前获得了区块的提案权限,并在8分钟前再次获取区块的提案权限,则代表节点2的等待时长为8分钟。竞拍资源可以根据实际情况进行设定,例如竞拍资源可以是由以下一种或多种组成:实体资源、虚拟物品、待存证业务数据的数量等等。
本实施例中,通过等待时长和竞拍资源量进行加权运算得到竞拍信息,从而能够针对等待时长和竞拍资源量进行有效平衡,确保提案权限的分配效果,确保基于区块链数据处理的有序进行。
在一个实施例中,竞拍信息根据等待时长、竞拍资源量以及业务优先级对应的权值进行加权运算得到。
不同代表节点可以对应不同的优先级(以税务局为例,国家税务局的业务(开票)优先级高于市级税务局的业务(开票)优先级,市级税务局的业务(开票)优先级高于县级税务局的业务(开票)优先级),业务优先级越高则对应的权值越大,竞拍信息可以通过等待时长、竞拍资源量以及业务优先级对应的权值运算得到。
本实施例中,通过等待时长和竞拍资源量,按照业务优先级对应的权值进行加权运算得到竞拍信息,从而能够利用业务优先级,针对等待时长和竞拍资源量进行有效平衡,确保提案权限的分配效果,确保基于区块链数据处理的有序进行。
在一个实施例中,竞拍资源量对应的竞拍资源包括实体资源、虚拟物品或待存证业务数据的数量中的至少一种。
竞拍资源量对应的竞拍资源可以根据实际需要进行设置,具体可以包括但不限于包括实体资源、虚拟物品或待存证业务数据的数量等。通过设置不同的竞拍资源,可以适用于不同的应用场景,从而扩展了基于区块链的数据方法的适用场景。
在一个实施例中,第一代表节点和第二代表节点为不同的代表节点。获取区块链下一个待上链区块的竞拍结果信息,包括:在对区块链上处于末尾位置的区块进行共识的过程中,接收第二代表节点提交的针对区块链下一个待上链区块的竞拍信息,竞拍信息用于请求获得区块链下一个待上链区块的提案权限;对竞拍信息进行共识校验;以及,接收共识委员会广播的竞拍结果信息。
其中,末尾位置是指区块链中最后上链的区块所处的位置,如区块链中已存在M个区块时,则区块链上处于末尾位置的区块即为第M个区块。具体地,在对所述区块链上的第M个区块进 行共识的过程中,第一代表节点接收第二代表节点提交的针对第M+1个区块的竞拍信息,竞拍信息用于请求获得第M+1个区块的提案权限;第一代表节点对竞拍信息进行共识校验,并接收共识委员会(中除第一代表节点外的其他代表节点)广播的竞拍结果信息,将重复率最高的竞拍结果信息确定为最终的竞拍结果信息;例如,设第一代表节点获取的竞拍结果信息中,根据竞拍信息1生成的竞拍结果信息1的重复率为95%,根据竞拍信息2生成的竞拍结果信息2的重复率为3%,根据竞拍信息3生成的竞拍结果信息3的重复率为2%;则第一代表节点将根据竞拍信息1生成的竞拍结果信息1确定为最终的竞拍结果信息。
本实施例中,在第一代表节点和第二代表节点为不同的代表节点时,通过第一代表节点接收第二代表节点的竞拍信息,并基于竞拍信息进行共识校验后接收广播的竞拍结果信息,从而确保获得的竞拍结果信息为具有提案权限的第二代表节点所广播的,保证竞拍结果信息的准确性。
在另一个实施例中,第一代表节点和第二代表节点为同一个代表节点。在对区块链上处于末尾位置的区块进行共识的过程中,向共识委员会提交针对区块链下一个待上链区块的竞拍信息,竞拍信息用于请求获得区块链下一个待上链区块的提案权限;对竞拍信息进行共识校验;以及,接收共识委员会广播的竞拍结果信息。
其中,末尾位置是指区块链中最后上链的区块所处的位置。具体地,在对所述区块链上的第M个区块进行共识的过程中,第一代表节点向共识委员会提交针对第M+1个区块的竞拍信息,竞拍信息用于请求获得第M+1个区块的提案权限;第一代表节点对竞拍信息进行共识校验,并接收共识委员会(中除第一代表节点外的其他代表节点)广播的竞拍结果信息,将重复率最高的竞拍结果信息确定为最终的竞拍结果信息。
本实施例中,在第一代表节点和第二代表节点为同一节点时,直接通过第一代表节点提交竞拍信息进行共识校验后,接收广播的竞拍结果信息,从而确保获得的竞拍结果信息为具有提案权限的第一代表节点所广播的,保证竞拍结果信息的准确性。
S302、根据竞拍结果信息生成区块链下一个待上链区块的上链指示信息。
在一种实施方式中,第一代表节点根据竞拍结果信息确定第二代表节点(即具有第M+1个区块的提案权限的代表节点),并根据第二代表节点广播的竞拍信息生成第M+1个区块的上链指示信息;例如,第一代表节点可以直接将第二代表节点广播的竞拍信息作为第M+1个区块的上链指示信息;也可以从第二代表节点广播的竞拍信息中提取部分数据(如第M+1个区块关联的业务方的标识、各个业务方的待存证业务数据的数量等),并根据提取的数据生成第M+1个区块的上链指示信息。本实施例中,根据区块链下一个待上链区块的竞拍结果信息,生成上链指示信息,具体利用竞拍结果信息所指示的第二代表节点提交的针对区块链下一个待上链区块的竞拍信息,生成上链指示信息,可以准确得到区块链下一个待上链区块的上链指示信息,以准确确定区块链下一个待上链区块的类型。
在一个实施例中,根据竞拍结果信息生成区块链下一个待上链区块的上链指示信息,包括:从竞拍结果信息中提取竞拍信息;根据提取获得的竞拍信息,生成区块链下一个待上链区块的上链指示信息。
具体地,竞拍结果信息中携带有竞拍信息,计算机设备从获得的竞拍结果信息中提取竞拍信息,并基于得到的竞拍信息生成区块链下一个待上链区块的上链指示信息,以通过上链指示 信息确定区块链下一个待上链区块的类型。本实施例中,通过从竞拍结果信息中提取竞拍信息以生成上链指示信息,从而能够按照具备提案权限的第二代表节点提交的竞拍信息,确定区块链下一个待上链区块的类型,确保区块链下一个待上链区块能够进行有序处理。
S303、获取区块链网络中等待共识的目标区块。
在一种实施方式中,第一代表节点和第二代表节点为不同的代表节点,第一代表节点获取第二代表节点广播的等待共识的目标区块。
在另一种实施方式中,第一代表节点和第二代表节点为同一个代表节点,第一代表节点从区块链网络中的资源池中获取目标业务的各业务方的跨链业务数据,并根据各业务方的跨链业务数据生成目标区块。
具体地,第一代表节点在对第M个区块进行共识的过程中,确定第M个区块中是否打包有竞拍交易结果信息,如果第M个区块中打包有竞拍交易结果信息,则根据竞拍交易结果信息生成第M+1个区块的上链指示信息。通过第一代表节点从区块链网络中的资源池中,获得目标业务的各业务方的跨链业务数据,并生成目标区块,从而可以实现对跨链业务数据的高效处理。
若第M+1个区块的上链指示信息指示第M+1个区块的类型为独占类型,则第M+1个区块仅能存放与竞拍交易结果信息所指示代表节点关联的独占类型的业务数据和普通类型的业务数据(优先放入独占类型的业务数据,然后放入普通类型的业务数据填满目标区块(即使得第M+1个区块中业务数据的数量满足上链指示信息所指示的数量))。
可选的,增加一个对于第M+1区块的竞拍资源扣除业务,并将这个扣除业务与业务数据一起打包成目标区块。
若第M+1个区块的上链指示信息指示第M+1个区块的类型为共同独占类型,则第M+1个区块仅能存放与竞拍交易结果信息所指示的跨链业务相关联的共同独占类型的业务数据。
若第M+1个区块的上链指示信息指示第M+1个区块的类型为普通类型,则第M+1个区块用于存放在资源池中的普通类型的业务数据,以及全局的链上配置更新等交易。
需要说明的是,当区块链上连续T个区块的区块类型均为独占类型或者共同独占类型时,对智能合约进行变更,变更后的智能合约用于将目标区块的类型确定为普通类型(即区块链中连续生成T个独占类型或者共同独占类型的区块后,必需生成一个普通类型的区块),T为正整数。
其中,资源池中可以包括以下三种类型的业务数据:(1)独占类型的业务数据:独占类型的业务数据仅能放入独占类型的区块中。(2)共同独占类型的业务数据:仅能放入共同独占类型的区块中,共同独占类型的区块用于存放由2到N业务方共同参与的跨链业务所关联的共同独占类型的业务数据。跨链业务所关联的共同独占类型的业务数据可以是一种特别标明的业务数据,该业务数据中携带有参与跨链业务的方的区块链子链(各个共识集群各自维护的私有链)的标识,各个业务方标识(如各个业务方的地址,以及各个业务方的签名信息等)。(3)普通类型的业务数据:普通类型的业务数据既可以放入普通类型的区块中,也可以放入独占类型的区块中,在放入独占类型的区块中时,其优先级低于独占类型的业务数据。
S304、若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则按照共同独占类型的共识规则对目标区块进行共识校验。
按照共同独占类型的共识规则对目标区块进行共识校验包括第一代表节点根据上链指示信 息对目标区块进行合法性校验,共识委员会基于投票确定最后的共识校验结果。
按照共同独占类型的共识规则对目标区块进行共识校验可以包括以下一种或多种实施方式:
在一种实施方式中,目标区块与目标业务相关联,目标区块用于存储目标业务的跨链业务数据;按照共同独占类型的共识规则对目标区块进行共识校验,包括:校验目标业务是否为独立跨链业务;若目标业务是独立跨链业务,则确定目标区块通过共识校验。
第一代表节点的计算机设备校验目标业务是否为独立跨链业务;具体地,第一代表节点的计算机设备可以校验目标业务的业务数据是否为共同独占类型的业务数据,若目标业务的业务数据不是共同独占类型的业务数据,则判定目标业务不是独立跨链业务,目标区块未通过共识校验;若目标业务的业务数据是共同独占类型的业务数据,则确定目标区块通过共识校验,可以将目标区块添加到区块链上。
进一步地,在确定目标业务的业务数据是共同独占类型的业务数据时,计算机设备还可以根据目标业务的业务数据中携带的目标业务的业务方的标识是否匹配;若目标业务的业务数据中携带的目标业务的业务方的标识匹配,则判定目标业务是独立跨链业务,目标区块通过共识校验;若目标业务的业务数据中携带的目标业务的业务方的标识不匹配,则判定目标业务是独立跨链业务,目标区块通过共识校验;例如,设目标业务由业务方A和业务方B参与,若业务方A的业务数据中携带业务方B(和业务方A)的标识,且业务方B的业务数据中携带业务方A(和业务方B)的标识,则判定目标业务是独立跨链业务,目标区块通过共识校验;相应地,若业务方A的业务数据中携带除(业务方A和)业务方B以外的业务方的标识(如业务方A的业务数据中携带业务方C的标识),或者业务方B的业务数据中携带除业务方A(和业务方B)以外的业务方的标识(如业务方B的业务数据中携带业务方D的标识),则判定目标业务不是独立跨链业务,目标区块未通过共识校验。
本实施例中,计算机设备针对目标区块所关联的目标业务进行校验,从而确定目标业务是否为独立跨链业务,实现对目标区块的校验,确保目标区块符合下一个待上链区块的业务条件,确保添加到区块链下一个区块的准确性。
在另一种实施方式中,目标区块与目标业务相关联,目标区块存储有参与目标业务的多个业务方的标识;上链指示信息还用于指示区块链下一个待上链区块的多个共同独占方的标识。按照共同独占类型的共识规则对目标区块进行共识校验,包括:检验目标区块中的多个业务方的标识与区块链下一个待上链区块的多个共同独占方的标识是否一致;若目标区块中的多个业务方的标识与区块链下一个待上链区块的多个共同独占方的标识一致,则确定目标区块通过共识校验。
具体地,第一代表节点检验目标区块中的多个业务方的标识与区块链下一个待上链区块的多个共同独占方的标识是否一致,在区块链中存在M个区块时,具体可以确定与第M+1个区块的多个共同独占方的标识是否一致;若目标区块中的多个业务方的标识与第M+1个区块的多个共同独占方的标识一致,则目标区块通过共识校验;若目标区块中的多个业务方的标识与第M+1个区块的多个共同独占方的标识不一致,则目标区块未通过共识校验;例如,若目标区块存储有参与目标业务的业务方1的标识和业务方2的标识,且上链指示信息指示第M+1个区块的共同独占方的标识为业务方1的标识和业务方2的标识,则第一代表节点判定目标区块通过共识校验,可以将目标区块添加到区块链上。
本实施例中,计算机设备针对目标区块所关联目标业务的业务方的标识进行校验,从而确定目标区块中多个业务方的标识与区块链下一个待上链区块的多个共同独占方的标识一致,实现对目标区块的校验,确保目标区块符合下一个待上链区块的业务方条件,确保添加到区块链下一个区块的准确性。
在一个实施例中,目标区块还存储有多个业务方中每个业务方的待存证业务数据;上链指示信息还用于指示多个共同独占方中每个共同独占方的占用数量。在目标区块中的多个业务方的标识与区块链下一个待上链区块的多个共同独占方的标识一致之后,还包括:获取目标区块中每个业务方的待存证业务数据的数量;检验每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量是否匹配;若每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量匹配,则继续执行判定确定目标区块通过共识校验的步骤。
具体地,第一代表节点获取目标区块中每个业务方的待存证业务数据的数量(如统计目标区块中各个业务方的待存证业务数据的数量),并检验每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量是否匹配(例如检验目标区块中每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量是否相同),若每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量匹配;则目标区块通过共识校验;若存在至少一个业务方的待存证业务数据的数量与相应的共同独占方的占用数量不匹配;则判定目标区块未通过共识校验。例如,设目标区块中存储有2条业务方1的待存证业务数据,1条业务方2的待存证数据,且上链指示信息指示业务方1的占用数量为2,业务方2的占用数量为1,则第一代表节点判定目标区块通过共识校验。
本实施例中,计算机设备针对目标区块所存储的每个业务方的待存证业务数据的数量进行校验,从而确定目标区块中每个业务方的待存证业务数据的数量,与区块链下一个待上链区块的每个共同独占方的占用数量相匹配,实现对目标区块的校验,确保目标区块符合下一个待上链区块的待存证业务数据的数量条件,确保添加到区块链下一个区块的准确性。
在再一种实施方式中,目标区块与目标业务相关联,目标业务由多个业务方参与,一个业务方是指共识子网络中的一个共识集群;目标区块还存储有多个业务方中每个业务方的待存证业务数据;每个业务方维护有一条区块链子链(即每个共识集群维护有一条用于存储该共识集群中的业务数据的私有链)。按照共同独占类型的共识规则对目标区块进行共识校验,包括:检验目标区块中的每个业务方的待存证业务数据是否已存储至每个业务方各自的区块链子链中;若目标区块中的每个业务方的待存证业务数据已存储至每个业务方各自的区块链子链中,则确定目标区块通过共识校验。
具体地,第一代表节点检验目标区块中的每个业务方的待存证业务数据是否已存储至每个业务方各自的区块链子链中(如第一代表节点向各个业务方发送确认信息,以确认每个业务方的待存证业务数据已存储至每个业务方各自的区块链子链中);若目标区块中的每个业务方的待存证业务数据已存储至每个业务方各自的区块链子链中,则判定目标区块通过共识校验;若存在至少一个目标区块中的业务方的待存证业务数据未存储至该业务方各自的区块链子链中,则判定目标区块未通过共识校验。
本实施例中,计算机设备针对目标区块中待存证业务数据是否已存储至每个业务方各自的区块链子链中进行校验,确保每个业务方各自的区块链子链中已经存储有相应的待存证业务数 据,确保目标区块符合下一个待上链区块的待存证业务数据的子链存储条件,确保添加到区块链下一个区块的准确性。
S305、若目标区块通过共识校验,则将目标区块作为区块链下一个待上链区块添加至区块链上。
其中,第M+1个区块中携带该区块的类型标识,以及第M+1个区块关联的业务方的标识。在一种具体的实施方式中,在区块链上添加新的区块的流程如下:
(1)第M+1个区块的第二代表节点生成待共识的目标区块;
(2)第M+1个区块的第二代表节点将待共识的目标区块广播给共识委员会中除第二代表节点外的其他代表节点;
(3)共识委员会中的代表节点对待共识的目标区块进行校验,并将各自的校验结果广播给共识委员会中的其他代表节点(如投票支持自己认可的校验结果);
(4)共识委员会中的各个代表节点收集共识委员会中其他代表节点的投票,并广播收集到的大于比例阈值(如2/3)投票结果;
(5)共识委员会中的各个代表节点收集共识委员会中其他代表节点的投票结果,若指示待共识的目标区块校验通过的校验结果获得的投票的比例大于比例阈值(如2/3),则表示待共识的目标区块共识通过;
(6)将目标区块作为区块链中的第M+1个区块,并根据共识的竞拍结果信息确定第M+2个区块对应的第二代表节点。
图4示出了本申请一个示例性实施例提供的一种基于区块链的数据处理场景的示意图,为更详细介绍本申请提供的基于区块链的数据处理方法的实现方式,下面结合图4进行简单介绍。如图4所示,共识子网络中包括N个共识集群,N为大于1的整数,共识子网络中所包含的各个共识集群可推选一个记账节点作为代表节点,N个代表节点组成共识委员会,共识委员会维护共识子网络的一条区块链401,该区块链401即为区块链网络中的主链。N个共识集群可竞拍区块链网络的提案权限,当某个共识集群获得提案权限后,由该具备提案权限的共识集群负责产生待共识的目标区块,并由具备提案权限的共识集群的代表节点负责将待共识的目标区块广播给共识委员会中的各个代表节点,由共识委员会进行共识处理。例如:区块链401中的区块A1由共识集群3中的代表节点广播给共识委员会中的各个代表节点,再如:区块链401中的区块C1由共识集群1中的代表节点广播给共识委员会中的各个代表节点。这样共识委员会维护的区块链中可记录整个共识子网络的业务数据,便于对整个共识子网络中不同共识集群提供的业务数据的管理和审查。
当然,各个共识集群还可以维护自己的区块链子链,该区块链子链只包含自身业务的区块,这样便于共识集群对本身的业务数据进行管理。具体实现中,当共识集群内产生一个新的区块时,该新的区块可以锚定本共识集群内产生的上一个区块,实现组织本共识集群的区块链子链。如图4所示的共识集群1,共识集群1可以组织自己的区块链子链402,该区块链子链402中包括在共识集群1内产生的区块C1和区块C2;其中,在共识集群1中产生区块C2时,区块C2可以锚定共识集群1中区块链子链401的上一个区块C1,即区块C2中记录了本共识集群1中区块链子链402的上一个区块C1的哈希值(subprehash),即区块C1的哈希值。当区块C2由代表节点提交到共识子网络的区块链401中进行共识处理时,区块C2还可以锚定区块链401中 上一个区块,此时区块2中记录了区块链401中区块D1的哈希值(prehash),即区块D1的哈希值。基于上述描述,每个共识集群可以通过区块中的subprehash来组织自己的区块链子链,便于对本集群内的业务数据进行管理,而共识委员会可维护整个共识子网络的区块链,便于对整个共识子网络的业务数据的统一管理和审查。
更进一步地,共识子网络中的各个共识集群还可以进行跨链交互(即执行跨链业务)。具体地:
(1)各个共识集群中的记账节点支持其他共识集群中的记账节点对其发起跨链请求(如进行跨链业务数据交互);
(2)跨链请求对应的业务智能合约要事先注册在各个共识集群的记账节点中;
(3)在至少两个共识集群的记账节点建立连接后,进行跨链业务的调用,在调用的过程中,产生的与该跨链业务相关的业务数据,要在各个共识集群中打包成区块链子链的区块。如图4所示,A2为共识集群3中打包的区块链子链的区块,B2为共识集群4中打包的区块链子链的区块。共同独占类型的区块只能放入与跨链业务相关的共同独占类型的业务数据(如A2,B2中的业务数据)。需要说明的是,共识集群3和共识集群4中间的跨链交互是一个独立跨链业务,与该独立跨链业务关联的共同独占类型的业务数据只能放入一个单独的共同独占类型的区块中,不能将多个独立跨链业务关联的共同独占类型的业务数据混在一起打包;
(4)与(3)同理,各个代表节点在竞拍共同独占类型的区块时,每产生一个独立跨链业务就竞拍一个共同独占类型的区块;
(5)由于跨链业务涉及到多方确认,如图4所示,在共识集群3在将A2添加到该共识集群维护的区块链子链,以及共识集群4在将B2添加到该共识集群维护的区块链子链后,共识集群3和共识集群4需要等到区块链主链上的A2+B2区块共识通过后,才能继续在自己维护的区块链子链上添加新的区块。
以处理的业务为发票业务为例,共识算法是和区块链电子发票处理逻辑绑定,各个开票机构(不同省市的地方税局)通过向共识委员会广播竞拍信息来获得出块机会。在对区块链的第N个区块进行共识的过程中,会决定N+1块区块由谁竞拍得到。不同税局的代表节点(如SPV节点)在积累了一定数量的业务数据(开票数据)后,会向共识委员会广播竞拍信息来竞拍一个独占类型的区块,共识委员会根据各个代表节点的竞拍信息来确定哪一个代表节点具有下一个区块的提案权限,获得下一个区块的提案权限的代表节点在竞拍到一个独占类型的区块后,根据等待时长,支付一定数量的竞拍资源(等待时长权重和竞拍资源方案可根据实际需求进行设计),该独占类型的区块则会全部打包该与该代表节点相关联的独占类型的业务数据(开票数据)和普通类型的业务数据(开票数据)。
本申请实施例中,通过竞拍独占类型的区块,可以单个共识集群(对应的机构)的业务数据进行批量上链,且独占类型的区块可以让单个代表节点将相关联的业务数据存储在单个区块之中,便于后续的校验和审计。独占类型的区块可以更好地隔离不同代表节点的业务数据,更好地保护隐私。同时在进行业务数据查找时,可以通过各个共识集群维护的区块链子链快速跳过不相关区块,提高效率查询效率。此外,竞拍的方式可以有效地满足需要尽快将大量业务数据进行上链的代表节点的需求,同时通过等待时长来整体计算所需的竞拍资源,保证区块链网络整体的效率和公平。对于跨链业务对应的数据处理方案来说,本申请除了提供了一种可行的多业务 方交互方案之外,还通过共同独占类型的区块保证了每个跨链业务数据的独立性,每个共识集群维护的区块链子链可以有效地同步和自己相关的跨链数据。实践证明该方案的扩展性好,适用于区块链网络中存在多个共识集群,且不断添加不同的跨链业务的场景。
上述详细阐述了本申请实施例的方法,为了便于更好地实施本申请实施例的上述方案,相应地,下面提供了本申请实施例的装置。
请参见图5,图5示出了本申请一个示例性实施例提供的一种基于区块链的数据处理装置的结构示意图,该装置可以搭载在图1e所示的代表节点上。图5所示的基于区块链的数据处理装置可以用于执行上述图2和图3所描述的方法实施例中的部分或全部功能。其中,区块链上包含至少一个区块;区块链位于区块链网络中,区块链网络包括见证子网络和共识子网络,见证子网络包含至少一个业务节点;共识子网络包含至少两个共识集群;每个共识集群包括多个记账节点,每个共识集群在各自的共识集群内推举一个记账节点作为代表节点;各个共识集群的代表节点组成区块链的共识委员会;数据处理装置可以搭载在共识委员会中的第一代表节点中,第一代表节点是共识委员会中的任一个代表节点;请参见图5,各个单元的详细描述如下:
获取单元501,用于获取区块链的上链指示信息,上链指示信息用于指示区块链下一个待上链区块的类型;以及用于获取区块链网络中等待共识的目标区块;目标区块是根据跨链业务数据生成的;及
处理单元502,用于若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则将目标区块作为区块链下一个待上链区块添加至区块链上;其中,共同独占类型的区块用于存储独立跨链业务。
在一个实施例中,处理单元502,还用于若上链指示信息指示区块链下一个待上链区块的类型为共同独占类型,则按照共同独占类型的共识规则对目标区块进行共识校验;若目标区块通过共识校验,则将目标区块作为区块链下一个待上链区块添加至区块链上。
在一种实施方式中,目标区块与目标业务相关联,目标区块用于存储目标业务的跨链业务数据;处理单元502,还用于校验目标业务是否为独立跨链业务;若目标业务是独立跨链业务,则确定目标区块通过共识校验。
在一种实施方式中,目标区块与目标业务相关联,目标区块存储有参与目标业务的多个业务方的标识;上链指示信息还用于指示区块链下一个待上链区块的多个共同独占方的标识;处理单元502,还用于检验目标区块中的多个业务方的标识与区块链下一个待上链区块的多个共同独占方的标识是否一致;若目标区块中的多个业务方的标识与区块链下一个待上链区块的多个共同独占方的标识一致,则确定目标区块通过共识校验。
在一种实施方式中,目标区块还存储有多个业务方中每个业务方的待存证业务数据;上链指示信息还用于指示多个共同独占方中每个共同独占方的占用数量;处理单元502还用于获取目标区块中每个业务方的待存证业务数据的数量;检验每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量是否匹配;若每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量匹配,则继续执行判定确定目标区块通过共识校验的步骤。
在一种实施方式中,目标区块与目标业务相关联,目标业务由多个业务方参与,一个业务方是指共识子网络中的一个共识集群;目标区块还存储有多个业务方中每个业务方的待存证业务数据;每个业务方维护有一条区块链子链;处理单元502还用于检验目标区块中的每个业务方 的待存证业务数据是否已存储至每个业务方各自的区块链子链中;若目标区块中的每个业务方的待存证业务数据已存储至每个业务方各自的区块链子链中,则确定目标区块通过共识校验。
在一种实施方式中,获取单元501还用于获取区块链下一个待上链区块的竞拍结果信息,竞拍结果信息用于指示获得区块链下一个待上链区块的提案权限的第二代表节点,以及由第二代表节点提交的针对区块链下一个待上链区块的竞拍信息;根据竞拍结果信息生成区块链下一个待上链区块的上链指示信息。
在一种实施方式中,获取单元501还用于在对区块链上处于末尾位置的区块进行共识的过程中,接收第二代表节点提交的针对区块链下一个待上链区块的竞拍信息,竞拍信息用于请求获得区块链下一个待上链区块的提案权限;对竞拍信息进行共识校验;以及,接收共识委员会广播的竞拍结果信息。
在一种实施方式中,若第一代表节点与第二代表节点为同一节点,则获取单元501还用于在对区块链上处于末尾位置的区块进行共识的过程中,向共识委员会提交针对区块链下一个待上链区块的竞拍信息,竞拍信息用于请求获得区块链下一个待上链区块的提案权限;对竞拍信息进行共识校验;以及,接收共识委员会广播的竞拍结果信息。
在一个实施例中,获取单元501还用于从竞拍结果信息中提取竞拍信息;根据提取获得的竞拍信息,生成区块链下一个待上链区块的上链指示信息。
在一个实施例中,竞拍信息包括待打包在区块链下一个待上链区块中的业务数据的数量、业务数据关联的业务方标识或业务数据的类型中的至少一项。
在一种实施方式中,竞拍信息包括等待时长和竞拍资源量;竞拍结果信息,是共识委员会基于竞拍信息中的等待时长和竞拍资源量,对竞拍信息进行共识校验,且当竞拍信息的共识校验成功后生成的。
在一个实施例中,竞拍资源量对应的竞拍资源包括实体资源、虚拟物品或待存证业务数据的数量中的至少一种。
在一种实施方式中,目标区块与目标业务相关联,目标业务由多个业务方参与;若第一代表节点与第二代表节点为同一节点,则处理单元502还用于:从区块链网络中的资源池中获取目标业务的各业务方的跨链业务数据,并根据各业务方的跨链业务数据生成目标区块。
根据本申请的一个实施例,图2和图3所示的基于区块链的数据处理方法所涉及的部分步骤可由图5所示的基于区块链的数据处理装置中的各个单元来执行。例如,图2中所示的步骤S201和步骤S202可由图5所示的获取单元501执行,步骤S203可由图5所示的处理单元502执行。图3中所示的步骤S301和步骤S303可由图5所示的获取单元501执行,步骤S302,步骤S304和步骤S305可由图5所示的处理单元502执行。图5所示的基于区块链的数据处理装置中的各个单元可以分别或全部合并为一个或若干个另外的单元来构成,或者其中的某个(些)单元还可以再拆分为功能上更小的多个单元来构成,这可以实现同样的操作,而不影响本申请的实施例的技术效果的实现。上述单元是基于逻辑功能划分的,在实际应用中,一个单元的功能也可以由多个单元来实现,或者多个单元的功能由一个单元实现。在本申请的其它实施例中,基于区块链的数据处理装置也可以包括其它单元,在实际应用中,这些功能也可以由其它单元协助实现,并且可以由多个单元协作实现。
根据本申请的另一个实施例,可以通过在包括中央处理单元(CPU)、随机存取存储介质 (RAM)、只读存储介质(ROM)等处理元件和存储元件的例如计算机的通用计算装置上运行能够执行如图2和图3中所示的相应方法所涉及的各步骤的计算机程序(包括程序代码),来构造如图5中所示的基于区块链的数据处理装置,以及来实现本申请实施例的基于区块链的数据处理方法。计算机程序可以记载于例如计算机可读记录介质上,并通过计算机可读记录介质装载于上述计算装置中,并在其中运行。
本申请实施例中,通过竞拍独占类型的区块,可以单个共识集群(对应的机构)的业务数据进行批量上链,且独占类型的区块可以让单个代表节点将相关联的业务数据存储在单个区块之中,便于后续的校验和审计。独占类型的区块可以更好地隔离不同代表节点的业务数据,更好地保护隐私。同时在进行业务数据查找时,可以通过各个共识集群维护的区块链子链快速跳过不相关区块,提高效率查询效率。此外,竞拍的方式可以有效地满足需要尽快将大量业务数据进行上链的代表节点的需求,同时通过等待时长来整体计算所需的竞拍资源,保证区块链网络整体的效率和公平。对于跨链业务对应的数据处理方案来说,本申请除了提供了一种可行的多业务方交互方案之外,还通过共同独占类型的区块保证了每个跨链业务数据的独立性,每个共识集群维护的区块链子链可以有效地同步和自己相关的跨链数据。实践证明该方案的扩展性好,适用于区块链网络中存在多个共识集群,且不断添加不同的跨链业务的场景。
请参阅图6,图6示出了本申请一个示例性实施例提供的一种基于区块链的数据处理设备的结构示意图,如图6所示,基于区块链的数据处理设备至少包括处理器601、通信接口602和存储器603。其中,处理器601、通信接口602和存储器603可通过总线或其他方式连接。其中,处理器601(或称中央处理器(Central Processing Unit,CPU))是终端的计算核心以及控制核心,其可以解析终端内的各类指令以及处理终端的各类数据,例如:CPU可以用于解析用户向终端所发送的开关机指令,并控制终端进行开关机操作;再如:CPU可以在终端内部结构之间传输各类交互数据,等等。通信接口602可选的可以包括标准的有线接口、无线接口(如WI-FI、移动通信接口等),受处理器601的控制可以用于收发数据;通信接口602还可以用于终端内部数据的传输以及交互。存储器603(Memory)是终端中的记忆设备,用于存放程序和数据。可以理解的是,此处的存储器603既可以包括终端的内置存储器,当然也可以包括终端所支持的扩展存储器。存储器603提供存储空间,该存储空间存储了终端的操作系统,可包括但不限于:Android系统、iOS系统、Windows Phone系统等等,本申请对此并不作限定。
本申请实施例还提供了一种计算机可读存储介质(Memory),计算机可读存储介质是终端中的记忆设备,用于存放计算机可读指令和数据。可以理解的是,此处的计算机可读存储介质既可以包括终端中的内置存储介质,当然也可以包括终端所支持的扩展存储介质。计算机可读存储介质提供存储空间,该存储空间存储了终端的处理系统。并且,在该存储空间中还存放了适于被处理器601加载并执行的一条或多条的计算机可读指令,这些计算机可读指令可以是一个或多个的计算机程序(包括程序代码)。需要说明的是,此处的计算机可读存储介质可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器;可选的,还可以是至少一个位于远离前述处理器的计算机可读存储介质。
在一个实施例中,该计算机可读存储介质中存储有一条或多条计算机可读指令;由处理器601加载并执行计算机可读存储介质中存放的一条或多条计算机可读指令,以实现上述基于区块链的数据处理方法实施例中的相应步骤。
本申请实施例还提供一种存储有计算机可读指令的非易失性计算机可读存储介质,计算机可读存储介质中存储有一条或多条计算机可读指令,一条或多条计算机可读指令适于由处理器加载并执行上述方法实施例的基于区块链的数据处理方法。
本申请实施例还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述方法实施例的基于区块链的数据处理方法。
本申请实施例还提供一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机可读指令,该计算机可读指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机可读指令,处理器执行该计算机可读指令,使得该计算机设备执行上述基于区块链的数据处理的方法。
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。本申请实施例装置中的模块可以根据实际需要进行合并、划分和删减。本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,可读存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。
以上所揭露的仅为本申请一种较佳实施例而已,当然不能以此来限定本申请之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分流程,并依本申请权利要求所作的等同变化,仍属于申请所涵盖的范围。

Claims (20)

  1. 一种基于区块链的数据处理方法,其特征在于,所述区块链上包含至少一个区块;所述区块链位于区块链网络中,所述区块链网络包括见证子网络和共识子网络,所述见证子网络包含至少一个业务节点;所述共识子网络包含至少两个共识集群,每个所述共识集群包括多个记账节点,每个所述共识集群在各自的共识集群内推举一个记账节点作为代表节点;各个所述共识集群的代表节点组成所述区块链的共识委员会;所述方法由所述共识委员会中的第一代表节点执行,所述第一代表节点是所述共识委员会中的任一个代表节点;所述方法包括:
    获取所述区块链的上链指示信息,所述上链指示信息用于指示所述区块链下一个待上链区块的类型;
    获取所述区块链网络中等待共识的目标区块;所述目标区块是根据跨链业务数据生成的;及
    若所述上链指示信息指示所述区块链下一个待上链区块的类型为共同独占类型,则将所述目标区块作为所述区块链下一个待上链区块添加至所述区块链上;其中,共同独占类型的区块用于存储独立跨链业务。
  2. 如权利要求1所述的方法,其特征在于,所述若所述上链指示信息指示所述区块链下一个待上链区块的类型为共同独占类型,则将所述目标区块作为所述区块链下一个待上链区块添加至所述区块链上,包括:
    若所述上链指示信息指示所述区块链下一个待上链区块的类型为共同独占类型,则按照共同独占类型的共识规则对所述目标区块进行共识校验;及
    若所述目标区块通过所述共识校验,则将所述目标区块作为所述区块链下一个待上链区块添加至所述区块链上。
  3. 如权利要求2所述的方法,其特征在于,所述目标区块与目标业务相关联,所述目标区块用于存储所述目标业务的跨链业务数据;所述按照共同独占类型的共识规则对所述目标区块进行共识校验,包括:
    校验所述目标业务是否为独立跨链业务;及
    若所述目标业务是独立跨链业务,则确定所述目标区块通过所述共识校验。
  4. 如权利要求2所述的方法,其特征在于,所述目标区块与目标业务相关联,所述目标区块存储有参与所述目标业务的多个业务方的标识;所述上链指示信息还用于指示所述区块链下一个待上链区块的多个共同独占方的标识;所述按照共同独占类型的共识规则对所述目标区块进行共识校验,包括:
    检验所述目标区块中的多个业务方的标识与所述区块链下一个待上链区块的多个共同独占方的标识是否一致;及
    若所述目标区块中的多个业务方的标识与所述区块链下一个待上链区块的多个共同独占方的标识一致,则确定所述目标区块通过所述共识校验。
  5. 如权利要求4所述的方法,其特征在于,所述目标区块还存储有所述多个业务方中每个业务方的待存证业务数据;所述上链指示信息还用于指示所述多个共同独占方中每个共同 独占方的占用数量;在所述目标区块中的多个业务方的标识与所述区块链下一个待上链区块的多个共同独占方的标识一致之后,所述方法还包括:
    获取所述目标区块中每个业务方的待存证业务数据的数量;
    检验所述每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量是否匹配;及
    若所述每个业务方的待存证业务数据的数量与相应的每个共同独占方的占用数量匹配,则继续执行判定确定所述目标区块通过所述共识校验的步骤。
  6. 如权利要求2所述的方法,其特征在于,所述目标区块与目标业务相关联,所述目标业务由多个业务方参与,一个所述业务方是指所述共识子网络中的一个共识集群;所述目标区块还存储有所述多个业务方中每个业务方的待存证业务数据;每个业务方维护有一条区块链子链;
    所述按照共同独占类型的共识规则对所述目标区块进行共识校验,包括:
    检验所述目标区块中的每个业务方的待存证业务数据是否已存储至所述每个业务方各自的区块链子链中;及
    若所述目标区块中的每个业务方的待存证业务数据已存储至所述每个业务方各自的区块链子链中,则确定所述目标区块通过所述共识校验。
  7. 如权利要求1所述的方法,其特征在于,所述获取所述区块链的上链指示信息,包括:
    获取所述区块链下一个待上链区块的竞拍结果信息,所述竞拍结果信息用于指示获得所述区块链下一个待上链区块的提案权限的第二代表节点,以及由所述第二代表节点提交的针对所述区块链下一个待上链区块的竞拍信息;及
    根据所述竞拍结果信息生成所述区块链下一个待上链区块的上链指示信息。
  8. 如权利要求7所述的方法,其特征在于,所述获取所述区块链下一个待上链区块的竞拍结果信息,包括:
    在对所述区块链上处于末尾位置的区块进行共识的过程中,接收所述第二代表节点提交的针对所述区块链下一个待上链区块的竞拍信息,所述竞拍信息用于请求获得所述区块链下一个待上链区块的提案权限;
    对所述竞拍信息进行共识校验;以及,
    接收所述共识委员会广播的所述竞拍结果信息。
  9. 如权利要求7所述的方法,其特征在于,若所述第一代表节点与所述第二代表节点为同一节点,则所述获取所述区块链下一个待上链区块的竞拍结果信息,包括:
    在对所述区块链上处于末尾位置的区块进行共识的过程中,向所述共识委员会提交针对所述区块链下一个待上链区块的竞拍信息,所述竞拍信息用于请求获得所述区块链下一个待上链区块的提案权限;
    对所述竞拍信息进行共识校验;以及,
    接收所述共识委员会广播的所述竞拍结果信息。
  10. 如权利要求7所述的方法,其特征在于,所述根据所述竞拍结果信息生成所述区块链下一个待上链区块的上链指示信息,包括:
    从所述竞拍结果信息中提取所述竞拍信息;及
    根据提取获得的所述竞拍信息,生成所述区块链下一个待上链区块的上链指示信息。
  11. 如权利要求7-10任一项所述的方法,其特征在于,所述竞拍信息包括待打包在所述区块链下一个待上链区块中的业务数据的数量、业务数据关联的业务方标识或业务数据的类型中的至少一项。
  12. 如权利要求7-10任一项所述的方法,其特征在于,所述竞拍信息包括等待时长和竞拍资源量;
    所述竞拍结果信息,是所述共识委员会基于所述竞拍信息中的所述等待时长和所述竞拍资源量,对所述竞拍信息进行共识校验,且当所述竞拍信息的共识校验成功后生成的。
  13. 如权利要求12所述的方法,其特征在于,所述等待时长和所述竞拍资源量呈负相关关系;所述竞拍信息至少根据所述等待时长和所述竞拍资源量进行加权运算得到。
  14. 如权利要求13所述的方法,其特征在于,所述竞拍信息根据所述等待时长、所述竞拍资源量以及业务优先级对应的权值进行加权运算得到。
  15. 如权利要求12所述的方法,其特征在于,所述竞拍资源量对应的竞拍资源包括实体资源、虚拟物品或待存证业务数据的数量中的至少一种。
  16. 如权利要求7所述的方法,其特征在于,所述目标区块与目标业务相关联,所述目标业务由多个业务方参与;若所述第一代表节点与所述第二代表节点为同一节点,则所述方法还包括:
    从所述区块链网络中的资源池中获取所述目标业务的各业务方的跨链业务数据,并根据所述各业务方的跨链业务数据生成所述目标区块。
  17. 一种基于区块链的数据处理装置,其特征在于,所述区块链上包含至少一个区块;所述区块链位于区块链网络中,所述区块链网络包括见证子网络和共识子网络,所述见证子网络包含至少一个业务节点;所述共识子网络包含至少两个共识集群;每个所述共识集群包括多个记账节点,每个所述共识集群在各自的共识集群内推举一个记账节点作为代表节点;各个所述共识集群的代表节点组成所述区块链的共识委员会;所述数据处理装置可以搭载在所述共识委员会中的第一代表节点中,所述第一代表节点是所述共识委员会中的任一个代表节点;所述数据处理装置,包括:
    获取单元,用于获取所述区块链的上链指示信息,所述上链指示信息用于指示所述区块链下一个待上链区块的类型;以及用于获取所述区块链网络中等待共识的目标区块;所述目标区块是根据跨链业务数据生成的;及
    处理单元,用于若所述上链指示信息指示所述区块链下一个待上链区块的类型为共同独占类型,则将所述目标区块作为所述区块链下一个待上链区块添加至所述区块链上;其中,共同独占类型的区块用于存储独立跨链业务。
  18. 一种基于区块链的数据处理设备,其特征在于,包括:
    一个或多个处理器,适于执行计算机可读指令;及
    计算机可读存储介质,所述计算机可读存储介质中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,实现如权利要求1-16任一项所述的基于区块链的数据处理方 法。
  19. 一种存储有计算机可读指令的非易失性计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令适于被处理器加载并执行如权利要求1-16任一项所述的基于区块链的数据处理方法。
  20. 一种计算机程序产品,所述计算机程序产品包括计算机可读指令,所述计算机可读指令存储在计算机可读存储介质中;计算机设备的处理器从所述计算机可读存储介质读取所述计算机指令,所述处理器执行所述计算机可读指令,使得所述计算机设备执行权利要求1-16任一项所述的方法。
PCT/CN2022/108482 2021-08-18 2022-07-28 基于区块链的数据处理方法、装置、设备及存储介质 WO2023020233A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22857546.0A EP4318362A1 (en) 2021-08-18 2022-07-28 Blockchain-based data processing method, apparatus and device, and storage medium
US18/323,120 US20230299984A1 (en) 2021-08-18 2023-05-24 Blockchain-based data processing method, apparatus and device, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110948504.6 2021-08-18
CN202110948504.6A CN113395363B (zh) 2021-08-18 2021-08-18 基于区块链的数据处理方法、装置、设备及存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/323,120 Continuation US20230299984A1 (en) 2021-08-18 2023-05-24 Blockchain-based data processing method, apparatus and device, and storage medium

Publications (1)

Publication Number Publication Date
WO2023020233A1 true WO2023020233A1 (zh) 2023-02-23

Family

ID=77622919

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/108482 WO2023020233A1 (zh) 2021-08-18 2022-07-28 基于区块链的数据处理方法、装置、设备及存储介质

Country Status (4)

Country Link
US (1) US20230299984A1 (zh)
EP (1) EP4318362A1 (zh)
CN (1) CN113395363B (zh)
WO (1) WO2023020233A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116684425A (zh) * 2023-07-28 2023-09-01 腾讯科技(深圳)有限公司 区块链的数据处理方法、系统、装置和计算机设备
CN117395305A (zh) * 2023-12-11 2024-01-12 广东电网有限责任公司东莞供电局 基于区块链的安全计算方法、装置、设备及存储介质

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113395363B (zh) * 2021-08-18 2021-10-29 腾讯科技(深圳)有限公司 基于区块链的数据处理方法、装置、设备及存储介质
CN113987566B (zh) * 2021-10-13 2024-04-23 普洛斯科技(重庆)有限公司 基于Hyperledger Fabric的内部桥接跨链方法、装置、设备和介质
US20230409602A1 (en) * 2022-06-21 2023-12-21 International Business Machines Corporation Data management
CN115174685B (zh) * 2022-07-05 2023-08-11 上海交通大学 基于流水线机制的区块链中的非中断式跨链委员会换届方法
CN115174598B (zh) * 2022-09-01 2022-12-27 杭州趣链科技有限公司 区块同步方法、区块链系统、设备和存储介质
CN116562884B (zh) * 2023-06-30 2023-09-26 睿格钛氪(北京)技术有限公司 数据要素流通方法、装置、电子设备及存储介质
CN116527684B (zh) * 2023-07-03 2023-09-05 江西农业大学 基于1+1+n中继共识委员会的多链信息交互方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190340266A1 (en) * 2018-05-01 2019-11-07 International Business Machines Corporation Blockchain implementing cross-chain transactions
CN112948153A (zh) * 2021-05-14 2021-06-11 支付宝(杭州)信息技术有限公司 一种消息跨链传输的方法和装置
CN113098694A (zh) * 2021-04-09 2021-07-09 杭州链网科技有限公司 一种混合跨链共识方法
CN113256424A (zh) * 2021-06-15 2021-08-13 腾讯科技(深圳)有限公司 一种交易数据处理方法、装置、设备及存储介质
CN113395363A (zh) * 2021-08-18 2021-09-14 腾讯科技(深圳)有限公司 基于区块链的数据处理方法、装置、设备及存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766540A (zh) * 2017-10-31 2018-03-06 上海分布信息科技有限公司 一种分区的区块链网络及其实现分区存储的方法
GB201810707D0 (en) * 2018-06-29 2018-08-15 Bedrock Capital Ltd Gospel L
CN109905368B (zh) * 2019-01-24 2021-12-10 真相网络科技(北京)有限公司 区块链跨链数据交互和验证方法、区块链系统及存储介质
CN110417883B (zh) * 2019-07-23 2021-09-24 杭州云象网络技术有限公司 一种应用于区块链的点对点网络结构的设计方法
CN110598446A (zh) * 2019-09-16 2019-12-20 腾讯科技(深圳)有限公司 基于区块链的测试方法、装置、存储介质和计算机设备
CN112804354B (zh) * 2021-03-19 2021-07-06 腾讯科技(深圳)有限公司 跨链进行数据传输的方法、装置、计算机设备和存储介质
CN112861190B (zh) * 2021-04-23 2021-07-16 腾讯科技(深圳)有限公司 数据跨链协同方法、系统及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190340266A1 (en) * 2018-05-01 2019-11-07 International Business Machines Corporation Blockchain implementing cross-chain transactions
CN113098694A (zh) * 2021-04-09 2021-07-09 杭州链网科技有限公司 一种混合跨链共识方法
CN112948153A (zh) * 2021-05-14 2021-06-11 支付宝(杭州)信息技术有限公司 一种消息跨链传输的方法和装置
CN113256424A (zh) * 2021-06-15 2021-08-13 腾讯科技(深圳)有限公司 一种交易数据处理方法、装置、设备及存储介质
CN113395363A (zh) * 2021-08-18 2021-09-14 腾讯科技(深圳)有限公司 基于区块链的数据处理方法、装置、设备及存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116684425A (zh) * 2023-07-28 2023-09-01 腾讯科技(深圳)有限公司 区块链的数据处理方法、系统、装置和计算机设备
CN116684425B (zh) * 2023-07-28 2023-10-27 腾讯科技(深圳)有限公司 区块链的数据处理方法、系统、装置和计算机设备
CN117395305A (zh) * 2023-12-11 2024-01-12 广东电网有限责任公司东莞供电局 基于区块链的安全计算方法、装置、设备及存储介质
CN117395305B (zh) * 2023-12-11 2024-03-19 广东电网有限责任公司东莞供电局 基于区块链的安全计算方法、装置、设备及存储介质

Also Published As

Publication number Publication date
EP4318362A1 (en) 2024-02-07
CN113395363A (zh) 2021-09-14
US20230299984A1 (en) 2023-09-21
CN113395363B (zh) 2021-10-29

Similar Documents

Publication Publication Date Title
WO2023020233A1 (zh) 基于区块链的数据处理方法、装置、设备及存储介质
JP7278453B2 (ja) ブロックチェーン・ネットワークにおいてトランザクションを管理するための方法、記憶媒体、電子デバイス、トランザクション検証ノード、スーパー・ノード及びブロックチェーン・ネットワーク
Yuan et al. CSEdge: Enabling collaborative edge storage for multi-access edge computing based on blockchain
US20190354518A1 (en) Chain mesh network for decentralized transaction systems
Kaur et al. Scalability in blockchain: Challenges and solutions
CN112541758A (zh) 基于区块链的多轮投票式容错排序共识机制与方法
US11902448B2 (en) Hybrid blockchain architecture with computing pool
CN112163856A (zh) 用于区块链与物联网融合场景的共识方法及系统
CN112822267B (zh) 基于区块链的数据处理方法和装置
CN113256297A (zh) 基于区块链的数据处理方法、装置、设备及可读存储介质
Batool et al. Fl-mab: client selection and monetization for blockchain-based federated learning
CN116055052A (zh) 基于区块链的数据处理方法、装置、设备及可读存储介质
CN111222885B (zh) 数据处理请求背书方法、装置、计算机设备及存储介质
WO2023116790A1 (zh) 计算任务的执行方法、装置、存储介质及电子装置
WO2023082883A1 (zh) 跨区块链处理事务的方法、装置、计算机设备、计算机存储介质及计算机程序产品
CN117061538A (zh) 一种基于区块链网络的共识处理方法及相关装置
Bandara et al. Lightweight, geo-scalable deterministic blockchain design for 5G networks sliced applications with hierarchical CFT/BFT consensus groups, IPFS and novel hardware design
Guo Cypherium: a scalable and permissionless smart contract platform
CN113300853B (zh) 金融征信信息管理方法、装置、电子设备及存储介质
Putra et al. Privacy-preserving Trust Management for Blockchain-based Resource Sharing in 6G-IoT
CN116112496A (zh) 一种基于区块链网络的跨链交互方法及相关设备
KR102494215B1 (ko) 뉴럴 블록 신속 전파 프로토콜 기반의 블록체인을 구축하는 장치 및 그 동작 방법
CN115455460A (zh) 一种基于区块链的数据存储方法、装置、设备及介质
Chiquito et al. Digitalized and decentralized open-cry auctioning: key properties, solution design and implementation
CN116186725A (zh) 一种数据处理方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22857546

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 22857546.0

Country of ref document: EP

Ref document number: 2022857546

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2022857546

Country of ref document: EP

Effective date: 20231026

NENP Non-entry into the national phase

Ref country code: DE