Blockchain network-based data storage method, device, equipment and storage medium

By acquiring network metadata and contract metadata with a common data structure, the differences between blockchain networks are masked, enabling unified data storage and contract invocation. This solves the compatibility issues of various blockchain networks and improves development and data storage efficiency.

CN114840604BActive Publication Date: 2026-01-02KINGDEE SOFTWARE(CHINA) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210509407.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2026-01-02
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

Existing blockchain networks use different data structures, making it difficult for business systems to be compatible with multiple heterogeneous blockchain networks simultaneously. This requires designing interfaces separately, resulting in long development cycles and low efficiency.

Method used

By acquiring network metadata with a common data structure, constructing blockchain network configuration data for the target network type, and using a unified basic instruction set to start and deploy transaction contracts, the differences between different blockchain networks are shielded, achieving unified data storage and contract invocation.

Benefits of technology

It improves the efficiency of blockchain network operation and management, reduces development time, and enables fast and efficient data storage and contract invocation, making it suitable for various types of blockchain networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114840604B_ABST
    Figure CN114840604B_ABST
Patent Text Reader

Abstract

The application relates to a data storage method and device based on a blockchain network, a computer device, a storage medium and a computer program product. The method comprises the following steps: obtaining network metadata of a general data structure through a network by using a basic instruction, and constructing blockchain network configuration data of a target network type according to the network metadata; obtaining a target blockchain network identifier based on a network running basic instruction, and starting a target blockchain network based on the target blockchain network identifier and the blockchain network configuration data; obtaining contract metadata of the general data structure through a contract deployment basic instruction, and deploying a transaction contract in the started target blockchain network based on the contract metadata; obtaining transaction data generated when a transaction is executed based on the transaction contract; and storing the transaction data in the started target blockchain network. The method can improve data storage efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to a data storage method and device based on a blockchain network, a computer device, a storage medium, and a computer program product. BACKGROUND

[0002] With the development of computer technology, blockchain is widely used due to its characteristics of historical non-tamperability, traceable process, and transparent and controllable permissions. When a business system uses a blockchain network to store transaction data, the business system cannot be compatible with multiple heterogeneous blockchain networks at the same time because existing various blockchain networks use their own data structures. Therefore, a set of interfaces needs to be designed for each type of blockchain network to be compatible with the blockchain network, which has a long development cycle and low efficiency. SUMMARY

[0003] Therefore, it is necessary to provide a data storage method and device based on a blockchain network that can improve efficiency, a computer device, a computer readable storage medium, and a computer program product.

[0004] In a first aspect, the present application provides a data storage method based on a blockchain network. The method comprises:

[0005] obtaining network metadata of a general data structure through network creation basic instructions, and constructing blockchain network configuration data of a target network type according to the network metadata;

[0006] obtaining a target blockchain network identifier based on network running basic instructions, and starting a target blockchain network based on the target blockchain network identifier and the blockchain network configuration data;

[0007] obtaining contract metadata of the general data structure through contract calling basic instructions, and deploying a transaction contract in the started target blockchain network based on the contract metadata;

[0008] obtaining transaction data generated when a transaction is executed based on the transaction contract;

[0009] storing the transaction data in the started target blockchain network.

[0010] In a second aspect, the present application also provides a data storage device based on a blockchain network. The device comprises:

[0011] a construction module configured to obtain network metadata of a general data structure through network creation basic instructions, and to construct blockchain network configuration data of a target network type according to the network metadata;

[0012] The starting module is configured to acquire a target blockchain network identifier based on a network running basic instruction, and start a target blockchain network based on the target blockchain network identifier and the blockchain network configuration data.

[0013] The deployment module is configured to acquire contract metadata of the general data structure through a contract calling basic instruction, and deploy a transaction contract in the started target blockchain network based on the contract metadata.

[0014] The acquisition module is configured to acquire transaction data generated when a transaction is executed based on the transaction contract.

[0015] The storage module is configured to store the transaction data in the started target blockchain network.

[0016] In a third aspect, the present application further provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0017] The network metadata of the general data structure is acquired through a network creation basic instruction, and the blockchain network configuration data of a target network type is constructed according to the network metadata.

[0018] The target blockchain network identifier is acquired based on a network running basic instruction, and the target blockchain network is started based on the target blockchain network identifier and the blockchain network configuration data.

[0019] The contract metadata of the general data structure is acquired through a contract calling basic instruction, and the transaction contract is deployed in the started target blockchain network based on the contract metadata.

[0020] The transaction data generated when a transaction is executed based on the transaction contract is acquired.

[0021] The transaction data is stored in the started target blockchain network.

[0022] In a fourth aspect, the present application further provides a computer readable storage medium. The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:

[0023] The network metadata of the general data structure is acquired through a network creation basic instruction, and the blockchain network configuration data of a target network type is constructed according to the network metadata.

[0024] The target blockchain network identifier is acquired based on a network running basic instruction, and the target blockchain network is started based on the target blockchain network identifier and the blockchain network configuration data.

[0025] obtain contract metadata of the general data structure through the contract calling basis instruction, and deploy a transaction contract in the target blockchain network after starting based on the contract metadata;

[0026] obtain transaction data generated based on execution of the transaction contract;

[0027] store the transaction data in the target blockchain network after starting.

[0028] In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the following steps:

[0029] obtain network metadata of the general data structure through the network creating basis instruction, and construct blockchain network configuration data of a target network type according to the network metadata;

