WO2024001039A1 - 一种维护区块链数据的方法、装置、电子设备和存储介质 - Google Patents

一种维护区块链数据的方法、装置、电子设备和存储介质 Download PDF

Info

Publication number
WO2024001039A1
WO2024001039A1 PCT/CN2022/135626 CN2022135626W WO2024001039A1 WO 2024001039 A1 WO2024001039 A1 WO 2024001039A1 CN 2022135626 W CN2022135626 W CN 2022135626W WO 2024001039 A1 WO2024001039 A1 WO 2024001039A1
Authority
WO
WIPO (PCT)
Prior art keywords
blockchain
data
relational database
database
node
Prior art date
Application number
PCT/CN2022/135626
Other languages
English (en)
French (fr)
Inventor
闫莺
魏长征
Original Assignee
蚂蚁区块链科技(上海)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 蚂蚁区块链科技(上海)有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2024001039A1 publication Critical patent/WO2024001039A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Definitions

  • the embodiments of this specification belong to the field of blockchain technology, and particularly relate to a method, device, electronic device and storage medium for maintaining blockchain data.
  • Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • data blocks are combined into a chained data structure in a chronological manner and are cryptographically guaranteed to be an untamperable and unforgeable distributed ledger.
  • non-relational databases In traditional blockchain technology, in order to meet the storage needs of blockchain nodes for large amounts of data when running blockchain services, blockchain nodes usually use non-relational databases with efficient access efficiency for data storage.
  • non-relational databases lack transaction relationships, lack connections between data and are not standardized, which is not conducive to data analysis. Relational databases have complete transaction relationships, connections between data and a strict standardized structure. If the non-relational database in traditional blockchain technology is replaced by a relational database, although it is beneficial to data analysis, it will not be used in the block chain.
  • the direct use of relational databases in the chain's underlying system will bring huge challenges to the online read and write performance of blockchain nodes when running blockchain services. Therefore, how to implement convenient data analysis services while ensuring that the blockchain service execution process has high access efficiency is an urgent problem in this field that needs to be solved.
  • the purpose of the present invention is to provide a method, device, electronic device and storage medium for maintaining blockchain data.
  • a method for maintaining blockchain data is proposed, which is applied to node devices deployed with blockchain nodes, and the node devices maintain blockchain non-relational Database and blockchain relational database, the blockchain non-relational database is used to maintain the blockchain data generated when the blockchain node runs the blockchain service; the method includes:
  • the standard data is maintained in the blockchain relational database, and the blockchain relational database is used to provide data analysis services to analysis demanders.
  • a device for maintaining blockchain data which is applied to node equipment deployed with blockchain nodes, and the node equipment maintains blockchain non-relational Database and blockchain relational database, the blockchain non-relational database is used to maintain the blockchain data generated when the blockchain node runs the blockchain service; the device includes:
  • a blockchain data acquisition unit used to acquire the blockchain data maintained in the blockchain non-relational database
  • a data conversion unit configured to convert the blockchain data into standard data defined by database schema information corresponding to the blockchain relational database
  • a standard data maintenance unit is used to maintain the standard data in the blockchain relational database, and the blockchain relational database is used to provide data analysis services to analysis demanders.
  • an electronic device including:
  • Memory used to store instructions executable by the processor
  • the processor implements the method described in the first aspect by running the executable instructions.
  • a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
  • the embodiment of this specification separately deploys a blockchain non-relational database and a blockchain relational database on the node device.
  • the blockchain non-relational database is used to maintain the blockchain node when running the blockchain service.
  • the generated blockchain data enables efficient access to blockchain data when the blockchain node runs the blockchain service; on the other hand, by maintaining the blockchain from the blockchain non-relational database
  • the data is converted into standard data and synchronously maintained in the blockchain relational database, thereby using the blockchain relational database to achieve convenient data analysis services.
  • the method for maintaining blockchain data involved in the embodiment of this specification realizes the backup of one data in two places, objectively improves the disaster recovery capability, realizes the separation of reading and writing of blockchain data through different types of databases, and ensures that the blockchain
  • the service execution process realizes convenient data analysis services with high access efficiency.
  • Figure 1 is a flow chart of a method for maintaining blockchain data provided by an exemplary embodiment.
  • Figure 2 is a system architecture diagram for maintaining blockchain data provided by an exemplary embodiment.
  • Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • Figure 4 is a block diagram of a device for maintaining blockchain data provided in an exemplary embodiment.
  • Figure 1 is a flow chart of a method for maintaining blockchain data provided by an exemplary embodiment. This method is applied to node equipment deployed with blockchain nodes.
  • the node equipment maintains a blockchain non-relational database and a blockchain relational database.
  • the blockchain non-relational database is used to maintain the area.
  • FIG. 2 is a system architecture diagram for maintaining blockchain data provided by an exemplary embodiment.
  • each blockchain node in the blockchain network is deployed on the corresponding node device, and each node device maintains both a blockchain non-relational database and a blockchain relational database.
  • the blockchain non-relational database belongs to the non-relational database
  • the blockchain relational database belongs to the relational database.
  • the blockchain non-relational database serves as the native database for blockchain nodes to run blockchain services, that is, as part of the infrastructure of the underlying system of the blockchain, it is used to run blockchain services on blockchain nodes.
  • the blockchain data generated during the process is efficiently accessed.
  • blockchain non-relational databases can specifically use Key-Value databases (key-value databases, a typical non-relational database, referred to as K-V database).
  • K-V databases do not know how to store data. Value, and there is no concept of schema (database schema information) like MySQL (relational database management system) and PostgreSQL (a free software object-relational database management system with very complete features).
  • the blockchain underlying system including blockchain nodes and corresponding blockchain databases
  • a non-relational database with efficient access speed i.e., blockchain non-relational type database
  • the blockchain node can efficiently access data from the blockchain non-relational database when running the blockchain service, thereby ensuring the efficient operation of the blockchain service.
  • the node devices involved in the embodiments of this specification also maintain an additional blockchain relational database as a native database for providing data analysis services to users, that is, as part of the infrastructure of the data analysis system, used to provide analysis services to users.
  • the demander provides data analysis services.
  • blockchain non-relational databases can specifically use relational databases such as Oracle database and MySQL.
  • a relational database refers to a database that uses a relational model to organize data. It stores data in the form of rows and columns to facilitate user understanding. The series of rows and columns in a relational database are called tables, and a set of tables consists of database. Users retrieve data from a database through queries, which are executable codes that limit certain areas of the database.
  • the relational model can be simply understood as a two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and the relationships between them.
  • a relational database needs to define the table structure, table relationships, and standardized Database schema information such as data structure is then stored in data based on the database schema information. It supports SQL and has strong data analysis capabilities.
  • relational databases place great emphasis on data consistency, they pay a huge price for reducing read and write performance.
  • the reliability of relational database for storing and processing data is very good, the efficiency will become very poor once faced with the processing of massive data, especially when encountering high concurrent reading and writing, the performance will drop very much. sharp.
  • relational databases have powerful data analysis capabilities but poor access speed and read and write performance, and are not suitable for large-scale concurrent read and write application scenarios.
  • the data analysis system deployed under the node device chain (including the data analysis engine and corresponding database not shown in Figure 2) adopts a non-relational database (i.e., block database) with efficient access speed, chain relational database), thus enabling node devices to utilize the powerful data analysis capabilities of blockchain non-relational databases when running data analysis services by calling the data analysis engine, thereby ensuring that convenient data analysis is provided to analysis demand parties.
  • a non-relational database i.e., block database
  • the data maintained in the blockchain relational database involved in the embodiments of this specification is obtained through data conversion and migration in the blockchain non-relational database.
  • the process of data conversion and migration will be introduced in detail below.
  • obtaining the blockchain data maintained in the blockchain non-relational database includes: receiving the blockchain data actively pushed by the blockchain node; and/ Or, send a blockchain data request to the blockchain node, and receive the blockchain data returned by the blockchain node in response to the blockchain data request.
  • the method for maintaining blockchain data involved in the embodiments of this specification is applied to node devices, specifically to the data conversion engine deployed under the node device chain.
  • the node device can obtain the blockchain data maintained in the non-relational database of the blockchain in at least one of two ways.
  • the two ways include: first, by receiving the area actively pushed by the blockchain node.
  • Blockchain data for example, every time a blockchain node adds or modifies blockchain data to the blockchain non-relational database during the process of running the blockchain service, the blockchain node will send it to the off-chain
  • the data conversion engine actively pushes data update messages carrying the latest newly added or modified blockchain data.
  • This method can timely convert and synchronize the data in the blockchain non-relational database to the blockchain relational database, thus Ensure the symmetry and timeliness of data in the blockchain relational database; secondly, send a blockchain data request to the blockchain node through the node device to obtain the response of the blockchain node to the blockchain data request For the returned blockchain data, this method obtains the blockchain data through the request-response mode, which can effectively control the scope of the requested blockchain data and thus shield some data that does not need to be maintained in the blockchain relational database. .
  • sending a blockchain data request to the blockchain node includes: initiating to the smart contract deployed by the blockchain node a non-relational database maintained in the blockchain for the smart contract.
  • Blockchain data request includes: initiating to the smart contract deployed by the blockchain node a non-relational database maintained in the blockchain for the smart contract.
  • the blockchain data request for the blockchain data in the blockchain node or, initiating to the blockchain node the zone for the blockchain data maintained in the blockchain non-relational database.
  • the blockchain data involved in the embodiments of this specification includes block data, status data and event data.
  • block data refers to the blockchain ledger maintained by each blockchain node in the blockchain network (the blockchain ledger is actually maintained in the blockchain non-relational database), because the blockchain ledger is A special data structure, which is composed of multiple blocks connected end to end through hash anchoring, and cannot be tampered with.
  • Each block consists of a block header and a block body.
  • the block header of any block Contains information such as the status tree root, transaction number root, receipt tree root, block height and the hash value of the corresponding parent block of the block, and the block body contains the transaction data contained in the block ( transaction hash).
  • the block data involved in the embodiments of this specification refers to the data contained in the blockchain ledger.
  • the status data and event data involved in the embodiments of this specification are maintained by each smart contract deployed by the blockchain node (essentially, the contract storage space corresponding to each smart contract is maintained in the blockchain non-relational database) .
  • the blockchain node is deployed with several smart contracts, and each smart contract maintains corresponding status data. These status data are maintained in the blockchain non-relational database corresponding to any one of the smart contracts.
  • the node device can initiate a blockchain data request to the smart contract deployed by the blockchain node (in fact, any smart contract is deployed on each blockchain node in the blockchain network).
  • the blockchain data request is Formally it is a blockchain transaction. After the blockchain transaction is received by the blockchain node, the blockchain node will further call the smart contract instructed by the blockchain transaction to execute the blockchain transaction.
  • the smart contract When the smart contract executes the blockchain transaction, it searches for and obtains the blockchain data indicated by the blockchain transaction from the contract storage space corresponding to the smart contract in the blockchain non-relational database, and uses it as a block.
  • the response message corresponding to the chain data request (such as in the form of a blockchain event) is called back to the node device, thereby achieving the method of calling a smart contract to obtain the blockchain data maintained in the blockchain non-relational database.
  • the node device can directly initiate a blockchain data request to the blockchain node, for example, initiate a blockchain data request through the data query interface of the blockchain node.
  • the blockchain data request is used to make the district
  • the blockchain node retrieves the block data indicated by the blockchain data request from the blockchain non-relational database and calls back to the node device.
  • the node device can directly initiate a blockchain data request to the blockchain non-relational database, for example, through the database interface of the blockchain non-relational database, which is equivalent to the node.
  • the blockchain non-relational database directly responds to the received blockchain data request and returns the blockchain data indicated by the blockchain data request.
  • a blockchain data request is in the same form as a blockchain transaction, it does not necessarily have all the properties of a blockchain transaction.
  • a blockchain node may not necessarily Instead of consensus in the blockchain network, it is processed as a local call request.
  • This kind of blockchain transaction that will only be executed within the local blockchain node without consensus is called a local transaction; of course, the blockchain Data requests can also have all the properties of a blockchain transaction, that is, after completing consensus in the blockchain network as a consensus transaction, they are executed separately by each blockchain node in the blockchain network.
  • S104 Convert the blockchain data into standard data defined by database schema information corresponding to the blockchain relational database.
  • Schema is an abstract collection of metadata, including a set of schema components: mainly the declaration of elements and attributes, and the definition of complex and simple data types. , specifically including: defining the elements that can appear in the document; defining the attributes that can appear in the document; defining which element is a sub-element; defining the order of sub-elements; defining the number of sub-elements; defining whether the element is empty or whether it can Contains text; defines data types for elements and attributes; defines default and fixed values for elements and attributes.
  • schema is the organization and structure of the database.
  • Database schema information contains schema objects, which can be tables, columns, data types, views, stored procedures, relationships, and primary keys. , foreign key, etc.
  • Database schema information can be represented by a visual diagram that shows database objects and their relationships to each other. Since the database schema information is used to describe the structure of the database and can be used as a blueprint for creating a database, by specifying the database schema information corresponding to a database, it can guide how the data in the database is stored.
  • the node device After the node device obtains the blockchain data, it will convert the blockchain data into the standard data defined by the database schema information based on the database schema information corresponding to the blockchain relational database, which means that the converted standard data It can be maintained in the blockchain relational database according to certain rules, and the standard data already has a standardized structure and has a defined relationship with other data in the blockchain relational database.
  • the conversion process of blockchain data to standard data includes but is not limited to the conversion of data tables, rows, and columns.
  • the block is implemented through the ETL (Extract-Transform-Load, data warehouse technology based on data extraction, conversion, and loading) mechanism.
  • ETL Extract-Transform-Load, data warehouse technology based on data extraction, conversion, and loading
  • the method further includes:
  • the database schema information corresponding to the blockchain relational database can be maintained at the node device in advance (for example, set by the administrator user of the node device), or can be obtained by requesting a smart contract.
  • each smart contract deployed by the blockchain node has a corresponding contract storage space in the blockchain non-relational database, and each smart contract has different characteristics when processing data, organizing data, and storing data. characteristics, so the corresponding contract storage spaces of different smart contracts in the non-relational blockchain have different data organization forms, and this data organization form includes the format, relationship and connotation of the data organization, etc. It is also based on database schema information The form is maintained in the smart contract.
  • the embodiment of this specification obtains the data maintained in the smart contract corresponding to the smart contract by requesting the corresponding smart contract.
  • the contract maintains the first database schema information of the blockchain data in the non-relational database as an organizational schema for maintaining the standard data converted from the blockchain data involved in the smart contract in the blockchain relational database, thereby Correctly maintain the standard data involved in the smart contract in the blockchain relational database.
  • the database schema information corresponding to each smart contract can be obtained through the embodiments of this specification, and the database schema information corresponding to the smart contract can be obtained according to the corresponding smart contract.
  • the database schema information is used as the database schema information corresponding to the blockchain relational database to realize the conversion of the blockchain data involved in the corresponding smart contract into standard data, and finally realizes according to the respective database schema information of different smart contracts.
  • the correct maintenance of standard data involved in multiple smart contracts in the blockchain relational database is equivalent to the blockchain relational database application having multiple different database schema information, and the database schema information corresponding to any smart contract Only the standard data involved in the maintenance of any smart contract (that is, the standard data obtained from the blockchain data conversion in any smart contract) is supported, thereby supporting the maintenance of multiple smart contracts using different data organization forms on the blockchain. After the blockchain data in the relational database is correctly converted into standard data, it is finally migrated to the blockchain relational database in the form of standard data for maintenance.
  • S106 Maintain the standard data in the blockchain relational database, which is used to provide data analysis services to analysis demanders.
  • the node device After the node device obtains the standard data, it can store the standard data in the blockchain relational database according to the blockchain mode information corresponding to the blockchain relational database to implement blocks in the blockchain non-relational database. Conversion and migration of chain data to standard data in blockchain relational database. Since the blockchain relational database supports a variety of SQL and has powerful data analysis capabilities (such as data query capabilities based on various conditions, indexes, and relationships), the blockchain relational database can easily provide analysis needs to parties. data analysis services. For example, the data analysis engine deployed on and off the chain of the node device provides a data analysis interface to the outside world to provide data analysis services for the blockchain relational database to the external analysis requester who calls the analysis interface.
  • the embodiment of this specification separately deploys a blockchain non-relational database and a blockchain relational database on the node device.
  • the blockchain non-relational database is used to maintain the blockchain node when running the blockchain service.
  • the generated blockchain data enables efficient access to blockchain data when the blockchain node runs the blockchain service; on the other hand, by maintaining the blockchain from the blockchain non-relational database
  • the data is converted into standard data and synchronously maintained in the blockchain relational database, thereby using the blockchain relational database to achieve convenient data analysis services.
  • the method for maintaining blockchain data involved in the embodiment of this specification realizes the backup of one data in two places, objectively improves the disaster recovery capability, realizes the separation of reading and writing of blockchain data through different types of databases, and ensures that the blockchain
  • the service execution process realizes convenient data analysis services with high access efficiency.
  • the method further includes: receiving a data analysis request sent by the analysis requester; and returning an analysis result obtained by analyzing the blockchain relational database based on the data analysis request to the analysis requester.
  • the data analysis engine deployed on and off-chain on the node device can also be used to receive data analysis requests sent by the analysis requester, and then call the blockchain relational database based on the data analysis engine. Analyze some of the data, and finally return the analysis results to the analysis requester, thereby realizing a complete data analysis service.
  • the data analysis engine will query the data that satisfies both condition A and condition B in the blockchain relational database and use these data as the analysis results. Return to analyzing the demand side.
  • Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • the device includes a processor 302, an internal bus 303, a network interface 306, a memory 308 and a non-volatile memory 310.
  • the processor 302 reads the corresponding computer program from the non-volatile memory 310 into the memory 308 and then runs it.
  • the execution subject of the following processing flow is not limited to each A logic unit can also be a hardware or logic device.
  • FIG 4 is a block diagram of a device for maintaining blockchain data provided in this specification according to an exemplary embodiment.
  • This device can be applied to the equipment shown in Figure 3 to implement the instructions of this specification.
  • Technical solution: This device is applied to node equipment deployed with blockchain nodes.
  • the node equipment maintains a blockchain non-relational database and a blockchain relational database.
  • the blockchain non-relational database is used to maintain The blockchain data generated when the blockchain node runs the blockchain service; the device includes:
  • the blockchain data acquisition unit 401 is used to acquire the blockchain data maintained in the blockchain non-relational database
  • the data conversion unit 402 is used to convert the blockchain data into standard data defined by the database schema information corresponding to the blockchain relational database;
  • the standard data maintenance unit 403 is used to maintain the standard data in the blockchain relational database, and the blockchain relational database is used to provide data analysis services to analysis demanders.
  • the blockchain data acquisition unit 401 is specifically used to:
  • the blockchain data acquisition unit 401 is further used to:
  • the device further includes:
  • the mode information query request sending unit 404 is configured to initiate a mode information query request to the smart contract, and determine the first database mode information recorded in the smart contract returned by the smart contract in response to the mode information query request. It is the database schema information corresponding to the blockchain relational database.
  • the blockchain data includes block data, status data and event data.
  • Optional also includes:
  • the data analysis request receiving unit 405 is used to receive the data analysis request sent by the analysis requester;
  • the analysis result return unit 406 is used to return the analysis result obtained by analyzing the blockchain relational database based on the data analysis request to the analysis requester.
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • the controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. , logic gates, switches, Application Specific Integrated Circuit (ASIC), programmable logic controllers and embedded microcontrollers.
  • controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, For Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
  • the controller in addition to implementing the controller in the form of pure computer-readable program code, the controller can be completely programmed with logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded logic by logically programming the method steps. Microcontroller, etc. to achieve the same function. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as structures within hardware components as well as software modules implementing the methods.
  • the systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
  • a typical implementation device is a server system.
  • the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, or a personal digital assistant. , media player, navigation device, email device, game console, tablet, wearable device, or a combination of any of these devices.
  • the functions are divided into various modules and described separately.
  • the functions of each module can be implemented in the same or multiple software and/or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. .
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
  • Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • read-only memory read-only memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • compact disc read-only memory CD-ROM
  • DVD digital versatile disc
  • Magnetic tape magnetic tape storage, graphene storage or other magnetic storage devices or any other non-transmission medium can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. Product form.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
  • program modules may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种维护区块链数据的方法、装置、电子设备和存储介质,所述方法应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护所述区块链节点运行区块链服务时生成的区块链数据;所述方法包括:获取所述区块链非关系型数据库中维护的所述区块链数据(102);将所述区块链数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据(104);将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务(106)。

