Transaction processing method and apparatus in a blockchain system
Patent Information
- Application Number
- CN202211741656.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-31
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2042-12-31
AI Technical Summary
[0008] The fifth aspect of this specification provides a computer program that, when executed in a computer, causes the computer to perform the method described in the first aspect.
Smart Images

Figure CN116416061B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification belong to the field of blockchain technology, and in particular relate to transaction processing methods and apparatus in blockchain systems. Background Technology
[0002] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. In a blockchain system, data blocks are sequentially linked together to form a chain-like data structure, and a distributed ledger is cryptographically guaranteed to be immutable and unforgeable. Due to its decentralized, immutable, and autonomous characteristics, blockchain has received increasing attention and application. Currently, to achieve scalability, multiple nodes in a blockchain system (such as consensus nodes) can be combined to form multiple blockchains. Summary of the Invention
[0003] The purpose of this invention is to provide a transaction processing scheme in a blockchain system, which enables N first blockchains in the blockchain system to correspond to different first address segments in the account address, and M second blockchains to correspond to different second address segments in the account address. Through this design, a new transaction allocation method is realized, and it is also beneficial for the splitting and merging of blockchains.
[0004] This specification provides a transaction processing method in a blockchain system, the blockchain system including N first blockchains and M second blockchains, the N first blockchains corresponding to different first address segments, and the M second blockchains corresponding to different second address segments, the first address segment including a string at a first preset position in an account address, the second address segment including a string at a second preset position in an account address, the second preset position being the first preset position plus the next digit of the first preset position, the method including: receiving a first transaction, the first transaction including a first account address that initiated the first transaction; obtaining a first address segment of the first account address; when there is no first blockchain among the N first blockchains corresponding to the first address segment of the first account address, obtaining a second address segment of the first account address; when there is a second blockchain among the M second blockchains corresponding to the second address segment of the first account address, sending the first transaction to the second blockchain corresponding to the second address segment of the first account address.
[0005] This specification provides a transaction processing apparatus in a blockchain system, the blockchain system including N first blockchains and M second blockchains, the N first blockchains corresponding to different first address segments, and the M second blockchains corresponding to different second address segments, the first address segment including a string at a first preset position in an account address, the second address segment including a string at a second preset position in an account address, the second preset position being the first preset position plus the next digit of the first preset position, the apparatus including: a receiving unit configured to receive a first transaction, the first transaction including a first account address initiating the first transaction; an obtaining unit configured to obtain a first address segment of the first account address; the obtaining unit is further configured to obtain a second address segment of the first account address when there is no first blockchain corresponding to the first address segment of the first account address among the N first blockchains; and a sending unit configured to send the first transaction to the second blockchain corresponding to the second address segment of the first account address when there is a second blockchain corresponding to the second address segment of the first account address among the M second blockchains.
[0006] A third aspect of this specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method described in the first aspect.
[0007] A fourth aspect of this specification provides a computing device including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method described in the first aspect.
[0008] The fifth aspect of this specification provides a computer program that, when executed in a computer, causes the computer to perform the method described in the first aspect.
[0009] In the embodiments provided in this specification, the N first blockchains in the blockchain system correspond to different first address segments in the account address, and the M second blockchains correspond to different second address segments in the account address. This design achieves a novel transaction allocation method and facilitates the splitting and merging of blockchains. Furthermore, multiple blockchains can provide parallel expansion capacity and processing power for the blockchain system. Compared to a single blockchain, this reduces read / write pressure and improves the processing efficiency of the blockchain system, especially enabling rapid expansion and parallel distribution of pressure during periods of sudden traffic surges. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a diagram of a blockchain architecture in one embodiment;
[0012] Figure 2 This is a schematic diagram illustrating one application scenario in which the embodiments of this specification can be applied;
[0013] Figure 3 This is a flowchart of a transaction processing method in a blockchain system as described in the embodiments of this specification;
[0014] Figure 4 This is a diagram illustrating the transaction processing procedure;
[0015] Figure 5 This is a flowchart of a transaction processing method in a blockchain system as described in the embodiments of this specification;
[0016] Figure 6 This is a schematic diagram of the splitting process of the first address segment;
[0017] Figure 7 This is a schematic diagram of the splitting process of address segment 00;
[0018] Figure 8 This is a schematic diagram of the splitting process of address segment 00;
[0019] Figure 9 This is a schematic diagram illustrating the merging process of the first address segments corresponding to each of the N2 first blockchains;
[0020] Figure 10 This is a schematic diagram illustrating the merging process of address segment 00 and address segment 01;
[0021] Figure 11 This is a schematic diagram illustrating the merging process of address segment 00 and address segment 01;
[0022] Figure 12 This is a schematic diagram of the transaction processing device in the blockchain system described in the embodiments of this specification. Detailed Implementation
[0023] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0024] Figure 1 A blockchain architecture diagram from one embodiment is shown. Figure 1 In the blockchain architecture diagram shown, blockchain 100 includes N nodes. Figure 1 The diagram illustrates nodes 1 through 8. The lines connecting the nodes schematically represent P2P (Peer-to-Peer) connections, such as TCP connections, used for data transfer between nodes. These nodes can store the entire ledger, i.e., the state of all blocks and all accounts. Each node in the blockchain can produce the same state by executing the same transactions, and each node can store the same state database.
[0025] In the blockchain field, a transaction refers to a unit of task executed and recorded within the blockchain. A transaction typically includes a From field, a To field, and a Data field. Specifically, in the case of a transfer transaction, the From field represents the account address initiating the transaction (i.e., initiating a transfer task to another account), the To field represents the account address receiving the transaction (i.e., receiving the transfer), and the Data field includes the transfer amount.
[0026] Blockchain provides the functionality of smart contracts. A smart contract on the blockchain is a contract that can be triggered and executed through transactions within the blockchain system. Smart contracts can be defined in the form of code. Calling a smart contract on the blockchain involves initiating a transaction pointing to the smart contract's address, causing each node in the blockchain to run the smart contract code in a distributed manner.
[0027] In a contract deployment scenario, for example, Bob sends a transaction containing information about creating a smart contract (i.e., deploying the contract) to a server such as... Figure 1In the blockchain shown, the `data` field of the transaction includes the code (such as bytecode or machine code) of the contract to be created, and the `to` field of the transaction is empty, indicating that the transaction is used to deploy the contract. After the nodes reach an agreement through the consensus mechanism, they determine the contract address "0x6f8ae93…". Each node adds a contract account corresponding to the contract address of the smart contract to the state database, allocates state storage corresponding to the contract account, stores the contract code, and saves the hash value of the contract code in the contract's state storage, thus the contract is successfully created.
[0028] In scenarios where contracts are invoked, for example, Bob sends a transaction to invoke a smart contract, such as... Figure 1 In the blockchain shown, the `from` field of this transaction is the address of the account of the transaction initiator (i.e., Bob), the `to` field is the aforementioned "0x6f8ae93…", which is the address of the smart contract being invoked, and the `data` field of the transaction includes the method and parameters for invoking the smart contract. After consensus is reached on this transaction in the blockchain, each node in the blockchain can execute the transaction, thereby executing the contract separately, and updating the state database based on the execution of the contract.
[0029] One of the decentralized characteristics that distinguishes blockchain technology from traditional technologies is its distributed ledger system, where records are kept on multiple nodes, rather than a centralized system. For a blockchain system to become a robust, publicly accessible, and tamper-proof decentralized system of honest and trustworthy data records, it needs to ensure the security, clarity, and irreversibility of distributed data records in the shortest possible time. In different types of blockchain networks, consensus algorithms are typically used to maintain consistency across the nodes recording the ledger—the consensus mechanisms mentioned earlier. For example, blockchain nodes can implement block-level consensus mechanisms. After a node (e.g., a unique node) generates a block, if this block is recognized by other nodes, those nodes record the same block. As another example, blockchain nodes can implement transaction-level consensus mechanisms. After a node (e.g., a unique node) acquires a blockchain transaction, if this transaction is recognized by other nodes, each node that recognized the transaction can add it to its own latest maintained block, ultimately ensuring that all nodes produce the same latest block. A consensus mechanism is a mechanism by which blockchain nodes reach a network-wide consensus on block information (or block data), ensuring that the latest block is accurately added to the blockchain. Current mainstream consensus mechanisms include Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPoS), and Practical Byzantine Fault Tolerance (PBFT) algorithms. In various consensus algorithms, consensus on a consensus proposal is typically determined after a predetermined number of nodes reach agreement on the proposed data. Specifically, in the PBFT algorithm, for N ≥ 3f+1 consensus nodes, f malicious nodes can be tolerated. That is, when 2f+1 out of N consensus nodes reach agreement, consensus is considered successful.
[0030] As mentioned earlier, to achieve scalability, multiple nodes in a blockchain system (such as consensus nodes) can be combined into multiple blockchains. When a blockchain system includes multiple blockchains, the question typically arises of assigning a transaction to a specific blockchain for execution.
[0031] Based on this, the embodiments of this specification provide a transaction processing scheme in a blockchain system, which enables N first blockchains in the blockchain system to correspond to different first address segments in the account address, and M second blockchains to correspond to different second address segments in the account address. Through this design, a new transaction allocation method is realized, and it is also beneficial for the splitting and merging of blockchains.
[0032] See Figure 2 This is a schematic diagram illustrating one application scenario to which the embodiments of this specification can be applied. Figure 2 The application scenario shown may include user device 21 (user A) and blockchain system 22. Blockchain system 22 may include a main chain 221 and multiple sub-chains (e.g., ...). Figure 2 The subchains 222-226 are shown in the diagram. The main chain can be referred to as the main blockchain or mainnet, and the subchains can be referred to as subblockchains or subnets. The main chain 221 can communicate with both the user device 21 and the multiple subchains, and the multiple subchains can communicate indirectly with each other through the main chain 221. Both the main chain 221 and the multiple subchains can include multiple nodes. For an explanation of these multiple nodes, please refer to the relevant descriptions above; they will not be repeated here.
[0033] The aforementioned subchains can correspond to different address segments. For example, subchain 222 can correspond to address segment 00 in the account address, which may include the string "00" at position L1 in the account address; subchain 223 can correspond to address segment 01 in the account address, which may include the string "01" at position L1 in the account address; subchain 224 can correspond to address segment 10 in the account address, which may include the string "10" at position L1 in the account address; subchain 225 can correspond to address segment 110 in the account address, which may include the string "110" at position L2 in the account address; subchain 225 can correspond to address segment 111 in the account address, which may include the string "111" at position L2 in the account address. Position L2 is position L1 plus the bit following position L1. Position L1 can be, for example, the first two bits in the account address starting from the target end, where the target end can be either the left or right end. Taking the target end as the left end as an example, address segment 00 can include the string "00" in the first two bits starting from the left end of the account address. It should be noted that the set of address segments corresponding to each of the above sub-chains can cover the account addresses of various user accounts in the blockchain system.
[0034] The address ranges corresponding to each of the above sub-chains can be determined through various implementation methods.
[0035] Specifically, in one implementation, when the aforementioned subchains are existing (initial) subchains in the blockchain system 22, two initial address segments "0" and "1" can be generated first. Then, "0" is split into "00" and "01", and "1" is split into "10" and "11". Then, "11" is split into "110" and "111", thus obtaining five address segments: "00", "01", "10", "110", and "111". It should be noted that the address segment splitting process described here only revolves around... Figure 2 The diagram illustrates this. In practical applications, the specific number of splits can be determined based on the number of sub-chains in the address segment to be allocated, and which address segment to split can be selected according to actual needs. In one example, when the number of sub-chains is 5, after obtaining the four address segments "00", "01", "10" and "11" through splitting, any one of these four address segments can be split once.
[0036] In another implementation, a can be calculated using the following formula (1), and the number of bits M used for address segment generation can be determined based on a:
[0037] 2 a =b (1)
[0038] Where b can represent the number of subchains. When the calculated a is an integer, a can be determined as the number of digits M. When the calculated a is a decimal, the result of rounding up a can be determined as the number of digits M. Assume that subchains 222-224 are the original subchains in blockchain system 22, and subchains 225-226 are formed by sharding the original subchain 227 (not shown in the figure) in blockchain system 22. Subchain 227 corresponds to address segment 11, which includes the string "11" at position L1 in the account address. The address segments corresponding to subchains 222-224 and 227 can be determined through the following implementation process: Based on the number 4 of subchains 222-224 and 227 and the above formula (1), M = a = 2 can be determined. Then, the binary characters "0" and "1" can be used to form 2. M There are four address segments of length M=2: "00", "01", "10", and "11". These four address segments can then be assigned to subchains 222-224 and 227. For example, "00" can be assigned to subchain 222, "01" to subchain 223, "10" to subchain 224, and "11" to subchain 227. Subsequently, when subchain 227 is divided into subchains 225 and 226, "11" can be split into "110" and "111", with "110" assigned to subchain 225 and "111" assigned to subchain 226.
[0039] It should be noted that in practical applications, when the number of subchains in the address segment to be allocated is odd, the number of bits M determined based on this number and the above formula (1) is an integer greater than a. In this case, binary characters "0" and "1" can be used to form 2. M = P address segments of length M, where P is greater than the number of subchains. In one example, the P address segments can be assigned to the subchains, where at least one subchain may be assigned multiple address segments. In another example, where at least one subchain is assigned multiple address segments, to reduce the number of address segment matches in subsequent transaction processing, for any subchain, if the first few characters (e.g., the first few characters starting from the target end) of multiple address segments assigned to that subchain are the same, these multiple address segments can be merged into a new address segment formed by those first few characters, and this new address segment will be used as the address segment corresponding to that subchain.
[0040] It should be understood that the address range corresponding to the sub-chain can be determined according to actual needs, and the embodiments in this specification do not specifically limit the method for determining the address range corresponding to the sub-chain.
[0041] The main chain 221 can store correspondence information representing the relationships between the aforementioned sub-chains and address ranges. The main chain 221 can receive transaction Tx1 sent by user A through user device 21, where transaction Tx1 includes user A's account address Aa1. Based on this correspondence information and the address range of account address Aa1, the main chain 221 can determine which blockchain will execute transaction Tx1.
[0042] The transaction processing scheme provided in the embodiments of this specification will be described below with reference to specific examples.
[0043] See Figure 3 This is a flowchart of a transaction processing method in a blockchain system according to embodiments of this specification. The blockchain system may include N first blockchains and M second blockchains. The N first blockchains correspond to different first address segments, and the M second blockchains correspond to different second address segments. The first address segment includes a string at a first preset position in the account address, and the second address segment includes a string at a second preset position in the account address. The second preset position is the first preset position plus the next digit after the first preset position. In one example, the blockchain system may also include a main chain, where the N first blockchains and M second blockchains are all sub-chains, and the method is executed by the main chain. In another example, the blockchain system may also include an intermediate platform (such as a server), which can communicate with the user device, the N first blockchains, and the M second blockchains respectively, and the method can be executed by the intermediate platform.
[0044] like Figure 3As shown, firstly, in step S301, transaction Tx1 is received, which includes the account address Aa1 that initiated transaction Tx1.
[0045] Account address Aa1 can be a hexadecimal account address or a binary account address, etc., without specific restrictions.
[0046] In step S303, the first address range of account address Aa1 is obtained.
[0047] The first address segment of account address Aa1 can specifically include the string at a first preset position in account address Aa1. This string can be a binary string, and when the length of the string is 2, the first preset position can be, for example, position L1 as described above. It should be noted that when account address Aa1 is not a binary account address, part or all of the content of account address Aa1 can be converted into a binary string, and then the string at the first preset position can be obtained from that string as the first address segment of account address Aa1.
[0048] After obtaining the first address segment of account address Aa1, it can be determined whether there exists a first blockchain among the N first blockchains corresponding to the first address segment of account address Aa1. Specifically, the blockchain system can store first correspondence information, which is used to characterize the correspondence between the N first blockchains and the first address segment, and the correspondence between the M second blockchains and the second address segment. When Figure 3 When the method described in the corresponding embodiment is executed by the aforementioned intermediate platform, the first correspondence information can be specifically stored in the intermediate platform. When the method is executed by the main chain, the first correspondence information can be specifically stored in the main chain. Therefore, based on the first correspondence information, it can be determined whether there exists a first blockchain among the N first blockchains that corresponds to the first address segment of account address Aa1.
[0049] If none of the N first blockchains corresponds to the first address segment of account address Aa1, step S305 can be executed. If there is a first blockchain among the N first blockchains that corresponds to the first address segment of account address Aa1, transaction Tx1 can be sent to that first blockchain, causing the first blockchain to execute transaction Tx1.
[0050] In practice, transaction Tx1 may also include account address Aa2 (e.g., the account address receiving transaction Tx1). In one implementation, when there is a first blockchain among N first blockchains corresponding to the first address segment of account address Aa1, regardless of whether there is a first blockchain among the N first blockchains corresponding to the first address segment of account address Aa2, transaction Tx1 can be sent to the first blockchain corresponding to the first address segment of account address Aa1. In one example, transaction Tx1 calls a first smart contract deployed in the blockchain system and also includes account address Aa2. The first smart contract can be used, upon execution, to generate a cross-chain transaction for sending to the first blockchain corresponding to the first address segment of account address Aa2 after determining that the first address segments of account addresses Aa1 and Aa2 each correspond to different first blockchains. Additionally, the first smart contract can also be used, upon execution, to generate a cross-chain transaction for sending to the second blockchain corresponding to the second address segment of account address Aa2 after determining that the first address segment of account address Aa1 corresponds to a certain first blockchain and the second address segment of account address Aa2 corresponds to a certain second blockchain. The state of the first smart contract may store the first correspondence information as described above.
[0051] In another implementation, the address range of account address Aa2 can also be used as a reference factor in determining which blockchain executes transaction Tx1. Specifically, if it is determined that there is a first blockchain among the N first blockchains corresponding to the first address range of account address Aa1, the first address range of account address Aa2 can also be obtained, and it can be determined whether there is a first blockchain among the N first blockchains corresponding to the first address range of account address Aa2. The first address range of account address Aa2 can specifically include the string at a first preset position in account address Aa2. When there is a first blockchain among the N first blockchains corresponding to the first address range of account address Aa2, it can be determined whether the first address ranges of account addresses Aa1 and Aa2 correspond to the same first blockchain. If the determination result is yes, transaction Tx1 can be sent to that same first blockchain, causing that same first blockchain to execute transaction Tx1. Additionally, when... Figure 3 When the method described in the corresponding embodiment is executed by the main chain, if there is no first blockchain among the N first blockchains corresponding to the first address segment of account address Aa2, or if the first address segments of account addresses Aa1 and Aa2 correspond to different first blockchains, then the main chain can execute transaction Tx1.
[0052] In step S305, when there is no first blockchain among the N first blockchains that corresponds to the first address segment of account address Aa1, the second address segment of account address Aa1 is obtained.
[0053] The second address segment of account address Aa1 can specifically include the string at the second preset position in account address Aa1. This string can be a binary string, and when the length of the string is 3, the second preset position can be, for example, position L2 as described above. It should be noted that when account address Aa1 is not a binary account address, the string at the second preset position can be obtained from the binary string obtained by converting part or all of the content of account address Aa1 into binary format, and used as the second address segment of account address Aa1.
[0054] After obtaining the second address segment of account address Aa1, it can be determined whether there exists a second blockchain among the M second blockchains that corresponds to the second address segment of account address Aa1. When the determination result is yes, step S307 can be executed.
[0055] In step S307, when there is a second blockchain among the M second blockchains that corresponds to the second address segment of account address Aa1, transaction Tx1 is sent to the second blockchain that corresponds to the second address segment of account address Aa1.
[0056] Below, we take N first blockchains as examples. Figure 2 The subchains 222-224 shown in the diagram have M second blockchains. Figure 2 The subchains 225-226 shown, taking the target end as the left end as mentioned above, are combined with... Figure 4 ,right Figure 3 The corresponding implementation examples provide illustrative examples of transaction processing solutions. Figure 4 This is a diagram illustrating the transaction processing procedure.
[0057] like Figure 4As shown, in step S401, user A can send transaction Tx1 to the main chain 221 through user device 21. Transaction Tx1 includes user A's account address Aa1. Assume account address Aa1 is specifically "0xf0123…", where "0x" represents hexadecimal and "f0123…" is the content of the account address. It is well known that a hexadecimal character occupies half a byte, and one byte equals 8 bits. Based on this, the hexadecimal character "f" in "0xf0123…" occupies 4 bits, corresponding to the binary string "1111". After receiving transaction Tx1, the main chain 221 can obtain the address segment 11 of "0xf0123…" by executing step S403. Address segment 11 includes the string "11" at position L1 (the first two bits from the left end) of the account address. Main chain 221 compares address segment 11 with the corresponding address segments of sub-chains 222-224 to determine that no sub-chain in sub-chains 222-224 corresponds to address segment 11. Then, main chain 221 can obtain address segment 111 ("0xf0123...") by executing step S405. Address segment 111 includes the string "111" at position L2 (the first three bits from the left end) of the account address. In step S407, main chain 221 compares address segment 111 with the corresponding address segment of sub-chain 226 to determine that sub-chain 226 corresponds to address segment 111. Therefore, main chain 221 can send transaction Tx1 to sub-chain 226 by executing step S409, causing sub-chain 226 to execute transaction Tx1.
[0058] Figure 3 The corresponding implementation provides a transaction processing scheme that enables N first blockchains in the blockchain system to correspond to different first address segments in account addresses, and M second blockchains to correspond to different second address segments in account addresses. This design achieves a novel transaction allocation method and facilitates blockchain splitting and merging. Furthermore, multiple blockchains can provide parallel scaling capacity and processing power for the blockchain system. Compared to a single blockchain, this reduces read / write pressure and improves the processing efficiency of the blockchain system, especially enabling rapid scaling and parallel distribution of pressure during periods of sudden traffic surges.
[0059] In one implementation, when transaction Tx1 also includes account address Aa2, if a second blockchain with a second address segment corresponding to account address Aa1 exists among the M second blockchains, transaction Tx1 can be sent to the second blockchain corresponding to the second address segment of account address Aa2, regardless of whether a second blockchain with a second address segment corresponding to account address Aa2 exists among the M second blockchains. In one example, transaction Tx1 invokes the first smart contract as described above and also includes account address Aa2. The first smart contract can be used, upon execution, to generate a cross-chain transaction for sending to the second blockchain corresponding to the second address segment of account address Aa2 after determining that the second address segments of account addresses Aa1 and Aa2 each correspond to different second blockchains. Alternatively, the first smart contract can also be used, upon execution, to generate a cross-chain transaction for sending to the first blockchain corresponding to the first address segment of account address Aa2 after determining that the second address segment of account address Aa1 corresponds to a certain second blockchain and the first address segment of account address Aa2 corresponds to a certain first blockchain.
[0060] In one implementation, when transaction Tx1 also includes account address Aa2, if there is a second blockchain among the M second blockchains that corresponds to the second address segment of account address Aa1, the second address segment of account address Aa2 can be used to determine which blockchain will execute transaction Tx1. For example, when the second addresses of account addresses Aa1 and Aa2 each correspond to the same second blockchain, it is determined that the same second blockchain will execute transaction Tx1, and thus transaction Tx1 is sent to the same second blockchain.
[0061] Below, taking the main chain in a blockchain system as the executing entity as an example, combined with... Figure 5 This section describes the transaction processing procedure when transaction Tx1 includes account addresses Aa1 and Aa2.
[0062] See Figure 5 This is a flowchart of the transaction processing method in the blockchain system in the embodiments of this specification.
[0063] First, in step S501, the user device sends transaction Tx1 to the main chain. Transaction Tx1 includes the account address Aa1 that initiated transaction Tx1, and also includes account address Aa2.
[0064] In step S503, the main chain obtains the first address segment of account address Aa1.
[0065] In step S505, when there is no first blockchain among the N first blockchains that corresponds to the first address segment of account address Aa1, the main chain obtains the second address segment of account address Aa1.
[0066] In step S507, when there is a second blockchain among the M second blockchains that corresponds to the second address segment of account address Aa1, the main chain obtains the second address segment of account address Aa2.
[0067] In step S509, when there is a second blockchain among the M second blockchains that corresponds to the second address segment of account address Aa2, the main chain determines whether the second address segments of account addresses Aa1 and Aa2 correspond to the same second blockchain.
[0068] In step S511, when the determination result is yes, the main chain sends transaction Tx1 to the same second blockchain mentioned above.
[0069] In step S513, if the result is negative, the main chain executes transaction Tx1.
[0070] Figure 5 The corresponding implementation provides a transaction processing scheme that enables N first blockchains in the blockchain system to correspond to different first address segments in account addresses, and M second blockchains to correspond to different second address segments in account addresses. This design achieves a novel transaction allocation method and facilitates blockchain splitting and merging. Furthermore, multiple blockchains can provide parallel scaling capacity and processing power for the blockchain system. Compared to a single blockchain, this reduces read / write pressure and improves the processing efficiency of the blockchain system, especially enabling rapid scaling and parallel distribution of pressure during periods of sudden traffic surges.
[0071] In one implementation, after the main chain obtains the execution result by executing transaction Tx1, it can generate transaction Tx2 including the execution result and send transaction Tx2 to the first / second blockchain corresponding to the first / second address range of account addresses Aa1 and Aa2, so that the first / second blockchain updates its state tree based on the execution result. Optionally, transaction Tx2 may also include transaction Tx1.
[0072] In one implementation, the blockchain system may include a shared storage for use by the various blockchains therein. After the main chain obtains the execution result by executing transaction Tx1, it can store the execution result in the shared storage. For example, transaction Tx1 and the execution result can be stored together in the shared storage. The first / second blockchains corresponding to the first / second address segments of account addresses Aa1 and Aa2 can obtain the execution result from the shared storage and update their respective state trees based on the execution result.
[0073] In one implementation, after the main chain sends transaction Tx1 to the first / second blockchain corresponding to the first / second address segment of account address Aa1, to ensure that the first / second blockchain has actually executed transaction Tx1, the main chain can also receive feedback information (e.g., feedback information in the form of a transaction) sent by the first / second blockchain after executing transaction Tx1. This feedback information can include at least one of the following: the root hash of the state tree after recording the execution result of transaction Tx1 in the state tree, the block header of the block containing transaction Tx1, the block hash of the block containing transaction Tx1, the final state of the account corresponding to the target account address, and the hash value of the final state, wherein the target account address includes at least account address Aa1. Further, when the first / second address segment of account address Aa2 also corresponds to the first / second blockchain, the target account address also includes account address Aa2. Afterwards, the main chain can store this feedback information, for example, by storing it in its own state tree.
[0074] In one implementation, when the blockchain system stores the first correspondence information as described above, if any one of the N first blockchains is divided into N1 blockchains, and that any one first blockchain corresponds to a first address segment, then the splitting of that first address segment will be involved. Below, in conjunction with... Figure 6 This section describes the splitting process of the first address segment.
[0075] See Figure 6 This is a schematic diagram of the splitting process of the first address segment.
[0076] like Figure 6 As shown, firstly, in step S601, when any first blockchain is divided into N1 blockchains and any first blockchain corresponds to a first address segment, the number of bits M1 is determined based on N1, and the number of bits M1 makes the N1 blockchains correspond to P1 strings, where P1 is greater than or equal to N1.
[0077] In one example, N1 can be substituted into formula (1) as described above to calculate a, thereby determining the number of digits M1 based on a. Where P1 = 2 M1 Each of the P1 strings can be a binary string of length M1.
[0078] In step S603, for each of the P1 strings, the string is concatenated with the first address segment corresponding to any of the first blockchains mentioned above, and the string is placed after the first preset position to obtain the third address segment.
[0079] In step S605, the third address segments corresponding to each of the N1 blockchains are determined from the obtained P1 third address segments, wherein the N1 blockchains correspond to different third address segments.
[0080] When P1 equals N1, one third address segment can be allocated to each of the N1 blockchains. For example, for each of the N1 blockchains, a third address segment can be randomly selected from the P1 unallocated third address segments and allocated to that blockchain.
[0081] When P1 is greater than N1, the allocation number for each of the N1 blockchains can be determined based on P1 and N1. In one example, the amount of data stored in each of the N1 blockchains can also be used as a reference factor in determining the allocation number. For example, when the amount of data in a blockchain is large, the allocation number for that blockchain can be smaller. For any blockchain among the N1 blockchains, when the allocation number for that blockchain is greater than 1, the number of third address segments with the same first few characters starting from the last position of the first preset position can be selected from the P1 unallocated third address segments, and the selected number of third address segments can be allocated to that blockchain. Optionally, when there are no number of third address segments with the same first few characters starting from the last position of the first preset position among the various third address segments, the number of third address segments can be randomly selected from the various third address segments and allocated to the blockchain.
[0082] In step S607, the correspondence between any of the first blockchains and the first address segments in the first correspondence information is updated to a correspondence between N1 blockchains and P1 third address segments.
[0083] Below, taking any of the aforementioned first blockchains as an example... Figure 2 As shown in the example of subchain 222, which is divided into two blockchains, let's combine... Figure 7 and Figure 8 ,right Figure 6 The first address segment splitting process is illustrated below. Here, sub-chain 222 corresponds to address segment 00. Figure 7 and Figure 8 These are all schematic diagrams illustrating the splitting process of address segment 00.
[0084] See first Figure 7 , Figure 7 The leaf nodes (circles filled with gray) of the tree diagram on the left side of the middle section illustrate... Figure 2 The address segments corresponding to subchains 222-226 are shown below, such as address segment 00 for subchain 222, address segment 01 for subchain 223, address segment 10 for subchain 224, address segment 110 for subchain 225, and address segment 111 for subchain 226. When subchain 222 is divided into two blockchains, according to... Figure 7The changes in the tree diagram on the right compared to the tree diagram on the left show that the address segment 00 corresponding to subchain 222 needs to be split into two address segments.
[0085] Specifically, the number 2 of the two blockchains can be substituted into the above formula (1) to calculate a = 1, thus determining M1 = a = 1. Then, based on the binary characters "0" and "1", two strings of length 1 can be obtained, namely "0" and "1". Next, "0" and the first address segment 00 corresponding to subchain 222 can be concatenated to obtain address segment 000, and "1" and the first address segment 00 can be concatenated to obtain address segment 001. Thus, it can be... Figure 8 As shown, address segment 00 is split into address segment 000 and address segment 001. Next, one of these two address segments, 000 and 001, can be assigned to one of the two blockchains, and the other to the other blockchain. Then, the correspondence between sub-chain 222 and the first address segment 00 in the first correspondence information can be updated to the correspondence between the two blockchains and address segments 000 and 001.
[0086] In one implementation, when the blockchain system stores the first correspondence information as described above, when N2 of the N first blockchains are merged into a third blockchain, it involves merging the first address segments corresponding to each of the N2 first blockchains. Below, in conjunction with... Figure 9 This paper introduces the merging process of the first address segments corresponding to the N2 first blockchains.
[0087] See Figure 9 This is a schematic diagram of the merging process of the first address segments corresponding to the N2 first blockchains.
[0088] like Figure 9 As shown, firstly, in step S901, when N2 first blockchains are merged into a third blockchain, if the first few characters of the first address segments corresponding to each of the N2 first blockchains are the same, then the string formed by the first few characters is used as the fourth address segment corresponding to the third blockchain.
[0089] In step S903, the correspondence between the N2 first blockchains and the first address segment in the first correspondence information is updated to the correspondence between the third blockchain and the fourth address segment.
[0090] Below, taking the target end as described above as the left end, and N2 first blockchains as... Figure 2 Taking subchains 222 and 223 as an example, combined with... Figure 10 and Figure 11 ,right Figure 9The first address segment merging process is illustrated below. Sub-chain 222 corresponds to address segment 00, and sub-chain 223 corresponds to address segment 01. Figure 10 and Figure 11 These are all schematic diagrams illustrating the merging process of address segment 00 and address segment 01.
[0091] First refer to Figure 10 , Figure 10 The leaf nodes (circles filled with gray) of the tree diagram on the left side of the middle section illustrate... Figure 2 The address segments corresponding to subchains 222-226 are shown. When subchains 222 and 223 are merged into subchain 228 (not shown in the figure), according to... Figure 10 The changes in the tree diagram on the right compared to the tree diagram on the left show that the address segment 00 corresponding to sub-chain 222 and the address segment 01 corresponding to sub-chain 223 need to be merged into one address segment.
[0092] Specifically, when subchains 222 and 223 are merged into subchain 228, by comparing the address 00 corresponding to subchain 222 and the address segment 01 corresponding to subchain 223, it can be determined that the first character "0" from the left end of these two address segments is the same. Therefore, "0" can be used as the address segment corresponding to subchain 228. Thus, it can be... Figure 11 As shown, address segment 00 and address segment 01 are merged into address segment 0. Then, the correspondence between subchains 222 and 223 and the address segment in the first correspondence information can be updated to the correspondence between subchain 228 and address segment 0.
[0093] In the transaction processing scheme provided in the embodiments of this specification, because the rules for dividing address segments are regular and continuous, merging and splitting can be facilitated. Furthermore, the splitting and merging rules for address segments can be quickly determined based on the number of sub-chains within the address segment to be allocated. In addition, this scheme can efficiently, continuously, and reliably merge and split address segments, which is beneficial for the merging and splitting of blockchains.
[0094] Figure 12This is a schematic diagram of the transaction processing device in the blockchain system described in this specification. The blockchain system includes N first blockchains and M second blockchains. The N first blockchains correspond to different first address segments, and the M second blockchains correspond to different second address segments. The first address segment includes a string at a first preset position in the account address, and the second address segment includes a string at a second preset position in the account address. The second preset position is the first preset position plus the next digit after the first preset position. In one example, the blockchain system may also include a main chain, where the N first blockchains and M second blockchains are all sub-chains, and the device can be applied to the main chain. In another example, the blockchain system may also include an intermediate platform (such as a server), which can communicate with user devices, the N first blockchains, and the M second blockchains respectively, and the device can be applied to the intermediate platform.
[0095] like Figure 12 As shown in the embodiments of this specification, the transaction processing device 1200 in the blockchain system includes: a receiving unit 1201, an acquiring unit 1202, and a sending unit 1203. The receiving unit 1201 is configured to receive a first transaction, the first transaction including the address of the first account that initiated the first transaction; the acquiring unit 1202 is configured to acquire a first address segment of the first account address; the acquiring unit 1202 is further configured to acquire a second address segment of the first account address when no first blockchain corresponding to the first address segment exists among N first blockchains; the sending unit 1203 is configured to send the first transaction to the second blockchain corresponding to the second address segment of the first account address when a second blockchain corresponding to the second address segment exists among M second blockchains.
[0096] In one implementation, the first transaction invokes a first smart contract deployed in the blockchain system and also includes a second account address. The first smart contract, upon execution, generates a cross-chain transaction to be sent to the second blockchain corresponding to the second address segment of the second account address after determining that the second address segments of the first account address and the second account address correspond to different second blockchains.
[0097] In one embodiment, the first transaction further includes a second account address; and when there is a second blockchain among the M second blockchains that corresponds to a second address segment of the first account address, the acquisition unit 1202 can also be configured to: acquire the second address segment of the second account address; the above-mentioned device 1200 can also include: a first determining unit (not shown in the figure), configured to determine whether the second address segments of the first account address and the second account address correspond to the same second blockchain when there is a second blockchain among the M second blockchains that corresponds to a second address segment of the second account address; the sending unit 1203 can be further configured to: if the determination result of the first determining unit is yes, then send the first transaction to the same second blockchain.
[0098] In one embodiment, when the above-described device 1200 is applied to the main chain, the device 1200 may further include: a transaction execution unit (not shown in the figure), configured to execute a first transaction if the above determination result is negative.
[0099] In one implementation, the blockchain system stores first correspondence information, which is used to characterize the correspondence between N first blockchains and a first address segment, and the correspondence between M second blockchains and a second address segment.
[0100] In one embodiment, when any one of the N first blockchains is divided into N1 blockchains, the apparatus 1200 may further include: a second determining unit (not shown in the figure), configured to determine a bit length M1 based on N1 when any one of the first blockchains corresponds to a first address segment, wherein the bit length M1 causes the N1 blockchains to correspond to P1 strings, where P1 is greater than or equal to N1; a concatenation unit (not shown in the figure), configured to concatenate each of the P1 strings with the first address segment corresponding to any one of the first blockchains, such that the string is placed after a first preset position, thereby obtaining a third address segment; a third determining unit (not shown in the figure), configured to determine the third address segment corresponding to each of the N1 blockchains from the obtained P1 third address segments; wherein the N1 blockchains correspond to different third address segments; and an updating unit (not shown in the figure), configured to update the correspondence between any one first blockchain and the first address segment in the first correspondence information to the correspondence between the N1 blockchains and the P1 third address segments.
[0101] Furthermore, the third determining unit can be further configured to: when P1 is greater than N1, determine the allocation number corresponding to each of the N1 blockchains based on P1 and N1; for any blockchain among the N1 blockchains, when the allocation number corresponding to the blockchain is greater than 1, select the number of third address segments that are the same in the first few characters starting from the last position of the first preset position from each of the P1 third address segments that have not yet been allocated, and allocate the selected number of third address segments to the blockchain.
[0102] In one embodiment, when N2 of the N first blockchains are merged into a third blockchain, the above-mentioned device 1200 may further include: a fourth determining unit (not shown in the figure), configured to, if the first few characters of the first address segments corresponding to each of the N2 first blockchains are the same, then use the string formed by the first few characters as the fourth address segment corresponding to the third blockchain; and an updating unit (not shown in the figure), configured to update the correspondence between the N2 first blockchains and the first address segments in the first correspondence information to the correspondence between the third blockchain and the fourth address segment.
[0103] exist Figure 12 For further explanation of each unit in the corresponding device embodiment, please refer to the relevant descriptions in the previous method embodiments, which will not be repeated here.
[0104] This specification also provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the methods described in the preceding method embodiments.
[0105] This specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method described in the preceding method embodiments.
[0106] This specification also provides a computer program in the embodiments, wherein when the computer program is executed in a computer, it causes the computer to perform the methods described in the preceding method embodiments.
[0107] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0108] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0109] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude the possibility that, with the future development of computer technology, the computer implementing the functions of the above embodiments can be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interaction device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0110] While one or more embodiments of this specification provide the operational steps of the methods described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is merely one possible order of execution among many steps and does not represent the only possible order. In actual device or end product execution, the methods shown in the embodiments or drawings may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in the process, method, product, or apparatus that includes the elements is not excluded. For example, the use of terms such as "first," "second," etc., is to denote names and does not indicate any particular order.
[0111] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, when implementing one or more of these specifications, the functions of each module can be implemented in one or more software and / or hardware components, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.
[0112] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0113] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0114] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0115] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0116] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0117] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0118] Those skilled in the art will understand that one or more embodiments of this specification can be provided as a method, system, or computer program product. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0119] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0120] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, system embodiments are basically similar to method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. In the description of this specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0121] The above description is merely an embodiment of one or more embodiments of this specification and is not intended to limit the scope of these embodiments. Various modifications and variations can be made to these embodiments by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims.
Claims
1. A transaction processing method in a blockchain system, the blockchain system comprising N first blockchains and M second blockchains, the N first blockchains corresponding to different first address segments, the M second blockchains corresponding to different second address segments, the first address segment comprising a string at a first preset position in an account address, the second address segment comprising a string at a second preset position in an account address, the second preset position being the first preset position plus the next digit of the first preset position, the method comprising: Receive a first transaction, wherein the first transaction includes the address of the first account that initiated the first transaction; Obtain the first address range of the first account address; When there is no first blockchain among the N first blockchains that corresponds to the first address segment of the first account address, obtain the second address segment of the first account address; When there is a second blockchain among the M second blockchains that corresponds to the second address segment of the first account address, the first transaction is sent to the second blockchain that corresponds to the second address segment of the first account address.
2. The method according to claim 1, wherein, The first transaction invokes a first smart contract deployed in the blockchain system and also includes a second account address. The first smart contract, upon execution, generates a cross-chain transaction to be sent to the second blockchain corresponding to the second address segment of the second account address after determining that the second address segments of the first account address and the second account address correspond to different second blockchains.
3. The method according to claim 1, wherein, The first transaction also includes a second account address; as well as When one of the M second blockchains corresponds to a second address segment of the first account address, the method further includes: Obtain the second address range of the second account address; When there is a second blockchain among the M second blockchains that corresponds to the second address segment of the second account address, determine whether the second address segments of the first account address and the second account address correspond to the same second blockchain; Sending the first transaction to the second blockchain corresponding to the second address segment of the first account address includes: If the result is yes, then the first transaction is sent to the same second blockchain.
4. The method according to claim 3, wherein, The blockchain system also includes a main chain, and the N first blockchains and the M second blockchains are all sub-chains. The method is executed by the main chain.
5. The method according to claim 4, further comprising: If the determination result is negative, then the first transaction is executed.
6. The method according to any one of claims 1-5, wherein, The blockchain system stores first correspondence information, which is used to characterize the correspondence between the N first blockchains and the first address segment, and the correspondence between the M second blockchains and the second address segment.
7. The method according to claim 6, wherein, When any one of the N first blockchains is divided into N1 blockchains, the method further includes: In the case where any first blockchain corresponds to a first address segment, the number of bits M1 is determined based on N1, and the number of bits M1 makes the N1 blockchains correspond to P1 strings, where P1 is greater than or equal to N1; For each of the P1 strings, the string and the first address segment corresponding to any of the first blockchains are concatenated such that the string is placed after the first preset position, thereby obtaining the third address segment; Among the obtained P1 third address segments, determine the third address segment corresponding to each of the N1 blockchains; wherein, the N1 blockchains correspond to different third address segments; The correspondence between any first blockchain and the first address segment in the first correspondence information is updated to the correspondence between the N1 blockchains and the P1 third address segments.
8. The method according to claim 7, wherein, The step of determining the third address segment corresponding to each of the N1 blockchains from the obtained P1 third address segments includes: When P1 is greater than N1, the allocation number corresponding to each of the N1 blockchains is determined based on P1 and N1. For any of the N1 blockchains, when the number of allocations corresponding to the blockchain is greater than 1, select the number of third address segments that are the same in terms of the first few characters starting from the last position of the first preset position from each of the P1 unallocated third address segments, and allocate the selected number of third address segments to the blockchain.
9. The method according to claim 6, wherein, When N2 of the N first blockchains are merged into a third blockchain, the method further includes: If the first few characters of the first address segment corresponding to each of the N2 first blockchains are the same, then the string formed by the first few characters shall be used as the fourth address segment corresponding to the third blockchain. The correspondence between the N2 first blockchains and the first address segment in the first correspondence information is updated to the correspondence between the third blockchain and the fourth address segment.
10. A transaction processing apparatus in a blockchain system, the blockchain system comprising N first blockchains and M second blockchains, the N first blockchains corresponding to different first address segments, the M second blockchains corresponding to different second address segments, the first address segment comprising a string at a first preset position in an account address, the second address segment comprising a string at a second preset position in an account address, the second preset position being the first preset position plus the next digit of the first preset position, the apparatus comprising: The receiving unit is configured to receive a first transaction, wherein the first transaction includes the address of the first account that initiated the first transaction; The acquisition unit is configured to acquire the first address segment of the first account address; The acquisition unit is further configured to acquire the second address segment of the first account address when there is no first blockchain corresponding to the first address segment of the first account address among the N first blockchains; The sending unit is configured to send the first transaction to the second blockchain corresponding to the second address segment of the first account address when there is a second blockchain among the M second blockchains that corresponds to the second address segment of the first account address.
11. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-9.
12. A computing device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-9.
Citation Information
Patent Citations
Transaction processing method in block chain system and block chain node
CN120410535A