[0030] obtain a target blockchain network identifier based on the network running basis instruction, and start a target blockchain network based on the target blockchain network identifier and the blockchain network configuration data;

[0031] obtain contract metadata of the general data structure through the contract calling basis instruction, and deploy a transaction contract in the target blockchain network after starting based on the contract metadata;

[0032] obtain transaction data generated based on execution of the transaction contract;

[0033] store the transaction data in the target blockchain network after starting.

[0034] The aforementioned data storage methods, devices, computer equipment, storage media, and computer program products based on blockchain networks obtain network metadata with a general data structure through basic network creation instructions. This allows for the construction of blockchain network configuration data for any target network type based on the network metadata of the general data structure, masking the differences between various blockchain network types. Then, based on basic network execution instructions, the target blockchain network identifier is obtained, and the target blockchain network is started based on the identifier and configuration data. This further masks the differences between different blockchain networks, allowing users to start any type of blockchain network using unified basic network execution instructions. Contract metadata with a general data structure is obtained through basic contract call instructions, and transaction contracts are deployed in the started target blockchain network based on this metadata. This allows for the invocation of transaction contracts through unified basic contract call instructions for various heterogeneous blockchain networks, eliminating the need to develop separate contract call interfaces for each type of blockchain network, thus improving the efficiency of transaction contract invocation. Finally, transaction data generated during transaction execution based on the transaction contract is obtained and stored in the started target blockchain network. For each type of blockchain network, the server can create and run the blockchain network through the network creation basic instructions and network operation basic instructions in the basic instruction set, and call the transaction contract in the blockchain network through the contract call basic instructions, without having to develop a separate interface for each blockchain network. This improves the efficiency of operating and managing the blockchain network, and allows transaction data to be stored in the blockchain network quickly and efficiently, thus improving the efficiency of data storage. Attached Figure Description

[0035] Figure 1 This is an application environment diagram of a data storage method based on a blockchain network in one embodiment;

[0036] Figure 2 This is a flowchart illustrating a data storage method based on a blockchain network in one embodiment;

[0037] Figure 3 This is a flowchart illustrating the process of calling a transaction contract method in one embodiment;

[0038] Figure 4 This is a schematic diagram illustrating the operation of a blockchain network in one embodiment;

[0039] Figure 5 This is a schematic diagram illustrating the management of transaction contracts in one embodiment;

[0040] Figure 6 This is a flowchart illustrating a data storage method based on a blockchain network in another embodiment;

[0041] Figure 7 A structural block diagram of a data storage device based on a blockchain network in an embodiment;

[0042] Figure 8 A structural block diagram of a data storage device based on a blockchain network in another embodiment;

[0043] Figure 9 An internal structural diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0044] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.

[0045] The data storage method based on a blockchain network provided by the embodiments of the present application can be applied to an application environment as shown in Figure 1 . The data storage system can store data required to be processed by the server 102. The data storage system can be integrated on the server 102, or placed on a cloud or other network server. The server 102 creates a network metadata of a general data structure through a network by a basic instruction, and constructs a blockchain network configuration data of a target network type based on the network metadata; obtains a target blockchain network identifier based on a network running basic instruction, and starts a target blockchain network based on the target blockchain network identifier and the blockchain network configuration data; obtains a contract metadata of a general data structure through a contract calling basic instruction, and deploys a transaction contract in the started target blockchain network based on the contract metadata; obtains transaction data generated when a transaction is executed based on the transaction contract; and stores the transaction data in the started target blockchain network.

[0046] The server 102 can be implemented by an independent server or a server cluster composed of multiple servers. The business system 104 includes but is not limited to a financial system, a personnel system, a tax system, an enterprise management system, an ERP (Enterprise Resource Planning) system, a production and manufacturing management system, a supply chain system, etc.

[0047] In an embodiment, as shown in Figure 2 , a data storage method based on a blockchain network is provided. Taking the server in Figure 1 as an example, the method includes the following steps:

[0048] S202, obtain a network metadata of a general data structure through a network by a basic instruction, and construct a blockchain network configuration data of a target network type based on the network metadata.

[0049] The network creation basic instruction is an instruction in a basic instruction set, and is used to build the blockchain network configuration data. For example, the network creation basic instruction can be a BuildNetwork(Network) instruction. The basic instruction set is a collection of general instructions for defining operations on a blockchain network, and is applicable to various types of blockchain networks, including a network creation basic instruction, a network running basic instruction (StartNetwork(Network)), a running judgment basic instruction (IsRunning(Network)), a network stopping basic instruction (StopNetwork(Network)), a stopping judgment basic instruction (IsStopped(Network)), a network deletion basic instruction (DeleteNetwork(Network)), an account registration basic instruction (Register(Network, Name, Password)), a blockchain addition basic instruction (BuildChain(Chain)), a contract deployment basic instruction (InstallContract(Chain, Contract)), a contract query basic instruction (QueryContract(Account, Chain, ContractName, args)), a contract call basic instruction (InvokeContract(Account, Chain, ContractName, args)), a contract update basic instruction (UpdateContract(Chain, Contract)), and the like.