Description

一种维护区块链数据的方法、装置、电子设备和存储介质
本申请要求于2022年06月29日提交中国专利局、申请号为202210761453.0、发明名称为“一种维护区块链数据的方法、装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本说明书实施例属于区块链技术领域,尤其涉及一种维护区块链数据的方法、装置、电子设备和存储介质。
背景技术
区块链(Blockchain)是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链系统中按照时间顺序将数据区块以顺序相连的方式组合成链式数据结构,并以密码学方式保证的不可篡改和不可伪造的分布式账本。
在传统区块链技术中,为了契合区块链节点在运行区块链服务过程中对大量数据的存储需求,区块链节点通常使用具有高效的存取效率的非关系型数据库进行数据存储,然而,非关系型数据库由于缺乏事务关系,数据之间缺乏联系且未标准化,不利于进行数据分析。关系型数据库具有完整的事务关系,数据之间具有联系且具有严格的标准化结构,如果将传统区块链技术中的非关系型数据库替换为关系型数据库,虽然利于进行数据分析,但在区块链底层系统直接使用关系型数据库又会对区块链节点运行区块链服务过程中的在线读写性能带来巨大挑战。因此,如何在确保区块链服务执行过程具有高效存取效率的情况下实现便捷的数据分析服务是本领域亟待解决的问题。
发明内容
本发明的目的在于提供一种维护区块链数据的方法、装置、电子设备和存储介质。
根据本说明书一个或多个实施例的第一方面,提出了一种维护区块链数据的方法,应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护所述区块链节点运行区块链服务时生成的区块链数据;所述方法包括:
获取所述区块链非关系型数据库中维护的所述区块链数据;
将所述区块链数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务。
根据本说明书一个或多个实施例的第二方面,提出了一种维护区块链数据的装置,应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护所述区块链节点运行区块链服务时生成的区块链数据;所述装置包括:
区块链数据获取单元,用于获取所述区块链非关系型数据库中维护的所述区块链数据;
数据转换单元,用于将所述区块链数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
标准数据维护单元,用于将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数 据库用于向分析需求方提供数据分析服务。
根据本说明书一个或多个实施例的第三方面,提出了一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器通过运行所述可执行指令以实现如第一方面所述的方法。
根据本说明书一个或多个实施例的第四方面,提出了一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如第一方面所述方法的步骤。
本说明书实施例通过在节点设备上分别部署区块链非关系型数据库和区块链关系型数据库,一方面,由于区块链非关系型数据库用于维护区块链节点运行区块链服务时生成的区块链数据,这使得区块链节点运行区块链服务时能够对区块链数据进行高效存取;另一方面,通过将从区块链非关系型数据库中维护的区块链数据转换为标准数据并同步维护于区块链关系型数据库中,从而利用区块链关系型数据库实现便捷的数据分析服务。本说明书实施例涉及的维护区块链数据的方法实现了一份数据两处备份,客观上提高了容灾能力,通过不同类型的数据库实现区块链数据的读写分离,在确保区块链服务执行过程具有高效存取效率的情况下实现便捷的数据分析服务。
附图说明
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是一示例性实施例提供的一种维护区块链数据的方法的流程图。
图2是一示例性实施例提供的一种维护区块链数据的系统架构图。
图3是一示例性实施例提供的一种设备的结构示意图。
图4是一示例性实施例提供的一种维护区块链数据的装置的框图。
具体实施方式
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。
图1是一示例性实施例提供的一种维护区块链数据的方法的流程图。该方法应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护所述区块链节点运行区块链服务时生成的区块链数据;所述方法包括:
S102:获取所述区块链非关系型数据库中维护的所述区块链数据。
图2是一示例性实施例提供的一种维护区块链数据的系统架构图。如图2所示,区块链网络中的每个区块链节点都部署于对应的节点设备上,每个节点设备都会同时维护有区块链非关系型数据库和区块链关系型数据库。在本说明书实施例中,区块链非关系型数据库属于非关系型数据库,而区块链关系型数据库属于关系型数据库。
一方面,区块链非关系型数据库作为区块链节点运行区块链服务的原生数据库,即作为区块链底层系统的基础架构的一部分,用于对区块链节点运行区块链服务的过程中生成的区块链数据进行高效存取。例如,区块链非关系型数据库可以具体采用Key-Value数据库(键值对数据库,一种典型的非关系型数 据库,简称K-V数据库),不同于关系型数据库,K-V数据库并不清楚存储数据的值,而且也没有像MySQL(关系型数据库管理系统)和PostgreSQL(一种特性非常齐全的自由软件的对象-关系型数据库管理系统)中schema(数据库模式信息)的概念。这也就意味着它不能像关系型数据库一样通过使用带where的SQL(Structured Query Language,结构化查询语句)来过滤并查询所存数据的部分内容。如果你不知道该从哪查询,你需要遍历所有的key值,找到对应的value,对其进行过滤,最终只保留你想要的那部分数据。这样一来计算量会非常大,同时也意味着只有在key已知的情况下,K-V数据库才能保证高性能,否则其性能明显不足。因此,虽然在绝对访问速度方面K-V数据库优于关系型数据库,但需要已知key值的要求限制了其应用场景。上述描述虽然仅涉及对K-V数据库的介绍,但实质上适用于大多数非关系型数据库,总的来说,就是非关系型数据库具有高效的访问速度但缺乏数据分析能力,例如缺乏基于索引、数据间关系的查询能力。
在本说明书实施例中,由于节点设备部署的区块链底层系统(包含区块链节点与对应的区块链数据库)沿用了具有高效的访问速度的非关系型数据库(即区块链非关系型数据库),因此可以使区块链节点在运行区块链服务时,能够高效地从区块链非关系型数据库中存取数据,从而确保区块链服务的高效运行。
另一方面,本说明书实施例涉及的节点设备还额外维护有区块链关系型数据库,以作为对用户提供数据分析服务的原生数据库,即作为数据分析系统的基础架构的一部分,用于向分析需求方提供数据分析服务。例如,区块链非关系型数据库可以具体采用oracle数据库、MySQL等关系型数据库。关系型数据库,是指采用了关系模型来组织数据的数据库,其以行和列的形式存储数据,以便于用户理解,关系型数据库这一系列的行和列被称为表,一组表组成了数据库。用户通过查询来检索数据库中的数据,而查询是一个用于限定数据库中某些区域的执行代码。关系模型可以简单理解为二维表格模型,而一个关系型数据库就是由二维表及其之间的关系组成的一个数据组织,关系型数据库需要提前定义好表的结构、表的关系、规范化的数据结构等数据库模式信息,再根据数据库模式信息存入数据,支持SQL,具有强大的数据分析能力,但由于关系型数据库十分强调数据的一致性,并为此降低读写性能付出了巨大的代价,虽然关系型数据库存储数据和处理数据的可靠性很不错,但一旦面对海量数据的处理的时候效率就会变得很差,特别是遇到高并发读写的时候性能就会下降的非常厉害。总的来说,就是关系型数据库具有强大的数据分析能力但访问速度、读写性能较差,不适用于大规模并发读写的应用场景。
在本说明书实施例中,由于节点设备链下部署的数据分析系统(包括图2中未示出的数据分析引擎与对应的数据库)采用了具有高效的访问速度的非关系型数据库(即区块链关系型数据库),因此可以使节点设备在通过调用数据分析引擎而运行数据分析服务时,能够利用区块链非关系型数据库强大的数据分析能力,从而确保向分析需求方提供便捷的数据分析服务。
本说明书实施例涉及的区块链关系型数据库中维护的数据是通过区块链非关系型数据库中的数据转换、迁移得到的。下面将具体介绍这个数据转换、迁移的过程。
在本说明书实施例中,所述获取所述区块链非关系型数据库中维护的所述区块链数据,包括:接收所述区块链节点主动推送的所述区块链数据;和/或,向所述区块链节点发送区块链数据请求,接收所述区块链节点响应于所述区块链数据请求返回的所述区块链数据。
本说明书实施例所涉及的维护区块链数据的方法应用于节点设备,具体应用于节点设备链下部署的数据转换引擎。节点设备可以通过两种方式中至少一种方式获取区块链非关系型数据库中维护的所述区块链数据,这两种方式包括:其一,通过接收区块链节点的主动推送的区块链数据,例如每次区块链节点在运行区块链服务的过程中向区块链非关系型数据库中新增或修改区块链数据的情况下,区块链节点都会向链下的数据转换引擎主动推送携带有最新新增或修改的区块链数据的数据更新消息,本方式可以及时将区块链非关系型数据库中的数据转换并同步至区块链关系型数据库中,从而确保区块链关系型数据库中数据的对称性和时效性;其二,通过节点设备向区块链节点发送区块链数据请求以获取所述区块链节点响应于所述区块链数据请求返回的所述区块链数据,本方式通过请求-响应模式来获取区块链数 据,可以有效控制请求的区块链数据的范围从而屏蔽一些不需要维护在区块链关系型数据库中的数据。
可选的,所述向所述区块链节点发送区块链数据请求,包括:向所述区块链节点部署的智能合约发起针对所述智能合约维护在所述区块链非关系型数据库中的所述区块链数据的所述区块链数据请求;或者,向所述区块链节点发起针对所述区块链非关系型数据库中维护的所述区块链数据的所述区块链数据请求。
本说明书实施例所涉及的区块链数据包括区块数据、状态数据和事件数据。其中,区块数据是指区块链网络中每个区块链节点所维护的区块链账本(区块链账本实质被维护在区块链非关系型数据库中),由于区块链账本是一种特殊的数据结构,其是由多个区块通过哈希锚定首尾相连而成,具有不可篡改性,每个区块由区块头和区块体组成,任一区块的区块头中包含有该个区块的状态树根、交易数根、收据树根、区块高度和对应父区块的哈希值等信息,而区块体中包含有该个区块包含的交易数据(交易哈希)。本说明书实施例所涉及的区块数据指的就是区块链账本中包含的数据。本说明书实施例涉及的状态数据和事件数据则是由区块链节点所部署的各个智能合约所维护(实质上是维护在区块链非关系型数据库中对应于各个智能合约的合约存储空间)。
在一实施例中,区块链节点部署有若干的智能合约,任一智能合约中都维护有相应的状态数据,这些状态数据被维护在区块链非关系型数据库中对应于所述任一智能合约的合约存储空间内。而节点设备可以向区块链节点部署的智能合约(事实上,任一智能合约部署在区块链网络中每个区块链节点上)发起区块链数据请求,该区块链数据请求在形式上属于一种区块链交易,该区块链交易在由区块链节点接收到后,区块链节点会进一步调用该区块链交易所指示的智能合约执行该区块链交易。智能合约在执行该区块链交易时,从区块链非关系型数据库中对应于该智能合约的合约存储空间查找并获取区块链交易所指示的区块链数据,并将其作为区块链数据请求对应的响应消息(如以区块链事件的形式)回调至节点设备,从而实现以调用智能合约的方式来获取区块链非关系型数据库中维护的区块链数据。
在另一实施例中,节点设备可以向区块链节点直接发起区块链数据请求,例如通过区块链节点的数据查询接口发起区块链数据请求,该区块链数据请求用于使区块链节点从区块链非关系型数据库中调取区块链数据请求所指示的区块数据并回调至节点设备。
在又一实施例中,节点设备可以直接向区块链非关系型数据库发起区块链数据请求,例如通过区块链非关系型数据库的数据库接口发起区块链数据请求,此时相当于节点设备链下的本地调用而无需经过区块链节点,区块链非关系型数据库直接响应于接收到的区块链数据请求返回区块链数据请求指示的区块链数据。
需要注意的是,虽然区块链数据请求在形式上与区块链交易相同,但不一定具有区块链交易的所有性质,例如区块链节点在接收到区块链数据请求后不一定会将其在区块链网络中进行共识,而是作为本地调用请求进行处理,这种不进行共识仅会在本地区块链节点内部执行的区块链交易称为本地交易;当然,区块链数据请求也可以具有区块链交易的所有性质,即作为共识交易在区块链网络中完成共识后,由区块链网络中的每个区块链节点各自分别执行。
S104:将所述区块链数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据。
本说明书实施例所涉及的数据库模式信息具体是指数据库schema,schema是元数据的一个抽象集合,包含一套schema component(模式组件):主要是元素与属性的声明、复杂与简单数据类型的定义,具体包括:定义可出现在文档中的元素;定义可出现在文档中的属性;定义哪个元素是子元素;定义子元素的次序;定义子元素的数目;定义元素是否为空,或者是否可包含文本;定义元素和属性的数据类型;定义元素和属性的默认值以及固定值。而在数据库中,schema是数据库的组织和结构。数据库模式信息中包含了schema对象,能够是表(table)、列(column)、数据类型(data type)、视图(view)、存储过程(stored procedures)、关系(relationships)、主键(primary key)、外键(foreign key)等。数据库模式信息能够用一个可视化的图来表示,它显示了数据库对象及其相互之间的关系。由于数据库模式信息用于描述数据库的结构,能够作为创建一个数据库的蓝图,因此通过规定一个数据库对应的数据库模式信息,可以指 导该数据库中数据是如何进行储存。
节点设备在获取到区块链数据后,将基于区块链关系型数据库对应的数据库模式信息,将区块链数据转换为该数据库模式信息所定义的标准数据,这意味着转换得到的标准数据能够被按照一定的规则维护在区块链关系型数据库中,并且标准数据也已经具备了规范化的结构以及被定义有与区块链关系型数据库中其他数据之间的关系。区块链数据到标准数据的转换过程包括但不限于数据表、行、列的转换,例如通过ETL(Extract-Transform-Load,基于数据抽取、转换和加载的数据仓库技术)机制实现了区块链数据到标准数据的转换,其具体实现方式现有技术均有所记载,这里不再赘述。
可选的,在所述区块链数据请求针对于所述智能合约维护在所述区块链非关系型数据库中的所述区块链数据的情况下,所述方法还包括:
向所述智能合约发起模式信息查询请求,将所述智能合约响应于所述模式信息查询请求返回的记录于所述智能合约中的第一数据库模式信息确定为所述区块链关系型数据库对应的所述数据库模式信息。
在本说明书实施例中,区块链关系型数据库对应的数据库模式信息可以被预先维护在节点设备处(例如由节点设备的管理员用户所设置),或者,向智能合约请求获取得到。如前所述,由于区块链节点部署的每个智能合约在区块链非关系型数据库中都有对应的合约存储空间,且每个智能合约在处理数据、组织数据、存储数据时具有不同的特性,因此不同智能合约在区块链非关系型中对应的合约存储空间具有不同的数据组织形式,而这个数据组织形式包括数据组织的格式、关系和内涵等,它同样是以数据库模式信息的形式被维护在智能合约中。因此,为了正确应对不同智能合约在区块链非关系型数据库所维护的具有不同组织特性的区块链数据,本说明书实施例通过向对应智能合约请求获取该智能合约中维护的对应于该智能合约维护在非关系型数据库中的区块链数据的第一数据库模式信息,来作为在区块链关系型数据库中维护该智能合约涉及的区块链数据转换得到的标准数据的组织模式,从而在区块链关系型数据库中正确地维护该智能合约涉及的标准数据。当区块链节点包含多个智能合约时,且不同的智能合约具有不同的数据组织形式的情况下,通过本说明书实施例可以获取每个智能合约对应的数据库模式信息,并按照对应智能合约的数据库模式信息,来作为所述区块链关系型数据库对应的所述数据库模式信息实现对应智能合约涉及的区块链数据到标准数据的转换,并最终按照不同智能合约各自的数据库模式信息,实现多个智能合约涉及的标准数据在区块链关系型数据库中的正确维护,此时相当于区块链关系型数据库应用有多种不同的数据库模式信息,且任一智能合约对应的数据库模式信息仅支持维护该任一智能合约涉及的标准数据(即来自该任一智能合约中区块链数据转换得到的标准数据),从而支持多个采用不同数据组织形式的智能合约维护在区块链非关系型数据库中的区块链数据正确地转换为标准数据后,最终以标准数据的形式迁移至区块链关系型数据库中维护。
S106:将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务。
节点设备在获得标准数据后,便可以按照区块链关系型数据库对应的区块链模式信息将标准数据存储于区块链关系型数据库中,以实现区块链非关系型数据库中的区块链数据到区块链关系型数据库中标准数据的转换迁移。由于区块链关系型数据库支持多种SQL,具有强大的数据分析能力(例如基于各类条件、索引、关系的数据查询能力),因此区块链关系型数据库可以方便地向分析需求方提供便捷的数据分析服务。例如,通过节点设备上链下部署的数据分析引擎向外部提供数据分析接口,来向外部调用该分析接口的分析需求方提供针对区块链关系型数据库的数据分析服务。
本说明书实施例通过在节点设备上分别部署区块链非关系型数据库和区块链关系型数据库,一方面,由于区块链非关系型数据库用于维护区块链节点运行区块链服务时生成的区块链数据,这使得区块链节点运行区块链服务时能够对区块链数据进行高效存取;另一方面,通过将从区块链非关系型数据库中维护的区块链数据转换为标准数据并同步维护于区块链关系型数据库中,从而利用区块链关系型数据库实现便捷的数据分析服务。本说明书实施例涉及的维护区块链数据的方法实现了一份数据两处备份,客观上提高了容灾能力,通过不同类型的数据库实现区块链数据的读写分离,在确保区块链服务执行过程具 有高效存取效率的情况下实现便捷的数据分析服务。
可选的,还包括:接收所述分析需求方发送的数据分析请求;将基于所述数据分析请求对所述区块链关系型数据库进行分析得到的分析结果返回所述分析需求方。作为一种提供数据分析服务的实施例,节点设备上链下部署的数据分析引擎还可以用于接收分析需求方发送的数据分析请求,然后基于所述数据分析引擎调用区块链关系型数据库中的部分数据进行分析,最终将分析得到的分析结果返回所述分析需求方,从而实现一次完整的数据分析服务。例如,数据分析请求是针对同时满足条件A与条件B的数据查询请求,那么数据分析引擎将在区块链关系型数据库中查询同时具备条件A与条件B的数据,并将这些数据作为分析结果返回分析需求方。
图3是一示例性实施例提供的一种设备的示意结构图。请参考图3,在硬件层面,该设备包括处理器302、内部总线303、网络接口306、内存308以及非易失性存储器310,当然还可能包括其他功能所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器302从非易失性存储器310中读取对应的计算机程序到内存308中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
如图4所示,图4是本说明书根据一示例性实施例提供的一种维护区块链数据的装置的框图,该装置可以应用于如图3所示的设备中,以实现本说明书的技术方案;该装置应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护所述区块链节点运行区块链服务时生成的区块链数据;所述装置包括:
区块链数据获取单元401,用于获取所述区块链非关系型数据库中维护的所述区块链数据;
数据转换单元402,用于将所述区块链数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
标准数据维护单元403,用于将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务。
可选的,所述区块链数据获取单元401具体用于:
接收所述区块链节点主动推送的所述区块链数据;和/或,
向所述区块链节点发送区块链数据请求,接收所述区块链节点响应于所述区块链数据请求返回的所述区块链数据。
可选的,所述区块链数据获取单元401进一步用于:
向所述区块链节点部署的智能合约发起针对所述智能合约维护在所述区块链非关系型数据库中的所述区块链数据的所述区块链数据请求;或者,
向所述区块链节点发起针对所述区块链非关系型数据库中维护的所述区块链数据的所述区块链数据请求。
可选的,在所述区块链数据请求针对于所述智能合约维护在所述区块链非关系型数据库中的所述区块链数据的情况下,所述装置还包括:
模式信息查询请求发送单元404,用于向所述智能合约发起模式信息查询请求,将所述智能合约响应于所述模式信息查询请求返回的记录于所述智能合约中的第一数据库模式信息确定为所述区块链关系型数据库对应的所述数据库模式信息。
可选的,所述区块链数据包括区块数据、状态数据和事件数据。
可选的,还包括:
数据分析请求接收单元405,用于接收所述分析需求方发送的数据分析请求;
分析结果返回单元406,用于将基于所述数据分析请求对所述区块链关系型数据库进行分析得到的分析结果返回所述分析需求方。
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶 体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为服务器系统。当然,本发明不排除随着未来计算机技术的发展,实现上述实施例功能的计算机例如可以为个人计算机、膝上型计算机、车载人机交互设备、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
虽然本说明书一个或多个实施例提供了如实施例或流程图所述的方法操作步骤,但基于常规或者无创造性的手段可以包括更多或者更少的操作步骤。实施例中列举的步骤顺序仅仅为众多步骤执行顺序中的一种方式,不代表唯一的执行顺序。在实际中的装置或终端产品执行时,可以按照实施例或者附图所示的方法顺序执行或者并行执行(例如并行处理器或者多线程处理的环境,甚至为分布式数据处理环境)。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、产品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、产品或者设备所固有的要素。在没有更多限制的情况下,并不排除在包括所述要素的过程、方法、产品或者设备中还存在另外的相同或等同要素。例如若使用到第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本说明书一个或多个时可以把各模块的功能在同一个或多个软件和/或硬件中实现,也可以将实现同一功能的模块由多个子模块或子单元的组合实现等。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成 到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
本发明是参照根据本发明实施例的方法、装置(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储、石墨烯存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
本领域技术人员应明白,本说明书一个或多个实施例可提供为方法、系统或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书一个或多个实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书一个或多个实施例可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本本说明书一个或多个实施例,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本说明书的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。
以上所述仅为本说明书一个或多个实施例的实施例而已,并不用于限制本本说明书一个或多个实施例。对于本领域技术人员来说,本说明书一个或多个实施例可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在权利要求范围之内。

Claims (10)

  1. 一种维护区块链数据的方法,应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护所述区块链节点运行区块链服务时生成的区块链数据;所述方法包括:
    获取所述区块链非关系型数据库中维护的所述区块链数据;
    将所述区块链数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
    将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务。
  2. 根据权利要求1所述的方法,所述获取所述区块链非关系型数据库中维护的所述区块链数据,包括:
    接收所述区块链节点主动推送的所述区块链数据;和/或,
    向所述区块链节点发送区块链数据请求,接收所述区块链节点响应于所述区块链数据请求返回的所述区块链数据。
  3. 根据权利要求2所述的方法,所述向所述区块链节点发送区块链数据请求,包括:
    向所述区块链节点部署的智能合约发起针对所述智能合约维护在所述区块链非关系型数据库中的所述区块链数据的所述区块链数据请求;或者,
    向所述区块链节点发起针对所述区块链非关系型数据库中维护的所述区块链数据的所述区块链数据请求。
  4. 根据权利要求3所述的方法,在所述区块链数据请求针对于所述智能合约维护在所述区块链非关系型数据库中的所述区块链数据的情况下,所述方法还包括:
    向所述智能合约发起模式信息查询请求,将所述智能合约响应于所述模式信息查询请求返回的记录于所述智能合约中的第一数据库模式信息确定为所述区块链关系型数据库对应的所述数据库模式信息。
  5. 根据权利要求1所述的方法,所述区块链数据包括区块数据、状态数据和事件数据。
  6. 根据权利要求1所述的方法,还包括:
    接收所述分析需求方发送的数据分析请求;
    将基于所述数据分析请求对所述区块链关系型数据库进行分析得到的分析结果返回所述分析需求方。
  7. 一种维护区块链数据的装置,应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护所述区块链节点运行区块链服务时生成的区块链数据;所述装置包括:
    区块链数据获取单元,用于获取所述区块链非关系型数据库中维护的所述区块链数据;
    数据转换单元,用于将所述区块链数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
    标准数据维护单元,用于将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务。
  8. 根据权利要求7所述的装置,还包括:
    数据分析请求接收单元,用于接收所述分析需求方发送的数据分析请求;
    分析结果返回单元,用于将基于所述数据分析请求对所述区块链关系型数据库进行分析得到的分析结果返回所述分析需求方。
  9. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-6中任一项所述的方法。
  10. 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求1-6中任一项所述方法的步骤。
PCT/CN2022/135626 2022-06-29 2022-11-30 一种维护区块链数据的方法、装置、电子设备和存储介质 WO2024001039A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210761453.0A CN115129786A (zh) 2022-06-29 2022-06-29 一种维护区块链数据的方法、装置、电子设备和存储介质
CN202210761453.0 2022-06-29

Publications (1)

Publication Number Publication Date
WO2024001039A1 true WO2024001039A1 (zh) 2024-01-04

Family

ID=83381448

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135626 WO2024001039A1 (zh) 2022-06-29 2022-11-30 一种维护区块链数据的方法、装置、电子设备和存储介质

Country Status (2)

Country Link
CN (1) CN115129786A (zh)
WO (1) WO2024001039A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115129786A (zh) * 2022-06-29 2022-09-30 蚂蚁区块链科技(上海)有限公司 一种维护区块链数据的方法、装置、电子设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597835A (zh) * 2019-09-17 2019-12-20 深圳前海微众银行股份有限公司 一种基于区块链的交易数据删除方法及装置
US20210152363A1 (en) * 2018-11-23 2021-05-20 Advanced New Technologies Co., Ltd. Blockchain recording methods and apparatuses, and computer devices
CN113420046A (zh) * 2021-06-22 2021-09-21 康键信息技术(深圳)有限公司 非关系型数据库的数据操作方法、装置、设备及存储介质
CN113742386A (zh) * 2021-11-03 2021-12-03 环球数科集团有限公司 一种对区块链账本的区块数据的加工解析方法
CN115129786A (zh) * 2022-06-29 2022-09-30 蚂蚁区块链科技(上海)有限公司 一种维护区块链数据的方法、装置、电子设备和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210152363A1 (en) * 2018-11-23 2021-05-20 Advanced New Technologies Co., Ltd. Blockchain recording methods and apparatuses, and computer devices
CN110597835A (zh) * 2019-09-17 2019-12-20 深圳前海微众银行股份有限公司 一种基于区块链的交易数据删除方法及装置
CN113420046A (zh) * 2021-06-22 2021-09-21 康键信息技术(深圳)有限公司 非关系型数据库的数据操作方法、装置、设备及存储介质
CN113742386A (zh) * 2021-11-03 2021-12-03 环球数科集团有限公司 一种对区块链账本的区块数据的加工解析方法
CN115129786A (zh) * 2022-06-29 2022-09-30 蚂蚁区块链科技(上海)有限公司 一种维护区块链数据的方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN115129786A (zh) 2022-09-30

Similar Documents

Publication Publication Date Title
US11816126B2 (en) Large scale unstructured database systems
CN110674228B (zh) 数据仓库模型构建和数据查询方法、装置及设备
JP6602355B2 (ja) クラウドベースの分散永続性及びキャッシュデータモデル
CN109299102B (zh) 一种基于Elastcisearch的HBase二级索引系统及方法
US11093466B2 (en) Incremental out-of-place updates for index structures
US10122783B2 (en) Dynamic data-ingestion pipeline
WO2019128318A1 (zh) 数据处理方法、装置和系统
JP6266630B2 (ja) アーカイブされたリレーションを有する連続クエリの管理
KR102634058B1 (ko) 입력 및 출력 스키마 매핑
Chavan et al. Survey paper on big data
JP2017157229A (ja) 半構造データのためのスケーラブルな分析プラットフォーム
US9753960B1 (en) System, method, and computer program for dynamically generating a visual representation of a subset of a graph for display, based on search criteria
Lai et al. Towards a framework for large-scale multimedia data storage and processing on Hadoop platform
CN107622055B (zh) 一种快速实现数据服务发布的方法
WO2024001028A1 (zh) 一种维护区块链数据的方法、装置、电子设备和存储介质
WO2024001039A1 (zh) 一种维护区块链数据的方法、装置、电子设备和存储介质
US20150363442A1 (en) Index merge ordering
WO2024001029A1 (zh) 一种维护区块链数据的方法、装置、电子设备和存储介质
CN112181950B (zh) 一种分布式对象数据库的构建方法
CN113779349A (zh) 数据检索系统、装置、电子设备和可读存储介质
Joldzic et al. The impact of cluster characteristics on HiveQL query optimization
Ye Research on the key technology of big data service in university library
Sinthong et al. AFrame: Extending DataFrames for large-scale modern data analysis (Extended Version)
Dhanda Big data storage and analysis
CN112800054A (zh) 数据模型的确定方法、装置、设备及存储介质

Legal Events

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

Ref document number: 22949118

Country of ref document: EP

Kind code of ref document: A1