TWI797738B - Data acquisition method, device, equipment and medium - Google Patents

Data acquisition method, device, equipment and medium Download PDF

Info

Publication number
TWI797738B
TWI797738B TW110132686A TW110132686A TWI797738B TW I797738 B TWI797738 B TW I797738B TW 110132686 A TW110132686 A TW 110132686A TW 110132686 A TW110132686 A TW 110132686A TW I797738 B TWI797738 B TW I797738B
Authority
TW
Taiwan
Prior art keywords
data
data query
chain
query
query request
Prior art date
Application number
TW110132686A
Other languages
Chinese (zh)
Other versions
TW202211047A (en
Inventor
何朔
許玉壯
周鈺
楊潔
Original Assignee
大陸商中國銀聯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商中國銀聯股份有限公司 filed Critical 大陸商中國銀聯股份有限公司
Publication of TW202211047A publication Critical patent/TW202211047A/en
Application granted granted Critical
Publication of TWI797738B publication Critical patent/TWI797738B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Economics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Mathematical Physics (AREA)
  • Fuzzy Systems (AREA)
  • Development Economics (AREA)
  • Computational Linguistics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Container Filling Or Packaging Operations (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

本發明公開了一種資料獲取方法、裝置、設備和介質。該方法包括:區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,資料查詢請求攜帶有資料查詢資訊;區塊鏈節點直接向與資料查詢資訊關聯的鏈外資料來源發送資料查詢請求;鏈外資料來源接收區塊鏈節點發送的資料查詢請求,鏈外資料來源基於資料查詢請求,得到資料查詢結果;鏈外資料來源向區塊鏈節點發送資料查詢結果;區塊鏈節點接收鏈外資料來源發送的資料查詢結果。根據本發明實施例,降低了區塊鏈節點訪問鏈外資料的複雜性。 The invention discloses a data acquisition method, device, equipment and medium. The method includes: the blockchain node queries information based on the obtained data, constructs a data query request through a smart contract, and the data query request carries data query information; the blockchain node directly sends data to an off-chain data source associated with the data query information Query request; the data source outside the chain receives the data query request sent by the blockchain node, and the data source outside the chain obtains the data query result based on the data query request; the data source outside the chain sends the data query result to the blockchain node; the blockchain node Receive data query results sent by off-chain data sources. According to the embodiment of the present invention, the complexity of blockchain nodes accessing data outside the chain is reduced.

Description

資料獲取方法、裝置、設備和介質 Data acquisition method, device, equipment and medium

本發明涉及資料業務領域,尤其涉及一種資料獲取方法、裝置、設備和介質。 The present invention relates to the field of data business, in particular to a data acquisition method, device, equipment and medium.

區塊鏈技術(也被稱之為,分散式帳本技術)是一種去中心化的分散式資料庫技術,具有去中心化、公開透明、不可篡改、可信任等多種特點,適用於諸多對資料可靠性具有高需求的應用場景中。 Blockchain technology (also known as distributed ledger technology) is a decentralized distributed database technology, which has many characteristics such as decentralization, openness, transparency, non-tampering, and trustworthiness, and is suitable for many In application scenarios with high demand for data reliability.

在一些應用場景下,區塊鏈節點需要訪問鏈外資料。目前,區塊鏈節點若想要訪問鏈外資料,需要在鏈外單獨部署預言機用戶端或者預言機網路,複雜度較高。 In some application scenarios, blockchain nodes need to access data outside the chain. At present, if a blockchain node wants to access data outside the chain, it needs to deploy an oracle client or an oracle network separately outside the chain, which is highly complex.

本發明提供一種資料獲取方法、裝置、設備和介質,能夠解決區塊鏈節點想要訪問鏈外資料時複雜度較高的問題。 The present invention provides a data acquisition method, device, equipment and medium, which can solve the problem of high complexity when blockchain nodes want to access data outside the chain.

第一方面,本發明提供一種資料獲取方法,方法包括: In a first aspect, the present invention provides a data acquisition method, the method comprising:

基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,資料查詢請求攜帶有資料查詢資訊; Based on the obtained data query information, a data query request is constructed through a smart contract, and the data query request carries data query information;

直接向與資料查詢資訊關聯的鏈外資料來源發送資料查詢請求,以使鏈外資料來源基於資料查詢請求得到資料查詢結果; Send a data query request directly to the off-chain data source associated with the data query information, so that the off-chain data source can obtain the data query result based on the data query request;

接收鏈外資料來源發送的資料查詢結果。 Receive data query results sent by off-chain data sources.

第二方面,本發明提供了一種資料獲取裝置,裝置包括: In a second aspect, the present invention provides a data acquisition device, which includes:

接收區塊鏈節點發送的資料查詢請求,資料查詢請求是區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建的,資料查詢請求攜帶有資料查詢資訊; Receive the data query request sent by the blockchain node. The data query request is based on the obtained data query information of the blockchain node, and is constructed through a smart contract. The data query request carries the data query information;

基於資料查詢請求,得到資料查詢結果; Based on the data query request, obtain the data query result;

向區塊鏈節點發送資料查詢結果。 Send data query results to blockchain nodes.

第三方面,本發明提供了一種資料獲取裝置,應用于區塊鏈節點,包括: In a third aspect, the present invention provides a data acquisition device, which is applied to blockchain nodes, including:

資料查詢請求構建模組,用於基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,資料查詢請求攜帶有資料查詢資訊; The data query request building module is used to query information based on the obtained data, and construct a data query request through a smart contract. The data query request carries data query information;

資料查詢請求發送模組,用於直接向與資料查詢資訊關聯的鏈外資料來源發送資料查詢請求,以使鏈外資料來源基於資料查詢請求得到資料查詢結果; The data query request sending module is used to directly send a data query request to the off-chain data source associated with the data query information, so that the off-chain data source can obtain the data query result based on the data query request;

資料查詢結果接收模組,用於接收鏈外資料來源發送的資料查詢結果。 The data query result receiving module is used to receive data query results sent by data sources outside the chain.

第四方面,本發明提供了一種資料獲取裝置,應用於鏈外資料來源,包括: In the fourth aspect, the present invention provides a data acquisition device, which is applied to out-of-chain data sources, including:

資料查詢請求接收模組,用於接收區塊鏈節點發送的資料查詢請求,資料查詢請求是區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建的,資料查詢請求攜帶有資料查詢資訊; The data query request receiving module is used to receive the data query request sent by the blockchain node. The data query request is based on the obtained data query information of the blockchain node and is constructed through a smart contract. The data query request carries the data query information;

資料查詢結果確定模組,用於基於資料查詢請求,得到資料查詢結果; The data query result determination module is used to obtain the data query result based on the data query request;

資料查詢結果發送模組,用於向區塊鏈節點發送資料查詢結果。 Data query result sending module, used to send data query results to blockchain nodes.

第五方面,本發明提供了一種資料獲取設備,設備包括:包括:處理器以及存儲有電腦程式指令的記憶體; In a fifth aspect, the present invention provides a data acquisition device, which includes: a processor and a memory storing computer program instructions;

處理器執行電腦程式指令時實現上述第一方面或第二方面提供的資料獲取方法。 When the processor executes computer program instructions, the data acquisition method provided in the first aspect or the second aspect is realized.

第六方面,本發明提供了一種電腦存儲介質,電腦存儲介質上存儲有電腦程式指令,電腦程式指令被處理器執行時實現如上述第一方面或第二方面提供的資料獲取方法。 In a sixth aspect, the present invention provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the data acquisition method provided in the first or second aspect above is implemented.

本發明實施例的資料獲取方法、裝置、設備及電腦存儲介質,區塊鏈節點能夠通過智慧合約,基於獲取的資料查詢資訊構建資料查詢請求,並可以直接向與資料查詢資訊關聯的鏈外資料來源發送資料查詢請求,以獲取資料查詢結果,不需要單獨建立預言機用戶端或者預言機網路,而是通過區塊鏈節點與鏈外資料來源的直接通信,則可以獲取需要的資料,降低了區塊鏈節點訪問鏈外資料的複雜性。 In the data acquisition method, device, device, and computer storage medium of the embodiments of the present invention, the blockchain node can construct a data query request based on the obtained data query information through a smart contract, and can directly request the out-of-chain data associated with the data query information The source sends a data query request to obtain the data query results. It is not necessary to establish a separate oracle machine client or oracle machine network, but through direct communication between the blockchain node and the data source outside the chain, the required data can be obtained, reducing It eliminates the complexity of blockchain nodes accessing data outside the chain.

11:用戶端 11: Client

12:區塊鏈節點 12:Blockchain node

13:鏈外資料來源 13: Off-chain data sources

200,300:資料獲取方法 200,300: data acquisition method

210,220,230:步驟 210, 220, 230: steps

310,320,330:步驟 310, 320, 330: steps

401-416:步驟 401-416: Steps

501-513:步驟 501-513: Steps

600:資料獲取裝置 600: data acquisition device

610:資料查詢請求構建模組 610: Data query request building module

620:資料查詢請求發送模組 620: Data query request sending module

630:資料查詢結果接收模組 630: Data query result receiving module

700:資料獲取裝置 700: data acquisition device

710:資料查詢請求接收模組 710: Data query request receiving module

720:資料查詢結果確定模組 720: Data query result determination module

730:資料查詢結果發送模組 730: Data query result sending module

800:資料獲取設備 800: data acquisition equipment

801:處理器 801: Processor

802:記憶體 802: memory

803:通信介面 803: communication interface

810:匯流排 810: busbar

為了更清楚地說明本發明實施例的技術方案,下面將對本發明實施例中所需要使用的圖式作簡單地介紹,對於本領域普通技術人員來講,在不付出創造性勞動的前提下,還可以根據這些圖式獲得其他的圖式。 In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the diagrams that need to be used in the embodiments of the present invention will be briefly introduced below. Other schemas can be derived from these schemas.

圖1是根據本發明提供的資料獲取系統的架構示意圖; Fig. 1 is a schematic structural diagram of a data acquisition system provided according to the present invention;

圖2是根據本發明提供的資料獲取方法的一個實施例的流程示意圖; Fig. 2 is a schematic flow chart of an embodiment of the data acquisition method provided by the present invention;

圖3是根據本發明提供的資料獲取方法的另一個實施例的流程示意圖; Fig. 3 is a schematic flow chart of another embodiment of the data acquisition method provided by the present invention;

圖4是根據本發明提供的資料獲取方法的又一個實施例的流程示意圖; Fig. 4 is a schematic flow chart of another embodiment of the data acquisition method provided by the present invention;

圖5是根據本發明提供的資料獲取方法的再一個實施例的流程示意圖; Fig. 5 is a schematic flow chart of another embodiment of the data acquisition method provided by the present invention;

圖6是根據本發明提供的資料獲取裝置的一個實施例的結構示意圖; FIG. 6 is a schematic structural diagram of an embodiment of a data acquisition device provided according to the present invention;

圖7是根據本發明提供的資料獲取裝置的另一個實施例的結構示意圖; Fig. 7 is a schematic structural diagram of another embodiment of a data acquisition device according to the present invention;

圖8是根據本發明提供的資料獲取設備的一個實施例的結構示意圖; Fig. 8 is a schematic structural diagram of an embodiment of a data acquisition device according to the present invention;

下面將詳細描述本發明的各個方面的特徵和示例性實施例,為了使本發明的目的、技術方案及優點更加清楚明白,以下結合圖式及實施例,對本發明進行進一步詳細描述。應理解,此處所描述的具體實施例僅被配置為解釋本發明,並不被配置為限定本發明。對於本領域技術人員來說,本發明可以在不需要這些具體細節中的一些細節的情況下實施。 下面對實施例的描述僅僅是為了通過示出本發明的示例來提供對本發明更好的理解。 The characteristics and exemplary embodiments of various aspects of the present invention will be described in detail below. In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described here are only configured to explain the present invention, not to limit the present invention. It will be apparent to one skilled in the art that the present invention may be practiced without some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by showing examples of the present invention.

需要說明的是,在本文中,諸如第一和第二等之類的關係術語僅僅用來將一個實體或者操作與另一個實體或操作區分開來,而不一定要求或者暗示這些實體或操作之間存在任何這種實際的關係或者順序。而且,術語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、物品或者設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、物品或者設備所固有的要素。在沒有更多限制的情況下,由語句“包括……”限定的要素,並不排除在包括所述要素的過程、方法、物品或者設備中還存在另外的相同要素。 It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the statement "comprising..." does not exclude the presence of additional same elements in the process, method, article or device comprising said element.

為了更好的理解本發明,下面將結合圖式,詳細描述根據本發明實施例的資料獲取方法、裝置和系統,應注意,這些實施例並不是用來限制本發明公開的範圍。 In order to better understand the present invention, the data acquisition method, device and system according to the embodiments of the present invention will be described in detail below in conjunction with the drawings. It should be noted that these embodiments are not intended to limit the scope of the present invention.

預言機就是一個能將鏈外資料真實輸入到區塊鏈內,保障區塊鏈鏈上資料真實性的工具。目前,預言機等技術正快速引起技術和產業各方的注意,其中預言機技術打通鏈內和鏈外空間,能極大程度上為區塊鏈賦能,促進區塊鏈各個方面的落地。但是,目前,區塊鏈節點若想要訪問鏈外資料,需要在鏈外單獨部署預言機用戶端或者預言機網路,複雜度較高。 The oracle machine is a tool that can actually input data outside the chain into the blockchain to ensure the authenticity of the data on the blockchain chain. At present, technologies such as oracle machines are rapidly attracting the attention of all parties in the technology and industry. Among them, the oracle machine technology can open up the space inside and outside the chain, which can greatly empower the blockchain and promote the implementation of various aspects of the blockchain. However, at present, if a blockchain node wants to access data outside the chain, it needs to deploy an oracle client or an oracle network separately outside the chain, which is very complicated.

基於此,本發明提供一種資料獲取方法、裝置、設備和介質,通過直接建立區塊鏈節點和鏈外資料來源之間的通信,減少了區塊鏈節點從鏈外獲取資料的複雜度。下面結合圖式和實施例進行詳細介紹。 Based on this, the present invention provides a data acquisition method, device, equipment and medium, which reduces the complexity of blockchain nodes obtaining data from outside the chain by directly establishing communication between blockchain nodes and data sources outside the chain. A detailed introduction will be made below in conjunction with the drawings and embodiments.

圖1是本發明提供的資料查詢系統的系統架構圖。如圖1所示,本發明提供的資料查詢系統包括用戶端11、區塊鏈節點12和鏈外資料來源13。 Fig. 1 is a system architecture diagram of the data query system provided by the present invention. As shown in FIG. 1 , the data query system provided by the present invention includes a client terminal 11 , a blockchain node 12 and an out-of-chain data source 13 .

在本發明的實施例,用戶端11發送資料查詢資訊至區塊 鏈節點12。在一些實施例中,資料查詢資訊可以包括需要查詢的資料在鏈外資料來源中的查詢索引。區塊鏈節點12接收資料查詢資訊後,基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求。其中,資料查詢請求攜帶有資料查詢資訊。接著,區塊鏈節點12直接向與資料查詢資訊關聯的鏈外資料來源13發送資料查詢請求。鏈外資料來源13接收區塊鏈節點12發送的資料查詢請求。然後,鏈外資料來源13基於接收的資料查詢請求進行查詢,得到資料查詢結果。再然後,鏈外資料來源13向區塊鏈節點12發送資料查詢結果,實現區塊鏈節點12從鏈外讀取了資料。 In the embodiment of the present invention, the client terminal 11 sends data query information to the block Chain node 12. In some embodiments, the data query information may include a query index of the data to be queried in out-of-chain data sources. After the blockchain node 12 receives the data query information, it constructs a data query request through a smart contract based on the obtained data query information. Wherein, the data query request carries data query information. Next, the blockchain node 12 directly sends a data query request to the off-chain data source 13 associated with the data query information. The data source 13 outside the chain receives the data query request sent by the blockchain node 12. Then, the out-of-chain data source 13 conducts a query based on the received data query request, and obtains a data query result. Then, the data source 13 outside the chain sends the data query result to the blockchain node 12, realizing that the blockchain node 12 has read the data from outside the chain.

在本發明的實施例中,鏈外資料來源13可以為提供鏈外資料的伺服器。 In an embodiment of the present invention, the out-of-chain data source 13 may be a server providing out-of-chain data.

在本發明的實施例中,區塊鏈節點12能夠通過智慧合約,基於獲取的資料查詢資訊構建資料查詢請求,並可以直接向與資料查詢資訊關聯的鏈外資料來源13發送資料查詢請求,以獲取資料查詢結果,不需要單獨建立預言機用戶端11或者預言機網路,而是通過區塊鏈節點12與鏈外資料來源13的直接通信,則可以獲取需要的資料,降低了區塊鏈節點12訪問鏈外資料的複雜性。 In the embodiment of the present invention, the block chain node 12 can construct a data query request based on the obtained data query information through a smart contract, and can directly send a data query request to an off-chain data source 13 associated with the data query information, in order to To obtain data query results, there is no need to establish a separate oracle machine client 11 or oracle machine network, but through direct communication between the blockchain node 12 and the data source 13 outside the chain, the required data can be obtained, reducing the blockchain The complexity of node 12 accessing data outside the chain.

圖2是本發明提供的資料獲取方法的一實施例的流程示意圖。如圖2所示,本發明提供的資料獲取方法200應用于區塊鏈節點12,包括: Fig. 2 is a schematic flowchart of an embodiment of the data acquisition method provided by the present invention. As shown in Figure 2, the data acquisition method 200 provided by the present invention is applied to the block chain node 12, including:

步驟210,基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,資料查詢請求攜帶有資料查詢資訊; Step 210, based on the obtained data query information, construct a data query request through a smart contract, and the data query request carries the data query information;

步驟220,直接向與資料查詢資訊關聯的鏈外資料來源發送資料查詢請求,以使鏈外資料來源基於資料查詢請求得到資料查詢結果; Step 220, directly sending a data query request to an off-chain data source associated with the data query information, so that the off-chain data source obtains a data query result based on the data query request;

步驟230,接收鏈外資料來源發送的資料查詢結果。 Step 230, receiving a data query result sent by an out-of-chain data source.

在本發明的實施例中,區塊鏈節點12能夠通過智慧合約,基於獲取的資料查詢資訊構建資料查詢請求,並可以直接向與資料查詢資訊關聯的鏈外資料來源13發送資料查詢請求,以獲取資料查詢結果,不需 要單獨建立預言機用戶端11或者預言機網路,而是通過區塊鏈節點12與鏈外資料來源13的直接通信,則可以獲取需要的資料,降低了區塊鏈節點12訪問鏈外資料的複雜性。 In the embodiment of the present invention, the block chain node 12 can construct a data query request based on the obtained data query information through a smart contract, and can directly send a data query request to an off-chain data source 13 associated with the data query information, in order to Obtain data query results without To establish the oracle client 11 or the oracle network separately, but through the direct communication between the blockchain node 12 and the data source 13 outside the chain, the required data can be obtained, reducing the need for the blockchain node 12 to access data outside the chain. complexity.

下面分別對步驟210~步驟230的具體實現方式進行介紹。 The specific implementation manners of steps 210 to 230 are introduced below respectively.

首先,涉及步驟210,在一些實施例中,資料查詢資訊包括在鏈外資料來源13中的查詢索引。例如,查詢索引包括查詢準則或在鏈外資料來源13的存儲位址。 First, referring to step 210 , in some embodiments, the data query information includes a query index in the out-of-chain data source 13 . For example, the query index includes query criteria or storage addresses in off-chain data sources 13 .

在本發明的實施例中,由於資料查詢資訊包括在鏈外資料來源13中的查詢索引,因此可以直接向鏈外資料來源13發送通過該資料查詢資訊構建的資料查詢請求,從而實現鏈外資料來源13和區塊鏈節點12之間的直接通信。 In the embodiment of the present invention, since the data query information includes the query index in the out-of-chain data source 13, the data query request constructed by the data query information can be directly sent to the out-of-chain data source 13, thereby realizing the out-of-chain data Direct communication between sources 13 and blockchain nodes 12.

在一些實施例中,區塊鏈節點12可以線上進行模型訓練,因此需要訓練樣本資料。但是,若將訓練樣本資料存儲在區塊鏈節點12中,則會佔用大量的存儲空間,而且也會為資料安全留下隱患。因此,可以預先將訓練資料存儲在鏈外資料來源13中。在需要進行模型訓練時,區塊鏈節點12可以回應於用戶端11發送的資料查詢資訊,從鏈外資料來源13查詢訓練資料。在一些實施例中,用戶端11可以預先獲取每個訓練資料在鏈外資料來源13中的存儲位址,並將該存儲位址作為資料查詢資訊。 In some embodiments, the blockchain node 12 can perform model training online, so training sample data is required. However, if the training sample data is stored in the blockchain node 12, it will take up a large amount of storage space, and will also leave hidden dangers for data security. Therefore, the training data can be stored in the off-chain data source 13 in advance. When model training is required, the blockchain node 12 can respond to the data query information sent by the client 11 and query the training data from the off-chain data source 13 . In some embodiments, the client terminal 11 can obtain the storage address of each training data in the out-of-chain data source 13 in advance, and use the storage address as the data query information.

在本發明的一些實施例中,由於訓練資料是預先採集的資料,因此基於用戶端11上傳的訓練資料的存儲位址查詢的是可信資料。 In some embodiments of the present invention, since the training data is pre-collected data, trusted data is queried based on the storage address of the training data uploaded by the client 11 .

在一些實施例中,鏈外資料來源13可以超文字傳輸安全協議(Hyper Text Transfer Protocol over Secure Socket Layer,HTTPS)的方式提供資料訪問服務。因此,通過智慧合約可以基於資料查詢請求中的存儲位址構建資料查詢請求,該資料查詢請求可以是一個攜帶該存儲位址的HTTPS請求位址。 In some embodiments, the out-of-chain data source 13 may provide data access services in the form of Hyper Text Transfer Protocol over Secure Socket Layer (HTTPS). Therefore, a data query request can be constructed based on the storage address in the data query request through the smart contract, and the data query request can be an HTTPS request address carrying the storage address.

在另一些實施例中,假設智慧合約需要根據目標資料觸發下一步的動作,但是通過用戶端11直接發送目標資料可能是不可信的。 例如,智慧合約需要根據支付結果觸發下一步的動作,但是通過交易發送者直接發送的支付結果是不可信的。而鏈外資料來源13的資料才是較為可信的。因此,資料查詢資訊包括在鏈外資料來源13的查詢準則。例如,資料查詢資訊包括支付流水號。即查詢準則為支付流水號。 In some other embodiments, it is assumed that the smart contract needs to trigger the next action according to the target data, but it may not be credible to directly send the target data through the client 11 . For example, a smart contract needs to trigger the next action based on the payment result, but the payment result sent directly by the transaction sender is not credible. The information from the off-chain information source 13 is more credible. Therefore, the data query information includes query criteria in off-chain data sources 13 . For example, the data query information includes the payment serial number. That is, the query criterion is the payment serial number.

在本發明的一些實施例中,若查詢索引包括查詢準則,則步驟210包括:基於獲取的查詢準則和預先存儲的鏈外資料來源13的查詢位址,通過智慧合約構建資料查詢請求。 In some embodiments of the present invention, if the query index includes query criteria, step 210 includes: constructing a data query request through a smart contract based on the acquired query criteria and the pre-stored query address of the off-chain data source 13 .

在本發明的實施例中,若需要從鏈外資料來源13查詢可信資料,且查詢索引是需要查詢的資料的查詢準則的情況下,還需要獲取鏈外資料來源13的查詢位址,才能實現鏈外資料的查詢。 In the embodiment of the present invention, if it is necessary to query trusted information from the data source 13 outside the chain, and the query index is the query criterion for the data to be queried, it is also necessary to obtain the query address of the data source 13 outside the chain. Realize the query of off-chain data.

在一些實施例中,若需要查詢銀行支付結果,則鏈外資料來源13的查詢位址可以為預先在區塊鏈節點12中登記的銀行支付結果查詢地址。則智慧合約可以基於接收的支付流水帳號以及預先登記的銀行支付結果查詢位址構建資料查詢請求。 In some embodiments, if it is necessary to query the bank payment result, the query address of the off-chain data source 13 can be the bank payment result query address registered in the blockchain node 12 in advance. Then the smart contract can construct a data query request based on the received payment account number and the pre-registered bank payment result query address.

在本發明的另一些實施例中,資料查詢資訊還包括查詢授權簽名。其中,查詢授權簽名用於鏈外資料來源13在對查詢授權簽名驗證通過的情況下,基於資料查詢請求得到資料查詢結果。 In some other embodiments of the present invention, the data query information further includes the query authorization signature. Wherein, the query authorization signature is used for the data source 13 outside the chain to obtain the data query result based on the data query request when the verification of the query authorization signature is passed.

在本發明的實施例中,用戶端11可以基於預先從鏈外資料來源13獲取的公私秘鑰對資料查詢資訊進行簽名,則可以得到查詢授權簽名。 In the embodiment of the present invention, the client 11 can sign the data query information based on the public and private keys previously obtained from the out-of-chain data source 13, and then obtain the query authorization signature.

在本發明的實施例中,資料查詢資訊中包括的查詢授權簽名是為了鏈外資料來源13進行驗證。只有當鏈外資料來源13在對查詢授權簽名驗證通過的情況下,才會基於資料查詢請求進行查詢,可以提高資料查詢的安全性。 In the embodiment of the present invention, the query authorization signature included in the data query information is for verification by the off-chain data source 13 . Only when the data source 13 outside the chain passes the verification of the query authorization signature, the query will be performed based on the data query request, which can improve the security of the data query.

需要說明的是,若資料查詢資訊包括在鏈外資料來源13中的查詢索引和查詢授權簽名,則智慧合約則會基於查詢索引和查詢授權簽名構建資料查詢請求。 It should be noted that if the data query information includes the query index and query authorization signature in the off-chain data source 13, the smart contract will construct a data query request based on the query index and query authorization signature.

作為一個示例,若查詢索引包括在鏈外資料來源13中的存儲位址,則智慧合約可以在基於該存儲位址生成的HTTPS請求位址中攜帶查詢授權簽名。 As an example, if the query index includes a storage address in the off-chain data source 13, the smart contract can carry the query authorization signature in the HTTPS request address generated based on the storage address.

下面介紹步驟220的具體實現方式。 The specific implementation manner of step 220 is introduced below.

在步驟210中,資料查詢資訊包括在鏈外資料來源13中的查詢索引。即資料查詢資訊自身即為與鏈外資料來源13相關的資訊。因此,通過資料查詢資訊則可以獲取需要發送資料查詢請求的鏈外資料來源13。 In step 210 , the data query information includes query indexes in the off-chain data sources 13 . That is, the data query information itself is the information related to the data source 13 outside the chain. Therefore, the out-of-chain data sources 13 that need to send data query requests can be obtained through data query information.

作為一個示例,若資料查詢資訊包括在鏈外資料來源13的存儲位址,則基於該資料查詢資訊可以獲取與該資訊關聯的鏈外資料來源13。 As an example, if the data query information includes the storage address of the out-of-chain data source 13, the out-of-chain data source 13 associated with the information can be obtained based on the data query information.

作為另外一個示例,若資料查詢資訊包括查詢準則,則基於與該查詢準則關聯的預先登記的查詢位址,則可以獲取鏈外資料來源13的位址。 As another example, if the data query information includes query criteria, based on the pre-registered query address associated with the query criteria, the address of the out-of-chain data source 13 can be obtained.

當獲取資料查詢請求之後,區塊鏈節點12可以直接向與資料查詢資訊關聯的鏈外資料來源13發送資料查詢請求。 After obtaining the data query request, the blockchain node 12 can directly send the data query request to the off-chain data source 13 associated with the data query information.

接著,涉及步驟230,當鏈外資料來源13基於資料查詢請求得到資料查詢結果之後,可以向區塊鏈節點12發送資料查詢結果。區塊鏈節點12可以接收鏈外資料來源13發送的資料查詢結果,從而實現了區塊鏈讀取鏈外資料。 Next, step 230 is involved. After obtaining the data query result based on the data query request, the off-chain data source 13 can send the data query result to the blockchain node 12 . The blockchain node 12 can receive the data query results sent by the data source 13 outside the chain, thereby realizing the reading of data outside the chain by the blockchain.

在本發明的一些實施例中,在步驟220之前,本發明提供的資料獲取方法300還包括:接收用戶端發送的資料查詢資訊。 In some embodiments of the present invention, before step 220, the data acquisition method 300 provided by the present invention further includes: receiving data query information sent by the client.

在本發明的一些實施例中,區塊鏈平臺可以為Hyperledger Fabric。則用戶端11可以調Fabric SDK(Software Development Kit,軟體開發套件)將資料查詢資訊發送到區塊鏈節點12。 In some embodiments of the present invention, the blockchain platform may be Hyperledger Fabric. Then the client 11 can call the Fabric SDK (Software Development Kit, software development kit) to send the data query information to the blockchain node 12 .

需要說明的是,區塊鏈節點12可以根據智慧合約中的規則,可以在獲取一個資料查詢資訊之後,立刻構建資料查詢請求進行查詢 資料,還可以在獲取一定數量的資料查詢資訊之後,再向鏈外資料來源13查詢資料。例如,若要進行線上模型訓練,則需要一定量的訓練資料。因此,可以在獲取一定量的訓練資料的資料查詢資訊之後,再統一向鏈外資料來源13進行查詢。 It should be noted that, according to the rules in the smart contract, the blockchain node 12 can immediately construct a data query request for query after obtaining a data query information The data can also be inquired from the off-chain data source 13 after obtaining a certain amount of data to inquire about the information. For example, to conduct online model training, a certain amount of training data is required. Therefore, after obtaining a certain amount of training data and querying information, the query can be made to the out-of-chain data source 13 in a unified manner.

在本發明的一些實施例中,為了提高查詢資料的安全性,在步驟220之前,本發明提供的資料獲取方法200還包括:對資料查詢請求進行加密,得到加密後的資料查詢請求;在此基礎上,步驟220包括:直接向與資料查詢資訊關聯的鏈外資料來源發送加密後的資料查詢請求。 In some embodiments of the present invention, in order to improve the security of the query data, before step 220, the data acquisition method 200 provided by the present invention further includes: encrypting the data query request to obtain the encrypted data query request; here Basically, step 220 includes: directly sending an encrypted data query request to an out-of-chain data source associated with the data query information.

在本發明的實施例中,通過對資料查詢請求進行加密,可以防止資料被攻擊,提高資料的安全性。 In the embodiment of the present invention, by encrypting the data query request, the data can be prevented from being attacked and the security of the data can be improved.

在一些實施例中,可以通過安全傳輸層協議加密通信通道,直接向與資料查詢資訊關聯的鏈外資料來源發送加密後的資料查詢請求。 In some embodiments, the communication channel can be encrypted through the security transport layer protocol, and the encrypted data query request can be directly sent to the out-of-chain data source associated with the data query information.

在本發明的實施例中,安全傳輸層協議用於在兩個通信應用程式之間提供保密性和資料完整性。安全傳輸層協議安全強度高、計算量小且加解密速度快、效率高,因此在提高資料安全性的同時,還可以提高資料查詢效率。 In an embodiment of the present invention, TLS is used to provide confidentiality and data integrity between two communicating applications. The secure transport layer protocol has high security strength, small amount of calculation, fast encryption and decryption speed, and high efficiency. Therefore, while improving data security, it can also improve data query efficiency.

在本發明的一些實施例中,為了進一步提高資料的安全性,資料查詢資訊還包括需要查詢的目標資料的資料指紋。其中,目標資料的資料指紋是利用預設雜湊演算法對目標資料雜湊之後得到的資料。在此基礎上,本發明提供的資料獲取方法200還包括:通過智慧合約,利用預設雜湊演算法對資料查詢結果進行雜湊,得到資料查詢結果的資料指紋;在通過智慧合約確定目標資料的資料指紋和資料查詢結果的資料指紋一致的情況下,通過智慧合約對資料查詢結果執行預設處理。 In some embodiments of the present invention, in order to further improve data security, the data query information further includes the data fingerprint of the target data to be queried. Wherein, the data fingerprint of the target data is the data obtained after hashing the target data by using a preset hash algorithm. On this basis, the data acquisition method 200 provided by the present invention further includes: using a preset hashing algorithm to hash the data query results through the smart contract to obtain the data fingerprint of the data query result; after determining the data of the target data through the smart contract When the fingerprint is consistent with the data fingerprint of the data query result, the preset processing is performed on the data query result through the smart contract.

在本發明的實施例中,目標資料可以為鏈外資料來源13中存儲的任一資料。用戶端11可以利用預設雜湊演算法對鏈外資料來源13 中存儲的資料進行雜湊,得到該資料的資料指紋。然後用戶端11將目標資料的資料指紋發送至區塊鏈節點12。 In the embodiment of the present invention, the target data can be any data stored in the out-of-chain data source 13 . The user end 11 can use the preset hash algorithm to check the data source 13 outside the chain Hash the data stored in the database to obtain the data fingerprint of the data. Then the client 11 sends the data fingerprint of the target data to the block chain node 12 .

在本發明的實施例中,通過驗證目標資料的資料指紋和資料查詢結果的資料指紋是否一致,可以確定需要查詢的資料是否正確,提高了資料查詢的準確性。 In the embodiment of the present invention, by verifying whether the data fingerprint of the target data is consistent with the data fingerprint of the data query result, it can be determined whether the data to be queried is correct, thereby improving the accuracy of the data query.

在本發明的實施例中,預設處理與智慧合約中預先定義的處理規則有關。例如,預設處理可以為開始模型訓練。 In the embodiment of the present invention, the preset processing is related to the pre-defined processing rules in the smart contract. For example, the preset process can be to start model training.

在本發明的一些實施例中,資料查詢結果為加密後的資料查詢結果,在步驟230之後,本發明提供的資料獲取方法200還包括:對加密後的資料查詢結果進行解密,得到資料查詢結果。 In some embodiments of the present invention, the data query result is an encrypted data query result. After step 230, the data acquisition method 200 provided by the present invention further includes: decrypting the encrypted data query result to obtain the data query result .

在本發明的實施例中,若為了提高資料的安全性,鏈外資料來源13對資料查詢結果進行了加密,則鏈外資料來源13發送給區塊鏈節點12的資料查詢結果是加密後的資料查詢結果。則區塊鏈節點12可以利用與加密演算法對應的解密演算法對加密後的資料查詢結果進行解密,以得到最終的資料查詢結果。 In the embodiment of the present invention, if in order to improve the security of the data, the data query result is encrypted by the data source 13 outside the chain, the data query result sent by the data source 13 to the block chain node 12 is encrypted Data query results. Then the blockchain node 12 can use the decryption algorithm corresponding to the encryption algorithm to decrypt the encrypted data query result to obtain the final data query result.

在本發明的實施例中,由於鏈外資料來源13發送至區塊鏈節點12的是加密後的資料查詢結果,因此可以防止外來攻擊,提高資料查詢結果的安全性。 In the embodiment of the present invention, since the data source 13 outside the chain sends the encrypted data query result to the blockchain node 12, external attacks can be prevented and the security of the data query result can be improved.

圖3是本發明提供的資料獲取方法的另一實施例的流程示意圖。如圖3所示,本發明提供的資料獲取方法300應用於鏈外資料來源13,包括: Fig. 3 is a schematic flowchart of another embodiment of the data acquisition method provided by the present invention. As shown in FIG. 3 , the data acquisition method 300 provided by the present invention is applied to an out-of-chain data source 13, including:

步驟310,接收區塊鏈節點發送的資料查詢請求,資料查詢請求是區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建的,資料查詢請求攜帶有資料查詢資訊; Step 310, receiving the data query request sent by the blockchain node. The data query request is constructed by the blockchain node based on the acquired data query information through a smart contract, and the data query request carries the data query information;

步驟320,基於資料查詢請求,得到資料查詢結果; Step 320, obtain a data query result based on the data query request;

步驟330,向區塊鏈節點發送資料查詢結果。 Step 330, sending the data query result to the blockchain node.

在本發明的實施例中,鏈外資料來源基於資料查詢請求中的資訊,可以從自身存儲的資料進行查詢,查詢到與資料查詢請求對應的資料查詢結果。 In the embodiment of the present invention, based on the information in the data query request, the out-of-chain data source can query from its own stored data, and find the data query result corresponding to the data query request.

在本發明的實施例中,區塊鏈節點12能夠通過智慧合約,基於獲取的資料查詢資訊構建資料查詢請求,並可以直接向與資料查詢資訊關聯的鏈外資料來源13發送資料查詢請求,以獲取資料查詢結果,不需要單獨建立預言機用戶端11或者預言機網路,而是通過區塊鏈節點12與鏈外資料來源13的直接通信,則可以獲取需要的資料,降低了區塊鏈節點12訪問鏈外資料的複雜性。 In the embodiment of the present invention, the block chain node 12 can construct a data query request based on the obtained data query information through a smart contract, and can directly send a data query request to an off-chain data source 13 associated with the data query information, in order to To obtain data query results, there is no need to establish a separate oracle machine client 11 or oracle machine network, but through direct communication between the blockchain node 12 and the data source 13 outside the chain, the required data can be obtained, reducing the blockchain The complexity of node 12 accessing data outside the chain.

在本發明的一些實施例中,參考資料獲取方法200的相關敘述,資料查詢資訊可以包括在鏈外資料來源13中的查詢索引和查詢授權簽名,在此基礎上,步驟320包括:在對資料查詢請求中攜帶的查詢授權簽名驗證通過的情況下,基於資料查詢請求中攜帶的查詢索引,得到與查詢索引匹配的資料查詢結果。 In some embodiments of the present invention, referring to the relevant description of the data acquisition method 200, the data query information may include the query index and the query authorization signature in the out-of-chain data source 13. On this basis, step 320 includes: If the query authorization signature carried in the query request passes the verification, based on the query index carried in the data query request, a data query result matching the query index is obtained.

在本發明的實施例中,通過對查詢授權簽名進行驗證,可以提高資料查詢的安全性。 In the embodiment of the present invention, the security of data query can be improved by verifying the query authorization signature.

在一些實施例中,對資料查詢請求中攜帶的查詢授權簽名驗證通過,包括:確定查詢授權簽名在預設有效期內,和/或,攜帶有查詢授權簽名的資料請求的請求次數小於預設次數閾值。 In some embodiments, the verification of the query authorization signature carried in the data query request includes: determining that the query authorization signature is within the preset validity period, and/or, the number of requests for data requests carrying the query authorization signature is less than the preset number of times threshold.

在一些實施例中,可以為查詢授權簽名預先設定有效期,若查詢授權簽名在預設有效期內,則確定查詢授權簽名驗證通過。若查詢授權簽名不在預設有效期內,則確定查詢授權簽名驗證不通過。 In some embodiments, a validity period may be preset for the query authorization signature, and if the query authorization signature is within the preset validity period, it is determined that the query authorization signature has been verified. If the query authorization signature is not within the preset validity period, it is determined that the query authorization signature verification fails.

在另一些實施例中,若攜帶有查詢授權簽名的資料請求的請求次數小於預設次數閾值,則確定查詢授權簽名驗證通過。若攜帶有查詢授權簽名的資料請求的請求次數大於或等於預設次數閾值,則確定查詢授權簽名驗證不通過。 In some other embodiments, if the number of requests for data requests carrying the query authorization signature is less than the preset number of times threshold, it is determined that the query authorization signature has been verified. If the number of data requests carrying the query authorization signature is greater than or equal to the preset number of times threshold, it is determined that the verification of the query authorization signature fails.

在又一些實施例中,也可以綜合查詢授權簽名在預設有效期內,以及,攜帶有查詢授權簽名的資料請求的請求次數小於預設次數閾值對查詢授權簽名進行驗證。 In some other embodiments, the query authorization signature can also be verified by considering that the query authorization signature is within the preset validity period, and the number of requests for data requests carrying the query authorization signature is less than the preset number of times threshold.

在本發明的一些實施例中,在步驟330之前,本發明提供的資料獲取方法300還包括:對資料查詢結果進行加密,得到加密後的資料查詢結果;其中,步驟330包括:向區塊鏈節點發送加密後的資料查詢結果。 In some embodiments of the present invention, before step 330, the data acquisition method 300 provided by the present invention further includes: encrypting the data query result to obtain the encrypted data query result; wherein, step 330 includes: Nodes send encrypted data query results.

在本發明的實施例中,若為了提高資料的安全性,鏈外資料來源13對資料查詢結果進行了加密。區塊鏈節點12可以利用與加密演算法對應的解密演算法對加密後的資料查詢結果進行解密,以得到最終的資料查詢結果。 In the embodiment of the present invention, in order to improve the security of the data, the out-of-chain data source 13 encrypts the data query results. The blockchain node 12 can use the decryption algorithm corresponding to the encryption algorithm to decrypt the encrypted data query result to obtain the final data query result.

在一些示例中,可以通過安全傳輸層協議加密通信通道,向區塊鏈節點12發送加密後的資料查詢結果。 In some examples, the communication channel can be encrypted through the secure transport layer protocol, and the encrypted data query result can be sent to the blockchain node 12 .

在本發明的實施例中,安全傳輸層協議安全強度高、計算量小且加解密速度快、效率高,因此在提高資料安全性的同時,還可以提高資料查詢效率。 In the embodiment of the present invention, the security transport layer protocol has high security strength, small amount of calculation, fast encryption and decryption speed, and high efficiency. Therefore, while improving data security, data query efficiency can also be improved.

圖4是根據本發明提供的資料獲取方法的一個實施例的流程示意圖。如圖4所示,本發明提供的資料獲取方法應用於從鏈下獲取訓練資料的應用場景中。 Fig. 4 is a schematic flowchart of an embodiment of a data acquisition method according to the present invention. As shown in Figure 4, the data acquisition method provided by the present invention is applied to the application scenario of obtaining training data from off-chain.

在使用智慧合約實現線上訓練模型的場景下,如果將訓練資料以交易的形式發送給至區塊鏈節點,則會使用大量的區塊存儲。因此,為了減少資料存儲量以及減少從鏈外獲取資料的複雜度,可以使用本發明提供的資料獲取方法。 In the scenario of using smart contracts to implement online training models, if the training data is sent to the blockchain nodes in the form of transactions, a large amount of block storage will be used. Therefore, in order to reduce the amount of data storage and reduce the complexity of obtaining data from outside the chain, the data acquisition method provided by the present invention can be used.

首先,可以在鏈外開發一個資料來源服務,即鏈外資料來源,該鏈外資料來源以HTTPS的方式提供資料訪問服務。區塊鏈平臺以Hyperledger Fabric為例,用鏈碼實現線上訓練模型的演算法,部署在區塊鏈上。 First of all, a data source service can be developed outside the chain, that is, the data source outside the chain, which provides data access services in the form of HTTPS. The blockchain platform takes Hyperledger Fabric as an example, uses chain code to implement the algorithm of the online training model, and deploys it on the blockchain.

步驟401,用戶端預先組建資料查詢資訊。其中,資料查詢資訊包括訓練資料的資料指紋、訓練資料在鏈外資料來源中的存儲位址以及查詢授權簽名。 In step 401, the client pre-configures data to query information. Among them, the data query information includes the data fingerprint of the training data, the storage address of the training data in the off-chain data source, and the query authorization signature.

其中,用戶端利用預設雜湊演算法對每個訓練資料雜湊,得到每個訓練資料的資料指紋。用戶端可以從鏈外資料來源預先獲取訓練資料在鏈外資料來源中的存儲位址。用戶端利用從來鏈外資料來源獲取的授權秘鑰對資料查詢資訊進行授權簽名,得到查詢授權簽名。 Wherein, the client uses a preset hash algorithm to hash each training data to obtain a data fingerprint of each training data. The client can pre-acquire the storage address of the training data in the off-chain data source from the off-chain data source. The client uses the authorization key obtained from the source outside the chain to authorize the data query information and obtain the query authorization signature.

步驟402,用戶端調用Fabric SDK向區塊鏈節點發送資料查詢資訊(也可稱之為交易)。 Step 402, the client invokes the Fabric SDK to send data query information (also referred to as a transaction) to the blockchain node.

步驟403,區塊鏈節點接收資料查詢資訊。 Step 403, the blockchain node receives data query information.

步驟404,區塊鏈節點中的智慧合約讀取資料查詢資訊,並基於資料查詢資訊構建資料查詢請求。 Step 404, the smart contract in the blockchain node reads the data query information, and constructs a data query request based on the data query information.

步驟405,區塊鏈節點通過安全傳輸層協議加密通信通道向鏈外資料來源發送資料查詢請求,該請求帶有查詢授權簽名。 Step 405, the blockchain node sends a data query request to the data source outside the chain through the secure transport layer protocol encrypted communication channel, and the request carries a query authorization signature.

步驟406,鏈外資料來源接收資料查詢請求。 Step 406, the out-of-chain data source receives a data query request.

步驟407,當鏈外資料來源接收到資料查詢請求之後,對查詢授權簽名進行驗證。 Step 407, after the data source outside the chain receives the data query request, verify the query authorization signature.

步驟408,若鏈外資料來源對查詢授權簽名驗證通過,則基於資料查詢請求得到資料查詢結果。 Step 408, if the data source outside the chain passes the verification of the query authorization signature, obtain the data query result based on the data query request.

步驟409,鏈外資料來源對資料查詢結果進行加密,得到加密後的資料查詢結果。 Step 409, the data source outside the chain encrypts the data query result to obtain the encrypted data query result.

步驟410,通過安全傳輸層協議加密通信通道,直接向區塊鏈節點發送加密後的資料查詢結果。 Step 410, encrypting the communication channel through the security transport layer protocol, and directly sending the encrypted data query result to the blockchain node.

步驟411,區塊鏈節點接收加密後的資料查詢結果。 Step 411, the block chain node receives the encrypted data query result.

步驟412,區塊鏈節點對加密後的資料查詢結果進行解密,得到資料查詢結果。 Step 412, the blockchain node decrypts the encrypted data query result to obtain the data query result.

步驟413,區塊鏈節點中的智慧合約可以調用資料查詢結 果,並對資料查詢結果進行雜湊,得到資料查詢結果的資料指紋。 Step 413, the smart contract in the block chain node can call the data query result results, and hash the data query results to obtain the data fingerprint of the data query results.

步驟414,區塊鏈節點中的智慧合約判斷資料查詢資訊中需要查詢的訓練資料的資料指紋是否與資料查詢結果的資料指紋的一致。 Step 414, the smart contract in the blockchain node judges whether the data fingerprint of the training data to be queried in the data query information is consistent with the data fingerprint of the data query result.

步驟415,若資料查詢資訊中需要查詢的訓練資料的資料指紋是否與資料查詢結果的資料指紋一致,則智慧合約利用資料查詢結果進行模型訓練。 Step 415, if the data fingerprint of the training data to be queried in the data query information is consistent with the data fingerprint of the data query result, the smart contract uses the data query result to perform model training.

步驟416,若資料查詢資訊中需要查詢的訓練資料的資料指紋是否與資料查詢結果的資料指紋的不一致,則向用戶端返回查詢失敗的回饋資訊。 Step 416 , if the data fingerprint of the training data to be queried in the data query information is inconsistent with the data fingerprint of the data query result, return feedback information of query failure to the client.

圖5是根據本發明提供的資料獲取方法的一個實施例的流程示意圖。如圖5所示,本發明提供的資料獲取方法應用於基於銀行查詢介面查詢支付結果的應用場景中。 Fig. 5 is a schematic flowchart of an embodiment of a data acquisition method according to the present invention. As shown in FIG. 5 , the data acquisition method provided by the present invention is applied to an application scenario of querying payment results based on a bank query interface.

在區塊鏈上有一個智慧合約,需要根據支付結果出發下一步的動作的場景下,為了提高資料的可靠性,可以從鏈外的銀行的支付結果資料庫中進行查詢。為了減少從鏈外獲取支付結果的複雜度,可以使用本發明提供的資料獲取方法。 There is a smart contract on the blockchain, and in the scenario where the next action needs to be initiated based on the payment result, in order to improve the reliability of the data, it can be queried from the payment result database of the bank outside the chain. In order to reduce the complexity of acquiring payment results from outside the chain, the data acquisition method provided by the present invention can be used.

首先,在區塊鏈上部署智慧合約時,將銀行的支付結果查詢地址登記到區塊鏈上,並獲得合約參與方的認可。 First, when deploying smart contracts on the blockchain, the bank's payment result query address is registered on the blockchain and approved by the contract participants.

步驟501,用戶端預先組建資料查詢資訊。其中,資料查詢資訊包括支付流水號以及查詢授權簽名。 In step 501, the client pre-configures data to query information. Among them, the data query information includes payment serial number and query authorization signature.

步驟502,用戶端向區塊鏈節點發送資料查詢資訊。 Step 502, the client sends data query information to the blockchain node.

步驟503,區塊鏈節點接收資料查詢資訊。 Step 503, the blockchain node receives data query information.

步驟504,區塊鏈節點中的智慧合約讀取資料查詢資訊,並基於支付流水號、查詢授權簽名以及預先登記的銀行支付結果查詢位址構建資料查詢請求。 Step 504, the smart contract in the blockchain node reads the data query information, and constructs a data query request based on the payment serial number, the query authorization signature, and the pre-registered bank payment result query address.

步驟505,區塊鏈節點通過安全傳輸層協議加密通信通道向鏈外資料來源(即銀行支付結果查詢介面)發送資料查詢請求,該請求 帶有查詢授權簽名。 Step 505, the blockchain node sends a data query request to the data source outside the chain (ie, the bank payment result query interface) through the secure transport layer protocol encrypted communication channel, the request With query authorization signature.

步驟506,鏈外資料來源接收資料查詢請求。 Step 506, the out-of-chain data source receives a data query request.

步驟507,當鏈外資料來源接收到資料查詢請求之後,對查詢授權簽名進行驗證。 Step 507, after the data source outside the chain receives the data query request, verify the query authorization signature.

步驟508,若鏈外資料來源對查詢授權簽名驗證通過,則查詢與支付流水號對應的支付結果。 Step 508, if the data source outside the chain passes the verification of the query authorization signature, query the payment result corresponding to the payment serial number.

步驟509,鏈外資料來源對支付結果進行加密,得到加密後的支付結果。 Step 509, the data source outside the chain encrypts the payment result to obtain the encrypted payment result.

步驟510,通過安全傳輸層協議加密通信通道,直接向區塊鏈節點發送加密後的支付結果。 Step 510, encrypting the communication channel through the secure transport layer protocol, and sending the encrypted payment result directly to the blockchain node.

步驟511,區塊鏈節點接收加密後的支付結果。 Step 511, the blockchain node receives the encrypted payment result.

步驟512,區塊鏈節點對加密後的支付結果進行解密,得到支付結果。 Step 512, the blockchain node decrypts the encrypted payment result to obtain the payment result.

步驟513,區塊鏈節點中的智慧合約利用查詢到的支付結果進行下一步處理。 Step 513, the smart contract in the blockchain node uses the queried payment result to perform the next step of processing.

圖6是根據本發明提供的資料獲取裝置的一個實施例的結構示意圖。如圖6所示,本發明提供的資料獲取裝置600包括: Fig. 6 is a schematic structural diagram of an embodiment of a data acquisition device according to the present invention. As shown in Figure 6, the data acquisition device 600 provided by the present invention includes:

資料查詢請求構建模組610,用於基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,資料查詢請求攜帶有資料查詢資訊; The data query request construction module 610 is used for querying information based on the obtained data, and constructing a data query request through a smart contract, where the data query request carries data query information;

資料查詢請求發送模組620,用於直接向與資料查詢資訊關聯的鏈外資料來源發送資料查詢請求,以使鏈外資料來源基於資料查詢請求得到資料查詢結果; A data query request sending module 620, configured to directly send a data query request to an off-chain data source associated with the data query information, so that the off-chain data source can obtain a data query result based on the data query request;

資料查詢結果接收模組630,用於接收鏈外資料來源發送的資料查詢結果。 The data query result receiving module 630 is used to receive the data query result sent by the data source outside the chain.

在本發明的實施例中,區塊鏈節點12能夠通過智慧合約,基於獲取的資料查詢資訊構建資料查詢請求,並可以直接向與資料查詢資訊關聯的鏈外資料來源13發送資料查詢請求,以獲取資料查詢結果,不需 要單獨建立預言機用戶端11或者預言機網路,而是通過區塊鏈節點12與鏈外資料來源13的直接通信,則可以獲取需要的資料,降低了區塊鏈節點12訪問鏈外資料的複雜性。 In the embodiment of the present invention, the block chain node 12 can construct a data query request based on the obtained data query information through a smart contract, and can directly send a data query request to an off-chain data source 13 associated with the data query information, in order to Obtain data query results without To establish the oracle client 11 or the oracle network separately, but through the direct communication between the blockchain node 12 and the data source 13 outside the chain, the required data can be obtained, reducing the need for the blockchain node 12 to access data outside the chain. complexity.

在本發明的一些實施例中,資料查詢資訊包括在鏈外資料來源13中的查詢索引。 In some embodiments of the present invention, the data query information includes a query index in the off-chain data source 13 .

在本發明的一些實施例中,查詢索引包括查詢準則或在鏈外資料來源13的存儲位址。 In some embodiments of the present invention, the query index includes query criteria or storage addresses in the off-chain data sources 13 .

在本發明的一些實施例中,若查詢索引包括查詢準則,資料查詢請求構建模組610: In some embodiments of the present invention, if the query index includes query criteria, the data query request construction module 610:

基於獲取的查詢準則和預先存儲的鏈外資料來源13的查詢位址,通過智慧合約構建資料查詢請求。 Based on the obtained query criteria and the pre-stored query address of the off-chain data source 13, a data query request is constructed through a smart contract.

在本發明的一些實施例中,資料查詢資訊還包括查詢授權簽名; In some embodiments of the present invention, the data query information also includes a query authorization signature;

其中,查詢授權簽名用於鏈外資料來源13在對查詢授權簽名驗證通過的情況下,基於資料查詢請求得到資料查詢結果。 Wherein, the query authorization signature is used for the data source 13 outside the chain to obtain the data query result based on the data query request when the verification of the query authorization signature is passed.

在本發明的一些實施例中,資料獲取裝置600還包括: In some embodiments of the present invention, the data acquisition device 600 also includes:

接收模組,用於接收用戶端11發送的資料查詢資訊。 The receiving module is used for receiving the data inquiry information sent by the client 11.

在本發明的一些實施例中,資料獲取裝置600還包括: In some embodiments of the present invention, the data acquisition device 600 also includes:

第一加密模組,用於對資料查詢請求進行加密,得到加密後的資料查詢請求; The first encryption module is used to encrypt the data query request to obtain the encrypted data query request;

其中,資料查詢請求發送模組620用於: Among them, the data inquiry request sending module 620 is used for:

直接向與資料查詢資訊關聯的鏈外資料來源13發送加密後的資料查詢請求。 Send the encrypted data query request directly to the off-chain data source 13 associated with the data query information.

在本發明的一些實施例中,資料查詢請求發送模組620用於: In some embodiments of the present invention, the data query request sending module 620 is used for:

通過安全傳輸層協議加密通信通道,直接向與資料查詢資訊關聯的鏈外資料來源13發送加密後的資料查詢請求。 The communication channel is encrypted through the secure transport layer protocol, and the encrypted data query request is directly sent to the out-of-chain data source 13 associated with the data query information.

在本發明的一些實施例中,資料查詢資訊還包括需要查詢的目標資料的資料指紋;目標資料的資料指紋是利用預設雜湊演算法對目標資料雜湊之後得到的資料; In some embodiments of the present invention, the data query information also includes the data fingerprint of the target data to be queried; the data fingerprint of the target data is the data obtained after hashing the target data using a preset hash algorithm;

其中,資料獲取裝置600還包括: Wherein, the data acquisition device 600 also includes:

資料指紋確定模組,用於通過智慧合約,利用預設雜湊演算法對資料查詢結果進行雜湊,得到資料查詢結果的資料指紋; The data fingerprint determination module is used to hash the data query results by using the preset hash algorithm through the smart contract to obtain the data fingerprint of the data query results;

處理模組,用於在通過智慧合約確定目標資料的資料指紋和資料查詢結果的資料指紋一致的情況下,通過智慧合約對資料查詢結果執行預設處理。 The processing module is used to perform preset processing on the data query result through the smart contract when the data fingerprint of the target data is determined to be consistent with the data fingerprint of the data query result through the smart contract.

在本發明的一些實施例中,資料查詢結果為加密後的資料查詢結果,資料獲取裝置600還包括: In some embodiments of the present invention, the data query result is an encrypted data query result, and the data acquisition device 600 also includes:

解密模組,用於對加密後的資料查詢結果進行解密,得到資料查詢結果。 The decryption module is used to decrypt the encrypted data query result to obtain the data query result.

根據本發明實施例的資料獲取裝置600的其他細節與以上結合圖2描述的根據本發明實施例的資料獲取方法200類似,在此不再贅述。 Other details of the data acquisition apparatus 600 according to the embodiment of the present invention are similar to the data acquisition method 200 according to the embodiment of the present invention described above in conjunction with FIG. 2 , and will not be repeated here.

圖7是根據本發明提供的資料獲取裝置的另一個實施例的結構示意圖。如圖7所示,本發明提供的資料獲取裝置700包括: Fig. 7 is a schematic structural diagram of another embodiment of a data acquisition device according to the present invention. As shown in Figure 7, the data acquisition device 700 provided by the present invention includes:

資料查詢請求接收模組710,用於接收區塊鏈節點12發送的資料查詢請求,資料查詢請求是區塊鏈節點12基於獲取的資料查詢資訊,通過智慧合約構建的,資料查詢請求攜帶有資料查詢資訊; The data query request receiving module 710 is used to receive the data query request sent by the blockchain node 12. The data query request is based on the obtained data query information of the blockchain node 12, and is constructed through a smart contract. The data query request carries data query information;

資料查詢結果確定模組720,用於基於資料查詢請求,得到資料查詢結果; The data query result determination module 720 is used to obtain the data query result based on the data query request;

資料查詢結果發送模組730,用於向區塊鏈節點12發送資料查詢結果。 The data query result sending module 730 is used to send the data query result to the block chain node 12.

在本發明的實施例中,區塊鏈節點12能夠通過智慧合約,基於獲取的資料查詢資訊構建資料查詢請求,並可以直接向與資料查詢資 訊關聯的鏈外資料來源13發送資料查詢請求,以獲取資料查詢結果,不需要單獨建立預言機用戶端11或者預言機網路,而是通過區塊鏈節點12與鏈外資料來源13的直接通信,則可以獲取需要的資料,降低了區塊鏈節點12訪問鏈外資料的複雜性。 In the embodiment of the present invention, the block chain node 12 can construct a data query request based on the obtained data query information through a smart contract, and can directly submit a request to the data query data The data source 13 outside the chain associated with the information sends a data query request to obtain the data query results. There is no need to establish a separate oracle machine client 11 or a network of oracle machines, but through the direct connection between the blockchain node 12 and the data source 13 outside the chain. communication, the required data can be obtained, which reduces the complexity of blockchain nodes 12 accessing data outside the chain.

在本發明的一些實施例中,資料查詢資訊包括在鏈外資料來源13中的查詢索引和查詢授權簽名; In some embodiments of the invention, the data query information includes the query index and query authorization signature in the off-chain data source 13;

其中,資料查詢結果確定模組720,包括: Wherein, the data query result determination module 720 includes:

在對資料查詢請求中攜帶的查詢授權簽名驗證通過的情況下,基於資料查詢請求中攜帶的查詢索引,得到與查詢索引匹配的資料查詢結果。 In the case that the verification of the query authorization signature carried in the data query request is passed, based on the query index carried in the data query request, a data query result matching the query index is obtained.

在本發明的一些實施例中,資料查詢結果確定模組720,用於: In some embodiments of the present invention, the data query result determination module 720 is used for:

確定查詢授權簽名在預設有效期內,和/或,攜帶有查詢授權簽名的資料請求的請求次數小於預設次數閾值。 It is determined that the query authorization signature is within the preset validity period, and/or, the number of requests for data requests carrying the query authorization signature is less than a preset number of times threshold.

在本發明的一些實施例中,資料獲取裝置700還包括: In some embodiments of the present invention, the data acquisition device 700 also includes:

第二加密模組,用於對資料查詢結果進行加密,得到加密後的資料查詢結果; The second encryption module is used to encrypt the data query result to obtain the encrypted data query result;

其中,資料查詢結果發送模組730,用於: Wherein, the data inquiry result sending module 730 is used for:

向區塊鏈節點12發送加密後的資料查詢結果。 Send the encrypted data query result to the block chain node 12.

在本發明的一些實施例中,資料查詢結果發送模組730,用於: In some embodiments of the present invention, the data query result sending module 730 is used for:

通過安全傳輸層協議加密通信通道,向區塊鏈節點12發送加密後的資料查詢結果。 The communication channel is encrypted through the secure transport layer protocol, and the encrypted data query result is sent to the blockchain node 12.

根據本發明實施例的資料獲取裝置700的其他細節與以上結合圖3描述的根據本發明實施例的資料獲取方法300類似,在此不再贅述。 Other details of the data acquisition apparatus 700 according to the embodiment of the present invention are similar to the data acquisition method 300 according to the embodiment of the present invention described above in conjunction with FIG. 3 , and will not be repeated here.

結合圖2至圖5描述的根據本發明實施例的資料獲取方法 和裝置可以由資料獲取設備來實現。圖8是根據本發明提供的資料獲取設備的一個實施例的結構示意圖。 The data acquisition method according to the embodiment of the present invention described in conjunction with FIGS. 2 to 5 The sum means can be realized by the data acquisition device. Fig. 8 is a schematic structural diagram of an embodiment of a data acquisition device according to the present invention.

資料獲取設備800可以包括處理器801以及存儲有電腦程式指令的記憶體802。 The data acquisition device 800 may include a processor 801 and a memory 802 storing computer program instructions.

具體地,上述處理器801可以包括中央處理器(Central Processing Unit,CPU),或者應用特定積體電路(Application Specific Integrated Circuit,ASIC),或者可以被配置成實施本發明實施例的一個或多個積體電路。 Specifically, the processor 801 may include a central processing unit (Central Processing Unit, CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement one or more of the embodiments of the present invention. integrated circuits.

記憶體802可以包括用於資料或指令的大量存放區。舉例來說而非限制,記憶體802可包括硬碟驅動器(Hard Disk Drive,HDD)、軟碟機、快閃記憶體、光碟、磁光碟、磁帶或通用序列匯流排(Universal Serial Bus,USB)驅動器或者兩個或更多個以上這些的組合。在合適的情況下,記憶體802可包括可移除或不可移除(或固定)的介質。在合適的情況下,記憶體802可在資料獲取設備800的內部或外部。在特定實施例中,記憶體802是非易失性固態記憶體。 Memory 802 may include a large number of storage areas for data or instructions. For example and not limitation, the memory 802 may include a hard disk drive (Hard Disk Drive, HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (USB) drive or a combination of two or more of the above. Memory 802 may include removable or non-removable (or fixed) media, where appropriate. The memory 802 may be internal or external to the data acquisition device 800 as appropriate. In a particular embodiment, memory 802 is a non-volatile solid-state memory.

在特定實施例中,記憶體802包括唯讀記憶體(Read-Only Memory,ROM)。在合適的情況下,該ROM可以是掩模程式設計的ROM、可程式化ROM(Programmable Read-Only Memory,PROM)、可抹除PROM(Erasable Programmable Read-Only Memory,EPROM)、電子可抹除PROM(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、電子可改寫ROM(Electrically Alterable Read-Only Memory,EAROM)或快閃記憶體或者兩個或更多個以上這些的組合。 In a specific embodiment, the memory 802 includes a read-only memory (Read-Only Memory, ROM). Where appropriate, the ROM can be mask programmed ROM, programmable ROM (Programmable Read-Only Memory, PROM), erasable PROM (Erasable Programmable Read-Only Memory, EPROM), electronically erasable PROM (Electrically-Erasable Programmable Read-Only Memory, EEPROM), Electronically Rewritable ROM (Electrically Alterable Read-Only Memory, EAROM) or flash memory or a combination of two or more of these.

記憶體可包括唯讀記憶體(ROM),隨機存取記憶體(Random Access Memory,RAM),磁片存儲介質設備,光存儲介質設備,快閃記憶體設備,電氣、光學或其他物理/有形的記憶體存放裝置。因此,通常,記憶體包括一個或多個編碼有包括電腦可執行指令的軟體的有形(非暫態)電腦可讀存儲介質(例如,記憶體設備),並且當該軟體被執 行(例如,由一個或多個處理器)時,其可操作來執行參考根據本公開的資料獲取的方法所描述的操作。 Memory may include read-only memory (ROM), random access memory (Random Access Memory, RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical/tangible memory storage device. Thus, in general, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software comprising computer-executable instructions, and when the software is executed When executed (eg, by one or more processors), it is operable to perform the operations described with reference to the method of material acquisition according to the present disclosure.

處理器801通過讀取並執行記憶體802中存儲的電腦程式指令,以實現上述實施例中的任意一種資料獲取方法。 The processor 801 reads and executes the computer program instructions stored in the memory 802 to implement any data acquisition method in the above-mentioned embodiments.

在一個示例中,資料獲取設備還可包括通信介面803和匯流排810。其中,如圖8所示,處理器801、記憶體802、通信介面803通過匯流排810連接並完成相互間的通信。 In an example, the data acquisition device may further include a communication interface 803 and a bus 810 . Wherein, as shown in FIG. 8 , the processor 801 , the memory 802 , and the communication interface 803 are connected through a bus 810 to complete mutual communication.

通信介面803,主要用於實現本發明實施例中各模組、裝置、單元和/或設備之間的通信。 The communication interface 803 is mainly used to realize the communication between various modules, devices, units and/or equipment in the embodiment of the present invention.

匯流排810包括硬體、軟體或兩者,將資料獲取設備的部件彼此耦接在一起。舉例來說而非限制,匯流排可包括高速圖形連接埠(Accelerated Graphics Port,AGP)或其他圖形匯流排、增強工業標準架構(Enhanced Industry Standard Architecture,EISA)匯流排、前側匯流排(Font Side Bus,FSB)、超傳送(Hyper Transport,HT)互連、工業標準架構(Industry Standard Architecture,ISA)匯流排、無限頻寬互連、低接腳計數(Low Pin Count,LPC)匯流排、記憶體匯流排、微通道架構(Micro Channel Architecture,MCA)匯流排、周邊組件互連(Peripheral Component Interconnect,PCI)匯流排、PCI-Express(PCI-X)匯流排、序列先進技術附接(Serial Advanced Technology Attachment,SATA)匯流排、視訊電子標準協會區域(VESA Local Bus,VLB)匯流排或其他合適的匯流排或者兩個或更多個以上這些的組合。在合適的情況下,匯流排810可包括一個或多個匯流排。儘管本發明實施例描述和示出了特定的匯流排,但本發明考慮任何合適的匯流排或互連。 Bus 810 includes hardware, software, or both, and couples the components of the data acquisition device to each other. By way of example and not limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (Font Side Bus) , FSB), hypertransport (Hyper Transport, HT) interconnection, Industry Standard Architecture (Industry Standard Architecture, ISA) bus, infinite bandwidth interconnection, low pin count (Low Pin Count, LPC) bus, memory Bus, Micro Channel Architecture (MCA) bus, Peripheral Component Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (Serial Advanced Technology Attachment (SATA) bus, VESA Local Bus (VLB) bus or other suitable bus or a combination of two or more of these. Bus bar 810 may include one or more bus bars, where appropriate. Although the embodiments of the invention describe and illustrate particular bus bars, the invention contemplates any suitable bus bars or interconnects.

另外,結合上述實施例中的資料獲取方法,本發明實施例可提供一種電腦存儲介質來實現。該電腦存儲介質上存儲有電腦程式指令;該電腦程式指令被處理器執行時實現上述實施例中的任意一種資料獲取方法。 In addition, in combination with the data acquisition method in the foregoing embodiments, embodiments of the present invention may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the data acquisition methods in the above-mentioned embodiments is implemented.

需要明確的是,本發明並不局限于上文所描述並在圖中示出的特定配置和處理。為了簡明起見,這裡省略了對已知方法的詳細描述。在上述實施例中,描述和示出了若干具體的步驟作為示例。但是,本發明的方法過程並不限於所描述和示出的具體步驟,本領域的技術人員可以在領會本發明的精神後,作出各種改變、修改和添加,或者改變步驟之間的順序。 It is to be understood that the invention is not limited to the specific arrangements and processes described above and shown in the drawings. For conciseness, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the sequence of steps after understanding the spirit of the present invention.

以上所述的結構框圖中所示的功能塊可以實現為硬體、軟體、固件或者它們的組合。當以硬體方式實現時,其可以例如是電子電路、應用特定積體電路(ASIC)、適當的固件、外掛程式、功能卡等等。當以軟體方式實現時,本發明的元素是被用於執行所需任務的程式或者程式碼片段。程式或者程式碼片段可以存儲在機器可讀介質中,或者通過載波中攜帶的資料信號在傳輸介質或者通信鏈路上傳送。“機器可讀介質”可以包括能夠存儲或傳輸資訊的任何介質。機器可讀介質的例子包括電子電路、半導體記憶體設備、ROM、快閃記憶體、可抹除ROM(Erasable Read-Only Memory,EROM)、軟磁碟、(Compact Disc Read-Only Memory)CD-ROM、光碟、硬碟、光纖介質、射頻(Radio frequencyRF)鏈路,等等。程式碼片段可以經由諸如網際網路、內聯網等的電腦網路被下載。 The functional blocks shown in the structural block diagrams above can be realized as hardware, software, firmware or a combination thereof. When implemented in hardware, it may be, for example, an electronic circuit, an application specific integrated circuit (ASIC), suitable firmware, a plug-in, a function card, or the like. When implemented in software, the elements of the invention are the programs or code segments used to perform the required tasks. Programs or program code segments may be stored on a machine-readable medium or transmitted over a transmission medium or communication link by a data signal carried in a carrier wave. "Machine-readable medium" may include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (Erasable Read-Only Memory, EROM), floppy disk, (Compact Disc Read-Only Memory) CD-ROM , CD, hard disk, fiber optic media, radio frequency (Radio frequencyRF) links, and so on. Code snippets may be downloaded via computer networks such as the Internet, Intranet, and the like.

還需要說明的是,本發明中提及的示例性實施例,基於一系列的步驟或者裝置描述一些方法或系統。但是,本發明不局限於上述步驟的順序,也就是說,可以按照實施例中提及的循序執行步驟,也可以不同於實施例中的順序,或者若干步驟同時執行。 It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is to say, the steps may be executed sequentially as mentioned in the embodiment, or may be different from the order in the embodiment, or several steps may be executed simultaneously.

上面參考根據本公開的實施例的方法、裝置(系統)和電腦程式產品的流程圖和/或框圖描述了本公開的各方面。應當理解,流程圖和/或框圖中的每個方框以及流程圖和/或框圖中各方框的組合可以由電腦程式指令實現。這些電腦程式指令可被提供給通用電腦、專用電腦、或其它可程式設計資料處理裝置的處理器,以產生一種機器,使得經由電腦 或其它可程式設計資料處理裝置的處理器執行的這些指令使能對流程圖和/或框圖的一個或多個方框中指定的功能/動作的實現。這種處理器可以是但不限於是通用處理器、專用處理器、特殊應用處理器或者現場可程式設計邏輯電路。還可理解,框圖和/或流程圖中的每個方框以及框圖和/或流程圖中的方框的組合,也可以由執行指定的功能或動作的專用硬體來實現,或可由專用硬體和電腦指令的組合來實現。 Aspects of the present disclosure are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each block in the flowchart and/or block diagrams, and combinations of blocks in the flowchart and/or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general purpose computer, special purpose computer, or other programmable data processing device to produce a machine that makes the These instructions, executed by a processor of a computer or other programmable data processing device, enable the implementation of the functions/actions specified in one or more blocks of the flowcharts and/or block diagrams. Such processors may be, but are not limited to, general purpose processors, special purpose processors, application specific processors, or field programmable logic circuits. It can also be understood that each block in the block diagrams and/or flowcharts and combinations of blocks in the block diagrams and/or flowcharts can also be realized by dedicated hardware for performing specified functions or actions, or can be implemented by It is realized by a combination of special hardware and computer instructions.

以上所述,僅為本發明的具體實施方式,所屬領域的技術人員可以清楚地瞭解到,為了描述的方便和簡潔,上述描述的系統、模組和單元的具體工作過程,可以參考前述方法實施例中的對應過程,在此不再贅述。應理解,本發明的保護範圍並不局限於此,任何熟悉本技術領域的技術人員在本發明揭露的技術範圍內,可輕易想到各種等效的修改或替換,這些修改或替換都應涵蓋在本發明的保護範圍之內。 The above is only a specific implementation of the present invention, and those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, modules and units described above can be implemented by referring to the aforementioned method The corresponding process in the example will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present invention, and these modifications or replacements should all be covered in within the protection scope of the present invention.

200:資料獲取方法 200: Data acquisition method

210:步驟 210: step

220:步驟 220: step

230:步驟 230: step

Claims (18)

一種資料獲取方法,應用於區塊鏈節點,包括:區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,所述資料查詢請求攜帶有所述資料查詢資訊;區塊鏈節點直接向與所述資料查詢資訊關聯的鏈外資料來源發送所述資料查詢請求,以使所述鏈外資料來源基於所述資料查詢請求得到資料查詢結果;區塊鏈節點接收所述鏈外資料來源發送的資料查詢結果;其中,所述資料查詢資訊包括在所述鏈外資料來源中的查詢索引。 A data acquisition method applied to a blockchain node, comprising: the blockchain node queries information based on the acquired data, constructs a data query request through a smart contract, and the data query request carries the data query information; the blockchain node Sending the data query request directly to the data source outside the chain associated with the data query information, so that the data source outside the chain can obtain the data query result based on the data query request; the block chain node receives the data outside the chain The data query result sent by the source; wherein, the data query information includes the query index in the out-of-chain data source. 如請求項1所述的方法,其特徵在於,所述查詢索引包括查詢準則或在所述鏈外資料來源的存儲位址。 The method according to claim 1, wherein the query index includes a query criterion or a storage address of the out-of-chain data source. 如請求項2所述的方法,其特徵在於,若所述查詢索引包括查詢準則,所述區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,包括:區塊鏈節點基於獲取的所述查詢準則和預先存儲的所述鏈外資料來源的查詢位址,通過智慧合約構建所述資料查詢請求。 The method as described in claim item 2, wherein, if the query index includes query criteria, the blockchain nodes query information based on the obtained data, and construct a data query request through a smart contract, including: the blockchain node based on The acquired query criteria and the pre-stored query address of the off-chain data source are used to construct the data query request through a smart contract. 如請求項1所述的方法,其特徵在於,所述資料查詢資訊還包括查詢授權簽名;其中,所述查詢授權簽名用於所述鏈外資料來源在對所述查詢授權簽名驗證通過的情況下,基於所述資料查詢請求得到所述資料查詢結果。 The method as described in claim 1, wherein the data query information also includes a query authorization signature; wherein, the query authorization signature is used when the off-chain data source passes the verification of the query authorization signature Next, the data query result is obtained based on the data query request. 如請求項1所述的方法,其特徵在於,所述區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求之前,所述方法還包括:區塊鏈節點接收用戶端發送的所述資料查詢資訊。 The method as described in claim item 1, wherein the blockchain node queries information based on the obtained data, and before constructing the data query request through the smart contract, the method also includes: the blockchain node receives the information sent by the client The data query information. 如請求項1所述的方法,其特徵在於,在所述區塊鏈節點直接向與所述資料查詢資訊關聯的鏈外資料來源發送所述資料查詢請求之前,所述方法還包括:區塊鏈節點對所述資料查詢請求進行加密,得到加密後的資料查詢請求;其中,所述區塊鏈節點直接向與所述資料查詢資訊關聯的鏈外資料來源發送所述資料查詢請求,包括:區塊鏈節點直接向與所述資料查詢資訊關聯的鏈外資料來源發送所述加密後的資料查詢請求。 The method according to claim 1, wherein, before the block chain node directly sends the data query request to an out-of-chain data source associated with the data query information, the method further includes: The chain node encrypts the data query request to obtain the encrypted data query request; wherein, the block chain node directly sends the data query request to an off-chain data source associated with the data query information, including: The blockchain node directly sends the encrypted data query request to an out-of-chain data source associated with the data query information. 如請求項6所述的方法,其特徵在於,所述區塊鏈節點直接向與所述資料查詢資訊關聯的鏈外資料來源發送所述加密後的資料查詢請求,包括:區塊鏈節點通過安全傳輸層協議加密通信通道,直接向與所述資料查詢資訊關聯的鏈外資料來源發送所述加密後的資料查詢請求。 The method as described in claim item 6, wherein the block chain node directly sends the encrypted data query request to an out-of-chain data source associated with the data query information, including: the block chain node passes The secure transport layer protocol encrypts the communication channel, and directly sends the encrypted data query request to the out-of-chain data source associated with the data query information. 如請求項1所述的方法,其特徵在於,所述資料查詢資訊還包括需要查詢的目標資料的資料指紋;所述目標資料的資料指紋是利用預設雜湊演算法對所述目標資料雜湊之後得到的資料;其中,在所述區塊鏈節點接收所述鏈外資料來源發送的資料查詢結果之後,所述方法還包括:區塊鏈節點通過所述智慧合約,利用所述預設雜湊演算法對所述資料查詢結果進行雜湊,得到所述資料查詢結果的資料指紋;區塊鏈節點在通過所述智慧合約確定所述目標資料的資料指紋和所述資料查詢結果的資料指紋一致的情況下,通過所述智慧合約對所述資料查詢結果執行預設處理。 The method as described in claim 1, wherein the data query information also includes the data fingerprint of the target data to be queried; the data fingerprint of the target data is obtained by hashing the target data using a preset hash algorithm The data obtained; wherein, after the block chain node receives the data query result sent by the data source outside the chain, the method further includes: the block chain node uses the preset hash algorithm through the smart contract The data query result is hashed by the method to obtain the data fingerprint of the data query result; when the blockchain node determines that the data fingerprint of the target data is consistent with the data fingerprint of the data query result through the smart contract Next, perform preset processing on the data query result through the smart contract. 如請求項1所述的方法,其特徵在於,所述資料查詢結果為加密後的資料查詢結果,所述方法還包括: 區塊鏈節點對所述加密後的資料查詢結果進行解密,得到所述資料查詢結果。 The method as described in claim 1, wherein the data query result is an encrypted data query result, and the method further includes: The blockchain node decrypts the encrypted data query result to obtain the data query result. 一種資料獲取方法,應用鏈外資料來源,包括:鏈外資料來源接收區塊鏈節點發送的資料查詢請求,所述資料查詢請求是所述區塊鏈節點基於獲取的資料查詢資訊通過智慧合約構建的,所述資料查詢請求攜帶有所述資料查詢資訊;鏈外資料來源基於所述資料查詢請求,得到資料查詢結果;鏈外資料來源向所述區塊鏈節點發送所述資料查詢結果;其中,所述資料查詢資訊包括在所述鏈外資料來源中的查詢索引。 A data acquisition method, using an off-chain data source, comprising: the off-chain data source receives a data query request sent by a blockchain node, and the data query request is constructed by the blockchain node through a smart contract based on the obtained data query information The data query request carries the data query information; the off-chain data source obtains the data query result based on the data query request; the off-chain data source sends the data query result to the blockchain node; wherein , the data query information includes a query index in the out-of-chain data source. 如請求項10所述的方法,其特徵在於,所述資料查詢資訊包括查詢授權簽名;其中,所述鏈外資料來源基於所述資料查詢請求,得到資料查詢結果,包括:鏈外資料來源在對所述資料查詢請求中攜帶的所述查詢授權簽名驗證通過的情況下,基於所述資料查詢請求中攜帶的所述查詢索引,得到與所述查詢索引匹配的資料查詢結果。 The method as described in claim 10, wherein the data query information includes a query authorization signature; wherein, the out-of-chain data source obtains a data query result based on the data query request, including: the out-of-chain data source is in If the verification of the query authorization signature carried in the data query request is passed, a data query result matching the query index is obtained based on the query index carried in the data query request. 如請求項11所述的方法,其特徵在於,鏈外資料來源對所述資料查詢請求中攜帶的所述查詢授權簽名驗證通過,包括:鏈外資料來源確定所述查詢授權簽名在預設有效期內,和/或,攜帶有所述查詢授權簽名的資料請求的請求次數小於預設次數閾值。 The method as described in claim item 11, wherein the verification of the query authorization signature carried in the data query request by the data source outside the chain includes: the data source outside the chain confirms that the query authorization signature is within the preset validity period and/or, the number of data requests carrying the query authorization signature is less than the preset number of times threshold. 如請求項10所述的方法,其特徵在於,所述鏈外資料來源向所述區塊鏈節點發送所述資料查詢結果之前,所述方法還包括:鏈外資料來源對所述資料查詢結果進行加密,得到加密後的資料查詢結果;其中,所述鏈外資料來源向所述區塊鏈節點發送所述資料查詢結果,包括:鏈外資料來源向所述區塊鏈節點發送所述加密後的資料查詢結果。 The method according to claim 10, wherein, before the data source outside the chain sends the data query result to the block chain node, the method further includes: the data query result from the data source outside the chain Encrypt to obtain encrypted data query results; wherein, the data source outside the chain sends the data query results to the block chain node, including: the data source outside the chain sends the encrypted data to the block chain node The subsequent data query results. 如請求項13所述的方法,其特徵在於,所述鏈外資料來源向所述區塊鏈節點發送所述加密後的資料查詢結果,包括:鏈外資料來源通過安全傳輸層協議加密通信通道,向所述區塊鏈節點發送所述加密後的資料查詢結果。 The method according to claim 13, wherein the data source outside the chain sends the encrypted data query result to the blockchain node, including: the data source outside the chain encrypts the communication channel through a secure transport layer protocol , sending the encrypted data query result to the blockchain node. 一種資料獲取裝置,應用於區塊鏈節點,包括:資料查詢請求構建模組,用於基於獲取的資料查詢資訊,通過智慧合約構建資料查詢請求,所述資料查詢請求攜帶有所述資料查詢資訊;資料查詢請求發送模組,用於直接向與所述資料查詢資訊關聯的鏈外資料來源發送所述資料查詢請求,以使所述鏈外資料來源基於所述資料查詢請求得到資料查詢結果;資料查詢結果接收模組,用於接收所述鏈外資料來源發送的資料查詢結果;其中,所述資料查詢資訊包括在所述鏈外資料來源中的查詢索引。 A data acquisition device, applied to a block chain node, comprising: a data query request construction module, used to query information based on the acquired data, and construct a data query request through a smart contract, the data query request carries the data query information ; A data query request sending module, configured to directly send the data query request to an off-chain data source associated with the data query information, so that the off-chain data source obtains a data query result based on the data query request; The data query result receiving module is used to receive the data query result sent by the out-of-chain data source; wherein, the data query information includes the query index in the out-of-chain data source. 一種資料獲取裝置,應用於鏈外資料來源,包括:資料查詢請求接收模組,用於接收區塊鏈節點發送的資料查詢請求,所述資料查詢請求是所述區塊鏈節點基於獲取的資料查詢資訊,通過智慧合約構建的,所述資料查詢請求攜帶有所述資料查詢資訊;資料查詢結果確定模組,用於基於所述資料查詢請求,得到資料查詢結果;資料查詢結果發送模組,用於向所述區塊鏈節點發送所述資料查詢結果;其中,所述資料查詢資訊包括在所述鏈外資料來源中的查詢索引。 A data acquisition device, which is applied to an out-of-chain data source, includes: a data query request receiving module, used to receive a data query request sent by a blockchain node, and the data query request is based on the data obtained by the blockchain node Query information is constructed through a smart contract, the data query request carries the data query information; the data query result determination module is used to obtain the data query result based on the data query request; the data query result sending module, It is used for sending the data query result to the blockchain node; wherein, the data query information includes a query index in the out-of-chain data source. 一種資料獲取設備,其特徵在於,所述設備包括:處理器以及存儲有電腦程式指令的記憶體;所述處理器執行所述電腦程式指令時實現如請求項1至14任意一項所述的資料獲取方法。 A data acquisition device, characterized in that the device includes: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it realizes any one of the requirements 1 to 14 Data acquisition method. 一種電腦存儲介質,其特徵在於,所述電腦存儲介質上存儲有電腦程式指令,所述電腦程式指令被處理器執行時實現如請求項1至14任意一項所述的資料獲取方法。 A computer storage medium, characterized in that computer program instructions are stored on the computer storage medium, and when the computer program instructions are executed by a processor, the data acquisition method described in any one of claims 1 to 14 is implemented.
TW110132686A 2020-09-03 2021-09-02 Data acquisition method, device, equipment and medium TWI797738B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010914632.4A CN112084234B (en) 2020-09-03 2020-09-03 Data acquisition method, device, equipment and medium
CN202010914632.4 2020-09-03

Publications (2)

Publication Number Publication Date
TW202211047A TW202211047A (en) 2022-03-16
TWI797738B true TWI797738B (en) 2023-04-01

Family

ID=73731893

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110132686A TWI797738B (en) 2020-09-03 2021-09-02 Data acquisition method, device, equipment and medium

Country Status (3)

Country Link
CN (1) CN112084234B (en)
TW (1) TWI797738B (en)
WO (1) WO2022048589A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112084234B (en) * 2020-09-03 2024-05-17 ***股份有限公司 Data acquisition method, device, equipment and medium
CN112651037B (en) * 2020-12-31 2024-01-16 深圳前海微众银行股份有限公司 Out-of-chain data access method and system for block chain system
CN112835974B (en) * 2021-01-07 2022-06-17 杭州链城数字科技有限公司 Method and device for credibly acquiring and storing evidence of data outside link
CN113379550B (en) * 2021-06-29 2023-04-14 杭州复杂美科技有限公司 Block execution method, computer device and storage medium
CN115567312B (en) * 2022-10-13 2023-07-18 佛山众陶联供应链服务有限公司 Alliance chain data authority management system and method capable of meeting various scenes
CN116055493B (en) * 2023-03-31 2023-06-23 北京比格大数据有限公司 Cross-architecture data acquisition method, gateway node and cross-architecture platform

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190179821A1 (en) * 2017-08-01 2019-06-13 Zhongan Information Technology Service Co., Ltd. Method and system for accessing out-of-chain data based on consortium block chain
CN110009494A (en) * 2019-03-18 2019-07-12 阿里巴巴集团控股有限公司 A kind of method and device monitoring the transaction content in block chain
TW201937417A (en) * 2018-02-27 2019-09-16 香港商阿里巴巴集團服務有限公司 Interaction method, device and system of cross block chain and electronic equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11093558B2 (en) * 2017-11-14 2021-08-17 International Business Machines Corporation Providing accountability of blockchain queries
CN111429134A (en) * 2018-12-21 2020-07-17 北京京东尚科信息技术有限公司 Data transaction method and device based on block chain
CN110474903B (en) * 2019-08-15 2022-04-01 广州蚁比特区块链科技有限公司 Trusted data acquisition method and device and block link point
CN111045812A (en) * 2019-12-24 2020-04-21 山东爱城市网信息技术有限公司 Block chain intelligent contract reverse calling method, equipment and medium
CN111163093A (en) * 2019-12-30 2020-05-15 杭州趣链科技有限公司 Method and device for acquiring external data from external data source in block chain of alliance
CN112084234B (en) * 2020-09-03 2024-05-17 ***股份有限公司 Data acquisition method, device, equipment and medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190179821A1 (en) * 2017-08-01 2019-06-13 Zhongan Information Technology Service Co., Ltd. Method and system for accessing out-of-chain data based on consortium block chain
TW201937417A (en) * 2018-02-27 2019-09-16 香港商阿里巴巴集團服務有限公司 Interaction method, device and system of cross block chain and electronic equipment
CN110009494A (en) * 2019-03-18 2019-07-12 阿里巴巴集团控股有限公司 A kind of method and device monitoring the transaction content in block chain

Also Published As

Publication number Publication date
WO2022048589A1 (en) 2022-03-10
CN112084234B (en) 2024-05-17
CN112084234A (en) 2020-12-15
TW202211047A (en) 2022-03-16

Similar Documents

Publication Publication Date Title
TWI797738B (en) Data acquisition method, device, equipment and medium
US11356280B2 (en) Personal device security using cryptocurrency wallets
CN110692214B (en) Method and system for ownership verification using blockchain
US20230196362A1 (en) Systems, apparatus and methods for secure electrical communication of biometric personal identification information to validate the identity of an individual
US20210367795A1 (en) Identity-Linked Authentication Through A User Certificate System
TWI683567B (en) Security verification method, device, server and terminal
US20190173873A1 (en) Identity verification document request handling utilizing a user certificate system and user identity document repository
CN108768933B (en) Autonomous supervision digital identity authentication system on block chain platform
JP2023502346A (en) Quantum secure networking
CN115549887A (en) Determination of a common secret and hierarchical deterministic keys for the secure exchange of information
KR20120053929A (en) The agent system for digital signature using sign private key with double encryption and method thereof features to store in web storage
US20210306135A1 (en) Electronic device within blockchain based pki domain, electronic device within certification authority based pki domain, and cryptographic communication system including these electronic devices
CN110598433A (en) Anti-counterfeiting information processing method and device based on block chain
CN109302286B (en) Fido equipment key index generation method
CN114268447B (en) File transmission method and device, electronic equipment and computer readable medium
US20170330177A1 (en) Payment terminal authentication
CN114238915A (en) Digital certificate adding method and device, computer equipment and storage medium
WO2016165662A1 (en) Mobile phone quasi-digital certificate subsystem, and system and method thereof
US11343078B2 (en) System and method for secure input at a remote service
CN118233218A (en) Remote authentication system and method based on distributed trusted execution environment application
KR20200004631A (en) User Authentication using ECC and Hash
CN116368507A (en) Method and system for authenticating a payment transaction using a user device
WO2015110037A1 (en) Dual-channel identity authentication method and system