[0050] The general data structure is a data structure uniformly defined for various types of blockchain networks. The network metadata is metadata for defining a blockchain network. For example, as shown in Table 1, the network metadata includes a network identifier, a network type, a network name, and a network creator identifier, etc. The network identifier is an identification number of the blockchain network, which can be composed of numbers, letters, symbols, special characters, etc. The network type is used to identify the type of the blockchain network, and heterogeneous blockchains have different blockchain network types, such as Hyperledger fabric (Hyperledger blockchain), FISCO BCOS blockchain, etc. The blockchain network configuration data is data required to run the blockchain network, including configuration files, certificates, keys, and deployment files of the blockchain network, etc.

[0051] Table 1

[0052] Field name Field data type Field description Network identity String Identification number of the blockchain network Network type String Type of the blockchain network Network name String Name of the blockchain network Network creator identity String Identity of the blockchain network creator

[0053] S204, obtain a target blockchain network identifier based on the network running basis instruction, and start the target blockchain network based on the target blockchain network identifier and the blockchain network configuration data.

[0054] The network running basis instruction is an instruction for starting a running blockchain network. The server obtains the target blockchain network identifier through the network running basis instruction, to determine the target blockchain network to be started according to the target blockchain network identifier, and then start the target blockchain network based on the target blockchain network identifier and the blockchain network configuration data.

[0055] In one embodiment, starting the target blockchain network includes starting each network node in the target blockchain network. The network node is a process in the blockchain network.

[0056] In one embodiment, S204 is followed by: the server determines whether the target blockchain network is completely started through the running judgment basis instruction.

[0057] S206, obtain the contract metadata of the general data structure through the contract deployment basis instruction, and deploy the transaction contract in the started target blockchain network based on the contract metadata.

[0058] The contract deployment basis instruction is a basis instruction for deploying a transaction contract in a blockchain network. The contract metadata is metadata for defining a transaction contract. For example, as shown in Table 2, the network metadata includes fields such as contract identifier, contract path, and contract version. The contract identifier field is used to record the identifier of the transaction contract. The contract path field is used to record the storage path of the transaction contract. The contract version field is used to record the version number of the transaction contract. The transaction contract is a computer protocol for propagating, verifying, or executing a contract in an informationized manner.

[0059] Table 2

[0060] Field name Field data type Field description Contract identity String Identity of the transaction contract Contract path String Storage path of the transaction contract Contract version String Version number of the transaction contract

[0061] S208, obtain transaction data generated when a transaction is executed based on the transaction contract.

[0062] The transaction data is data for recording the transaction process, including transaction participant identifier, transaction subject, whether the transaction is successful, transaction time, secret key, certificate, and transaction contract on which the transaction is based. For example, transaction participant A makes a transfer to transaction participant B based on the transaction contract, and the server obtains the transaction data generated in the transfer process. For example, transaction participant A exchanges the subject with transaction participant B based on the transaction contract, and the server obtains the transaction data generated in the subject exchange process.

[0063] S210, store the transaction data in the started target blockchain network.

[0064] The server stores the transaction data in a block of the target blockchain network after starting, so as to ensure that the transaction data is authentic and reliable and cannot be tampered with.

[0065] In one embodiment, S210 is followed by: stopping, by the server, a network stopping basis instruction to acquire a stop parameter of the general data structure; in the stop parameter, extracting a network identifier to be stopped; and if the network identifier to be stopped is consistent with the target blockchain network identifier, stopping running the target blockchain network and releasing resources occupied by each network node in the target blockchain network during running.

[0066] The network stopping basis instruction is a basis instruction for stopping running the blockchain network. The stop parameter is a parameter for stopping running the blockchain network and includes the network identifier to be stopped. If the network identifier to be stopped is consistent with the target blockchain network identifier, it indicates that the target blockchain network is a blockchain network that needs to be stopped running. Next, the server stops running the target blockchain network and releases resources occupied by each network node in the target blockchain network during running. The resources released by the server include a CPU (Central Processing Unit) and a memory.

[0067] In one embodiment, after the server stops running the target blockchain network by the network stopping basis instruction, the server determines whether the target blockchain network has completely stopped running by a stop judgment basis instruction. If the target blockchain network has not completely stopped running, an error prompt information is generated.

[0068] In the above embodiments, the network metadata of the general data structure is obtained through the network creation basis instruction, so that the blockchain network configuration data of the target network type can be constructed according to the network metadata of the general data structure, regardless of the type of the target blockchain network, and the differences between various types of blockchain networks are shielded. Then, the target blockchain network identifier is obtained based on the network running basis instruction, and the target blockchain network is started based on the target blockchain network identifier and the blockchain network configuration data, so that the differences between different blockchain networks can be shielded, and the user can start any type of blockchain network through the unified network running basis instruction. The contract metadata of the general data structure is obtained through the contract calling basis instruction, and the transaction contract is deployed in the started target blockchain network based on the contract metadata, so that for various heterogeneous blockchain networks, the transaction contract can be called through the unified contract calling basis instruction, without the need to develop an interface for contract calling for each type of blockchain network, and the efficiency of calling the transaction contract is improved. Finally, the transaction data generated when the transaction is executed based on the transaction contract is obtained, and the transaction data is stored in the started target blockchain network. For each type of blockchain network, the network creation basis instruction and the network running basis instruction in the basis instruction set can be used to create and run the blockchain network, and the transaction contract in the blockchain network can be called through the contract calling basis instruction, without the need to develop an interface for each type of blockchain network, which improves the efficiency of operating and controlling the blockchain network, so that the transaction data can be quickly and efficiently stored in the blockchain network, and the data storage efficiency is improved.

