Block chain-based information processing method and device, electronic equipment and storage medium
By determining the on-chain type based on the concurrency and reliability factors of transaction data in the blockchain, and combining the sharded node and full-node consensus synchronization mechanisms, the balance problem between high concurrency and high security is solved and improved System efficiency and reliability are suitable for financial living asset supervision scenarios.
Patent Information
- Application Number
- CN202311525238.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-15
- Publication Date
- 2024-10-22
AI Technical Summary
In high-concurrency scenarios, there is a performance bottleneck problem in large-scale uploading of full data on the blockchain. In high-security scenarios, the reliability of blockchain sharding technology is low and fails to effectively balance high concurrency and high security. sex.
By determining the concurrency factor and reliability factor of transaction data, the on-chain type is dynamically determined, and the full-node consensus synchronization mechanism is used to perform consensus calculations on transaction data when high security requirements are required or the shard node consensus synchronization mechanism is used when high concurrency requirements are required. and storage, combined with the pruning technology of the block index tree to optimize data storage.
It achieves a dynamic balance between high concurrency and high security, improves data classification capabilities and system efficiency, reduces error rates, adapts to the application of financial living asset supervision scenarios, and enhances the practical feasibility of the technology in production engineering.
Smart Images

Figure CN118820249A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to but is not limited to the field of information processing technology, and in particular to a blockchain-based information processing method, device, electronic device and storage medium. Background Art
[0002] Credible evidence of living assets is a security interest established on movable property, and is one of the important forms of financing and guarantee in society. The electronic archive management system of living assets relies on mobile communication technology, Internet of Things technology, blockchain technology, etc., to sense and collect objective data such as physical signs, location, activity level, body length, weight, etc. of important physical living assets in livestock finance scenarios, and uniformly store key data on the blockchain, and ensure the credibility of the electronic archives of living assets through the tamper-proof characteristics of the blockchain.
[0003] However, in high-concurrency scenarios, large-scale uploading of full data to the chain has performance bottlenecks; in high-security scenarios, blockchain sharding technology has low reliability. It can be seen that there is currently no method that can balance high concurrency and high security. Summary of the invention
[0004] In view of this, the present application provides a blockchain-based information processing method, device, electronic device and storage medium to ensure a dynamic balance between high concurrency and high security.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, the present application provides an information processing method based on blockchain, including: obtaining transaction data to be stored; determining the chain type corresponding to the transaction data; when the chain type has a high security requirement, performing consensus calculation on the transaction data on all nodes of the blockchain, and saving the calculated new blocks on all nodes; when the chain type has a high concurrency requirement, performing consensus calculation on the transaction data on the sharding nodes associated with the transaction data in the blockchain, and saving the calculated new blocks on the sharding nodes.
[0007] In some embodiments, determining the chain-up type corresponding to transaction data includes: determining a concurrency factor and a reliability factor associated with the transaction data, wherein the concurrency factor is used to represent the concurrency requirement of the transaction data, and the reliability factor is used to represent the security requirement of the transaction data; determining a classification result of the transaction data based on the concurrency factor and the reliability factor, and the classification result is used to indicate the chain-up type of the transaction data.
[0008] In some embodiments, determining a concurrency factor associated with transaction data includes: determining the length of a monitoring cycle under a regulatory scenario corresponding to the transaction data, the amount of data under a target business classification in the transaction data, and the total amount of data in the transaction data; determining the concurrency factor based on the length of the monitoring cycle, the amount of data under the target business classification, and the total amount of data.
[0009] In some embodiments, determining a reliability factor associated with transaction data includes: determining the sum of security constants under a target business classification in the transaction data, the amount of data under the target business classification in the transaction data, and a security coefficient corresponding to the target business classification; determining the reliability factor based on the sum of security constants, the amount of data under the target business classification, and the security coefficient.
[0010] In some embodiments, the classification result of the transaction data is determined based on the concurrency factor and the reliability factor, including: obtaining a concurrency security comprehensive factor based on the concurrency factor and the reliability factor, the concurrency security comprehensive factor being used to represent the classification result of the transaction data; standardizing the concurrency security comprehensive factor; normalizing the standardized concurrency security comprehensive factor, wherein when the classification result is a first value, it indicates that the on-chain type of the transaction data has a high security requirement; when the classification result is a second value, it indicates that the on-chain type of the transaction data has a high parallelism requirement.
[0011] In some embodiments, before performing consensus calculation on the transaction data on the shard node associated with the transaction data in the blockchain, the method further includes: determining the institutional information of the transaction institution corresponding to the transaction data, the transaction institutions including lending institutions, regulatory agencies and financial institutions; determining whether the blockchain shard corresponding to the transaction institution exists based on the institutional information; if the blockchain shard exists, determining the node on the blockchain shard as the shard node; if the blockchain shard does not exist, creating the blockchain shard corresponding to the transaction institution based on the institutional information, and determining the node on the blockchain shard as the shard node.
[0012] In some embodiments, the method further includes: determining a block index tree in which the target block parameter is an index field, the block index tree including a tree node corresponding to the new block; determining the data page where the header block is located in the block index tree based on a preset value of the target block parameter; traversing the tree nodes in the block index tree backward based on the data page where the header block is located to obtain a block to be cropped whose value of the target block parameter satisfies the cropping target; and deleting the block to be cropped.
[0013] In some embodiments, the target block parameter is a block height; wherein, based on a preset value of the target block parameter, determining the data page where the header block is located in the block index tree includes: determining the data page where the header block is located in the block index tree, the block height of the header block being equal to a preset value; based on the data page where the header block is located, traversing the tree nodes in the block index tree backwards to obtain a block to be pruned whose block height is lower than the preset value.
[0014] In some embodiments, before determining the block index tree in which the target block parameter is an index field, the method further includes: obtaining the block index tree; retrieving the target data page where the index of the i-th new block in the new block should be stored in the block index tree, where i is a positive integer; if the target data page is full, performing page splitting on the target data page based on the index of the i-th new block, and storing the i-th new block in the split new data page or the target data page; if the target data page is not full, storing the i-th new block in the target data page; after the i-th new block is stored, adding 1 to the value of i, and returning to the step of retrieving the data page where the index of the i-th new block in the new block should be stored in the block index tree, until all new blocks are stored in the data pages in the block index tree.
[0015] In some embodiments, the target data page is split based on the index of the i-th new block, and the i-th new block is stored in the new data page or the target data page after the split, including: if the index of the i-th new block is located at the first position of the target data page, a new data page is created before the target data page, and the i-th new block is stored in the new data page; or, if the index of the i-th new block is located in the first half of the target data page, a new data page is created before the target data page, and the index of the i-th new block is stored in the new data page. The block before the index is stored in the new data page, and the i-th new block is stored in the target data page; or, if the index of the i-th new block is located in the non-last rear half of the target data page, a new data page is created after the target data page, and the block after the index of the i-th new block is stored in the new data page, and the i-th new block is stored in the target data page; or, if the index of the i-th new block is located at the last position of the target data page, a new data page is created after the target data page, and the i-th new block is stored in the new data page.
[0016] In the second aspect, the present application provides an information processing device based on blockchain, including: an acquisition module for obtaining transaction data to be stored; a determination module for determining the chain type corresponding to the transaction data; a chain module for performing consensus calculations on the transaction data on all nodes of the blockchain when the chain type has high security requirements, and saving the calculated new blocks on all nodes; or, when the chain type has high concurrency requirements, performing consensus calculations on the transaction data on the shard nodes associated with the transaction data in the blockchain, and saving the calculated new blocks on the shard nodes.
[0017] In some embodiments, a determination module is used to: determine a concurrency factor and a reliability factor associated with transaction data, wherein the concurrency factor is used to represent the concurrency requirement of the transaction data, and the reliability factor is used to represent the security requirement of the transaction data; determine a classification result of the transaction data based on the concurrency factor and the reliability factor, and the classification result is used to indicate the chain type of the transaction data.
[0018] In some embodiments, a determination module is used to: determine the length of the monitoring cycle under the regulatory scenario corresponding to the transaction data, the amount of data under the target business classification in the transaction data, and the total amount of data of the transaction data; determine the concurrency factor based on the length of the monitoring cycle, the amount of data under the target business classification, and the total amount of data.
[0019] In some embodiments, a determination module is used to: determine the sum of security constants under the target business classification in the transaction data, the amount of data under the target business classification in the transaction data, and the security coefficient corresponding to the target business classification; determine the reliability factor based on the sum of security constants, the amount of data under the target business classification, and the security coefficient.
[0020] In some embodiments, the determination module is also used to: obtain a concurrency security comprehensive factor based on a concurrency factor and a reliability factor, wherein the concurrency security comprehensive factor is used to represent a classification result of transaction data; standardize the concurrency security comprehensive factor; and normalize the standardized concurrency security comprehensive factor, wherein when the classification result is a first value, it indicates that the on-chain type of the transaction data has a high security requirement; and when the classification result is a second value, it indicates that the on-chain type of the transaction data has a high parallelism requirement.
[0021] In some embodiments, the on-chain module is used to: determine the institutional information of the transaction institution corresponding to the transaction data before performing consensus calculation on the transaction data on the shard node associated with the transaction data in the blockchain, the transaction institutions include lending institutions, regulatory agencies and financial institutions; determine whether the blockchain shard corresponding to the transaction institution exists based on the institutional information; if the blockchain shard exists, determine the node on the blockchain shard as the shard node; if the blockchain shard does not exist, create the blockchain shard corresponding to the transaction institution based on the institutional information, and determine the node on the blockchain shard as the shard node.
[0022] In some embodiments, the above-mentioned device also includes: a cropping module, which is used to: determine a block index tree in which the target block parameter is an index field, and the block index tree includes a tree node corresponding to the new block; based on a preset value of the target block parameter, determine the data page where the header block is located in the block index tree; based on the data page where the header block is located, traverse the tree nodes in the block index tree backward to obtain a block to be cropped whose value of the target block parameter meets the cropping target; and delete the block to be cropped.
[0023] In some embodiments, the target block parameter is the block height; wherein the cropping module is used to: determine the data page where the header block is located in the block index tree, and the block height of the header block is equal to a preset value; based on the data page where the header block is located, traverse the tree nodes in the block index tree backward to obtain the block to be cropped whose block height is lower than the preset value.
[0024] In some embodiments, the cropping module is also used to: obtain a block index tree before determining that the target block parameter is a block index tree of an index field; retrieve the target data page in the block index tree where the index of the i-th new block in the new block should be stored, where i is a positive integer; if the target data page is full, split the target data page based on the index of the i-th new block, and store the i-th new block in the split new data page or the target data page; if the target data page is not full, store the i-th new block in the target data page; after the i-th new block is stored, add 1 to the value of i, and return to the step of retrieving the data page in the block index tree where the index of the i-th new block in the new block should be stored, until all new blocks are stored in the data pages in the block index tree.
[0025] In some embodiments, the cropping module is used to: if the index of the i-th new block is located at the first position of the target data page, create a new data page before the target data page and store the i-th new block in the new data page; or, if the index of the i-th new block is located in the front half of the target data page that is not the first position, create a new data page before the target data page, store the block before the index of the i-th new block in the new data page, and store the i-th new block in the target data page; or, if the index of the i-th new block is located in the back half of the target data page that is not the last position, create a new data page after the target data page, store the block after the index of the i-th new block in the new data page, and store the i-th new block in the target data page; or, if the index of the i-th new block is located at the last position of the target data page, create a new data page after the target data page, and store the i-th new block in the new data page.
[0026] In a third aspect, the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the processor executes the computer program, some or all of the steps in the above method are implemented.
[0027] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements some or all of the steps in the above method when the computer program is executed by a processor.
[0028] In a fifth aspect, the present application provides a computer program, including a computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes some or all of the steps for implementing the above method.
[0029] In a sixth aspect, the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, some or all of the steps in the above method are implemented.
[0030] In this application, by referring to the two dimensions of concurrency and security, the chain type of transaction data to be chained is determined, and then it is determined whether it is currently in a high-security scenario or a high-concurrency scenario. When it is currently in a high-security scenario, a full-node consensus synchronization mechanism is adopted to perform consensus calculations on transaction data on all nodes of the blockchain, and save the calculated new blocks on all nodes to complete the transaction data chain; when it is currently in a high-concurrency scenario, a sharding node consensus synchronization mechanism is adopted to perform consensus calculations on transaction data on the sharding nodes associated with the transaction data in the blockchain, and save the calculated new blocks on the sharding nodes to complete the transaction data chain. Therefore, through the technical solution of this application, it is ensured that a dynamic balance is achieved between high concurrency and high security. Compared with the existing technology, it has stronger data classification capabilities and lower error rates, and is more suitable for the application of dynamic sharding technology solutions in financial living asset supervision scenarios, which strengthens the feasibility of this technology and production engineering practice scenarios.
[0031] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0033] Figure 1 is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0034] Figure 2 This is a schematic diagram of a structure of a blockchain-based information processing device provided in an embodiment of the present application;
[0035] Figure 3 This is a schematic diagram of a blockchain system with a multi-chain structure provided in an embodiment of the present application.
[0036] Figure 4 This is a schematic diagram of an implementation process of the blockchain-based information processing method provided in an embodiment of the present application;
[0037] Figure 5 This is a schematic diagram of an implementation process of the shard node consensus mechanism provided in an embodiment of the present application;
[0038] Figure 6 This is another implementation flow diagram of the blockchain-based information processing method provided in the embodiment of the present application;
[0039] Figure 7 This is a schematic diagram of page splitting of a block index tree provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The following is a description of the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. In the following description, reference is made to the drawings that form a part of the present application and show the specific aspects of the embodiments of the present application or the specific aspects of the embodiments of the present application in an illustrative manner. It should be understood that the embodiments of the present application can be used in other aspects and may include structural or logical changes not depicted in the drawings. Therefore, the following detailed description should not be understood in a restrictive sense, and the scope of the present application is defined by the appended claims. For example, it should be understood that the disclosure of the described method can be equally applicable to the corresponding device or system for performing the method, and vice versa. For example, if one or more specific method steps are described, the corresponding device may include one or more units such as functional units to perform the one or more method steps described (for example, one unit performs one or more steps, or multiple units, each of which performs one or more of the multiple steps), even if such one or more units are not explicitly described or illustrated in the drawings. On the other hand, for example, if a specific device is described based on one or more units such as functional units, the corresponding method may include a step to perform the functionality of the one or more units (e.g., a step to perform the functionality of the one or more units, or multiple steps, each of which performs the functionality of one or more of the multiple units), even if such one or more steps are not explicitly described or illustrated in the drawings. Further, it should be understood that, unless otherwise explicitly stated, the features of the various exemplary embodiments and / or aspects described herein may be combined with each other.
[0041] Credible evidence of living assets is a security interest established on movable property, and is one of the important financing guarantee methods in society. Pledge fully guarantees the security and credibility of the value of the pledged property by transferring the management rights of the pledged property. For the lending bank, it is a more reliable financing guarantee solution. For many small and medium-sized enterprises that lack credit accumulation, it is an extremely important guarantee financing method.
[0042] The electronic file management system of living assets relies on technologies such as mobile communications, the Internet of Things, and blockchain to sense and collect objective data such as the physical signs, location, activity level, body length, and weight of important physical living assets in livestock financial scenarios, and upload key data information to the chain, providing financial institutions with an integrated auxiliary management system for early warning and alarm of regulatory risks such as mortgage, pledge, financing, and insurance of living assets.
[0043] Although blockchain-based living asset supervision technology has been widely used, there are still some unresolved issues:
[0044] Concurrency control: In blockchain, due to the existence of the full-node consensus synchronization mechanism, each node participating in the network needs to verify and record transactions. Therefore, in high-concurrency transaction scenarios, all nodes need to participate in consensus, resulting in a decrease in the processing speed of blockchain services, thus affecting the overall efficiency of the system.
[0045] Scalability: Blockchain involves large-scale transactions and data storage issues. Since each node needs to verify and store all transaction data, as the transaction volume increases, the storage and processing pressure of the node will also increase. It is necessary to introduce a sustainable optimization solution for the storage architecture to solve this problem.
[0046] Trustworthy evidence problem: For many small and medium-sized livestock enterprises that lack credit accumulation, it is extremely difficult to convert biological living assets into electronic archive data that can be recognized by financial institutions. Generally speaking, financial institutions need to strictly supervise the pledged assets of enterprises through various communication systems and sensor devices. Whether the data reported by these devices is true, complete and valid directly determines whether the financial institution can conduct risk assessment on the business conditions of the enterprise based on the credible data and the actual status of the pledged assets, so as to decide whether to lend to the enterprise.
[0047] Then, in order to solve the problems existing in the above blockchain, the following corresponding solutions are proposed:
[0048] First, in order to solve the problem of credible evidence storage of electronic archives of living assets, it is generally adopted to uniformly store the data of living assets on the blockchain, and ensure the credibility of the electronic archives of living assets through the tamper-proof nature of the blockchain.
[0049] Specifically, all operational data from the entire process of purchasing, breeding, transportation, slaughtering and sales in the archives of live assets, as well as the biometric information of live assets, are uniformly stored on the blockchain to ensure the reliability and non-tamperability of the data. However, since the data of live assets is uniformly stored on the blockchain, there is a situation where the data cannot be effectively graded and classified. Therefore, in high-concurrency scenarios, the large-scale uploading of all data to the blockchain leads to performance bottlenecks.
[0050] Second, some blockchain projects use a technology similar to sharding, which divides the entire blockchain network into multiple small segments, each of which processes transactions independently, dispersing transaction pressure to multiple small segments, thereby improving the overall system efficiency.
[0051] Specifically, in order to solve the performance bottleneck problem caused by high concurrency, the technology of dividing the entire blockchain network into multiple fragments, each of which can run, process transactions and store data independently, can improve the throughput and concurrency performance of the entire blockchain network. However, since blockchain sharding requires the entire network to be divided into multiple sub-blockchains, each of which only maintains part of the data in the global ledger, if the number of nodes in a sub-blockchain is too small, it may face the risk of being attacked, resulting in doubts about the degree of confidence in the trusted evidence. It can be seen that blockchain sharding technology is not suitable for scenarios with high security requirements such as financial financing and asset securities.
[0052] Third, in order to solve the problem of blockchain transaction data expansion, the existing technology has introduced a variety of blockchain historical data clipping methods. Among them, by introducing additional index fields, the historical status data is recorded through the index field, such as the block height, and then the index field can be used for indexing and clipping.
[0053] Specifically, in order to solve the problem of blockchain transaction data expansion, a variety of blockchain historical data pruning methods can be used. Among them, some solutions can introduce additional index fields to record historical status data through index fields, and then index and prune through index fields. Although this solution can effectively locate and delete specified historical block information, as the number of transaction blocks continues to increase, the index complexity of the system locating specified blocks through index fields will also increase. For example, if the index field is the block height, the underlying application programming interface (API) provided by the blockchain will traverse from the end of the blockchain until the block of the specified height is retrieved and the block information is returned. When the number of blocks is too large, it will seriously affect the block pruning speed.
[0054] As can be seen from the above, due to the decentralized nature of blockchain, security and performance have always been an incompatible contradiction. In high-concurrency scenarios, large-scale uploading of full data to the chain has performance bottleneck problems; in high-security scenarios, blockchain sharding technology has the problem of low security.
[0055] In view of this, the embodiments of the present application provide a blockchain-based information processing method, device, electronic device and storage medium to ensure a dynamic balance between high concurrency and high security.
[0056] In some embodiments, the method described in the embodiments of the present application can be applied to the securitization of living assets. In some embodiments, the method described in the embodiments of the present application can also be applied to the transaction settlement of digital wallets, digital currencies, and financial assets. In some embodiments, the method described in the embodiments of the present application can also be applied to the fields of digital government affairs, evidence storage and anti-counterfeiting data services, etc.
[0057] The following describes an exemplary application of the electronic device provided in the embodiment of the present application. The electronic device provided in the embodiment of the present application can be a laptop, a tablet computer, a desktop computer, a mobile device (e.g., a mobile phone, a wearable smart watch, a dedicated messaging device), an electric car, an electric bicycle, and other rechargeable devices, but is not limited thereto. Alternatively, the electronic device can also be implemented as a server.
[0058] In some embodiments, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms, but is not limited thereto. In some embodiments, the server and the electronic device may be directly or indirectly connected via wired or wireless communication, and this is not specifically limited in the embodiments of the present application.
[0059] See also Figure 1 , Figure 1 is a structural schematic diagram of an electronic device provided in an embodiment of the present application, Figure 1 The electronic device 100 shown includes: at least one processor 110, a memory 150, at least one network interface 120 and a user interface 130. The various components in the electronic device 100 are coupled together via a bus system 140. It is understood that the bus system 140 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 140 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 140 is not described in detail. Figure 1 Various buses are labeled as bus system 140 .
[0060] The processor 110 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0061] The user interface 130 includes one or more output devices 131 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 130 also includes one or more input devices 132, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0062] The memory 150 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 150 may optionally include one or more storage devices that are physically remote from the processor 110.
[0063] The memory 150 includes a volatile memory or a nonvolatile memory, and may also include both volatile and nonvolatile memories. The nonvolatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 150 described in the embodiments of the present application is intended to include any suitable type of memory.
[0064] In some embodiments, the memory 150 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0065] The operating system 151 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic businesses and process hardware-based tasks.
[0066] The network communication module 152 is used to reach other computing devices via one or more (wired or wireless) network interfaces 120. Exemplary network interfaces 120 include: Bluetooth, WiFi, and universal serial bus (USB).
[0067] The presentation module 153 is used to enable presentation of information (eg, a user interface for operating peripheral devices and displaying content and information) via one or more output devices 131 (eg, a display screen, a speaker, etc.) associated with the user interface 130 .
[0068] The input processing module 154 is configured to detect one or more user inputs or interactions from one of the one or more input devices 132 and to translate the detected inputs or interactions.
[0069] In some embodiments, the information processing method based on blockchain provided in the embodiments of the present application can be implemented in software and stored in the memory 150. Figure 2 , Figure 2 This is a structural diagram of a blockchain-based information processing device provided by an embodiment of the present application, which can be software in the form of programs and plug-ins. The blockchain-based information processing device 155 (hereinafter referred to as information processing device 155) includes the following software modules: acquisition module 1551, determination module 1552, chain module 1553 and cutting module 1554. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.
[0070] In other embodiments, the information processing device 155 provided in the embodiment of the present application can be implemented in hardware. As an example, the information processing device 155 provided in the embodiment of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the information processing method based on blockchain provided in the embodiment of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field-programmable gate array (FPGA) or other electronic components.
[0071] The following will illustrate the blockchain-based information processing method provided by the embodiment of the present application in combination with the exemplary application and implementation of the electronic device provided by the embodiment of the present application.
[0072] In some embodiments, the blockchain-based information processing method provided in the embodiments of the present application can be applied to a blockchain system with a multi-chain structure, which can be used for credit financing of living assets.
[0073] In the credit financing scenario of live assets, the credit financing system of live assets can include three user roles: lending institutions, regulatory agencies, and financial institutions. Among them, the lending institution, as the initiator of credit financing, initiates a loan process application to the financial institution and reports the equivalent live assets as collateral. While assessing the credit risk of the loan breeding enterprise, the financial institution will initiate an asset supervision application to the regulatory agency and entrust the regulatory agency to conduct market price estimation, entry supervision, IoT equipment installation and live monitoring for the mortgaged live assets. Therefore, in the process of credit financing of live assets, each financing transaction will involve three trading institutions: lending institutions, regulatory agencies, and financial institutions, and each operation of entering, exiting, releasing mortgages, generating credible animal husbandry orders, and financing of live assets needs to be completed on the basis of consensus reached by the three trading institutions.
[0074] For example, in the credit financing scenario of live assets, the regulatory agency is generally a large live ranching organization.
[0075] It can be seen that the above credit financing system is a multi-tenant scenario, and an institution with a single user role can be associated with multiple institutions with other user roles, thereby forming different credit relationship chains. For example, a financial institution can simultaneously connect with multiple loan breeders for loans and entrust multiple different ranch regulatory agencies to supervise live assets. In this way, the above multi-tenant live asset credit financing system composed of three-party transaction institutions can be mapped to the blockchain network, and each institution participates in the data consensus of each transaction as a distributed node in the blockchain system. The credit relationship chain composed of institutions with different user roles can be mapped to the blockchain network to form a corresponding sub-blockchain.
[0076] Exemplarily, the live asset credit financing system may include two lending institutions (i.e., lending institution A and lending institution B), two regulatory agencies (i.e., regulatory agency A and regulatory agency B) and a financial institution. Among them, lending institution A initiates a loan application to the financial institution and reports the live assets of equal value as collateral. While assessing the credit risk of the loan-making breeding enterprise, the financial institution will initiate an asset supervision application to regulatory agency A, and entrust regulatory agency A to conduct market price estimation, entry supervision, Internet of Things equipment installation and live monitoring for the mortgaged live assets. Similarly, lending institution B initiates a loan application to the financial institution and reports the live assets of equal value as collateral. While assessing the credit risk of the loan-making breeding enterprise, the financial institution will initiate an asset supervision application to regulatory agency B, and entrust regulatory agency B to conduct market price estimation, entry supervision, Internet of Things equipment installation and live monitoring for the mortgaged live assets. At this time, if Figure 3 As shown, Figure 3It is a schematic diagram of a blockchain system with a multi-chain structure provided in an embodiment of the present application. The blockchain system may include: loan node A, loan node B, regulatory node A, regulatory node B and financial node K. Here, loan node A is a node mapped to the blockchain network by loan institution A, loan node B is a node mapped to the blockchain network by loan institution B, regulatory node A is a node mapped to the blockchain network by regulatory agency A, regulatory node B is a node mapped to the blockchain network by regulatory agency B, and financial node K is a node mapped to the blockchain network by financial institutions. In some embodiments, the full node consensus chain 0 is composed of loan node A, loan node B, regulatory node A, regulatory node B and financial node K, and all nodes on the full node consensus chain 0 perform consensus calculations on transaction data. The shard consensus chain 1 is composed of loan node A, regulatory node A and financial node K, and all nodes on the shard consensus chain 1 perform consensus calculations on the associated transaction data. The shard consensus chain 2 is composed of loan node B, regulatory node B and financial node K, and all nodes on the shard consensus chain 2 perform consensus calculations on the associated transaction data.
[0077] It should be noted that transaction data can involve different transaction institutions and thus be associated with different shard consensus chains. For example, if transaction data A is reported by lending institution A, then transaction data A is associated with shard consensus chain 1. Then, when transaction data A is uploaded to the chain, all nodes in shard consensus chain 1 perform consensus calculations. For example, if transaction data B is reported by lending institution B, then transaction data B is associated with shard consensus chain 2. When transaction data B is uploaded to the chain, all nodes in shard consensus chain 2 perform consensus calculations.
[0078] In some embodiments, the mapping relationship between the transaction institution and the distributed node can be encrypted and saved by the blockchain system.
[0079] The following is an explanation of the blockchain-based information processing method provided in the embodiment of the present application in combination with the above-mentioned blockchain system.
[0080] Figure 4 This is a schematic diagram of an implementation process of the information processing method based on blockchain provided in the embodiment of the present application. Figure 4 As shown, the blockchain-based information processing method of an embodiment of the present application may include steps S410 to S440.
[0081] In step S410, the transaction data to be stored is obtained.
[0082] Understandably, the loan-taking breeding enterprise applies to the lending institution to mortgage the live assets in order to obtain the corresponding loan. The lending institution reports the asset information of the live assets of equivalent value to the financial institution, such as the physical signs, location, activity level, body length, weight and other data of the live assets. At this time, the blockchain system obtains the asset information of the live assets and uses it as the transaction data to be stored.
[0083] In step S420, the on-chain type corresponding to the transaction data is determined.
[0084] It is understandable that after obtaining the transaction data, the blockchain system can determine the corresponding on-chain type according to the security and concurrency requirements of the transaction data. Exemplarily, the on-chain type of the transaction data can include high security requirements and high concurrency requirements.
[0085] In some embodiments, when the chaining type has a high security requirement, step S430 is executed; when the chaining type has a high concurrency requirement, step S440 is executed.
[0086] In step S430, consensus calculation is performed on the transaction data on all nodes of the blockchain, and the calculated new blocks are saved on all nodes.
[0087] Understandably, when the transaction data is on-chain with high security requirements, it can be determined that the transaction data has high security requirements. At this time, the blockchain system can perform consensus calculations on the transaction data in the full-node consensus chain to obtain a new block and save it to each node in the full-node consensus chain, thereby completing the trusted storage of transaction data.
[0088] In one embodiment, when the transaction data is on-chain with high security requirements, the blockchain system can execute a full-node consensus synchronization mechanism. It can be understood that regardless of whether the nodes in the blockchain system are associated with the transaction data, these nodes will participate in the consensus calculation of the transaction data, and after reaching a consensus, the new blocks calculated will be synchronized with the full nodes, that is, the new blocks will be saved to each node in the full-node consensus chain. Due to the characteristics of the full-node consensus synchronization mechanism, the degree of decentralization is relatively high. In this way, even if some nodes are tampered with, it will not affect the transaction consensus results of the entire network, and the system security is relatively high.
[0089] In step S440, consensus calculation is performed on the transaction data on the shard node associated with the transaction data in the blockchain, and the calculated new block is saved on the shard node.
[0090] Understandably, when the transaction data is on-chain with high concurrency requirements, it can be determined that the transaction data has a high concurrency requirement, that is, it is in a high concurrency scenario. At this time, the blockchain system can perform consensus calculations on the transaction data in the shard consensus chain to obtain a new block and save it to each node in the shard consensus chain, thereby completing the trusted storage of transaction data.
[0091] In one embodiment, when the type of transaction data on the chain is a high concurrency requirement, the blockchain system can execute a shard node consensus synchronization mechanism. Understandably, in a high concurrency scenario, a large amount of transaction data is concurrent in the blockchain system, which will cause the blockchain system to be blocked or even lose data. To this end, the blockchain system can dynamically divide the entire blockchain network into multiple blockchain shards (or shard networks, subnetworks, etc.) according to the institutional nodes associated with each transaction data, and each blockchain shard can independently process the associated transactions. Each node in the blockchain shard will participate in the consensus calculation of the transaction data, and after reaching a consensus, the calculated new block will be synchronized with the shard node, that is, the new block will be saved to each node in the shard consensus chain, thereby completing the credible evidence of the transaction data. In this way, the transaction pressure is dispersed to multiple blockchain shards, avoiding the performance consumption caused by the full-node consensus synchronization mechanism, thereby improving the overall system efficiency.
[0092] In one embodiment, in the above-mentioned shard node consensus synchronization mechanism, since the number of nodes participating in the consensus calculation is reduced, the loss of transaction security is generated. Then, in order to solve this problem, the blockchain system can also optimize the security of the above-mentioned shard node consensus synchronization mechanism in combination with the actual living asset financing credit scenario. It can be understood that each transaction data will be judged by business logic to obtain the transaction institution (i.e., lending institution, regulatory agency, and financial institution) to which it is associated, and create blockchain shards and consensus relationships on the corresponding nodes of the transaction institution. In this way, the blockchain system can dynamically create blockchain shards on the blockchain network according to the transaction data, and the mapping relationship between the transaction institution and the distributed node will be encrypted and saved by the system. Then, if the attacker attacks and tampers with a certain transaction data, it is necessary to decipher the mapping relationship between at least two transaction institutions and nodes in the associated three-party transaction institutions. It can be seen that the security is greatly improved.
[0093] At this point, the process of credible storage of transaction data is completed. In some embodiments, the process of credible storage of transaction data can also be understood as the process of putting transaction data on the chain.
[0094] In the embodiment of the present application, by referring to the two dimensions of concurrency and security, the chain type of the transaction data to be chained is determined, and then it is determined whether it is currently in a high-security scenario or a high-concurrency scenario. When it is currently in a high-security scenario, a full-node consensus synchronization mechanism is adopted to perform consensus calculations on the transaction data on all nodes of the blockchain, and the calculated new blocks are saved on all nodes to complete the transaction data chain; when it is currently in a high-concurrency scenario, a sharding node consensus synchronization mechanism is adopted to perform consensus calculations on the transaction data on the sharding nodes associated with the transaction data in the blockchain, and the calculated new blocks are saved on the sharding nodes to complete the transaction data chain. Thus, through the technical solution of the present application, it is ensured that a dynamic balance is achieved between high concurrency and high security. Compared with the prior art, it has stronger data classification capabilities and lower error rates, and is more suitable for the application of dynamic sharding technology solutions in financial living asset supervision scenarios, which strengthens the feasibility of this technology and production engineering practice scenarios.
[0095] In some embodiments, in step S420, in order to determine the chain type of transaction data, a data classification algorithm may be used to calculate the concurrency factor and the reliability factor in sequence, and then determine the classification result of the transaction data based on the concurrency factor and the reliability factor. Among them, the concurrency factor is used to indicate the concurrency requirement of the transaction data, the reliability factor is used to indicate the security requirement of the transaction data, and the classification result of the transaction data is used to indicate the chain type of the transaction data.
[0096] In some embodiments, when determining the concurrency factor associated with transaction data, the blockchain system can determine the length of the monitoring cycle under the regulatory scenario corresponding to the transaction data, the amount of data under the target business category in the transaction data, and the total amount of data in the transaction data, and then determine the concurrency factor based on the length of the monitoring cycle, the amount of data under the target business category, and the total amount of data.
[0097] For example, the concurrency factor DC associated with transaction data i The following expression (1) can be satisfied:
[0098]
[0099] Where i represents a certain regulatory scenario and is a positive integer. Different values of i represent different regulatory scenarios. The constant factors in expression (1) will change with the change of regulatory scenarios. For example, the regulatory scenarios may include live asset supervision (i=1), warehouse asset supervision (i=2), etc. i represents the length of the monitoring cycle in the regulatory scenario i, T iIt is set based on experience. For example, taking live monitoring and warehouse monitoring as examples, the data such as vital signs and live information involved in live monitoring have the characteristics of large fluctuations and high frequency. i The unit length of the interval. Warehouse supervision has the characteristics of strong stability and relatively low risk. i The interval unit length. n represents T i The number of transaction data (i.e., on-chain data) generated under the target business category, n is a positive integer. Indicates that in T i The amount of data under the target business category. c,i represents the data volume of the cth transaction data under the target business category under regulatory scenario i, and N represents T i The total number of entries of all transaction data generated within Indicates that in T i The total amount of transaction data in V c,i It represents the data volume of the cth transaction data under the supervision scenario i. It can be seen that factors such as the proportion of the number of transaction data items under the target business classification and the proportion of the data volume of transaction data will affect the concurrency factor DC i The calculation result of .
[0100] It should be noted that the above term "target business classification" refers to the business classification of transaction data in the blockchain system. For example, taking livestock supervision as an example, the business classification may include: IoT live monitoring, alarm information, financing livestock orders, etc.
[0101] In some embodiments, when determining the reliability factor associated with transaction data, the blockchain system can determine the sum of security constants under the target business classification in the transaction data, the amount of data under the target business classification in the transaction data, and the security coefficient corresponding to the target business classification, and then determine the reliability factor based on the sum of security constants, the amount of data under the target business classification, and the security coefficient.
[0102] In one embodiment, the security constant can be understood as a constant parameter related to security. Exemplarily, the security constant can represent the alarm level, which is divided into four levels: slight, medium, severe, and very severe, and can be represented by numbers 1 to 4. For example, 1 represents a slight alarm level, 2 represents a medium alarm level, 3 represents a severe alarm level, and 4 represents a very severe alarm level.
[0103] For example, the reliability factor S associated with transaction data i The following expression (2) can be satisfied:
[0104]
[0105] in, Represents the security constant s under the target business classification c,i The sum Gθ,i represents the safety factor under the target business classification. The safety factor has 10 levels and can be represented by numbers 1 to 10. Furthermore, in order to eliminate the increase in the safety ratio caused by the large amount of data in the batch, the sum of the reliability coefficients will be divided by the number of chain data items n to represent the average index.
[0106] For example, 1 represents the highest security requirement and 10 represents the lowest security requirement. It can be seen that the security coefficient ratio under the target business classification can represent the reliability coefficient of the transaction data.
[0107] In some embodiments, in the process of determining the classification result of transaction data according to the concurrency factor and the reliability factor, the blockchain system can first calculate the concurrency security comprehensive factor according to the concurrency factor and the reliability factor, where the concurrency security comprehensive factor is used to represent the classification result of the transaction data. Then, the blockchain system performs standardization processing on the concurrency security comprehensive factor, and then performs normalization processing on the standardized concurrency security comprehensive factor, thereby obtaining the classification result of the transaction data.
[0108] In one embodiment, when the classification result is a first value, it indicates that the on-chain type of the transaction data has a high security requirement; when the classification result is a second value, it indicates that the on-chain type of the transaction data has a high parallelism requirement.
[0109] In some embodiments, the classification result R of the transaction data i It can be calculated according to the following expression (3).
[0110]
[0111] in, represents the comprehensive concurrent safety factor, Represents the classification result after standardization, Z-score function X is a variable, x is a variable.
[0112] In some embodiments, when the blockchain system determines that the transaction data is on-chain with high concurrency requirements, it can also first determine whether the shard consensus chain associated with the transaction data has been established. If it has been established, the shard node consensus synchronization mechanism is directly executed; if it has not been established, a shard consensus chain can be established for the transaction data, and then the shard node consensus synchronization mechanism is executed. Figure 5 As shown, Figure 5 It is a schematic diagram of an implementation process of executing a shard node consensus mechanism provided in an embodiment of the present application. Step S440 may include: steps S510 to S550.
[0113] In step S510, the institution information of the transaction institution corresponding to the transaction data is determined.
[0114] Among them, transaction institutions include lending institutions, regulatory agencies and financial institutions.
[0115] It is understandable that the transaction data obtains the institutional information of the corresponding three-party transaction institution through the business module, such as the universally unique identifier (UUID). In one embodiment, the UUID of the transaction institution can be a long string composed of Chinese and English characters, such as "21f820fe26d642f48e4a1affce1deb28".
[0116] In step S520, it is determined whether the blockchain shard corresponding to the transaction institution exists based on the institution information.
[0117] It is understandable that the blockchain system can calculate the corresponding unique identifier based on the institutional information of the above three-party transaction institution, and the unique identifier can uniquely represent the blockchain shard composed of the nodes corresponding to the three-party transaction institution. Then, the blockchain system can quickly locate whether there is a corresponding blockchain shard by looking up the unique identifier.
[0118] For example, the blockchain system can concatenate the UUIDs of the three-party transaction institutions in a fixed order of "financial institution-regulatory agency-lending institution" to obtain a concatenated string S used to represent the shard consensus chain, as shown in expression (4).
[0119] S = concat(s 1 ,s 2 ,s 3 ) (4)
[0120] Among them, s 1 is the UUID of the financial institution. 2 is the UUID of the supervisory authority, s 3 is the UUID of the lending institution, concat(s 1 ,s 2 ,s 3 ) means s 1 、s 2 and 3 Splicing.
[0121] Furthermore, according to expression (5), the unique identifier BChain(S) corresponding to the three-party transaction institution can be obtained.
[0122]
[0123] Among them, c 1 、c 2 、c 3 ,…,c n represents the ASCII value of each character in the concatenated string S, n represents the length of the concatenated string S, and n is a positive integer. p is a preset prime number, and a larger prime number is usually selected to reduce the probability of mapping collision. m represents the number of combinations of three-party transaction institutions, that is, the capacity space of the mapping. Indicates 1 Length, Indicates 2 Length, Indicates 3 Length.
[0124] Through the above expression, a unique sequence mapped by the three-party transaction institutions associated with the transaction data is finally obtained, which will correspond to a unique shard consensus chain.
[0125] In some embodiments, if the blockchain shard corresponding to the transaction data exists, step S530 is executed; if the blockchain shard corresponding to the transaction data does not exist, steps S540 to S550 are executed.
[0126] In step S530, the nodes on the blockchain shard are determined as shard nodes.
[0127] It can be understood that if the blockchain shard corresponding to the transaction data exists, the blockchain system can determine each node in the blockchain shard as a shard node. These shard nodes perform consensus calculations on the transaction data and save the calculated new blocks on each shard node.
[0128] In step S540, a blockchain shard corresponding to the transaction institution is created based on the institution information.
[0129] It is understandable that if the blockchain shard corresponding to the transaction data exists, the blockchain system needs to create a new blockchain shard for the transaction data. At this time, the blockchain system can obtain the node identifiers corresponding to the three-party transaction institutions associated with the transaction information based on the mapping relationship between the institution information and the node identifier, and create a new blockchain shard by these three nodes. Exemplarily, the mapping relationship between the institution information and the node identifier can be represented by a mapping table between the institution UUID and the node IP address.
[0130] Furthermore, the blockchain system can also generate a unique identifier corresponding to the three-party transaction institution based on the institutional information of the three-party transaction institution associated with the transaction data. The unique identifier can uniquely represent the blockchain shard composed of the nodes corresponding to the three-party transaction institution, and save the unique identifier.
[0131] In step S550, the node on the created blockchain shard is determined as a shard node.
[0132] It is understandable that the blockchain system can determine each node in the blockchain shard created by step S540 as a shard node. These shard nodes perform consensus calculations on the transaction data and store the calculated new blocks on each shard node.
[0133] In the embodiment of the present application, by mapping the three-dimensional feature space of the three-party transaction institution to a one-dimensional feature space representing a unique mapping sequence, the time complexity in determining the blockchain shard corresponding to the three-party transaction institution is reduced from Reduced to O(n). In certain cases, combining bit arrays to store unique mapping sequences can further reduce the time complexity to O(1), greatly reducing the storage size occupied by the mapping space, and enabling faster positioning of blockchain shards when there are a large number of trading institutions.
[0134] Furthermore, by dynamically allocating consensus nodes and the mapping relationship between transaction institutions and distributed nodes, the system will encrypt and save them, thereby enhancing the ability to prevent attacks and tampering, thereby significantly improving security.
[0135] The embodiment of the present application also provides a blockchain-based information processing method, which is used to trim blocks in the blockchain to solve the problem of expansion of transaction data in the blockchain.
[0136] The following is an explanation of the blockchain-based information processing method provided in the embodiment of the present application in combination with the above-mentioned blockchain system.
[0137] Figure 6 This is another implementation flow diagram of the blockchain-based information processing method provided in the embodiment of the present application. Figure 6 As shown, the blockchain-based information processing method of an embodiment of the present application may include steps S610 to S640.
[0138] In some embodiments, steps S610 to S640 may be performed after step S440.
[0139] In step S610 , a block index tree using the target block parameter as an index field is determined.
[0140] The block index tree includes tree nodes corresponding to the new blocks.
[0141] It is understandable that when the blockchain system performs blockchain pruning, first, according to the blockchain pruning requirements, it determines the target block parameters, such as block height, block creation time, etc. Then, the blockchain system obtains a block index tree with the target block parameters as index fields.
[0142] In some embodiments, the blockchain system can create multiple block index trees according to the actual blockchain cutting requirements. These block index trees can use data such as block height, block creation time, etc. that are incremented by operation order, time order, etc. as index fields. It should be noted that in the embodiments of the present application, the target block parameter is taken as the block height for example.
[0143] In some embodiments, the above block index tree can not only be used as an efficiency-enhancing auxiliary for data clipping, but also can be used to quickly trace the historical information of blocks, filter conditions, and locate them. For example, an index can be constructed according to the alarm level to quickly retrieve all blockchain historical alarm evidence data of the specified level.
[0144] In some embodiments, while the transaction data is being reliably stored, the corresponding new block can be added to the block index tree as a new tree node, and each leaf node can be composed of a key-value pair consisting of "index field-block hash".
[0145] In some embodiments, the leaf nodes of the block index tree have a bidirectional linked list characteristic. Exemplarily, the block index tree is a B+ tree.
[0146] In step S620, based on the preset value of the target block parameter, the data page where the head block is located is determined in the block index tree.
[0147] It can be understood that the blockchain system retrieves the corresponding block in the block index tree according to the preset value of the target block parameter, such as the specified block height, and uses the block as the header block. Then, the blockchain system determines the data page where the header block is located. Exemplarily, assuming that the specified block height is a, the block index tree is searched with "a" as the index field, and block A with a block height of a is determined, and block A is used as the header block, thereby determining the data page 1 where block A is located.
[0148] In some embodiments, since each leaf node of the block index tree is composed of a key-value pair consisting of "index field-block hash", when determining block A, the blockchain system can obtain the hash value corresponding to block A, that is, the block hash.
[0149] In some embodiments, since the B+ tree stores data only in leaf nodes, the data pages only exist in the leaf nodes of the block index tree.
[0150] In step S630, based on the data page where the head block is located, the tree nodes in the block index tree are traversed backwards to obtain the to-be-cropped block whose value of the target block parameter satisfies the cropping target.
[0151] It can be understood that the blockchain system takes the data page where the header block is located as the starting point, and traverses the tree nodes (including leaf nodes and non-leaf nodes) in the block index tree backwards to obtain the block to be pruned whose value of the target block parameter meets the pruned target. Exemplarily, starting from data page 1, traverse each tree node in the blockchain index tree backwards to obtain the leaf nodes whose index field value is less than "a" (i.e., the pruned target), and then determine the blocks to be pruned corresponding to these leaf nodes.
[0152] In step S640 , the block to be cropped is deleted.
[0153] It can be understood that the blockchain system calls the blockchain framework API, passes in the block hash value set of the blocks to be pruned, and performs targeted block deletion based on the block hash value set to complete the batch block pruning operation.
[0154] At this point, the block clipping process is completed.
[0155] In an embodiment of the present application, a block index is constructed based on an optimized B+ tree data structure, and the structure is used to support fast retrieval, so that block nodes at a specified height can be quickly located with an average time complexity of O(logn), which significantly improves retrieval efficiency.
[0156] In some embodiments, before step S610, the blockchain system also needs to add the new block as a leaf node to the block index tree, that is, to create a leaf node of the block index tree for the new block. Specifically, the above method may also include the following steps:
[0157] Step 1: Get the block index tree.
[0158] It can be understood that while the new block is being saved, the blockchain system can obtain the current block index tree, at which point the leaf node corresponding to the new block does not exist in the block index tree. Here, the new block can be one or more.
[0159] Step 2: Retrieve the target data page where the index of the i-th new block in the new block should be stored in the block index tree, where i is a positive integer.
[0160] It can be understood that for the i-th new block in the new blocks, the blockchain system can search in the block index tree according to the bidirectional linked list characteristics of the block index tree to determine the target data page where the index of the i-th new block should be stored.
[0161] Step 3: If the target data page corresponding to the i-th new block is full, the target data page is split based on the index of the i-th new block, and the i-th new block is stored in the split new data page or the target data page.
[0162] It can be understood that for the i-th new block, if the target data page corresponding to the new block is full, the blockchain system needs to create a new leaf node for the new block. At this time, the blockchain system splits the target data page according to the index of the i-th new block to obtain a new data page after the split. Then, the blockchain system determines whether to store the i-th new block in the new data page or the target data page according to the position of the i-th new block in the target data page.
[0163] Step 4: If the target data page is not full, store the i-th new block into the target data page.
[0164] It can be understood that for the i-th new block, if the target data page corresponding to the new block is not full, the blockchain system can directly store the i-th new block in the target data page. In one embodiment, the key-value pair corresponding to the i-th new block, i.e., "index field-block hash", is stored in the target data page.
[0165] Step 5: After the i-th new block is stored in the new data page or the target data page, the value of i is increased by 1, and the process returns to step 2 until all new blocks are stored in the data pages in the block index tree.
[0166] In some embodiments, in step 3, referring to the ordered characteristics of the index of the block in the credit financing scenario of living assets, the block index tree is constructed by taking the newly added data as the splitting basis to perform page splitting. Then, step 3 may include but is not limited to the following situations:
[0167] In the first case, the index of the i-th new block is located at the first position of the target data page. Then, when the target data page is split, a new data page can be created before the target data page (i.e., in the leading direction), and the i-th new block can be stored in the new data page.
[0168] In the second case, the index of the i-th new block is located in the non-first half of the target data page. Then, when the target data page is split, a new data page can be created before the target data page (i.e., in the predecessor direction), and the blocks before the index of the i-th new block (i.e., in the predecessor direction) are stored in the new data page, and the i-th new block is stored in the target data page.
[0169] In the third case, the index of the i-th new block is located in the non-last half of the target data page. Then, when the target data page is split, a new data page can be created after the target data page (i.e., in the rear-drive direction), and the blocks after the index of the i-th new block (i.e., in the rear-drive direction) are stored in the new data page, and the i-th new block is stored in the target data page.
[0170] In the fourth case, the index of the i-th new block is located at the end of the target data page. Then, when the target data page is split, a new data page can be created after the target data page (i.e., in the rear-drive direction), and the i-th new block can be stored in the new data page.
[0171] In some embodiments, after the i-th new block is stored as mentioned above, the key (i.e., index field) of the key-value pair corresponding to the new block needs to be inserted into the parent node of the node where the target data page is located (i.e., the original node), and a pointer to the node where the new data page is located (i.e., the new node) needs to be added.
[0172] It should be noted that the above method can be applied to construct a block index tree. While the transaction data is being stored in a credible manner, corresponding nodes and data can be added to the block index tree.
[0173] In the embodiment of the present application, the above method can significantly reduce the space waste and frequent page split problems caused when the index has monotonic characteristics, while taking into account the insertion efficiency when the index insertion order is non-monotonic.
[0174] For example. Figure 7 As shown, Figure 7 Schematic diagram of page splitting of a block index tree provided in an embodiment of the present application. Figure 7 In (a), it is assumed that data page 1 in the block index tree includes a block with an index of 0005 (recorded as 0005) and a block with an index of 0008 (recorded as 0008). At this time, a new block is added to the block index tree. The data of the new block is monotonically increasing.
[0175] First, insert a block with index 0010 (recorded as 0010) into the block index tree. 0010 is the block after 0008. Accordingly, in the first step, determine that the target data page corresponding to 0010 is data page 1. In the second step, because data page 1 includes 2 indexes, it can be determined that data page 1 is not full. In the third step, store 0010 in data page 1. 0010 is located after 0008.
[0176] Secondly, insert a block with index 0015 (recorded as 0015) into the block index tree. 0015 is the block after 0010. Accordingly, in the first step, determine that the target data page corresponding to 0015 is data page 1. In the second step, because data page 1 includes 3 indexes, it can be determined that data page 1 is full. In the third step, determine that 0015 is at the last position in data page 1. At this time, perform page splitting, create a new data page 2 after data page 1, and store 0015 in data page 2.
[0177] Next, insert a block with index 0020 (recorded as 0020) into the block index tree. 0020 is the block after 0015. Accordingly, in the first step, determine that the target data page corresponding to 0020 is data page 2. In the second step, because data page 2 includes 1 index, it can be determined that data page 2 is not full. In the third step, store 0020 in data page 2. 0020 is located after 0015.
[0178] exist Figure 7 In (b), it is assumed that data page 1 in the block index tree includes a block with an index of 0005 (recorded as 0005) and a block with an index of 0020 (recorded as 0020). At this time, a new block is added to the block index tree. The data of the new block is non-monotonic.
[0179] First, insert 0015 into the block index tree. 0015 is the block between 0005 and 0020. Accordingly, in the first step, determine that the target data page corresponding to 0015 is data page 1. In the second step, because data page 1 includes 2 indexes, it can be determined that data page 1 is not full. In the third step, store 0015 in data page 1, between 0005 and 0020.
[0180] Secondly, insert 0008 into the block index tree. 0008 is the block between 0005 and 0015. Accordingly, in the first step, determine that the target data page corresponding to 0008 is data page 1. In the second step, since data page 1 includes 3 indexes, it can be determined that data page 1 is full. In the third step, since 0015 is located in the non-first half of data page 1, at this time, page splitting is performed, creating a new data page 2 after data page 1, and storing 0008 in data page 2, located after 0005, and storing 0015 and 0020 after 0008 in data page 2 in sequence.
[0181] Next, insert 0010 into the block index tree. 0010 is the block between 0008 and 0015. Accordingly, in the first step, determine that the target data page corresponding to 0010 is data page 1. In the second step, because data page 1 includes 2 indexes, it can be determined that data page 1 is not full. In the third step, store 0010 in data page 1, after 0008.
[0182] It can be seen that when inserting monotonic data (such as Figure 7 (a)) or non-monotonic data (such as Figure 7 When constructing the index tree, each node can achieve 100% space utilization, and compared with the traditional B+ tree page splitting algorithm when inserting the same data set, only one page split operation is generated, which greatly improves the efficiency of B+ tree construction and significantly improves the performance of block index construction.
[0183] In some embodiments, if the blockchain is pruned directly, the consistency of the block hash chain will be destroyed, reducing the confidence of the trusted evidence. The blockchain system can use a simplified payment verification (SPV) node to prune the blockchain without affecting the consistency of the block hash chain. When using an SPV node, the validity of the block can be verified by verifying the hash value of the block header and the Merkle root. In this way, even if the blockchain is pruned, as long as the longest block hash chain is retained, the SPV node can still ensure the consistency of the blockchain. When performing data pruning, SPV nodes can be used to verify the validity of the block, and the longest block hash chain is retained to ensure the consistency of the blockchain.
[0184] Based on the same inventive concept, the present application embodiment also provides a blockchain-based information processing device, such as the information processing device 155 in the above embodiment. Figure 2 As shown, the information processing device 155 includes: an acquisition module 1551, used to obtain transaction data to be stored; a determination module 1552, used to determine the chain type corresponding to the transaction data; a chain module 1553, used to perform consensus calculations on the transaction data on all nodes of the blockchain when the chain type has a high security requirement, and save the calculated new blocks on all nodes; or, when the chain type has a high concurrency requirement, perform consensus calculations on the transaction data on the shard nodes associated with the transaction data in the blockchain, and save the calculated new blocks on the shard nodes.
[0185] In some embodiments, the determination module 1552 is used to: determine the concurrency factor and reliability factor associated with the transaction data, wherein the concurrency factor is used to represent the concurrency requirement of the transaction data, and the reliability factor is used to represent the security requirement of the transaction data; determine the classification result of the transaction data based on the concurrency factor and the reliability factor, and the classification result is used to indicate the chain type of the transaction data.
[0186] In some embodiments, determination module 1552 is used to: determine the length of the monitoring cycle under the regulatory scenario corresponding to the transaction data, the amount of data under the target business classification in the transaction data, and the total amount of data of the transaction data; determine the concurrency factor based on the length of the monitoring cycle, the amount of data under the target business classification, and the total amount of data.
[0187] In some embodiments, determination module 1552 is used to: determine the sum of security constants under the target business classification in the transaction data, the amount of data under the target business classification in the transaction data, and the security coefficient corresponding to the target business classification; determine the reliability factor based on the sum of security constants, the amount of data under the target business classification, and the security coefficient.
[0188] In some embodiments, the determination module 1552 is also used to: obtain a concurrency security comprehensive factor based on the concurrency factor and the reliability factor, the concurrency security comprehensive factor being used to represent the classification result of the transaction data; standardize the concurrency security comprehensive factor; and normalize the standardized concurrency security comprehensive factor, wherein when the classification result is a first value, it indicates that the on-chain type of the transaction data has a high security requirement; and when the classification result is a second value, it indicates that the on-chain type of the transaction data has a high parallelism requirement.
[0189] In some embodiments, the on-chain module 1553 is used to: determine the institutional information of the transaction institution corresponding to the transaction data before performing consensus calculation on the shard node associated with the transaction data in the blockchain, the transaction institution includes a lending institution, a regulatory agency, and a financial institution; determine whether the blockchain shard corresponding to the transaction institution exists based on the institutional information; if the blockchain shard exists, determine the node on the blockchain shard as a shard node; if the blockchain shard does not exist, create a blockchain shard corresponding to the transaction institution based on the institutional information, and determine the node on the blockchain shard as a shard node.
[0190] In some embodiments, the above-mentioned device also includes: a cropping module 1554, which is used to: determine a block index tree in which the target block parameter is an index field, and the block index tree includes a tree node corresponding to the new block; based on a preset value of the target block parameter, determine the data page where the header block is located in the block index tree; based on the data page where the header block is located, traverse the tree nodes in the block index tree backward to obtain a block to be cropped whose value of the target block parameter meets the cropping target; and delete the block to be cropped.
[0191] In some embodiments, the target block parameter is the block height; wherein the cropping module 1554 is used to: determine the data page where the header block is located in the block index tree, and the block height of the header block is equal to a preset value; based on the data page where the header block is located, traverse the tree nodes in the block index tree backward to obtain the block to be cropped whose block height is lower than the preset value.
[0192] In some embodiments, the clipping module 1554 is also used to obtain a block index tree before determining that the target block parameter is a block index tree of an index field; retrieve the target data page where the index of the i-th new block in the new block should be stored in the block index tree, where i is a positive integer; if the target data page is full, split the target data page based on the index of the i-th new block, and store the i-th new block in the split new data page or the target data page; if the target data page is not full, store the i-th new block in the target data page; after the i-th new block is stored, add 1 to the value of i, and return to the step of retrieving the data page where the index of the i-th new block in the new block should be stored in the block index tree, until all new blocks are stored in the data pages in the block index tree.
[0193] In some embodiments, the trimming module 1554 is used to: if the index of the i-th new block is located at the first position of the target data page, then a new data page is created before the target data page, and the i-th new block is stored in the new data page; or, if the index of the i-th new block is located in the front half of the target data page that is not the first position, then a new data page is created before the target data page, and the block before the index of the i-th new block is stored in the new data page, and the i-th new block is stored in the target data page; or, if the index of the i-th new block is located in the back half of the target data page that is not the last position, then a new data page is created after the target data page, and the block after the index of the i-th new block is stored in the new data page, and the i-th new block is stored in the target data page; or, if the index of the i-th new block is located at the last position of the target data page, then a new data page is created after the target data page, and the i-th new block is stored in the new data page.
[0194] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the device provided in the embodiment of the present application can be used to execute the method described in the above method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0195] It should be noted that in the embodiment of the present application, if the above-mentioned information processing method based on blockchain is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), disk or optical disk, etc. Various media that can store program codes. In this way, the embodiment of the present application is not limited to any specific hardware, software or firmware, or any combination of hardware, software, and firmware.
[0196] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.
[0197] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in the above method are implemented. The computer-readable storage medium can be transient or non-transient.
[0198] An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is run in an electronic device, a processor in the electronic device executes some or all of the steps for implementing the above method.
[0199] The embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, some or all of the steps in the above method are implemented. The computer program product can be implemented specifically by hardware, software or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.
[0200] It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device, storage medium, computer program and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiments of the device, storage medium, computer program and computer program product of this application, please refer to the description of the method embodiment of this application for understanding.
[0201] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
[0202] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0203] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0204] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0205] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0206] Those skilled in the art will appreciate that all or part of the steps of the above method embodiments may be implemented by hardware associated with program instructions, and the aforementioned program may be stored in a computer-readable storage medium, which, when executed, executes the steps of the above method embodiments; and the aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROM), magnetic disks or optical disks.
[0207] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0208] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A blockchain-based information processing method, characterized in that: include: Obtain transaction data to be stored; Determine the on-chain type corresponding to the transaction data; When the on-chain type is a high security requirement, consensus calculation is performed on the transaction data on all nodes of the blockchain, and the calculated new blocks are saved on all nodes; When the on-chain type is a high concurrency requirement, consensus calculation is performed on the transaction data on the shard node associated with the transaction data in the blockchain, and the calculated new block is saved on the shard node.
2. The method according to claim 1, characterized in that Determining the on-chain type corresponding to the transaction data includes: Determining a concurrency factor and a reliability factor associated with the transaction data, wherein the concurrency factor is used to represent a concurrency requirement of the transaction data, and the reliability factor is used to represent a security requirement of the transaction data; A classification result of the transaction data is determined according to the concurrency factor and the reliability factor, and the classification result is used to indicate the on-chain type of the transaction data.
3. The method according to claim 2, characterized in that The determining of the concurrency factor associated with the transaction data includes: Determine the monitoring period length under the regulatory scenario corresponding to the transaction data, the data volume under the target business classification in the transaction data, and the total data volume of the transaction data; The concurrency factor is determined according to the monitoring period length, the data volume under the target business classification and the total data volume.
4. The method according to claim 2, characterized in that: The determining of the reliability factor associated with the transaction data includes: Determine the sum of security constants under the target business classification in the transaction data, the amount of data under the target business classification in the transaction data, and the security coefficient corresponding to the target business classification; The reliability factor is determined according to the sum of the security constants, the amount of data under the target business category, and the security coefficient.
5. The method according to claim 2, characterized in that: Determining the classification result of the transaction data according to the concurrency factor and the reliability factor includes: Obtaining a concurrency safety comprehensive factor according to the concurrency factor and the reliability factor, wherein the concurrency safety comprehensive factor is used to represent a classification result of the transaction data; Standardizing the concurrent safety comprehensive factor; The standardized concurrency security comprehensive factor is normalized, wherein when the classification result is a first value, it indicates that the on-chain type of the transaction data has a high security requirement; when the classification result is a second value, it indicates that the on-chain type of the transaction data has a high parallelism requirement.
6. The method according to claim 1, characterized in that Before performing consensus calculation on the transaction data on the shard node associated with the transaction data in the blockchain, the method further includes: Determining the institutional information of the transaction institution corresponding to the transaction data, wherein the transaction institution includes a lending institution, a regulatory agency, and a financial institution; Determine, based on the institution information, whether a blockchain shard corresponding to the transaction institution exists; If the blockchain shard exists, determining the node on the blockchain shard as the shard node; If the blockchain shard does not exist, a blockchain shard corresponding to the transaction institution is created according to the institution information, and the node on the blockchain shard is determined as the shard node.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Determine a block index tree whose target block parameter is an index field, wherein the block index tree includes a tree node corresponding to the new block; Based on the preset value of the target block parameter, determining the data page where the head block is located in the block index tree; Based on the data page where the header block is located, traverse the tree nodes in the block index tree backward to obtain a block to be cropped whose value of the target block parameter satisfies the cropping target; Delete the block to be cropped.
8. The method according to claim 7, characterized in that The target block parameter is the block height; wherein, The step of determining the data page where the header block is located in the block index tree based on the preset value of the target block parameter includes: Determining the data page where the header block is located in the block index tree, wherein the block height of the header block is equal to a preset value; Based on the data page where the header block is located, the tree nodes in the block index tree are traversed backward to obtain the to-be-cut blocks whose block heights are lower than the preset value.
9. The method according to claim 7, characterized in that: Before determining that the target block parameter is a block index tree of an index field, the method further includes: Obtaining the block index tree; Retrieve the target data page where the index of the i-th new block in the new block should be stored in the block index tree, where i is a positive integer; If the target data page is full, split the target data page based on the index of the i-th new block, and store the i-th new block in the split new data page or the target data page; If the target data page is not full, storing the i-th new block into the target data page; After the i-th new block is stored, the value of i is increased by 1, and the step of retrieving the data page that should be stored in the index of the i-th new block in the new block in the block index tree is returned until all the new blocks are stored in the data pages in the block index tree.
10. The method according to claim 9, characterized in that The step of performing page splitting on the target data page based on the index of the i-th new block, and storing the i-th new block in a split new data page or the target data page, includes: If the index of the i-th new block is located at the first position of the target data page, the new data page is created before the target data page, and the i-th new block is stored in the new data page; If the index of the i-th new block is located in the non-first half of the target data page, the new data page is created before the target data page, the blocks before the index of the i-th new block are stored in the new data page, and the i-th new block is stored in the target data page; If the index of the i-th new block is located in the non-last half of the target data page, the new data page is created after the target data page, and the blocks after the index of the i-th new block are stored in the new data page, and the i-th new block is stored in the target data page; If the index of the i-th new block is located at the end of the target data page, the new data page is created after the target data page, and the i-th new block is stored in the new data page.
11. An information processing device based on blockchain, characterized in that: include: An acquisition module is used to obtain transaction data to be stored; A determination module, used to determine the on-chain type corresponding to the transaction data; The on-chain module is used to perform consensus calculation on the transaction data on all nodes of the blockchain when the on-chain type has a high security requirement, and save the calculated new blocks on all nodes; or, when the on-chain type has a high concurrency requirement, perform consensus calculation on the transaction data on the shard nodes associated with the transaction data in the blockchain, and save the calculated new blocks on the shard nodes.
12. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the program, the steps in the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 10 are implemented.
