WO2020220764A1 - 基于区块链的数据压缩、查询方法及装置和电子设备 - Google Patents

基于区块链的数据压缩、查询方法及装置和电子设备 Download PDF

Info

Publication number
WO2020220764A1
WO2020220764A1 PCT/CN2020/072133 CN2020072133W WO2020220764A1 WO 2020220764 A1 WO2020220764 A1 WO 2020220764A1 CN 2020072133 W CN2020072133 W CN 2020072133W WO 2020220764 A1 WO2020220764 A1 WO 2020220764A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
blockchain
compression
transaction
smart contract
Prior art date
Application number
PCT/CN2020/072133
Other languages
English (en)
French (fr)
Inventor
程龙
李艳鹏
贾博岩
Original Assignee
创新先进技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 创新先进技术有限公司 filed Critical 创新先进技术有限公司
Priority to US16/786,794 priority Critical patent/US10795882B2/en
Publication of WO2020220764A1 publication Critical patent/WO2020220764A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • 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 relate to the field of blockchain technology, and in particular to a method and device for data compression and query based on blockchain, and electronic equipment.
  • Blockchain technology also known as distributed ledger technology, is an emerging technology in which several computing devices participate in “bookkeeping" and jointly maintain a complete distributed database. Because the blockchain technology has the characteristics of decentralization, openness and transparency, each computing device can participate in database records, and the rapid data synchronization between computing devices, the blockchain technology is widely used in many fields. application.
  • a blockchain-based data compression method including:
  • the business party compresses the target data to be certified according to the preset compression template
  • the compression of the target data to be certified according to a preset compression template specifically includes:
  • the target data is compressed according to the compression template corresponding to the data structure.
  • the data structure of the target data is composed of a self-describing structure and actual data; wherein, the self-describing structure is used to represent the meaning expressed by the actual data;
  • the compression rule of the self-describing structure is recorded in the compression template
  • the compressing the target data includes:
  • the self-describing structure of the target data is mapped to custom data; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • the method further includes:
  • the creation transaction is sent to the node device of the blockchain, so that the node device, in response to the creation transaction, calls the contract audit logic declared in the audit contract published on the blockchain, and writes it in the transaction log Enter a voting event.
  • the audit node of the blockchain monitors the voting event, it submits a voting transaction to the audit contract; the audit contract summarizes the voting transactions to obtain the audit result of the smart contract .
  • the method further includes:
  • the smart contract is created in the blockchain and the unique identifier of the smart contract is returned to the business party.
  • the unique identifier includes:
  • a block chain-based data compression device including:
  • the node device of the blockchain receives the deposit certificate transaction submitted by the business party; wherein, the deposit certificate transaction contains a unique identifier and target data to be deposited, and the target data is compressed by a compression template corresponding to the unique identifier After the data;
  • the method further includes:
  • the contract audit logic declared in the audit contract published on the blockchain is called, and a voting event is written in the transaction log.
  • the audit node of the blockchain listens to the voting event , Submit voting transactions to the audit contract; the audit contract summarizes the voting transactions to obtain the audit result of the smart contract.
  • the method further includes:
  • the smart contract is created in the blockchain and the unique identifier of the smart contract is returned to the business party.
  • the unique identifier includes:
  • a data query device based on a blockchain is provided, and the data stored on the blockchain is compressed data after data compression based on the above-mentioned blockchain-based data compression method. ;
  • the method includes:
  • the business policy assembles the data to be queried into the query transaction
  • the query transaction is sent to the node device of the blockchain, so that the node device queries the compressed data stored on the blockchain in response to the query transaction; the query is published in the blockchain for the unique Identify the corresponding smart contract, call the compression template declared in the smart contract to restore the compressed data to complete data;
  • a compression rule of a self-describing structure is recorded in the compression template
  • the restoring the compressed data to complete data specifically includes:
  • the custom data in the compressed data is mapped to a self-describing structure; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • a data query device based on a blockchain is provided, and the data stored on the blockchain is compressed data after data compression based on the above-mentioned blockchain-based data compression method. ;
  • the method includes:
  • the node device of the blockchain receives the query transaction submitted by the business party; wherein, the query transaction includes a unique identifier;
  • a compression rule of a self-describing structure is recorded in the compression template
  • the restoring the compressed data to complete data specifically includes:
  • the custom data in the compressed data is mapped to a self-describing structure; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • an electronic device including:
  • a memory for storing processor executable instructions
  • the processor is configured as any one of the aforementioned blockchain-based data compression methods.
  • an electronic device including:
  • a memory for storing processor executable instructions
  • the processor is configured as any one of the above-mentioned blockchain-based data query methods.
  • the embodiment of this specification provides a data compression scheme based on the blockchain.
  • the business party compresses the target data to be certified based on the compression template locally, and the node device of the corresponding blockchain is based on the smart contract corresponding to the compression template.
  • Check the compressed data to ensure that the compressed data to be saved meets the requirements of the data format to avoid data abnormalities (such as data garbled and misplaced).
  • data abnormalities such as data garbled and misplaced.
  • this provides a blockchain-based data query solution.
  • the node device of the blockchain When the node device of the blockchain receives the query transaction from the business party, because the data deposited on the blockchain is compressed data, it can be based on intelligence
  • the compression template declared in the contract restores the compressed data to complete data. In this way, it is also based on the compression template of the smart contract, which restores the compressed data of the certificate to the complete data for the business side to ensure the correctness of the data.
  • Fig. 1 is a flowchart of a blockchain-based data compression method provided by an embodiment of this specification
  • Figure 2 is a flowchart of a blockchain-based data compression method provided by an embodiment of this specification
  • Figure 3 is a flowchart of a blockchain-based data query method provided by an embodiment of this specification
  • Figure 4 is a flowchart of a blockchain-based data query method provided by an embodiment of this specification
  • FIG. 5 is a hardware structure diagram of a block chain-based data compression device provided by an embodiment of this specification.
  • FIG. 6 is a schematic diagram of modules of a block chain-based data compression device provided by an embodiment of this specification.
  • FIG. 7 is a schematic diagram of modules of a block chain-based data compression device provided by an embodiment of this specification.
  • FIG. 8 is a hardware structure diagram of a block chain-based data query device provided by an embodiment of this specification.
  • FIG. 9 is a schematic diagram of a block chain-based data query device provided by an embodiment of the present specification.
  • FIG. 10 is a schematic diagram of modules of a block chain-based data query device provided by an embodiment of this specification.
  • first, second, third, etc. may be used in this specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as second information, and similarly, the second information may also be referred to as first information.
  • word “if” as used herein can be interpreted as "when” or “when” or "in response to determination”.
  • the blockchain-based traceability storage evidence scenario is one of the most widely used scenarios of blockchain technology today.
  • the blockchain is a multi-node device each has its own data ledger, that is, a piece of evidence data will be copied and stored by the multi-node device.
  • the entire blockchain data will become The multiplier increases, which will take up a lot of storage resources and network overhead.
  • the existing data on the chain is usually deposited on the chain in the form of a data structure.
  • a data structure For example, xml, json and other data structures.
  • the advantage of this data structure is a self-describing structure, which has the advantage of displaying the meaning expressed by the data, but the self-describing structure takes up a lot of storage space.
  • the embodiment of this specification provides a data compression scheme based on the blockchain.
  • the business party compresses the target data to be certified based on the compression template locally, and the node device of the corresponding blockchain is based on the smart contract corresponding to the compression template.
  • Check the compressed data to ensure that the compressed data to be saved meets the requirements of the data format to avoid data abnormalities (such as data garbled and misplaced).
  • data abnormalities such as data garbled and misplaced.
  • this provides a blockchain-based data query solution.
  • the node device of the blockchain When the node device of the blockchain receives the query transaction from the business party, because the data deposited on the blockchain is compressed data, it can be based on intelligence
  • the compression template declared in the contract restores the compressed data to complete data. In this way, it is also based on the compression template of the smart contract, which restores the compressed data of the certificate to the complete data for the business side to ensure the correctness of the data.
  • the blockchain described in this specification can specifically include private chains, shared chains, and alliance chains, etc., which are not particularly limited in this specification.
  • the aforementioned blockchain may specifically be a consortium chain composed of business systems, audit systems, publicity systems, etc. as alliance members; the operator of the consortium chain can rely on the consortium chain to deploy against the aforementioned Data compression storage certificate business; and the business system, audit system, and publicity system described above as alliance members can all be used as a business node of the above data compression storage certificate business.
  • Each business node can publish the compressed data generated or received by itself in the alliance chain in the form of a transaction, and after the transaction is processed by the consensus node in the alliance chain, the distributed in the alliance chain
  • the database is stored, and the above-mentioned logistic inspection results are "on-chain" storage certificate.
  • the transaction described in this specification refers to a piece of data created by the business party through the client of the blockchain and need to be finally released to the distributed database of the blockchain.
  • the transactions in the blockchain usually have a narrow transaction and a broad transaction.
  • a narrow transaction refers to a value transfer issued by a business to the blockchain; for example, in a traditional Bitcoin blockchain network, a transaction can be a transfer initiated by a business party in the blockchain.
  • a transaction refers to a piece of business data with business intentions released by the business direction of the blockchain; for example, the operator can build a consortium chain based on actual business needs, and rely on the consortium chain to deploy some other types that are not related to value transfer Online business (for example, business data storage certificate, business data query, business data processing, etc.), and in this type of alliance chain, the transaction can be a business message or business with business intent issued by the business party in the alliance chain request.
  • the foregoing client may include any type of upper-level application that uses the underlying business data stored in the blockchain as data support to implement specific business functions.
  • Smart contract is a computer protocol designed to spread, verify or execute contracts in an information-based way that can be deployed on the blockchain. The corresponding operations can be implemented by declaring business logic in the smart contract. Smart contracts allow for trusted transactions without a third party. These transactions are traceable and irreversible. Smart contracts can provide better security than traditional contract methods and reduce other transaction costs related to contracts.
  • the program provided in this manual is mainly divided into two parts: data compression and storage certificate and compressed data query.
  • FIG. 1 is a flowchart of a blockchain-based data compression method provided by an embodiment of this specification. The method is applied to a business party and may specifically include the following steps:
  • Step 110 The business party compresses the target data to be certified according to the preset compression template
  • Step 110 Assemble the compressed target data and the unique identifier of the compressed template into a deposit transaction
  • Step 110 Send the deposit certificate transaction to the node device of the blockchain, so that the node device can query the smart contract corresponding to the unique identifier published in the blockchain in response to the deposit transaction, Call the compression template declared in the smart contract to verify the data format of the target data, and if the verification passes, the target data is stored.
  • A1 Assemble the compressed template into a smart contract creation transaction
  • A2 Send the creation transaction to the node device of the blockchain, so that the node device, in response to the creation transaction, invokes the contract audit logic declared in the audit contract published on the blockchain, in the transaction log
  • a voting event is written in the block chain.
  • the audit node of the blockchain monitors the voting event, it submits a voting transaction to the audit contract; the audit contract summarizes the voting transactions to obtain the smart contract Audit results.
  • the business party can create a smart contract for verifying business data, and the smart contract is assembled based on a compressed template.
  • smart contracts need to comply with the specifications of smart contracts. Therefore, for node devices, smart contracts submitted by business parties need to be reviewed. Specifically, the contract audit logic declared in the audit contract published on the blockchain is called, and a voting event is written in the transaction log. After the audit node of the blockchain listens to the voting event, The audit contract submits voting transactions; the audit contract summarizes the voting transactions and obtains the audit result of the smart contract.
  • the creation business party submits a smart contract for data compression verification, and the blockchain can generate a unique identifier corresponding to the smart contract. That is, there is a one-to-one correspondence between the unique identifier and the smart contract.
  • the unique identifier may refer to a hash value obtained by hashing the unique content of the compressed template declared in the smart contract.
  • the hash value is also used as the contract address for storing the smart contract.
  • the business party can receive the unique identifier allocated by the blockchain in addition to successfully publishing the smart contract corresponding to the compressed template.
  • the unique identifier can not only correspond to the smart contract in the blockchain, but also correspond to the local compression template of the business party. That is, there is a one-to-one correspondence between the unique identifier and the compressed template.
  • the step 110 compresses the target data to be certified according to the preset compression template, which may specifically include:
  • the target data is compressed according to the compression template corresponding to the data structure.
  • the business side needs to use the XML compression template to compress the target data
  • the business side needs to use the JSON compression template to compress the target data.
  • the data structure of the target data is composed of a self-describing structure and actual data; wherein, the self-describing structure is used to represent the meaning expressed by the actual data;
  • the compression rule of the self-describing structure is recorded in the compression template
  • the compressing the target data includes:
  • the self-describing structure of the target data is mapped to custom data; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • the characteristic of the XML data structure is to use "/***/" as the self-describing structure, where "***” is the content describing the meaning of the actual data; for example: /username/ZhangSan; it can be determined by /username/ "ZhangSan" expresses the username.
  • JSON data structure is to use "***:” as the self-describing structure, where "***” is the content describing the meaning of actual data; for example: username: ZhangSan; through username: you can determine "ZhangSan” It expresses the username.
  • the mapping relationship between each self-describing structure and custom data can be predefined in the corresponding compression template.
  • the business party can map the self-describing structure of the target data to custom data according to the compression rule; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • the target data /username/ZhangSan
  • the data structure of the target data is an XML data structure
  • the /username/ mapping is "1" defined in the XML compression template
  • the compressed target data will change For: 1ZhangSan. It can be seen that the data volume of the target data before and after compression is greatly reduced.
  • the embodiment of this specification provides a data compression scheme based on the blockchain.
  • the business party compresses the target data to be certified based on the compression template locally, and the node device of the corresponding blockchain is based on the smart contract corresponding to the compression template.
  • Check the compressed data to ensure that the compressed data to be saved meets the requirements of the data format to avoid data abnormalities (such as data garbled and misplaced). In this way, by compressing the template and the format constraints of the smart contract, the data is compressed from the data source to reduce the amount of data.
  • FIG. 2 is a flowchart of a blockchain-based data compression method provided by an embodiment of this specification. The method is applied to a node device of a blockchain and may specifically include the following steps:
  • Step 210 The node device of the blockchain receives the deposit certificate transaction submitted by the business party; wherein, the deposit certificate transaction contains a unique identifier and target data to be deposited, and the target data is corresponding to the unique identifier Compressed data after compression template;
  • Step 220 In response to the deposit transaction, query the smart contract corresponding to the unique identifier published in the blockchain, and call the compression template declared in the smart contract to verify the data format of the target data , If the verification is passed, the target data is stored.
  • This embodiment is different from the embodiment shown in FIG. 1 in the execution subject, and the specific implementation can refer to the description in the embodiment in FIG. 1.
  • the business party can create a smart contract for verifying business data, which is assembled based on a compressed template.
  • smart contracts need to comply with the specifications of smart contracts. Therefore, for node devices, smart contracts submitted by business parties need to be reviewed.
  • the node device of the blockchain receives the creation transaction of the smart contract assembled for the compressed template sent by the business party;
  • the contract audit logic declared in the audit contract published on the blockchain is called, and a voting event is written in the transaction log.
  • the audit node of the blockchain listens to the voting event , Submit voting transactions to the audit contract; the audit contract summarizes the voting transactions to obtain the audit result of the smart contract.
  • the smart contract is created in the blockchain and the unique identifier of the smart contract is returned to the business party. That is, there is a one-to-one correspondence between the unique identifier and the smart contract.
  • the unique identifier may refer to a hash value obtained by hashing the unique content of the compressed template declared in the smart contract.
  • the hash value is also used as the contract address for storing the smart contract.
  • the node device For the target data uploaded by the business party that has been compressed locally based on the compression template, the node device needs to verify the target data. Only when the data format of the target data conforms to the data format specified by the compression template, can the verification be determined to pass, thereby storing the compressed target data.
  • the embodiment of this specification provides a data compression scheme based on the blockchain.
  • the business party compresses the target data to be certified based on the compression template locally, and the node device of the corresponding blockchain is based on the smart contract corresponding to the compression template.
  • Check the compressed data to ensure that the compressed data to be saved meets the requirements of the data format to avoid data abnormalities (such as data garbled and misplaced). In this way, by compressing the template and the format constraints of the smart contract, the data is compressed from the data source to reduce the amount of data.
  • the business party can compress the target data and upload it to the chain for certificate, so that the amount of data for the certificate on the chain will be greatly reduced to reduce the storage resources required for data storage; however, because the data is compressed, it is read After fetching these compressed data, how to restore the compressed data to complete data also needs to be solved.
  • Figure 3 is a flowchart of a blockchain-based data query method provided by an embodiment of this specification. The method is applied to a business party, and the data stored on the blockchain is based on the aforementioned Figure 1
  • the illustrated embodiment performs compressed data after data compression; this embodiment may specifically include the following steps:
  • Step 310 The business policy assembles the data to be queried into the query transaction
  • Step 320 Send the query transaction to the node device of the blockchain, so that the node device queries the compressed data deposited on the blockchain in response to the query transaction; the query is published in the blockchain The smart contract corresponding to the unique identifier, calling the compression template declared in the smart contract to restore the compressed data to complete data;
  • Step 330 Receive complete data returned by the node device.
  • the business party When the business party needs to obtain the target data, it can assemble the query transaction based on the unique identifier corresponding to the data structure to which the target data belongs, that is, the query transaction includes the unique identifier.
  • the node device can first query the compressed data of the target data stored on the blockchain; and query the smart contract corresponding to the unique identifier.
  • the compression template declared in the smart contract needs to be called to restore the compressed data to complete data.
  • the compression rules of the self-describing structure are recorded in the compression template
  • the restoring the compressed data to complete data specifically includes:
  • the custom data in the compressed data is mapped to a self-describing structure; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • the custom data needs to be restored back to the self-describing structure; because the XML compression template declared in the smart contract defines "/username/" and " 1"; therefore, the node device can convert the custom data "1" in the compressed data into a self-describing structure "/username/", that is, the restored complete data is /username/ZhangSan; the query found
  • the meaning of the data ZhangSan is the user name.
  • the embodiment of this specification provides a data query solution based on blockchain.
  • the node device of the blockchain receives the query transaction from the business party, since the data deposited on the blockchain is compressed data, it can be based on The compression template declared in the smart contract restores the compressed data to complete data. In this way, it is also based on the compressed template of the smart contract, which restores the compressed data of the certificate to the complete data for the business side to ensure the correctness of the data.
  • FIG. 4 is a flowchart of a blockchain-based data query method provided by an embodiment of this specification.
  • the method is applied to a node device of a blockchain, and the data stored on the blockchain is
  • the compressed data after data compression is performed based on the embodiment shown in FIG. 1; this embodiment may specifically include the following steps:
  • Step 410 The node device of the blockchain receives the query transaction submitted by the business party; wherein, the query transaction includes a unique identifier;
  • Step 420 In response to the query transaction, query the compressed data deposited on the blockchain;
  • Step 430 Query the smart contract corresponding to the unique identifier published in the blockchain, and call the compression template declared in the smart contract to restore the compressed data to complete data;
  • Step 440 Return the complete data to the business party.
  • This embodiment is different from the embodiment shown in FIG. 3 in the execution subject, and the specific implementation can refer to the description in the embodiment in FIG. 3.
  • the business party can initiate a query transaction to the node device of the blockchain to query the target data stored on the blockchain.
  • the query transaction includes a unique identifier.
  • the node device can first query the compressed data of the target data stored on the blockchain; and query the smart contract corresponding to the unique identifier.
  • the compression template declared in the smart contract needs to be called to restore the compressed data to complete data.
  • the compression rules of the self-describing structure are recorded in the compression template
  • the restoring the compressed data to complete data specifically includes:
  • the custom data in the compressed data is mapped to a self-describing structure; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • the custom data needs to be restored back to the self-describing structure; because the XML compression template declared in the smart contract defines "/username/" and " 1"; therefore, the node device can convert the custom data "1" in the compressed data into a self-describing structure "/username/", that is, the restored complete data is /username/ZhangSan; the query found
  • the meaning of the data ZhangSan is the user name.
  • the embodiment of this specification provides a data query solution based on blockchain.
  • the node device of the blockchain receives the query transaction from the business party, since the data deposited on the blockchain is compressed data, it can be based on The compression template declared in the smart contract restores the compressed data to complete data. In this way, it is also based on the compression template of the smart contract, which restores the compressed data of the certificate to the complete data for the business side to ensure the correctness of the data.
  • this specification also provides an embodiment of the block chain-based reward fund distribution device.
  • the device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer business program instructions in the non-volatile memory into the memory through the processor of the device where it is located. From a hardware perspective, as shown in Figure 5, this manual is a hardware structure diagram of the device where the block chain-based reward fund distribution device is located, except for the processor, network interface, memory and non-volatile memory shown in Figure 5. In addition to the functional memory, the device in the embodiment usually distributes the actual function of the reward funds based on the blockchain, and may also include other hardware, which will not be repeated here.
  • FIG. 6 is a block diagram of a block chain-based data compression device provided by an embodiment of this specification.
  • the device corresponds to the embodiment shown in FIG. 1 and is applied to a business party.
  • the device includes:
  • the compression unit 510 the business party compresses the target data to be certified according to a preset compression template
  • the assembling unit 520 assembles the compressed target data and the unique identifier of the compressed template into a deposit transaction
  • the deposit certificate unit 530 sends the deposit certificate transaction to the node device of the blockchain, so that the node device responds to the deposit transaction and queries the smart device corresponding to the unique identifier published in the blockchain.
  • the contract calls the compression template declared in the smart contract to verify the data format of the target data, and if the verification passes, the target data is stored.
  • the compression unit 510 specifically includes:
  • the compression subunit compresses the target data according to the compression template corresponding to the data structure.
  • the data structure of the target data is composed of a self-describing structure and actual data; wherein, the self-describing structure is used to represent the meaning expressed by the actual data;
  • the compression rule of the self-describing structure is recorded in the compression template
  • compressing the target data includes:
  • the self-describing structure of the target data is mapped to custom data; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • the device further includes:
  • Transaction assembly sub-unit which assembles compressed templates into smart contract creation transactions
  • the contract creation subunit sends the creation transaction to the node device of the blockchain, so that the node device, in response to the creation transaction, calls the contract review logic declared in the review contract published on the blockchain, A voting event is written in the transaction log.
  • the audit node of the blockchain monitors the voting event, it submits a voting transaction to the audit contract; the audit contract summarizes the voting transactions to obtain the The audit result of the smart contract.
  • the contract creation sub-unit further includes:
  • the smart contract is created in the blockchain and the unique identifier of the smart contract is returned to the business party.
  • the unique identifier includes:
  • FIG. 7 is a block diagram of a block chain-based data compression device provided by an embodiment of this specification.
  • the device corresponds to the embodiment shown in FIG. 2 and is applied to a node device of a block chain.
  • the device includes :
  • the receiving unit 610 the node device of the blockchain receives the deposit certificate transaction submitted by the business party; wherein, the deposit certificate transaction includes a unique identifier and target data to be deposited, and the target data is corresponding to the unique identifier
  • the compressed data of the compression template
  • the response unit 620 in response to the deposit certificate transaction, queries the smart contract corresponding to the unique identifier published in the blockchain, and calls the compression template declared in the smart contract to verify the data format of the target data If the verification passes, the target data will be stored.
  • the node device of the blockchain receives the deposit certificate transaction submitted by the business party; wherein, the deposit certificate transaction contains a unique identifier and target data to be deposited, and the target data is compressed by a compression template corresponding to the unique identifier After the data;
  • the device further includes:
  • the receiving subunit receives the creation transaction of the smart contract assembled from the compressed template sent by the business party;
  • the creating sub-unit further includes:
  • the smart contract is created in the blockchain and the unique identifier of the smart contract is returned to the business party.
  • the unique identifier includes:
  • this specification also provides an embodiment of a blockchain-based data query device.
  • the device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer business program instructions in the non-volatile memory into the memory through the processor of the device where it is located. From a hardware perspective, as shown in Figure 8, it is a hardware structure diagram of the device where the blockchain-based data query device is located in this specification, except for the processor, network interface, memory, and non-volatile memory shown in Figure 8. In addition to the memory, the device where the device is located in the embodiment usually queries actual functions based on blockchain-based data, and may also include other hardware, which will not be repeated here.
  • Fig. 9 is a block diagram of a block chain-based data compression device provided by an embodiment of this specification.
  • the device corresponds to the embodiment shown in Fig. 3 and is applied to a business party.
  • the data is compressed data after data compression performed by the aforementioned blockchain-based data compression method; the device includes:
  • the assembling unit 710 the business policy of data to be queried, assembles the unique identifier into a query transaction
  • the query unit 720 sends the query transaction to the node device of the blockchain, so that the node device queries the compressed data stored on the blockchain in response to the query transaction; the query is published on the blockchain
  • the unique identifier corresponding to the smart contract in the above calling the compression template declared in the smart contract to restore the compressed data to complete data;
  • the receiving unit 730 receives the complete data returned by the node device.
  • a compression rule of a self-describing structure is recorded in the compression template
  • restoring the compressed data to complete data specifically includes:
  • the custom data in the compressed data is mapped to a self-describing structure; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • FIG. 10 is a block diagram of a block chain-based data compression device provided by an embodiment of this specification.
  • the device corresponds to the embodiment shown in FIG. 4 and is applied to a node device of a block chain.
  • the data stored on the chain is the compressed data after data compression performed by the aforementioned blockchain-based data compression method; the device includes:
  • the receiving unit 810, the node device of the blockchain receives a query transaction submitted by a business party; wherein the query transaction includes a unique identifier;
  • the query unit 820 in response to the query transaction, queries the compressed data deposited on the blockchain;
  • the decompression unit 830 queries the smart contract corresponding to the unique identifier published in the blockchain, and calls the compression template declared in the smart contract to restore the compressed data to complete data;
  • the returning unit 840 returns the complete data to the business party.
  • a compression rule of a self-describing structure is recorded in the compression template
  • the restoration of the compressed data to complete data in the decompression unit 830 specifically includes:
  • the custom data in the compressed data is mapped to a self-describing structure; wherein the amount of the custom data is smaller than the data amount of the self-describing structure.
  • a typical implementation device is a computer.
  • the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
  • the relevant part can refer to the part of the description of the method embodiment.
  • the device embodiments described above are merely illustrative.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network units.
  • Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement it without creative work.
  • Figure 6 above depicts the internal functional modules and structure of the blockchain-based data compression device.
  • the actual execution subject can be an electronic device, including:
  • a memory for storing processor executable instructions
  • the processor is configured to:
  • the business party compresses the target data to be certified according to the preset compression template
  • Figure 7 above depicts the internal functional modules and structure of the blockchain-based data compression device.
  • the actual execution subject can be an electronic device, including:
  • a memory for storing processor executable instructions
  • the processor is configured to:
  • the node device of the blockchain receives the deposit certificate transaction submitted by the business party; wherein, the deposit certificate transaction contains a unique identifier and target data to be deposited, and the target data is compressed by a compression template corresponding to the unique identifier After the data;
  • the substantial execution body may be an electronic device, including:
  • a memory for storing processor executable instructions
  • the processor is configured to:
  • the business policy is to assemble the unique identifier into a query transaction for the data to be queried; wherein, the data stored on the blockchain is the compressed data after data compression by any of the aforementioned blockchain-based data compression methods;
  • the query transaction is sent to the node device of the blockchain, so that the node device queries the compressed data stored on the blockchain in response to the query transaction; the query is published in the blockchain for the unique Identify the corresponding smart contract, call the compression template declared in the smart contract to restore the compressed data to complete data;
  • Figure 10 above depicts the internal functional modules and structure of the blockchain-based data query device.
  • the actual execution subject can be an electronic device, including:
  • a memory for storing processor executable instructions
  • the processor is configured to:
  • the node device of the block chain receives the query transaction submitted by the business party; wherein the query transaction includes a unique identifier; the data stored on the block chain is any of the foregoing data compression methods based on the block chain. Compressed compressed data
  • the processor may be a central processing unit (English: Central Processing Unit, CPU for short), or other general-purpose processors or digital signal processors (English: Digital Signal Processor) , Abbreviation: DSP), application specific integrated circuit (English: Application Specific Integrated Circuit, abbreviation: ASIC), etc.
  • the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
  • the aforementioned memory can be read-only memory (English: read-only memory, abbreviation: ROM), random access memory (English : Random access memory, referred to as RAM), flash memory, hard disk or solid state disk.
  • the steps of the method disclosed in the embodiments of the present invention may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Development Economics (AREA)
  • Computer Hardware Design (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种基于区块链的数据压缩方法及装置和电子设备,所述方法包括:业务方根据预设的压缩模版,将待存证的目标数据进行压缩(110);将压缩后的目标数据以及所述压缩模版的唯一标识组装为存证交易(120);将所述存证交易发送给区块链的节点设备,以使所述节点设备响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过存证所述目标数据(130)。

Description

基于区块链的数据压缩、查询方法及装置和电子设备 技术领域
本说明书实施例涉及区块链技术领域,尤其涉及一种基于区块链的数据压缩、查询方法及装置和电子设备。
背景技术
区块链技术,也被称之为分布式账本技术,是一种由若干台计算设备共同参与“记账”,共同维护一份完整的分布式数据库的新兴技术。由于区块链技术具有去中心化、公开透明、每台计算设备可以参与数据库记录、并且各计算设备之间可以快速的进行数据同步的特性,使得区块链技术在众多的领域中广泛的进行应用。
发明内容
本说明书实施例提供的一种基于区块链的数据压缩、查询方法及装置和电子设备:
根据本说明书实施例的第一方面,提供一种基于区块链的数据压缩方法,所述方法包括:
业务方根据预设的压缩模版,将待存证的目标数据进行压缩;
将压缩后的目标数据以及所述压缩模版的唯一标识组装为存证交易;
将所述存证交易发送给区块链的节点设备,以使所述节点设备响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过存证所述目标数据。
可选的,所述根据预设的压缩模版,将待存证的目标数据进行压缩,具体包括:
确定待存证的目标数据的数据结构;
根据所述数据结构对应的压缩模版,将所述目标数据进行压缩。
可选的,所述目标数据的数据结构由自描述结构和实际数据构成;其中,所述自描述结构用于表示实际数据所表达的含义;
所述压缩模版中记录了自描述结构的压缩规则;
所述将所述目标数据进行压缩包括:
根据所述压缩规则,将目标数据的自描述结构映射为自定义数据;其中,所述自定义数据量小于自描述结构的数据量。
可选的,所述方法还包括:
将压缩模版组装为智能合约的创建交易;
将所述创建交易发送给区块链的节点设备,以使所述节点设备响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
可选的,所述方法还包括:
如果审核结果为通过,在区块链中创建所述智能合约,并向业务方返回所述智能合约的唯一标识。
可选的,所述唯一标识包括:
针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。
根据本说明书实施例的第二方面,提供一种基于区块链的数据压缩装置,所述装置包括:
区块链的节点设备接收业务方提交的存证交易;其中,所述存证交易中包含有唯一标识、待存证的目标数据,所述目标数据为经过所述唯一标识对应的压缩模版压缩后的数据;
响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过,存证所述目标数据。
可选的,所述方法还包括:
接收业务方发送的针对压缩模版组装而成的智能合约的创建交易;
响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
可选的,所述方法还包括:
如果审核结果为通过,在区块链中创建所述智能合约,并向业务方返回所述智能合约的唯一标识。
可选的,所述唯一标识包括:
针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。
根据本说明书实施例的第三方面,提供一种基于区块链的数据查询装置,所述区块链上存证的数据为基于上述基于区块链的数据压缩方法进行数据压缩后的压缩数据;所述方法包括:
业务方针对待查询的数据,将所述唯一标识组装为查询交易;
将所述查询交易发送给区块链的节点设备,以使所述节点设备响应于所述查询交易,查询区块链上存证的压缩数据;查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
接收所述节点设备返回的完整数据。
可选的,所述压缩模版中记录了自描述结构的压缩规则;
所述将所述压缩数据还原为完整数据,具体包括:
根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
根据本说明书实施例的第四方面,提供一种基于区块链的数据查询装置,所述区块链上存证的数据为基于上述基于区块链的数据压缩方法进行数据压缩后的压缩数据;所述方法包括:
区块链的节点设备接收业务方提交的查询交易;其中,所述查询交易中包含有唯一标识;
响应于所述查询交易,查询区块链上存证的压缩数据;
查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
将所述完整数据返回给所述业务方。
可选的,所述压缩模版中记录了自描述结构的压缩规则;
所述将所述压缩数据还原为完整数据,具体包括:
根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
根据本说明书实施例的第五方面,提供一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为上述任一项基于区块链的数据压缩方法。
根据本说明书实施例的第六方面,提供一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为上述任一项基于区块链的数据查询方法。
本说明书实施例,提供了一种基于区块链的数据压缩方案,业务方在本地基于压缩模板对待存证的目标数据进行压缩,对应的区块链的节点设备基于该压缩模版对应的智能合约对压缩数据进行校验,确保待存证的压缩数据符合数据格式的要求以避免数据异常(如数据乱码、错位)。如此,通过压缩模版与智能合约的格式约束,从数据源头上对数据进行压缩,减少数据量。另一方面,该提供了一种基于区块链的数据查询方案,区块链的节点设备在接收到业务方的查询交易时,由于区块链存证的数据为压缩数据,因此可以基于智能合约中声明的压缩模版将压缩数据还原为完整的数据。如此,同样是基于智能合约的压缩模版,将存证的压缩数据还原为完整数据以提供给业务方,保证数据正确性。
附图说明
图1是本说明书一实施例提供的基于区块链的数据压缩方法的流程图;
图2是本说明书一实施例提供的基于区块链的数据压缩方法的流程图;
图3是本说明书一实施例提供的基于区块链的数据查询方法的流程图;
图4是本说明书一实施例提供的基于区块链的数据查询方法的流程图;
图5是本说明书一实施例提供的基于区块链的数据压缩装置的硬件结构图;
图6是本说明书一实施例提供的基于区块链的数据压缩装置的模块示意图;
图7是本说明书一实施例提供的基于区块链的数据压缩装置的模块示意图;
图8是本说明书一实施例提供的基于区块链的数据查询装置的硬件结构图;
图9是本说明书一实施例提供的基于区块链的数据查询装置的模块示意图;
图10是本说明书一实施例提供的基于区块链的数据查询装置的模块示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书的一些方面相一致的装置和方法的例子。
在本说明书使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书。在本说明书和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本说明书可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
基于区块链的溯源存证场景,是现如今应用区块链技术最为广泛的场景之一。区块链技术的防篡改、可追溯、数据存储公平公正等特点赋能存证溯源数据的公信力,被业界广泛使用。但由于区块链是多节点设备各自拥有自己的数据账本,即一份存证数据会被多节点设备复制存储,随着业务存证数据量的增加,整个区块链上存证数据会成倍数增长,从而会占用大量的存储资源、网络开销。
具体地,现有上链存证的数据通常是以数据结构的形式上链存证的。例如xml,json等数据结构。这种数据结构的优点具有自描述结构,所述自描述结构具有展示数据所表达的意义的优点,但是自描述结构会占用大量的存储空间。
而区块链的存储资源、网络资源并不是无穷无尽的;因此,如何即保证业务需求的实现,又能够节省资源开销成了一个亟待解决的问题。
本说明书实施例,提供了一种基于区块链的数据压缩方案,业务方在本地基于压缩模板对待存证的目标数据进行压缩,对应的区块链的节点设备基于该压缩模版对应的智能合约对压缩数据进行校验,确保待存证的压缩数据符合数据格式的要求以避免数据异常(如数据乱码、错位)。如此,通过压缩模版与智能合约的格式约束,从数据源头上对数据进行压缩,减少数据量。另一方面,该提供了一种基于区块链的数据查询方案,区块链的节点设备在接收到业务方的查询交易时,由于区块链存证的数据为压缩数据,因此可以基于智能合约中声明的压缩模版将压缩数据还原为完整的数据。如此,同样是基于智能合约的压缩模版,将存证的压缩数据还原为完整数据以提供给业务方,保证数据正确性。
在本说明书所描述的区块链,具体可以包括私有链、共有链以及联盟链等,在本说明书中不进行特别限定。
例如,在一个场景中,上述区块链具体可以是由业务***、审核***、公示***等作为联盟成员组成的一个联盟链;该联盟链的运营方可以依托于该联盟链,来部署针对上述数据压缩存证业务;而以上所描述的作为联盟成员的业务***、审核***、公示***都可以作为上述数据压缩存证业务的一个业务节点。各个业务节点可以将自身所产生或者接收到的与上述压缩数据以交易的形式在联盟链中进行发布,并在该交易经过联盟链中的共识节点的共识处理之后,在联盟链中的分布式数据库进行存储,完成上述物流检验结果的“上链”存证。
其中,需要说明的是,在本说明书中所描述的交易(Transaction),是指业务方通过区块链的客户端创建,并需要最终发布至区块链的分布式数据库中的一笔数据。
区块链中的交易,通常存在狭义的交易以及广义的交易之分。狭义的交易是指业务方向区块链发布的一笔价值转移;例如,在传统的比特币区块链网络中,交易可以是业务方在区块链中发起的一笔转账。而广义的交易是指业务方向区块链发布的一笔具有业务意图的业务数据;例如,运营方可以基于实际的业务需求搭建一个联盟链,依托于联盟链部署一些与价值转移无关的其它类型的在线业务(比如,业务数据存证、业务数据查询、业务数据处理等),而在这类联盟链中,交易可以是业务方在联盟链中发布的一笔具有业务意图的业务消息或者业务请求。
上述客户端,可以包括任意类型的以区块链中存储的底层业务数据作为数据支撑,来实现特定的业务功能的上层应用。
智能合约(Smart contract)是一种旨在应用在可以部署在区块链上的以信息化方式传播、验证或执行合同的计算机协议。通过在智能合约中声明业务逻辑可以实现执行相应操作。智能合约允许在没有第三方的情况下进行可信交易。这些交易可追踪且不可逆转。智能合约能够提供优于传统合同方法的安全,并减少与合同相关的其他交易成本。
本说明书提供的方案,主要分为数据压缩并存证以及压缩数据查询两部分。
请参考图1,图1为本说明书一实施例提供的基于区块链的数据压缩方法的流程图,所述方法应用于业务方,具体可以包括以下步骤:
步骤110:业务方根据预设的压缩模版,将待存证的目标数据进行压缩;
步骤110:将压缩后的目标数据以及所述压缩模版的唯一标识组装为存证交易;
步骤110:将所述存证交易发送给区块链的节点设备,以使所述节点设备响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过存证所述目标数据。
值得一提的是,上述区块链中所述唯一标识对应的智能合约是由任一业务方预先发布至区块链中的。具体如下步骤所示:
A1:将压缩模版组装为智能合约的创建交易;
A2:将所述创建交易发送给区块链的节点设备,以使所述节点设备响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
该实施例中,业务方可以创建用于对业务数据进行校验的智能合约,该智能合约是基于压缩模版组装而成的。
一般的,智能合约需要符合智能合约的规范。因此,对于节点设备来说,需要对业务方提交的智能合约进行审核。具体地,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得 出所述智能合约的审核结果。
如果审核结果通过,则创建业务方提交用于进行数据压缩校验的智能合约,并且区块链可以生成该智能合约对应的唯一标识。即,唯一标识与智能合约之间具有一一对应关系。
在一实施例中,所述唯一标识可以是指针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。而所述hash值也作为存放智能合约的合约地址。
所述唯一标识除了采用hash值之外,还可以采用其它任意具有唯一性的标识,例如采用依次增长的ID进行标识。例如,从ID=0开始,每创建一个智能合约,在原有的ID基础上加1作为新创建的智能合约的唯一标识。
如上所述,业务方可以在成功发布压缩模版对应的智能合约之外,可以接收区块链分配的唯一标识。该唯一标识不仅可以对应区块链中的智能合约,也可以对应业务方本地的压缩模版。即,唯一标识与压缩模版之间具有一一对应关系。
在一实施例中,不同压缩模版用于对不同数据结构的业务数据进行压缩。因此,所述步骤110根据预设的压缩模版,将待存证的目标数据进行压缩,具体可以包括:
确定待存证的目标数据的数据结构;
根据所述数据结构对应的压缩模版,将所述目标数据进行压缩。
举例说明,假设目标数据属于XML数据结构,那么业务方需要采用XML的压缩模版对目标数据进行压缩;
如果目标数据属于JSON数据结构,那么业务方需要采用JSON的压缩模版对目标数据进行压缩。
在一实施例中,所述目标数据的数据结构由自描述结构和实际数据构成;其中,所述自描述结构用于表示实际数据所表达的含义;
所述压缩模版中记录了自描述结构的压缩规则;
所述将所述目标数据进行压缩包括:
根据所述压缩规则,将目标数据的自描述结构映射为自定义数据;其中,所述自定义数据量小于自描述结构的数据量。
举例说明,XML数据结构的特征是以“/***/”作为自描述结构,其中“***”是 描述实际数据含义的内容;例如:/username/ZhangSan;通过/username/就可以确定“ZhangSan”表达的是用户名。
类似的,JSON数据结构的特征是以“***:”作为自描述结构,其中“***”是描述实际数据含义的内容;例如:username:ZhangSan;通过username:就可以确定“ZhangSan”表达的是用户名。
不管是哪种数据结构,在对应的压缩模版中可以预先定义每种自描述结构与自定义数据之间的映射关系。从而使得业务方可以根据所述压缩规则,将目标数据的自描述结构映射为自定义数据;其中,所述自定义数据量小于自描述结构的数据量。
举例说明,针对目标数据:/username/ZhangSan;由于该目标数据的数据结构为XML数据结构,假设XML的压缩模版中定义了/username/映射的是“1”;那么压缩后的目标数据就变为:1ZhangSan。可见,压缩前后目标数据的数据量减少了很多。
本说明书实施例,提供了一种基于区块链的数据压缩方案,业务方在本地基于压缩模板对待存证的目标数据进行压缩,对应的区块链的节点设备基于该压缩模版对应的智能合约对压缩数据进行校验,确保待存证的压缩数据符合数据格式的要求以避免数据异常(如数据乱码、错位)。如此,通过压缩模版与智能合约的格式约束,从数据源头上对数据进行压缩,减少数据量。
请参考图2,图2为本说明书一实施例提供的基于区块链的数据压缩方法的流程图,所述方法应用于区块链的节点设备,具体可以包括以下步骤:
步骤210:区块链的节点设备接收业务方提交的存证交易;其中,所述存证交易中包含有唯一标识、待存证的目标数据,所述目标数据为经过所述唯一标识对应的压缩模版压缩后的数据;
步骤220:响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过,存证所述目标数据。
该实施例中与前述图1所示实施例是执行主体不同,具体实现可以参考图1实施例中的描述。
业务方可以创建用于对业务数据进行校验的智能合约,该智能合约是基于压缩模版组装而成的。
一般的,智能合约需要符合智能合约的规范。因此,对于节点设备来说,需要对业务方提交的智能合约进行审核。
在一实施例中,区块链的节点设备接收业务方发送的针对压缩模版组装而成的智能合约的创建交易;
响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
如果审核结果为通过,在区块链中创建所述智能合约,并向业务方返回所述智能合约的唯一标识。即,唯一标识与智能合约之间具有一一对应关系。
在一实施例中,所述唯一标识可以是指针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。而所述hash值也作为存放智能合约的合约地址。
所述唯一标识除了采用hash值之外,还可以采用其它任意具有唯一性的标识,例如采用依次增长的ID进行标识。例如,从ID=0开始,每创建一个智能合约,在原有的ID基础上加1作为新创建的智能合约的唯一标识。
针对业务方上传的已在业务方本地基于压缩模版压缩后的目标数据,节点设备需要对该目标数据进行校验。只有在目标数据的数据格式符合压缩模版规定的数据格式时,才可以确定校验通过,从而存证所述压缩后的目标数据。
本说明书实施例,提供了一种基于区块链的数据压缩方案,业务方在本地基于压缩模板对待存证的目标数据进行压缩,对应的区块链的节点设备基于该压缩模版对应的智能合约对压缩数据进行校验,确保待存证的压缩数据符合数据格式的要求以避免数据异常(如数据乱码、错位)。如此,通过压缩模版与智能合约的格式约束,从数据源头上对数据进行压缩,减少数据量。
如前所述,业务方可以将目标数据压缩后上链存证,这样上链存证的数据量会大大减少,以降低数据存证所需的存储资源;然而由于数据经过了压缩,在读取这些压缩数据后,如何将压缩数据还原为完整数据也需要解决。
请参考图3,图3为本说明书一实施例提供的基于区块链的数据查询方法的流程图,所述方法应用于业务方,所述区块链上存证的数据为基于前述图1所示实施例进行数据压缩后的压缩数据;本实施例具体可以包括以下步骤:
步骤310:业务方针对待查询的数据,将所述唯一标识组装为查询交易;
步骤320:将所述查询交易发送给区块链的节点设备,以使所述节点设备响应于所述查询交易,查询区块链上存证的压缩数据;查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
步骤330:接收所述节点设备返回的完整数据。
业务方在需要获取目标数据时,可以基于目标数据所属数据结构对应的唯一标识组装为查询交易,即查询交易中包含有唯一标识。
节点设备响应所述查询交易,首先可以查询目标数据存证在区块链上的压缩数据;以及,查询所述唯一标识对应的智能合约。
这里查询压缩数据和智能合约的执行没有绝对的时序顺序,可以是同时执行,也可以先执行压缩数据,也可以是先执行查询智能合约。
在查询到智能合约以及压缩数据之后,需要调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据。
在一实施例中,所述压缩模版中记录了自描述结构的压缩规则;
所述将所述压缩数据还原为完整数据,具体包括:
根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
继续沿用前述示例:针对目标数据:/username/ZhangSan;由于该目标数据的数据结构为XML数据结构,假设XML的压缩模版中定义了/username/映射的是“1”;那么压缩后的目标数据就变为:1ZhangSan;
如果业务方需要获取该目标数据,由于区块链中存证的是1ZhangSan;需要将自定义数据还原回自描述结构;由于智能合约中声明的XML压缩模版中定义了“/username/”与“1”之间的映射关系;因此,节点设备可以将压缩数据中的自定义数据“1”转换为自描述结构“/username/”,即还原的完整数据为/username/ZhangSan;该查询到的数据ZhangSan的含义为用户名。
本说明书实施例,该提供了一种基于区块链的数据查询方案,区块链的节点设备在接收到业务方的查询交易时,由于区块链存证的数据为压缩数据,因此可以基于智能合约中声明的压缩模版将压缩数据还原为完整的数据。如此,同样是基于智能合约的压 缩模版,将存证的压缩数据还原为完整数据以提供给业务方,保证数据正确性。
请参考图4,图4为本说明书一实施例提供的基于区块链的数据查询方法的流程图,所述方法应用于区块链的节点设备,所述区块链上存证的数据为基于前述图1所示实施例进行数据压缩后的压缩数据;本实施例具体可以包括以下步骤:
步骤410:区块链的节点设备接收业务方提交的查询交易;其中,所述查询交易中包含有唯一标识;
步骤420:响应于所述查询交易,查询区块链上存证的压缩数据;
步骤430:查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
步骤440:将所述完整数据返回给所述业务方。
该实施例中与前述图3所示实施例是执行主体不同,具体实现可以参考图3实施例中的描述。
业务方可以向区块链的节点设备发起查询交易,以查询存证在区块链上的目标数据。其中,所述查询交易中包含有唯一标识。
节点设备响应所述查询交易,首先可以查询目标数据存证在区块链上的压缩数据;以及,查询所述唯一标识对应的智能合约。
这里查询压缩数据和智能合约的执行没有绝对的时序顺序,可以是同时执行,也可以先执行压缩数据,也可以是先执行查询智能合约。
在查询到智能合约以及压缩数据之后,需要调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据。
在一实施例中,所述压缩模版中记录了自描述结构的压缩规则;
所述将所述压缩数据还原为完整数据,具体包括:
根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
继续沿用前述示例:针对目标数据:/username/ZhangSan;由于该目标数据的数据结构为XML数据结构,假设XML的压缩模版中定义了/username/映射的是“1”;那么压缩后的目标数据就变为:1ZhangSan;
如果业务方需要获取该目标数据,由于区块链中存证的是1ZhangSan;需要将自定义数据还原回自描述结构;由于智能合约中声明的XML压缩模版中定义了“/username/”与“1”之间的映射关系;因此,节点设备可以将压缩数据中的自定义数据“1”转换为自描述结构“/username/”,即还原的完整数据为/username/ZhangSan;该查询到的数据ZhangSan的含义为用户名。
本说明书实施例,该提供了一种基于区块链的数据查询方案,区块链的节点设备在接收到业务方的查询交易时,由于区块链存证的数据为压缩数据,因此可以基于智能合约中声明的压缩模版将压缩数据还原为完整的数据。如此,同样是基于智能合约的压缩模版,将存证的压缩数据还原为完整数据以提供给业务方,保证数据正确性。
与前述基于区块链的奖励资金分配方法实施例相对应,本说明书还提供了基于区块链的奖励资金分配装置的实施例。所述装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的处理器将非易失性存储器中对应的计算机业务程序指令读取到内存中运行形成的。从硬件层面而言,如图5所示,为本说明书基于区块链的奖励资金分配装置所在设备的一种硬件结构图,除了图5所示的处理器、网络接口、内存以及非易失性存储器之外,实施例中装置所在的设备通常根据基于区块链的奖励资金分配实际功能,还可以包括其他硬件,对此不再赘述。
请参见图6,为本说明书一实施例提供的基于区块链的数据压缩装置的模块图,所述装置对应了图1所示实施例,应用于业务方,所述装置包括:
压缩单元510,业务方根据预设的压缩模版,将待存证的目标数据进行压缩;
组装单元520,将压缩后的目标数据以及所述压缩模版的唯一标识组装为存证交易;
存证单元530,将所述存证交易发送给区块链的节点设备,以使所述节点设备响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过存证所述目标数据。
可选的,所述压缩单元510,具体包括:
确定子单元,确定待存证的目标数据的数据结构;
压缩子单元,根据所述数据结构对应的压缩模版,将所述目标数据进行压缩。
可选的,所述目标数据的数据结构由自描述结构和实际数据构成;其中,所述自描述结构用于表示实际数据所表达的含义;
所述压缩模版中记录了自描述结构的压缩规则;
所述压缩子单元中,将所述目标数据进行压缩包括:
根据所述压缩规则,将目标数据的自描述结构映射为自定义数据;其中,所述自定义数据量小于自描述结构的数据量。
可选的,所述装置还包括:
交易组装子单元,将压缩模版组装为智能合约的创建交易;
合约创建子单元,将所述创建交易发送给区块链的节点设备,以使所述节点设备响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
可选的,所述合约创建子单元还包括:
如果审核结果为通过,在区块链中创建所述智能合约,并向业务方返回所述智能合约的唯一标识。
可选的,所述唯一标识包括:
针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。
请参见图7,为本说明书一实施例提供的基于区块链的数据压缩装置的模块图,所述装置对应了图2所示实施例,应用于区块链的节点设备,所述装置包括:
接收单元610,区块链的节点设备接收业务方提交的存证交易;其中,所述存证交易中包含有唯一标识、待存证的目标数据,所述目标数据为经过所述唯一标识对应的压缩模版压缩后的数据;
响应单元620,响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过,存证所述目标数据。
区块链的节点设备接收业务方提交的存证交易;其中,所述存证交易中包含有唯 一标识、待存证的目标数据,所述目标数据为经过所述唯一标识对应的压缩模版压缩后的数据;
响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过,存证所述目标数据。
可选的,所述装置还包括:
接收子单元,接收业务方发送的针对压缩模版组装而成的智能合约的创建交易;
创建子单元,响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
可选的,所述创建子单元,还包括:
如果审核结果为通过,在区块链中创建所述智能合约,并向业务方返回所述智能合约的唯一标识。
可选的,所述唯一标识包括:
针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。
与前述基于区块链的数据查询方法实施例相对应,本说明书还提供了基于区块链的数据查询装置的实施例。所述装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的处理器将非易失性存储器中对应的计算机业务程序指令读取到内存中运行形成的。从硬件层面而言,如图8所示,为本说明书基于区块链的数据查询装置所在设备的一种硬件结构图,除了图8所示的处理器、网络接口、内存以及非易失性存储器之外,实施例中装置所在的设备通常根据基于区块链的数据查询实际功能,还可以包括其他硬件,对此不再赘述。
请参见图9,为本说明书一实施例提供的基于区块链的数据压缩装置的模块图,所述装置对应了图3所示实施例,应用于业务方,所述区块链上存证的数据为前述基于区块链的数据压缩方法进行数据压缩后的压缩数据;所述装置包括:
组装单元710,业务方针对待查询的数据,将所述唯一标识组装为查询交易;
查询单元720,将所述查询交易发送给区块链的节点设备,以使所述节点设备响应于所述查询交易,查询区块链上存证的压缩数据;查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
接收单元730,接收所述节点设备返回的完整数据。
可选的,所述压缩模版中记录了自描述结构的压缩规则;
所述查询单元720中,将所述压缩数据还原为完整数据,具体包括:
根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
请参见图10,为本说明书一实施例提供的基于区块链的数据压缩装置的模块图,所述装置对应了图4所示实施例,应用于区块链的节点设备,所述区块链上存证的数据为前述基于区块链的数据压缩方法进行数据压缩后的压缩数据;所述装置包括:
接收单元810,区块链的节点设备接收业务方提交的查询交易;其中,所述查询交易中包含有唯一标识;
查询单元820,响应于所述查询交易,查询区块链上存证的压缩数据;
解压单元830,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
返回单元840,将所述完整数据返回给所述业务方。
可选的,所述压缩模版中记录了自描述结构的压缩规则;
所述解压单元830中将所述压缩数据还原为完整数据,具体包括:
根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
上述实施例阐明的***、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
以上图6描述了基于区块链的数据压缩装置的内部功能模块和结构示意,其实质上的执行主体可以为一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为:
业务方根据预设的压缩模版,将待存证的目标数据进行压缩;
将压缩后的目标数据以及所述压缩模版的唯一标识组装为存证交易;
将所述存证交易发送给区块链的节点设备,以使所述节点设备响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过存证所述目标数据。
以上图7描述了基于区块链的数据压缩装置的内部功能模块和结构示意,其实质上的执行主体可以为一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为:
区块链的节点设备接收业务方提交的存证交易;其中,所述存证交易中包含有唯一标识、待存证的目标数据,所述目标数据为经过所述唯一标识对应的压缩模版压缩后的数据;
响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约, 调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过,存证所述目标数据。
以上图9描述了基于区块链的数据查询装置的内部功能模块和结构示意,其实质上的执行主体可以为一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为:
业务方针对待查询的数据,将所述唯一标识组装为查询交易;其中,所述区块链上存证的数据为前述任一基于区块链的数据压缩方法进行数据压缩后的压缩数据;
将所述查询交易发送给区块链的节点设备,以使所述节点设备响应于所述查询交易,查询区块链上存证的压缩数据;查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
接收所述节点设备返回的完整数据。
以上图10描述了基于区块链的数据查询装置的内部功能模块和结构示意,其实质上的执行主体可以为一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为:
区块链的节点设备接收业务方提交的查询交易;其中,所述查询交易中包含有唯一标识;所述区块链上存证的数据为前述任一基于区块链的数据压缩方法进行数据压缩后的压缩数据
响应于所述查询交易,查询区块链上存证的压缩数据;
查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
将所述完整数据返回给所述业务方。
在上述电子设备的实施例中,应理解,该处理器可以是中央处理单元(英文:Central Processing Unit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文: Digital Signal Processor,简称:DSP)、专用集成电路(英文:Application Specific Integrated Circuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,而前述的存储器可以是只读存储器(英文:read-only memory,缩写:ROM)、随机存取存储器(英文:random access memory,简称:RAM)、快闪存储器、硬盘或者固态硬盘。结合本发明实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于电子设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本说明书的其它实施方案。本说明书旨在涵盖本说明书的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本说明书的一般性原理并包括本说明书未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本说明书的真正范围和精神由下面的权利要求指出。
应当理解的是,本说明书并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本说明书的范围仅由所附的权利要求来限制。

Claims (19)

  1. 一种基于区块链的数据压缩方法,所述方法包括:
    业务方根据预设的压缩模版,将待存证的目标数据进行压缩;
    将压缩后的目标数据以及所述压缩模版的唯一标识组装为存证交易;
    将所述存证交易发送给区块链的节点设备,以使所述节点设备响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过存证所述目标数据。
  2. 根据权利要求1所述的方法,所述根据预设的压缩模版,将待存证的目标数据进行压缩,具体包括:
    确定待存证的目标数据的数据结构;
    根据所述数据结构对应的压缩模版,将所述目标数据进行压缩。
  3. 根据权利要求2所述的方法,所述目标数据的数据结构由自描述结构和实际数据构成;其中,所述自描述结构用于表示实际数据所表达的含义;
    所述压缩模版中记录了自描述结构的压缩规则;
    所述将所述目标数据进行压缩包括:
    根据所述压缩规则,将目标数据的自描述结构映射为自定义数据;其中,所述自定义数据量小于自描述结构的数据量。
  4. 根据权利要求1所述的方法,所述方法还包括:
    将压缩模版组装为智能合约的创建交易;
    将所述创建交易发送给区块链的节点设备,以使所述节点设备响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
  5. 根据权利要求4所述的方法,所述方法还包括:
    如果审核结果为通过,在区块链中创建所述智能合约,并向业务方返回所述智能合约的唯一标识。
  6. 根据权利要求5所述的方法,所述唯一标识包括:
    针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。
  7. 一种基于区块链的数据压缩方法,所述方法包括:
    区块链的节点设备接收业务方提交的存证交易;其中,所述存证交易中包含有唯一标识、待存证的目标数据,所述目标数据为经过所述唯一标识对应的压缩模版压缩后的 数据;
    响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过,存证所述目标数据。
  8. 根据权利要求7所述的方法,所述方法还包括:
    接收业务方发送的针对压缩模版组装而成的智能合约的创建交易;
    响应于所述创建交易,调用发布于所述区块链的审核合约中声明的合约审核逻辑,在交易日志中写入一个投票事件,所述区块链的审核节点监听到所述投票事件后,向所述审核合约提交投票交易;所述审核合约对投票交易进行汇总整理,得出所述智能合约的审核结果。
  9. 根据权利要求8所述的方法,所述方法还包括:
    如果审核结果为通过,在区块链中创建所述智能合约,并向业务方返回所述智能合约的唯一标识。
  10. 根据权利要求9所述的方法,所述唯一标识包括:
    针对所述智能合约中声明的压缩模版的唯一内容进行hash计算得到的hash值。
  11. 一种基于区块链的数据查询方法,所述区块链上存证的数据为基于权利要求1所述方法进行数据压缩后的压缩数据;所述方法包括:
    业务方针对待查询的数据,将所述唯一标识组装为查询交易;
    将所述查询交易发送给区块链的节点设备,以使所述节点设备响应于所述查询交易,查询区块链上存证的压缩数据;查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
    接收所述节点设备返回的完整数据。
  12. 根据权利要求11所述的方法,所述压缩模版中记录了自描述结构的压缩规则;
    所述将所述压缩数据还原为完整数据,具体包括:
    根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
  13. 一种基于区块链的数据查询方法,所述区块链上存证的数据为基于权利要求9所述方法进行数据压缩后的压缩数据;所述方法包括:
    区块链的节点设备接收业务方提交的查询交易;其中,所述查询交易中包含有唯一标识;
    响应于所述查询交易,查询区块链上存证的压缩数据;
    查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
    将所述完整数据返回给所述业务方。
  14. 根据权利要求13所述的方法,所述压缩模版中记录了自描述结构的压缩规则;
    所述将所述压缩数据还原为完整数据,具体包括:
    根据所述压缩规则,将压缩数据中的自定义数据映射为自描述结构;其中,所述自定义数据量小于自描述结构的数据量。
  15. 一种基于区块链的数据压缩装置,所述装置包括:
    压缩单元,业务方根据预设的压缩模版,将待存证的目标数据进行压缩;
    组装单元,将压缩后的目标数据以及所述压缩模版的唯一标识组装为存证交易;
    响应单元,将所述存证交易发送给区块链的节点设备,以使所述节点设备响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过存证所述目标数据。
  16. 一种基于区块链的数据压缩装置,所述装置包括:
    接收单元,区块链的节点设备接收业务方提交的存证交易;其中,所述存证交易中包含有唯一标识、待存证的目标数据,所述目标数据为经过所述唯一标识对应的压缩模版压缩后的数据;
    响应单元,响应于所述存证交易,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版对所述目标数据的数据格式进行校验,如果校验通过,存证所述目标数据。
  17. 一种基于区块链的数据查询装置,所述区块链上存证的数据为基于权利要求1所述方法进行数据压缩后的压缩数据;所述装置包括:
    组装单元,业务方针对待查询的数据,将所述唯一标识组装为查询交易;
    查询单元,将所述查询交易发送给区块链的节点设备,以使所述节点设备响应于所述查询交易,查询区块链上存证的压缩数据;查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
    接收单元,接收所述节点设备返回的完整数据。
  18. 一种基于区块链的数据查询装置,所述区块链上存证的数据为基于权利要求7所述方法进行数据压缩后的压缩数据;所述装置包括:
    接收单元,区块链的节点设备接收业务方提交的查询交易;其中,所述查询交易中 包含有唯一标识;
    查询单元,响应于所述查询交易,查询区块链上存证的压缩数据;
    解压单元,查询发布于所述区块链中所述唯一标识对应的智能合约,调用所述智能合约中声明的压缩模版将所述压缩数据还原为完整数据;
    返回单元,将所述完整数据返回给所述业务方。
  19. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为上述权利要求1-14中任一项所述的方法。
PCT/CN2020/072133 2019-04-30 2020-01-15 基于区块链的数据压缩、查询方法及装置和电子设备 WO2020220764A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/786,794 US10795882B2 (en) 2019-04-30 2020-02-10 Blockchain-based data compression and searching

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910363442.5 2019-04-30
CN201910363442.5A CN110163755B (zh) 2019-04-30 2019-04-30 基于区块链的数据压缩、查询方法及装置和电子设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/786,794 Continuation US10795882B2 (en) 2019-04-30 2020-02-10 Blockchain-based data compression and searching

Publications (1)

Publication Number Publication Date
WO2020220764A1 true WO2020220764A1 (zh) 2020-11-05

Family

ID=67633304

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/072133 WO2020220764A1 (zh) 2019-04-30 2020-01-15 基于区块链的数据压缩、查询方法及装置和电子设备

Country Status (3)

Country Link
CN (2) CN110163755B (zh)
TW (1) TWI726573B (zh)
WO (1) WO2020220764A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10795882B2 (en) 2019-04-30 2020-10-06 Alibaba Group Holding Limited Blockchain-based data compression and searching
CN110163755B (zh) * 2019-04-30 2020-11-24 创新先进技术有限公司 基于区块链的数据压缩、查询方法及装置和电子设备
CN110928534B (zh) * 2019-10-14 2021-11-09 上海唯链信息科技有限公司 一种基于区块链的工作流节点认证方法及装置
CN111260469A (zh) * 2020-01-10 2020-06-09 杭州溪塔科技有限公司 基于区块链的存证方法、查询方法及相应装置和电子设备
CN111262876B (zh) * 2020-01-22 2022-05-27 腾讯科技(深圳)有限公司 基于区块链的数据处理方法、装置、设备以及存储介质
US11263206B1 (en) * 2021-03-02 2022-03-01 Coupang Corp. Systems and methods for multi-nodal stream processing framework for partitioned database
CN113242044B (zh) * 2021-06-02 2022-10-14 湖北央中巨石信息技术有限公司 一种减少内存占用的区块链数据存储压缩方法
CN113468583A (zh) * 2021-07-26 2021-10-01 华链时代(北京)科技有限公司 一种基于区块链的加密数据处理方法、装置及电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107944868A (zh) * 2017-12-07 2018-04-20 杭州趣链科技有限公司 一种基于区块链智能合约的电子存证***和管理方法
CN108563796A (zh) * 2018-05-04 2018-09-21 蔷薇信息技术有限公司 区块链的数据压缩处理方法、装置及电子设备
US10181948B1 (en) * 2018-01-25 2019-01-15 Fortress Cyber Security, LLC Secure storage of hashes within a distributed ledger
CN109274377A (zh) * 2018-08-22 2019-01-25 泰康保险集团股份有限公司 区块链网络的数据处理方法、装置、介质及电子设备
CN109615383A (zh) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 基于区块链的数据存证、获取方法和装置
CN110163755A (zh) * 2019-04-30 2019-08-23 阿里巴巴集团控股有限公司 基于区块链的数据压缩、查询方法及装置和电子设备

Family Cites Families (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100452071C (zh) * 1995-02-13 2009-01-14 英特特拉斯特技术公司 用于安全交易管理和电子权利保护的***和方法
US20030037237A1 (en) * 2001-04-09 2003-02-20 Jean-Paul Abgrall Systems and methods for computer device authentication
CN103595559A (zh) * 2013-11-05 2014-02-19 深圳市远行科技有限公司 一种大数据的传输***、传输方法及其业务***
US9736081B2 (en) * 2015-06-04 2017-08-15 At&T Intellectual Property I, L.P. Apparatus and method to improve compression and storage data
GB2604540B (en) * 2016-02-03 2023-01-11 Luther Systems System and method for secure management of digital contracts
US20180284755A1 (en) * 2016-05-09 2018-10-04 StrongForce IoT Portfolio 2016, LLC Methods and systems for data storage in an industrial internet of things data collection environment with large data sets
US20180039422A1 (en) * 2016-08-05 2018-02-08 Alibaba Group Holding Limited Solid state storage capacity management systems and methods
US20180046992A1 (en) * 2016-08-10 2018-02-15 Jpmorgan Chase Bank, N.A. Systems and methods for account reconciliation using a distributed ledger
CN106326641A (zh) * 2016-08-13 2017-01-11 深圳市樊溪电子有限公司 基于压缩感知和稀疏重构算法的区块链***数据处理方法
US10681133B2 (en) * 2016-09-19 2020-06-09 Tego, Inc. Methods and systems for endpoint device operating system in an asset intelligence platform
WO2018089447A1 (en) * 2016-11-10 2018-05-17 EyeVerify Inc. Verified and private portable identity
DE112017006701T5 (de) * 2016-12-30 2019-09-19 Intel Corporation Internet der Dinge
CN107728941B (zh) * 2017-09-28 2019-09-24 中国银行股份有限公司 一种区块链数据压缩方法及***
CN108156173A (zh) * 2018-01-09 2018-06-12 江苏徐工信息技术股份有限公司 一种json数据包的动态无损压缩方法
CN108256354B (zh) * 2018-01-29 2022-02-22 张天 一种基于试验数据的存储方法及存储介质
CN108446991A (zh) * 2018-04-02 2018-08-24 深圳市亚来科技有限公司 基于区块链的车辆事故处理方法及***
CN109067541B (zh) * 2018-06-29 2020-09-22 阿里巴巴集团控股有限公司 基于区块链的数据验证方法及装置、电子设备
CN109173261A (zh) * 2018-08-08 2019-01-11 平安科技(深圳)有限公司 网络游戏资产数据修改方法、装置及电子设备
CN109615517A (zh) * 2018-12-07 2019-04-12 北京瑞卓喜投科技发展有限公司 一种智能合约执行方法及智能合约执行***

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107944868A (zh) * 2017-12-07 2018-04-20 杭州趣链科技有限公司 一种基于区块链智能合约的电子存证***和管理方法
US10181948B1 (en) * 2018-01-25 2019-01-15 Fortress Cyber Security, LLC Secure storage of hashes within a distributed ledger
CN108563796A (zh) * 2018-05-04 2018-09-21 蔷薇信息技术有限公司 区块链的数据压缩处理方法、装置及电子设备
CN109274377A (zh) * 2018-08-22 2019-01-25 泰康保险集团股份有限公司 区块链网络的数据处理方法、装置、介质及电子设备
CN109615383A (zh) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 基于区块链的数据存证、获取方法和装置
CN110163755A (zh) * 2019-04-30 2019-08-23 阿里巴巴集团控股有限公司 基于区块链的数据压缩、查询方法及装置和电子设备

Also Published As

Publication number Publication date
CN110163755A (zh) 2019-08-23
CN110163755B (zh) 2020-11-24
CN112750037A (zh) 2021-05-04
TW202042218A (zh) 2020-11-16
TWI726573B (zh) 2021-05-01

Similar Documents

Publication Publication Date Title
WO2020220764A1 (zh) 基于区块链的数据压缩、查询方法及装置和电子设备
US11243945B2 (en) Distributed database having blockchain attributes
TWI737944B (zh) 基於區塊鏈的交易執行方法及裝置、電子設備
US11494344B2 (en) Customized endorsement logic for blockchain
US11895223B2 (en) Cross-chain validation
US11663197B2 (en) Convolutional and ephemeral datachains with conditional period
TWI719797B (zh) 區塊鏈中智能合約的儲存、執行方法及裝置和電子設備
US10795882B2 (en) Blockchain-based data compression and searching
US20200110824A1 (en) Blockchain notification board storing blockchain resources
US11195180B2 (en) Virtual blockchain
US20220382746A1 (en) Blockchain notification board storing blockchain resources
US11048689B2 (en) Consensus transaction scheduler
WO2020155811A1 (zh) 区块链的智能合约执行方法及装置和电子设备
US11720545B2 (en) Optimization of chaincode statements
TWI714308B (zh) 基於區塊鏈的***真偽驗證方法及裝置和電子設備
EP3864816A1 (en) Blockchain notification board storing blockchain resources
TWI734217B (zh) 基於區塊鏈的***沖紅方法及裝置和電子設備
TWI706362B (zh) 基於區塊鏈的資料處理方法、裝置和伺服器
US11048593B2 (en) Data aggregation node for blockchain rollup
US11070563B2 (en) Trace-based transaction validation and commitment
US20200092361A1 (en) Sparse peer with transient participation
US20200202355A1 (en) Storage and execution of smart contracts in blockchains
US11245756B2 (en) Sparse peer with transient participation
US11348101B2 (en) Post-settlement processes
CN117422396A (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: 20799027

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20799027

Country of ref document: EP

Kind code of ref document: A1