[0069] In one embodiment, S202 specifically includes: parsing the network metadata to obtain blockchain network data of the target data structure; determining a target network type corresponding to the target blockchain network according to the blockchain network data; and constructing network configuration data according to the target network type.

[0070] The target data structure is a data structure corresponding to the target blockchain network, which can be a data structure corresponding to an SDK (Software Development Kit) or API (Application Programming Interface) interface of the target blockchain network. The blockchain network data is data of the target data structure, and is used to describe the target blockchain network. After the server obtains the network metadata of the general data structure through the network creation basic instruction in the basic instruction set, the server parses the network metadata of the general data structure through the network creation basic instruction, obtains the blockchain network data of the target data structure, and converts the network metadata of the general data structure into the blockchain network data of the target data structure, so that the network configuration data of the blockchain network can be constructed through the unified network creation basic instruction for various blockchain networks with different data structures.

[0071] In the above embodiment, the server parses the network metadata to obtain the blockchain network data of the target data structure, and then determines the target network type corresponding to the target blockchain network according to the blockchain network data, and constructs the network configuration data according to the target network type. The server can construct the network configuration data through the unified network creation basic instruction for various heterogeneous blockchain networks, so as to start the blockchain network according to the network configuration data, thereby shielding the differences between various network types of the blockchain network, and only calling the general data interface (network creation basic instruction) can quickly start the blockchain network of various network types, thereby improving the efficiency of starting the blockchain network.

[0072] In one embodiment, S206 specifically includes: parsing the contract metadata to obtain the blockchain contract data of the target data structure; extracting the contract identifier and the contract address in the blockchain contract data; obtaining the contract source code according to the contract identifier and the contract address; and deploying the transaction contract in the started target blockchain network based on the contract source code.

[0073] The blockchain contract data is data of the target data structure, and is used to describe the transaction contract deployed in the blockchain. The contract identifier is a symbol of the transaction contract, which can be composed of one or more of numbers, characters, letters, or special characters. The contract address is a storage address of the transaction contract source code. The server obtains the contract source code corresponding to the contract identifier from the storage area corresponding to the contract address, and writes the contract source code into the target blockchain network, thereby realizing the deployment of the transaction contract in the blockchain network.

[0074] In the above embodiments, the server parses the contract metadata in the universal data structure into blockchain contract data in a target data structure corresponding to a target blockchain network, so as to convert data in the universal data structure into data in the data structure of the specific blockchain network, thereby obtaining the contract source code through the contract metadata in the universal data structure and deploying the contract source code in the blockchain network. Therefore, when deploying the transaction contract, details of the specific data structure of various types of blockchain networks do not need to be concerned, and the deployment of the transaction contract can be implemented only through the contract metadata in the universal data structure, thereby improving the efficiency of deploying the transaction contract.

[0075] In one embodiment, as shown in FIG. 3, S208 further includes S302-S306, and S208 specifically includes S308: Figure 3

[0076] S302, obtaining calling parameters in a universal data structure through a contract calling basic instruction; the calling parameters include a caller identifier, a chain identifier, and a contract identifier.

[0077] The contract calling basic instruction is an instruction in a basic instruction set, and is used to call a transaction contract deployed in a blockchain network. The calling parameters are used to describe the called transaction contract, and include the caller identifier, the chain identifier, and the contract identifier. The chain identifier is an identifier of a blockchain to which the called transaction contract belongs. For example, the blockchain network includes a blockchain 001A, a blockchain 002B, and a blockchain 003C, the transaction contract is deployed on the blockchain 003C, and the chain identifier is 003C. The caller is a client calling the transaction contract, and can be a client of a business system. For example, a client of a financial system calls the transaction contract as the caller of the transaction contract, and is used to reimburse the transaction contract.

[0078] S304, if the caller identifier is verified, determining a target blockchain according to the chain identifier.

[0079] After the server obtains the caller identifier, the server verifies whether the caller identifier is a registered caller. If the caller identifier is registered, the caller corresponding to the caller identifier is allowed to call the transaction contract in the blockchain network to perform a transaction.

[0080] In one embodiment, before S304, the method further includes: obtaining user registration data in a universal data structure through an account registration basic instruction; parsing the user registration data to obtain a to-be-registered account identifier; and writing the account identifier into a user center of a target blockchain network; the user center further includes other registered account identifiers; and S304 specifically includes: if the caller identifier matches the account identifier stored in the user center, determining the target blockchain according to the chain identifier.

[0081] ​The account registration basis instruction is an instruction in the basis instruction set, and is used for registering an account in a user center of a blockchain network. The user registration data is data used for describing an account to be registered, and includes an account identifier to be registered, an account password, and the like.

[0082] The user center stores the account identifier registered through the account registration basis instruction. If the identifier of the calling party matches the account identifier stored in the user center, it indicates that the identifier of the calling party is a registered user account, and can be verified.

[0083] S306, in the target blockchain, a target transaction contract corresponding to the contract identifier is called.

[0084] If the identifier of the calling party is verified, it indicates that the calling party is a legal calling party. The server determines the target blockchain according to the chain identifier, and in the target blockchain, a target transaction contract corresponding to the contract identifier is called.

[0085] S308, a calling party corresponding to the identifier of the calling party is obtained, and transaction data generated when a transaction is executed based on the target transaction contract is obtained.

[0086] The server calls the target transaction contract corresponding to the contract identifier in the target blockchain according to the contract identifier, so that the calling party corresponding to the identifier of the calling party executes a transaction according to the target transaction contract, and transaction data is generated when the transaction is executed. The server stores the generated transaction data in the target blockchain network, so that the transaction data is not tampered with, and the security of the transaction data is improved.

[0087] In the above embodiment, the calling parameter of the general data structure is obtained through the contract calling basis instruction, the target blockchain is determined according to the chain identifier in the calling parameter, and in the target blockchain, the target transaction contract corresponding to the contract identifier is called, so that the calling party executes a transaction according to the target transaction contract. It is realized that the transaction contract is called through the contract calling basis instruction common to various blockchain networks, and the interface for calling the contract is developed for each blockchain network, so that the efficiency of calling the contract is improved.

[0088] In one embodiment, S210 further includes: obtaining chain metadata of a general data structure through a blockchain addition basis instruction; analyzing the chain metadata to obtain chain data of a target data structure; and adding a new blockchain in the target blockchain network started according to the chain data; and S210 specifically includes: storing transaction data in the new blockchain.

[0089] The blockchain addition instruction is an instruction in the basis instruction set, and is used for adding a new blockchain in a blockchain network. The chain metadata is data used for describing a blockchain, and includes network metadata of a blockchain network to which the blockchain belongs, a blockchain identifier, and the like. For example, as shown in Table 3, the chain metadata includes a network metadata field and a chain identifier field.

[0090] Table 3

[0091]

[0092] The server obtains the chain metadata of the general data structure through the blockchain addition instruction in the basic instruction set, parses the chain metadata through the blockchain addition instruction, obtains the chain data of the target data structure, and converts the chain metadata of the general data structure into the chain data of the target data structure, so that the blockchain can be added in various blockchain networks with different data structures through the unified blockchain addition instruction.

[0093] In the above embodiment, the server parses the chain metadata of the general data structure to obtain the chain data of the target data structure, and then adds a new blockchain in the target blockchain network after startup according to the chain data. The server can add a blockchain through the general blockchain addition basic instruction for various heterogeneous blockchain networks, thereby shielding the differences between various network types of blockchain networks. Only the general data interface (blockchain addition basic instruction) needs to be called to quickly add a blockchain in various blockchain networks, thereby improving the efficiency of adding a blockchain.

[0094] In one embodiment, S208 further includes: obtaining an update parameter of the general data structure through a contract update basic instruction, the update parameter including an update chain identifier and an updated transaction contract; determining a to-be-updated blockchain according to the update chain identifier; and adjusting the transaction contract deployed in the to-be-updated blockchain to the updated transaction contract; and S208 specifically includes: obtaining transaction data generated when a transaction is executed based on the updated transaction contract.

[0095] The contract update instruction is an instruction in the basic instruction set, and is used to update the transaction contract. The update parameter is a parameter of the to-be-updated transaction contract, and includes an update chain identifier and an updated transaction contract. The update chain identifier is an identifier of the blockchain on which the to-be-updated transaction contract is deployed.

[0096] The server obtains the update parameter of the general data structure through the contract update instruction in the basic instruction set, parses the update parameter through the contract update instruction, obtains the update parameter of the target data structure, and converts the update parameter of the general data structure into the update parameter of the target data structure, so that the transaction contract deployed in various blockchain networks with different data structures can be updated through the unified contract update instruction.

[0097] In the above embodiments, update parameters of a general data structure are obtained through basic contract update instructions. The blockchain to be updated is determined based on the update chain identifier in the update parameters, and the transaction contracts deployed in the blockchain to be updated are adjusted to the updated transaction contracts. The server can update transaction contracts deployed in various heterogeneous blockchain networks using general basic contract update instructions, thereby shielding the differences between various blockchain network types. Only a general data interface (basic contract update instructions) needs to be called to quickly update transaction contracts deployed in various blockchain networks, improving the efficiency of updating transaction contracts.

[0098] In one embodiment, the server operates and manages the blockchain network through a basic instruction set. This basic instruction set masks the differences in data structures and interfaces among various blockchain networks, allowing business systems to integrate with the blockchain network using a common data structure and the basic instruction set. Business developers do not need to concern themselves with the detailed differences between heterogeneous blockchain networks; they only need to call the instructions in the basic instruction set to quickly perform tasks such as building, starting, stopping, deploying, updating, querying, and invoking transaction contracts on the blockchain network. The definitions of the basic instructions for managing the blockchain network in the basic instruction set are shown in Table 4.

[0099] Table 4

[0100]

[0101]

[0102] like Figure 4 As shown, the server constructs blockchain network configuration data by creating basic instructions over the network, and then runs these basic instructions to start the blockchain network based on the configuration data. After starting the blockchain network, the server checks whether the blockchain network is fully started by running the basic instructions. If the blockchain network is fully started, it enters the operational phase. Once the blockchain network is operational, the server can add new blockchains using the "Add Blockchain" basic instruction and register accounts using the "Register Account" basic instruction. When it is necessary to stop the blockchain network, the server stops the blockchain network and releases the resources occupied by each network node using the "Stop" basic instruction. Then, the server checks whether the blockchain network has completely stopped using the "Stop Check" basic instruction. If the blockchain network has completely stopped, the server deletes all data in the blockchain network using the "Delete Blockchain" basic instruction.

[0103] The server can obtain network metadata (Network) and chain metadata (Chain) of a general data structure from a business system through the basic instruction set, and then parse the network metadata and the chain metadata into data of a target data structure corresponding to each target blockchain network through the basic instruction set. Thus, the basic instruction set is used to uniformly manage each heterogeneous blockchain network.

[0104] As shown in Table 5, the server deploys a transaction contract through a basic instruction in the basic instruction set that supports the transaction contract and a transaction call, and calls the transaction contract to perform a transaction.

[0105] Table 5

[0106]

[0107]

[0108] As Figure 5 shown, when the blockchain network is in a running period, the server deploys a transaction contract in the blockchain network through a contract deployment basic instruction, queries the deployed transaction contract through a contract query basic instruction, and calls the deployed transaction contract through a contract call basic instruction, so that a calling party performs a transaction according to the called transaction contract. During the continuous running of the blockchain network, the server can update the deployed transaction contract through a contract update basic instruction. The server uses the contract deployment basic instruction, the contract query basic instruction, the contract call basic instruction, and the contract update basic instruction in the basic instruction set to uniformly manage and control the transaction contract in the blockchain network, so that the basic instruction set can be reused for each blockchain network, avoiding repeated development of interfaces for operating the transaction contract for each blockchain network, and improving the efficiency of managing and controlling the transaction contract in the blockchain network.

[0109] In addition, the server can export configuration files and certificates used when creating the blockchain network through a file download instruction (DownloadArtifacts(Network)) in the basic instruction set, so as to back up the configuration files of the blockchain network and facilitate testing, debugging, and operation and maintenance of the blockchain network.

[0110] In one embodiment, as Figure 6 shown, a data storage method based on a blockchain network includes the following steps:

[0111] S602, the network metadata is parsed to obtain blockchain network data of a target data structure.

[0112] S604, according to the blockchain network data, determining a target network type corresponding to a target blockchain network.

[0113] S606, construct network configuration data according to the target network type.

[0114] S608, obtain the target blockchain network identifier based on the network running basis instruction, and start the target blockchain network based on the target blockchain network identifier and the blockchain network configuration data.

[0115] S610, obtain the contract metadata of the general data structure through the contract deployment basis instruction, analyze the contract metadata, and obtain the blockchain contract data of the target data structure.

[0116] S612, extract the contract identifier and the contract address from the blockchain contract data, obtain the contract source code according to the contract identifier and the contract address, and deploy the transaction contract in the started target blockchain network based on the contract source code.

[0117] S614, obtain the calling parameter of the general data structure through the contract calling basis instruction.

[0118] S616, if the caller identifier in the calling parameter is verified, determine the target blockchain according to the chain identifier, and call the target transaction contract corresponding to the contract identifier in the target blockchain.

[0119] S618, obtain the calling party corresponding to the caller identifier, and generate the transaction data based on the target transaction contract executed when the transaction is executed.

[0120] S620, obtain the chain metadata of the general data structure through the blockchain addition basis instruction, analyze the chain metadata, and obtain the chain data of the target data structure.

[0121] S622, add a new blockchain in the started target blockchain network according to the chain data, and store the transaction data in the new blockchain.

[0122] S624, obtain the stop parameter of the general data structure through the network stop basis instruction, and extract the network identifier to be stopped in the stop parameter.

[0123] S626, if the network identifier to be stopped is consistent with the target blockchain network identifier, stop running the target blockchain network, and release the resources occupied by each network node in the target blockchain network when running.

[0124] The specific contents of S602 to S626 can refer to the specific implementation process described above.

[0125] It should be understood that although each step in the flowchart involved in each embodiment as described above is shown in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless explicitly stated herein, there is no strict order limitation for the execution of these steps, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with at least part of other steps or steps or stages in other steps.

[0126] Based on the same inventive concept, the embodiments of the present application also provide a blockchain network-based data storage device for implementing the above-mentioned blockchain network-based data storage method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more blockchain network-based data storage device embodiments provided below can refer to the limitations of the blockchain network-based data storage method in the above text, which will not be repeated here.

[0127] In one embodiment, as shown in Figure 7 a blockchain network-based data storage device is provided, comprising: a construction module 702, a starting module 704, a deployment module 706, an acquisition module 708 and a storage module 710, wherein:

[0128] The construction module 702 is configured to create network metadata of a general data structure by running a basic instruction through a network, and to construct blockchain network configuration data of a target network type according to the network metadata;

[0129] The starting module 704 is configured to obtain a target blockchain network identifier based on the network running the basic instruction, and to start the target blockchain network based on the target blockchain network identifier and the blockchain network configuration data;

[0130] The deployment module 706 is configured to obtain contract metadata of a general data structure by calling a basic instruction through a contract, and to deploy a transaction contract in the started target blockchain network based on the contract metadata;

[0131] The acquisition module 708 is configured to acquire transaction data generated when a transaction is executed based on the transaction contract;

[0132] The storage module 710 is configured to store the transaction data in the started target blockchain network.

[0133] In the above embodiments, the network metadata of the general data structure is obtained through the network creation basic instruction, so that the blockchain network configuration data of the target network type can be constructed according to the network metadata of the general data structure, regardless of the type of the target blockchain network, and the differences between various types of blockchain networks are shielded. Then, the target blockchain network identifier is obtained based on the network running basic instruction, and the target blockchain network is started based on the target blockchain network identifier and the blockchain network configuration data, so that the differences between different blockchain networks can be shielded, and the user can start any type of blockchain network through the unified network running basic instruction. The contract metadata of the general data structure is obtained through the contract calling basic instruction, and the transaction contract is deployed in the started target blockchain network based on the contract metadata, so that for various heterogeneous blockchain networks, the transaction contract can be called through the unified contract calling basic instruction, without the need to develop an interface for contract calling for each type of blockchain network, thereby improving the efficiency of calling the transaction contract. Finally, the transaction data generated when the transaction is executed based on the transaction contract is obtained, and the transaction data is stored in the started target blockchain network. For each type of blockchain network, the network creation basic instruction and the network running basic instruction in the basic instruction set can be used to create and run the blockchain network, and the transaction contract in the blockchain network can be called through the contract calling basic instruction, without the need to develop an interface for each type of blockchain network, thereby improving the efficiency of operating and controlling the blockchain network, so that the transaction data can be quickly and efficiently stored in the blockchain network, and further, the data storage efficiency is improved.

[0134] In one embodiment, the construction module 702 is further configured to:

[0135] The network metadata is parsed to obtain the blockchain network data of the target data structure;

[0136] According to the blockchain network data, the target network type corresponding to the target blockchain network is determined;

[0137] The network configuration data is constructed according to the target network type.

[0138] In one embodiment, the deployment module 706 is further configured to:

[0139] The contract metadata is parsed to obtain the blockchain contract data of the target data structure;

[0140] In the blockchain contract data, the contract identifier and the contract address are extracted;

[0141] The contract source code is obtained according to the contract identifier and the contract address;

[0142] The transaction contract is deployed in the started target blockchain network based on the contract source code.

[0143] In one embodiment, as shown in FIG. 7, Figure 8 the device further comprises:

[0144] The acquisition module 708 is configured to acquire, by the contract calling basis instruction, a calling parameter of the general data structure; the calling parameter comprises a caller identifier, a chain identifier, and a contract identifier.

[0145] The determination module 712 is configured to determine, if the caller identifier is verified, a target blockchain according to the chain identifier.

[0146] The calling module 714 is configured to call, in the target blockchain, a target transaction contract corresponding to the contract identifier.

[0147] The acquisition module 708 is further configured to acquire a caller corresponding to the caller identifier, and generate transaction data based on execution of the target transaction contract.

[0148] In one embodiment, the device further comprises:

[0149] The acquisition module 708 is further configured to acquire, by the account registration basis instruction, user registration data of the general data structure.

[0150] The parsing module 716 is configured to parse the user registration data to obtain an account identifier to be registered.

[0151] The writing module 718 is configured to write the account identifier into a user center of the target blockchain network; the user center further comprises other registered account identifiers.

[0152] The determination module 712 is further configured to determine, if the caller identifier matches the account identifier stored in the user center, the target blockchain according to the chain identifier.

[0153] In one embodiment, the device further comprises:

[0154] The acquisition module 708 is further configured to acquire, by the blockchain addition basis instruction, chain metadata of the general data structure.

[0155] The parsing module 716 is configured to parse the chain metadata to obtain chain data of a target data structure.

[0156] The adding module 718 is configured to add a new blockchain in the target blockchain network started according to the chain data.

[0157] The storage module 710 is further configured to store the transaction data in the new blockchain.

[0158] In one embodiment, the device further comprises:

[0159] The acquisition module 708 is further configured to acquire an update parameter of the general data structure through the contract update base instruction, and the update parameter comprises an update chain identifier and an updated transaction contract;

[0160] The determination module 712 is configured to determine the to-be-updated blockchain according to the update chain identifier;

[0161] The adjustment module 720 is configured to adjust the transaction contract deployed in the to-be-updated blockchain to the updated transaction contract.

[0162] The acquisition module 708 is further configured to acquire transaction data generated when a transaction is executed based on the updated transaction contract.

[0163] In an embodiment, the apparatus further comprises:

[0164] The acquisition module 708 is further configured to acquire a stop parameter of the general data structure through the network stop base instruction.

[0165] The extraction module 722 is configured to extract a to-be-stopped network identifier from the stop parameter.

[0166] The stop module 724 is configured to stop running the target blockchain network and release resources occupied by each network node in the target blockchain network when running, if the to-be-stopped network identifier is consistent with the target blockchain network identifier.

[0167] The above various modules in the data storage apparatus based on the blockchain network can be realized by software, hardware and combinations thereof in whole or in part. The above various modules can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in the computer device in software form, so as to be called and executed by a processor to perform the operations corresponding to the above various modules.

[0168] In an embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in Figure 9As shown in the figure. The computer device includes a processor, a memory, an input / output interface (I / O for short) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data storage data based on the blockchain network. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through network connection. The computer program is executed by the processor to implement a data storage method based on the blockchain network.

[0169] Those skilled in the art can understand that, Figure 9 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0170] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps in each of the above method embodiments.

[0171] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by the processor to implement the steps in each of the above method embodiments.

[0172] In one embodiment, a computer program product is provided, including a computer program, and the computer program is executed by the processor to implement the steps in each of the above method embodiments.

[0173] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0174] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0175] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.

[0176] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A data storage method based on a blockchain network, characterized in that, The method comprises: obtaining network metadata of a general data structure through a network creation basic instruction, and constructing blockchain network configuration data of a target network type according to the network metadata; wherein the network creation basic instruction is an instruction in a basic instruction set, and is used for constructing the blockchain network configuration data; the network metadata is metadata used for defining a blockchain network, and comprises network identification, network type, network name, and network creator identification; the blockchain network configuration data is data required for running the blockchain network; obtaining a target blockchain network identification based on a network running basic instruction, and starting a target blockchain network based on the target blockchain network identification and the blockchain network configuration data; judging whether the target blockchain network is completely started through a running judgment basic instruction; if the target blockchain network is completely started, the target blockchain network enters a running period; after the target blockchain network enters the running period, obtaining contract metadata of the general data structure through a contract deployment basic instruction, and deploying a transaction contract in the target blockchain network after starting based on the contract metadata; the contract deployment basic instruction is a basic instruction used for deploying a transaction contract in a blockchain network; obtaining transaction data generated when a transaction is executed based on the transaction contract; storing the transaction data in the target blockchain network after starting.

2. The method of claim 1, wherein, The constructing of the blockchain network configuration data of the target network type according to the network metadata comprises: parsing the network metadata to obtain blockchain network data of a target data structure; determining a target network type corresponding to a target blockchain network according to the blockchain network data; constructing network configuration data according to the target network type.

3. The method of claim 1, wherein, The deploying of the transaction contract in the target blockchain network after starting based on the contract metadata comprises: parsing the contract metadata to obtain blockchain contract data of a target data structure; extracting a contract identification and a contract address in the blockchain contract data; obtaining contract source code according to the contract identification and the contract address; deploying a transaction contract in the target blockchain network after starting based on the contract source code.

4. The method of claim 1, wherein, The method further comprises: obtaining calling parameters of a general data structure through a contract calling basic instruction; the calling parameters comprise a caller identification, a chain identification, and a contract identification; if the caller identification is verified, determining a target blockchain according to the chain identification; calling a target transaction contract corresponding to the contract identification in the target blockchain. The obtaining of transaction data generated when a transaction is executed based on the transaction contract comprises: obtaining transaction data generated when a transaction is executed based on the target transaction contract by a caller corresponding to the caller identification.

5. The method of claim 4, wherein, The method further comprises: obtaining user registration data of a general data structure through an account registration basic instruction; parsing the user registration data to obtain an account identification to be registered; writing the account identification into a user center of the target blockchain network; the user center further comprises other registered account identifications. If the invoker identity is verified, the target blockchain is determined according to the chain identity, and the method comprises the following steps: If the invoker identity matches the account identity stored in the user center, the target blockchain is determined according to the chain identity.

6. The method of claim 1, wherein, The method further comprises the following steps: A chain metadata of a general data structure is obtained through a blockchain addition basic instruction; The chain metadata is parsed to obtain chain data of a target data structure; A new blockchain is added in the target blockchain network after startup according to the chain data; The transaction data is stored in the new blockchain. The method further comprises the following steps:

7. The method of claim 1, wherein, An update parameter of a general data structure is obtained through a contract update basic instruction, and the update parameter comprises an update chain identity and an updated transaction contract; A blockchain to be updated is determined according to the update chain identity; The transaction contract deployed in the blockchain to be updated is adjusted to the updated transaction contract; The transaction data generated when the transaction is executed based on the updated transaction contract is obtained. The method further comprises the following steps: A stop parameter of a general data structure is obtained through a network stop basic instruction; 8. The method of claim 1, wherein, In the stop parameter, a network identity to be stopped is extracted; If the network identity to be stopped is consistent with the target blockchain network identity, the target blockchain network is stopped running, and resources occupied by each network node in the target blockchain network when running are released. The device comprises: A construction module is configured to obtain network metadata of a general data structure through a network creation basic instruction, and to construct blockchain network configuration data of a target network type according to the network metadata; wherein the network creation basic instruction is an instruction in a basic instruction set, and is used to construct blockchain network configuration data; the network metadata is metadata used to define a blockchain network, and comprises a network identity, a network type, a network name, and a network creator identity; the blockchain network configuration data is data required for running a blockchain network; 9.A data storage device based on a blockchain network, characterized in that, A startup module is configured to obtain a target blockchain network identity based on a network running basic instruction, and to start a target blockchain network based on the target blockchain network identity and the blockchain network configuration data; A deployment module is configured to judge whether the target blockchain network is completely started by running a judgment basic instruction; if the target blockchain network is completely started, the target blockchain network enters a running period; after the target blockchain network enters the running period, contract metadata of the general data structure is obtained through a contract deployment basic instruction, and a transaction contract is deployed in the target blockchain network after startup based on the contract metadata; the contract deployment basic instruction is a basic instruction used to deploy a transaction contract in a blockchain network; An acquisition module is configured to obtain transaction data generated when a transaction is executed based on the transaction contract; A storage module is configured to store the transaction data in the target blockchain network after startup. The processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program. The processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program. 10.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-9. ​ 11. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, which when executed by a processor, implements the steps of the method of any one of claims 1 to 8.

12. A computer program product comprising a computer program, characterized in that, The computer program, which when executed by a processor, implements the steps of the method of any one of claims 1 to 8.

Citation Information

Patent Citations

  • Block chain cross-chain processing method and device, equipment and storage medium

    CN111769958A

  • New energy data modeling and checking method and system based on cloud platform

    CN112579562A

  • Architecture system of trusted block chain service platform and construction method thereof

    CN113114498A