TWI810464B - A blockchain-based transaction method, a blockchain-based transaction device and electronic device - Google Patents

A blockchain-based transaction method, a blockchain-based transaction device and electronic device Download PDF

Info

Publication number
TWI810464B
TWI810464B TW109119039A TW109119039A TWI810464B TW I810464 B TWI810464 B TW I810464B TW 109119039 A TW109119039 A TW 109119039A TW 109119039 A TW109119039 A TW 109119039A TW I810464 B TWI810464 B TW I810464B
Authority
TW
Taiwan
Prior art keywords
transaction
target
block chain
user terminal
node
Prior art date
Application number
TW109119039A
Other languages
Chinese (zh)
Other versions
TW202147225A (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 鴻海精密工業股份有限公司
Priority to TW109119039A priority Critical patent/TWI810464B/en
Publication of TW202147225A publication Critical patent/TW202147225A/en
Application granted granted Critical
Publication of TWI810464B publication Critical patent/TWI810464B/en

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The present disclosure relates to a blockchain-based transaction method, a blockchain-based transaction device, and an electronic device. In present disclosure, a server filters out a target transaction corresponding to an associated account of the transaction from a transaction pool and a blockchain, and determines whether the target transaction is correct by a calculation of the target transaction, and determines the target transaction is correct when the calculation of the target transaction is correct. The server further determines whether the target transaction is correct by a balance of the associated account when the target transaction is not filtered out from the transaction pool and the blockchain. When the target transaction is correct and a confirmation information that the target transaction is successful is sent by a terminal, the transaction is packaged into a block chained into the blockchain by the node, thus improving a processing efficiency of the blockchain and meeting the business needs of the blockchain transaction.

Description

基於區塊鏈的交易方法、裝置及電子設備 Transaction method, device and electronic device based on block chain

本發明涉及區塊鏈技術領域,具體涉及一種基於區塊鏈的交易方法、裝置及電子設備。 The present invention relates to the technical field of blockchain, in particular to a transaction method, device and electronic equipment based on blockchain.

比特幣在2008年問世之後,區塊鏈技術也隨之日新月異發展,然而,目前現有的區塊鏈技術仍無法達到商業等級的應用所需每秒交易次數,即每秒30000萬筆交易次數。因而,現有區塊鏈的處理效率低下。 After the advent of Bitcoin in 2008, blockchain technology has also developed rapidly. However, the current existing blockchain technology is still unable to achieve the number of transactions per second required by commercial-grade applications, that is, 300 million transactions per second. Therefore, the processing efficiency of the existing blockchain is low.

鑒於以上內容,有必要提出一種基於區塊鏈的交易方法、裝置及電子設備,以提高區塊鏈在處理交易時的處理效率,並達到在商業上的交易次數需求。 In view of the above, it is necessary to propose a blockchain-based transaction method, device, and electronic equipment to improve the processing efficiency of the blockchain in processing transactions and meet the commercial transaction frequency requirements.

本申請的第一方面提供一種基於區塊鏈的交易方法,所述方法包括:伺服器接收使用者終端發送的交易,其中所述交易包括交易類別、關聯帳號及交易狀態;所述伺服器從所述交易中提取出交易類別、關聯帳號及交易狀態,並判斷所述交易類別是否為金融轉帳; 當所述交易類別是為金融轉帳時,所述伺服器藉由節點訪問交易池及/或區塊鏈並判斷從所述交易池及/或區塊鏈中是否篩選出與所述關聯帳號有關的目標交易;當篩選出與所述關聯帳號有關的目標交易時,所述伺服器根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端以供所述使用者終端進行確認;及所述伺服器接收使用者終端發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中。 The first aspect of the present application provides a transaction method based on block chain, the method includes: the server receives the transaction sent by the user terminal, wherein the transaction includes transaction type, associated account number and transaction status; Extracting the transaction category, associated account number and transaction status from the transaction, and judging whether the transaction category is a financial transfer; When the transaction type is financial transfer, the server accesses the transaction pool and/or block chain through the node and judges whether to screen the associated account from the transaction pool and/or block chain target transaction; when the target transaction related to the associated account is screened out, the server calculates the result of the target transaction in sequence according to the time sequence and judges whether the transaction is correct according to the result of the target transaction, and it will be correct The transaction status of the transaction is marked as pending on-chain, and the marked transaction is sent to the user terminal for confirmation by the user terminal; and the server receives the transaction success sent by the user terminal or Confirmation information of transaction failure, and when receiving confirmation information of successful transaction, mark the transaction status of the transaction as confirmed and package the transaction into a block and chain it to the block chain by the node .

優選地,所述方法還包括:當所述交易類別是為交易記錄保存時,所述伺服器藉由所述節點訪問所述交易池及/或區塊鏈,並從所述交易池及/或區塊鏈中篩選出與所述交易相關聯的所有目標交易,根據時間順序依次計算所述目標交易的結果,並將計算結果正確的目標交易所對應的交易藉由節點將打包成區塊上鏈到所述區塊鏈中。 Preferably, the method further includes: when the transaction type is reserved for transaction records, the server accesses the transaction pool and/or block chain through the node, and obtains from the transaction pool and/or Or filter out all target transactions associated with the transaction in the blockchain, calculate the results of the target transactions in sequence according to time, and package the transactions corresponding to the target transactions with correct calculation results into blocks by the node be uploaded to the blockchain.

優選地,所述方法還包括:當沒有篩選出與所述關聯帳號有關的目標交易時,所述伺服器藉由所述節點從所述區塊鏈中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端以供所述使用者終端進行確認。 Preferably, the method further includes: when no target transaction related to the associated account is screened out, the server uses the node to read the balance of the associated account of the transaction from the blockchain And judge whether the transaction is correct according to the balance of the associated account, mark the transaction status of the correct transaction as pending on-chain, and send the marked transaction to the user terminal for the user terminal Undergo verification.

優選地,所述方法還包括:所述伺服器在接收到交易失敗的資訊時將所述交易的交易狀態標記為失敗,並藉由所述節點將標記後的所述交易發送給使用者終端。 Preferably, the method further includes: the server marks the transaction status of the transaction as failed when receiving the information of transaction failure, and sends the marked transaction to the user terminal through the node .

優選地,所述伺服器根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確包括:根據時間順序依次計算所述目標交易的內容是否一致;在所述目標交易的內容一致時確定所述交易為正確;及在所述交易的內容不一致時確定所述交易不正確。 Preferably, the server sequentially calculates the result of the target transaction according to the time sequence and judges whether the transaction is correct according to the result of the target transaction includes: sequentially calculating whether the content of the target transaction is consistent according to the time sequence; determining that the transaction is correct when the content of the target transaction is consistent; and determining that the transaction is incorrect when the content of the transaction is inconsistent.

優選地,所述在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中包括:所述伺服器將交易狀態為待上鏈的所述交易藉由所述節點傳送至所述交易池中,當接收到使用者終端發送的交易成功的確認資訊時藉由所述節點從所述交易池中提取出所述交易,並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中。 Preferably, marking the transaction status of the transaction as confirmed when receiving the confirmation information of the transaction success and packaging the transaction into a block and chaining the transaction to the block chain by the node includes: The server transmits the transaction whose transaction status is pending on-chain to the transaction pool through the node, and when receiving the confirmation information of the successful transaction sent by the user terminal, the node transfers the transaction from the The transaction is extracted from the transaction pool, and the node packages the transaction into a block and chains it to the block chain.

優選地,所述方法還包括:所述伺服器將不正確的交易的交易狀態標記為失敗,並將標記後的交易發送給所述使用者終端,並通知所述使用者終端刪除所述交易。 Preferably, the method further includes: the server marks the transaction status of the incorrect transaction as failure, sends the marked transaction to the user terminal, and notifies the user terminal to delete the transaction .

優選地,所述伺服器藉由所述節點從所述區塊鏈中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確包括:當所述交易的關聯帳號中的轉帳帳號的餘額不小於轉帳金額時確定所述交易正確,否則確定所述交易不正確。 Preferably, the server uses the node to read the balance of the associated account of the transaction from the block chain and judge whether the transaction is correct according to the balance of the associated account includes: when the transaction When the balance of the transfer account in the associated account is not less than the transfer amount, it is determined that the transaction is correct; otherwise, it is determined that the transaction is incorrect.

本申請的第二方面提供一種一種基於區塊鏈的交易裝置,所述裝置包括:接收模組,用於接收使用者終端發送的交易,其中所述交易包括交易類別、關聯帳號及交易狀態;交易類別判斷模組,用於從所述交易中提取出交易類別、關聯帳號及交易狀態,並判斷所述交易類別是否為金融轉帳; 篩選模組,用於當所述交易類別是為金融轉帳時,藉由節點訪問交易池及/或區塊鏈並判斷從所述交易池及/或區塊鏈中是否篩選出與所述關聯帳號有關的目標交易;交易結果判斷模組,用於當篩選出與所述關聯帳號有關的目標交易時,根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端以供所述使用者終端進行確認;及上鏈模組,用於接收使用者終端發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中。 The second aspect of the present application provides a transaction device based on blockchain, the device includes: a receiving module for receiving a transaction sent by a user terminal, wherein the transaction includes a transaction category, an associated account number and a transaction status; A transaction category judging module, used to extract the transaction category, associated account number and transaction status from the transaction, and determine whether the transaction category is a financial transfer; A screening module, used to access the transaction pool and/or block chain through the node when the transaction type is financial transfer, and judge whether to filter out the associated transaction pool and/or block chain from the transaction pool and/or block chain Account-related target transactions; a transaction result judging module, used to calculate the results of the target transactions in sequence according to the time sequence and judge the target transactions according to the results of the target transactions Whether the transaction is correct, mark the transaction status of the correct transaction as pending on-chain, and send the marked transaction to the user terminal for confirmation by the user terminal; and an on-chain module for Receive confirmation information of transaction success or transaction failure sent by the user terminal, and when receiving confirmation information of transaction success, mark the transaction status of the transaction as confirmed and package the transaction into a block by the node be uploaded to the blockchain.

本申請的協力廠商面提供一種電子設備,所述電子設備包括處理器及記憶體,所述處理器用於執所述行記憶體中存儲的電腦程式時實現所述基於區塊鏈的交易方法。 The third aspect of the present application provides an electronic device, the electronic device includes a processor and a memory, and the processor is used to implement the blockchain-based transaction method when executing a computer program stored in the memory.

本案中所述伺服器當從所述交易池及區塊鏈中篩選出與所述交易的關聯帳號有關的目標交易並在目標交易的計算結果正確時確定所述交易正確,及當從所述交易池及區塊鏈中沒有篩選出與所述交易的關聯帳號有關的目標交易時,根據關聯帳號的餘額判斷出所述交易是否正確,及在所述交易正確時及接收到使用者終端發送地交易成功的確認資訊時藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中,從而提高區塊鏈的處理效率,滿足區塊鏈在商業上的交易的次數需求。 In this case, when the server screens out the target transaction related to the account associated with the transaction from the transaction pool and the block chain and determines that the transaction is correct when the calculation result of the target transaction is correct, and When the target transaction related to the associated account of the transaction is not screened out in the transaction pool and the block chain, it is judged whether the transaction is correct according to the balance of the associated account, and when the transaction is correct and the transaction is received from the user terminal When confirming the success of the transaction, the node packages the transaction into a block and chains it to the blockchain, thereby improving the processing efficiency of the blockchain and meeting the number of commercial transactions of the blockchain need.

1:使用者終端 1: User terminal

2:伺服器 2: Server

3:節點 3: node

4:交易池 4: Trading pool

5:區塊鏈 5: Blockchain

30:基於區塊鏈的交易裝置 30: Blockchain-based transaction device

301:接收模組 301: Receiving module

302:交易類別判斷模組 302: Transaction category judgment module

303:篩選模組 303: Screening modules

304:交易結果判斷模組 304: Transaction result judgment module

305:上鏈模組 305: Winding module

306:通知模組 306:Notification module

6:電子設備 6: Electronic equipment

61:記憶體 61: memory

62:處理器 62: Processor

63:電腦程式 63: Computer program

S11-S18:步驟 S11-S18: Steps

圖1為本發明一實施方式中基於區塊鏈的交易方法的流程圖。 Fig. 1 is a flowchart of a blockchain-based transaction method in an embodiment of the present invention.

圖2為本發明一實施方式中基於區塊鏈的交易方法的應用環境圖。 Fig. 2 is an application environment diagram of a blockchain-based transaction method in an embodiment of the present invention.

圖3為本發明一實施方式中基於區塊鏈的交易裝置的結構圖。 Fig. 3 is a structural diagram of a blockchain-based transaction device in an embodiment of the present invention.

圖4為本發明一實施方式中電子設備的示意圖。 FIG. 4 is a schematic diagram of an electronic device in an embodiment of the present invention.

為了能夠更清楚地理解本發明的上述目的、特徵和優點,下面結合附圖和具體實施例對本發明進行詳細描述。需要說明的是,在不衝突的情況下,本申請的實施例及實施例中的特徵可以相互組合。 In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.

在下面的描述中闡述了很多具體細節以便於充分理解本發明,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。 Many specific details are set forth in the following description to facilitate a full understanding of the present invention, and the described embodiments are only some of the embodiments of the present invention, rather than all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

除非另有定義,本文所使用的所有的技術和科學術語與屬於本發明的技術領域的技術人員通常理解的含義相同。本文中在本發明的說明書中所使用的術語只是為了描述具體的實施例的目的,不是旨在於限制本發明。 Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of the invention. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.

優選地,本發明基於區塊鏈的交易方法應用在一個或者多個電子設備中。所述電子設備是一種能夠按照事先設定或存儲的指令,自動進行數值計算和/或資訊處理的設備,其硬體包括但不限於微處理器、專用積體電路(Application Specific Integrated Circuit,ASIC)、可程式設計閘陣列(Field-Programmable Gate Array,FPGA)、數文書處理器(Digital Signal Processor,DSP)、嵌入式設備等。 Preferably, the blockchain-based transaction method of the present invention is applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and/or information processing according to pre-set or stored instructions, and its hardware includes but not limited to microprocessors, Application Specific Integrated Circuits (ASIC) , Programmable Gate Array (Field-Programmable Gate Array, FPGA), Digital Signal Processor (Digital Signal Processor, DSP), embedded devices, etc.

所述電子設備可以是桌上型電腦、筆記型電腦、平板電腦及雲端伺服器等計算設備。所述設備可以與使用者藉由鍵盤、滑鼠、遙控器、觸控板或聲控設備等方式進行人機交互。 The electronic device may be a computing device such as a desktop computer, a notebook computer, a tablet computer, or a cloud server. The device can perform human-computer interaction with the user through keyboard, mouse, remote controller, touch panel or voice control device.

實施例1 Example 1

圖1是本發明一實施方式中基於區塊鏈的交易方法的流程圖。根據不同的需求,所述流程圖中步驟的順序可以改變,某些步驟可以省略。 Fig. 1 is a flowchart of a blockchain-based transaction method in an embodiment of the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

參閱圖1所示,所述基於區塊鏈的交易方法具體包括以下步驟: Referring to Figure 1, the blockchain-based transaction method specifically includes the following steps:

步驟S11,伺服器2接收使用者終端1發送的交易,其中所述交易包括交易類別、關聯帳號及交易狀態。 Step S11 , the server 2 receives the transaction sent by the user terminal 1 , wherein the transaction includes the transaction type, associated account number and transaction status.

請參考圖2,所示為本發明一實施方式中基於區塊鏈的交易方法的應用環境圖。所述方法應用在伺服器2及節點3中。本實施方式中,所述伺服器2及節點3為兩個不同的設備,所述伺服器2與所述節點3通訊連接。在另一個實施方式中,所述伺服器2及節點3為同一設備。所述伺服器2與所述使用者終端1之間通訊連接,並接收所述使用者終端1發送的交易。本實施方式中,所述伺服器2可以與多個使用者終端1通訊連接,並接收每一使用者終端1發送的交易。本實施方式中,所述伺服器2根據業務量需求可以擴展為多個。所述節點3分別與交易池4及區塊鏈5通訊連接,並能夠訪問所述交易池4及所述區塊鏈5。本實施方式中,所述節點3有多個,所述伺服器2藉由不同的節點3接入所述交易池4及所述區塊鏈5。本實施方式中,所述交易池4及區塊鏈5中存儲各種交易的交易記錄。本實施方式中,所述伺服器2與所述節點3之間,所述使用者終端1與所述伺服器2之間,所述節點與所述交易池之間,所述節點3與所述區塊鏈5之間可以藉由4G/5G網路通訊連接。 Please refer to FIG. 2 , which shows an application environment diagram of a blockchain-based transaction method in an embodiment of the present invention. The method is applied in the server 2 and the node 3 . In this embodiment, the server 2 and the node 3 are two different devices, and the server 2 and the node 3 are connected by communication. In another embodiment, the server 2 and the node 3 are the same device. The server 2 communicates with the user terminal 1 and receives transactions sent by the user terminal 1 . In this embodiment, the server 2 can communicate with multiple user terminals 1 and receive transactions sent by each user terminal 1 . In this embodiment, the server 2 can be expanded into multiples according to business volume requirements. The nodes 3 are connected to the transaction pool 4 and the block chain 5 respectively, and can access the transaction pool 4 and the block chain 5 . In this embodiment, there are multiple nodes 3, and the server 2 accesses the transaction pool 4 and the blockchain 5 through different nodes 3. In this embodiment, transaction records of various transactions are stored in the transaction pool 4 and the block chain 5 . In this embodiment, between the server 2 and the node 3, between the user terminal 1 and the server 2, between the node and the transaction pool, between the node 3 and the Blockchains 5 can be connected through 4G/5G network communication.

本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝,並將封裝後的所述交易發送給所述伺服器2。本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝包括:將所述交易封裝成包含交易編號、交易狀態、交易類別、關聯帳號、交易內容、檢查碼的交易。本實施方式中,所述交易編號用於標識交易。所述交易編號為由字母與數位組成的編號,例如,所述交易編號可以表示為“Tx4939”。所述交易狀態用於指示交易的狀態。本實施方式中,所述交易狀態包括發佈中、待上鏈、已確認及失敗。所述交易類別用於指示交易的類型。本實施方式中,所述交易類別包括金融轉帳及交易記錄保存。所述關聯帳號用於指示所述交易所關聯的帳號,例如,所述關聯帳號可以表示為“用戶帳號A”、“用戶帳號B”。所述檢查碼用於檢查所 述交易的正確性。本實施方式中,所述檢查碼為雜湊(Hash)值。本實施方式中,使用者終端1將交易發送給所述伺服器2時,所述交易的狀態為發佈中。 In this embodiment, the user terminal 1 packages the transaction according to a preset method, and sends the packaged transaction to the server 2 . In this embodiment, the user terminal 1 packaging the transaction according to a preset method includes: packaging the transaction into a transaction including transaction number, transaction status, transaction category, associated account number, transaction content, and check code. In this embodiment, the transaction number is used to identify the transaction. The transaction number is a number composed of letters and digits, for example, the transaction number may be expressed as "Tx4939". The transaction status is used to indicate the status of the transaction. In this embodiment, the transaction status includes publishing, waiting to be uploaded, confirmed and failed. The transaction category is used to indicate the type of transaction. In this embodiment, the transaction category includes financial transfer and transaction record preservation. The associated account is used to indicate the account associated with the transaction, for example, the associated account may be expressed as "user account A" and "user account B". The check code is used to check the correctness of the transaction. In this embodiment, the check code is a hash (Hash) value. In this embodiment, when the user terminal 1 sends the transaction to the server 2, the status of the transaction is publishing.

步驟S12,所述伺服器2從所述交易中提取出交易類別、關聯帳號及交易狀態,並判斷所述交易類別是否為金融轉帳。本實施方式中,當確定所述交易類別為金融轉帳時執行步驟S13,當確定所述交易類別為交易記錄保存時執行步驟S18。 Step S12, the server 2 extracts the transaction type, associated account number and transaction status from the transaction, and determines whether the transaction type is financial transfer. In this embodiment, step S13 is executed when the transaction type is determined to be financial transfer, and step S18 is executed when the transaction type is determined to be transaction record preservation.

步驟S13,所述伺服器2藉由節點3訪問交易池4及/或區塊鏈5並判斷從所述交易池4及/或區塊鏈5中是否篩選出與所述關聯帳號有關的目標交易。本實施方式中,當篩選出與所述關聯帳號有關的目標交易時執行步驟S14,否則執行步驟S15。 Step S13, the server 2 accesses the transaction pool 4 and/or block chain 5 through the node 3 and judges whether the target related to the associated account is screened out from the transaction pool 4 and/or block chain 5 trade. In this embodiment, step S14 is performed when the target transaction related to the associated account is screened out, otherwise step S15 is performed.

步驟S14,所述伺服器2根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。本實施方式中,執行完所述步驟S14之後執行步驟S16。 Step S14, the server 2 sequentially calculates the result of the target transaction according to the time sequence and judges whether the transaction is correct according to the result of the target transaction, marks the transaction status of the correct transaction as pending, and marks The subsequent transaction is sent to the user terminal 1 for confirmation by the user terminal 1 . In this embodiment, step S16 is executed after step S14 is executed.

例如,當確定所述交易的關聯帳號為用戶帳號A及用戶帳號B時,所述伺服器2藉由節點3訪問交易池4及/或區塊鏈5,並篩選出與用戶帳號A及用戶帳號B相關的目標交易,並根據時間順序依次計算所述目標交易的結果,根據所述目標交易的結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。 For example, when it is determined that the associated accounts of the transaction are user account A and user account B, the server 2 accesses the transaction pool 4 and/or the block chain 5 through the node 3, and screens out transactions related to user account A and user account B. The target transaction related to account B, and calculate the result of the target transaction in sequence according to the time sequence, judge whether the transaction is correct according to the result of the target transaction, mark the transaction status of the correct transaction as pending, and mark The subsequent transaction is sent to the user terminal 1 for confirmation by the user terminal 1 .

本實施方式中,所述伺服器2根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確包括:根據時間順序依次計算所述目標交易的內容是否一致;在所述目標交易的內容一致時確定所述交易為正確;及在所述交易的內容不一致時確定所述交易不正確。 In this embodiment, the server 2 sequentially calculates the result of the target transaction according to the time sequence and judges whether the transaction is correct according to the result of the target transaction includes: sequentially calculating whether the content of the target transaction is consistent according to the time sequence ; determining that the transaction is correct when the content of the target transaction is consistent; and determining that the transaction is incorrect when the content of the transaction is inconsistent.

步驟S15,所述伺服器2藉由節點3從所述區塊鏈5中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確,將正 確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。本實施方式中,執行完所述步驟S15之後執行步驟S16。 Step S15, the server 2 uses the node 3 to read the balance of the associated account of the transaction from the block chain 5 and judge whether the transaction is correct according to the balance of the associated account, and will The transaction status of the correct transaction is marked as pending, and the marked transaction is sent to the user terminal 1 for the user terminal 1 to confirm. In this embodiment, step S16 is executed after step S15 is executed.

本實施方式中,所述伺服器2藉由節點3從所述區塊鏈5中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確包括:當所述交易的關聯帳號中的轉帳帳號的餘額不小於轉帳金額時確定所述交易正確,否則確定所述交易不正確。 In this embodiment, the server 2 uses the node 3 to read the balance of the associated account of the transaction from the block chain 5 and judge whether the transaction is correct according to the balance of the associated account. If the balance of the transfer account in the associated account of the above transaction is not less than the transfer amount, it is determined that the transaction is correct; otherwise, it is determined that the transaction is incorrect.

步驟S16,所述伺服器2接收使用者終端1發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中。 Step S16, the server 2 receives the confirmation information of transaction success or transaction failure sent by the user terminal 1, and when receiving the confirmation information of transaction success, marks the transaction status of the transaction as confirmed and through the The node 3 packages the transaction into a block and chains it into the block chain 5 .

本實施方式中,所述在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中包括:伺服器2將交易狀態為待上鏈的交易藉由節點3傳送至交易池4中,當接收到使用者終端1發送的交易成功的確認資訊時藉由節點3從所述交易池4中提取出所述交易,並藉由節點3將所述交易打包成區塊上鏈到所述區塊鏈5中。 In this embodiment, when the confirmation information of the successful transaction is received, the transaction status of the transaction is marked as confirmed and the node 3 packages the transaction into a block and chains it to the block chain 5 includes: the server 2 sends the transaction whose transaction status is to be linked to the chain to the transaction pool 4 through the node 3, and when receiving the confirmation information of the successful transaction sent by the user terminal 1, the node 3 from the transaction The transaction is extracted from the pool 4, and the transaction is packaged into a block and linked to the block chain 5 by the node 3.

步驟S17,所述伺服器2在接收到交易失敗的資訊時將所述交易的交易狀態標記為失敗,並藉由所述節點3將標記後的所述交易發送給使用者終端1。 Step S17 , the server 2 marks the transaction status of the transaction as failed when receiving the transaction failure information, and sends the marked transaction to the user terminal 1 through the node 3 .

步驟S18,所述伺服器2藉由節點3訪問交易池4及/或區塊鏈5,並從所述交易池4及/或區塊鏈5中篩選出與所述交易相關聯的所有目標交易,根據時間順序依次計算所述目標交易的結果,並將計算結果正確的目標交易所對應的交易藉由節點3將打包成區塊上鏈到所述區塊鏈5中。 Step S18, the server 2 accesses the transaction pool 4 and/or block chain 5 through the node 3, and screens out all targets associated with the transaction from the transaction pool 4 and/or block chain 5 For transactions, the results of the target transactions are calculated sequentially according to the time sequence, and the transactions corresponding to the target transactions with correct calculation results are packaged into blocks by the node 3 and uploaded to the blockchain 5 .

本實施方式中,所述方法還包括:伺服器2將不正確的交易的交易狀態標記為失敗,並將標記後的交易發送給使用者終端1,並通知所述使用者終端1刪除所述交易。 In this embodiment, the method further includes: the server 2 marks the transaction status of the incorrect transaction as failure, sends the marked transaction to the user terminal 1, and notifies the user terminal 1 to delete the trade.

本案中所述伺服器2當從所述交易池4及區塊鏈5中篩選出與所述交易的關聯帳號有關的目標交易並在目標交易的計算結果正確時確定所述交易正確,及當從所述交易池4及區塊鏈5中沒有篩選出與所述交易的關聯帳號有關的目標交易時,根據關聯帳號的餘額判斷出所述交易是否正確,及在所述交易正確時及接收到使用者終端1發送的交易成功的確認資訊時藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中,從而提高區塊鏈的處理效率,滿足區塊鏈在商業上的交易的次數需求。 In this case, when the server 2 screens out the target transaction related to the account associated with the transaction from the transaction pool 4 and the block chain 5 and determines that the transaction is correct when the calculation result of the target transaction is correct, and when When the target transaction related to the associated account of the transaction is not screened out from the transaction pool 4 and block chain 5, judge whether the transaction is correct according to the balance of the associated account, and when the transaction is correct and receive When the confirmation information of the successful transaction is sent by the user terminal 1, the node 3 packs the transaction into a block and chains it to the block chain 5, thereby improving the processing efficiency of the block chain and satisfying the requirements of the block chain. The number of transactions required by the chain in the business.

實施例2 Example 2

圖3為本發明一實施方式中基於區塊鏈的交易裝置30的結構圖。 FIG. 3 is a structural diagram of a blockchain-based transaction device 30 in an embodiment of the present invention.

在一些實施例中,所述基於區塊鏈的交易裝置30運行於伺服器2中。所述基於區塊鏈的交易裝置30可以包括多個由程式碼段所組成的功能模組。所述基於區塊鏈的交易裝置30中的各個程式段的程式碼可以存儲於記憶體中,並由至少一個處理器所執行,以執行基於區塊鏈的交易功能。 In some embodiments, the blockchain-based transaction device 30 runs in the server 2 . The blockchain-based transaction device 30 may include a plurality of functional modules composed of program code segments. The program codes of each program segment in the blockchain-based transaction device 30 can be stored in the memory and executed by at least one processor to execute the blockchain-based transaction function.

本實施例中,所述基於區塊鏈的交易裝置30根據其所執行的功能,可以被劃分為多個功能模組。參閱圖3所示,所述基於區塊鏈的交易裝置30可以包括接收模組301、交易類別判斷模組302、篩選模組303、交易結果判斷模組304、上鏈模組305及通知模組306。本發明所稱的模組是指一種能夠被至少一個處理器所執行並且能夠完成固定功能的一系列電腦程式段,其存儲在記憶體中。所述在一些實施例中,關於各模組的功能將在後續的實施例中詳述。 In this embodiment, the blockchain-based transaction device 30 can be divided into multiple functional modules according to the functions it performs. Referring to Fig. 3, the transaction device 30 based on block chain can include a receiving module 301, a transaction category judgment module 302, a screening module 303, a transaction result judgment module 304, an upper chain module 305 and a notification module. Group 306. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in the memory. In some embodiments, the functions of each module will be described in detail in subsequent embodiments.

所述接收模組301用於接收使用者終端1發送的交易,其中所述交易包括交易類別、關聯帳號及交易狀態。 The receiving module 301 is used for receiving the transaction sent by the user terminal 1 , wherein the transaction includes transaction category, associated account number and transaction status.

本實施方式中,所述伺服器2及節點3為兩個不同的設備,所述伺服器2與所述節點3通訊連接。在另一個實施方式中,所述伺服器2及節點3為同一設備。所述伺服器2與所述使用者終端1之間通訊連接,並接收所述使用者終端1發送的交易。本實施方式中,所述伺服器2可以與多個使用者終端1通訊連接,並接收每一使用者終端1發送的交易。本實施方式中,所述伺服器2 根據業務量需求可以擴展為多個。所述節點3分別與交易池4及區塊鏈5通訊連接,並能夠訪問所述交易池4及所述區塊鏈5。本實施方式中,所述節點3有多個,所述伺服器2藉由不同的節點3接入所述交易池4及所述區塊鏈5。本實施方式中,所述交易池4及區塊鏈5中存儲各種交易的交易記錄。本實施方式中,所述伺服器2與所述節點3之間,所述使用者終端1與所述伺服器2之間,所述節點與所述交易池之間,所述節點3與所述區塊鏈5之間可以藉由4G/5G網路通訊連接。 In this embodiment, the server 2 and the node 3 are two different devices, and the server 2 and the node 3 are connected by communication. In another embodiment, the server 2 and the node 3 are the same device. The server 2 communicates with the user terminal 1 and receives transactions sent by the user terminal 1 . In this embodiment, the server 2 can communicate with multiple user terminals 1 and receive transactions sent by each user terminal 1 . In this embodiment, the server 2 It can be expanded to multiple according to business volume requirements. The nodes 3 are connected to the transaction pool 4 and the block chain 5 respectively, and can access the transaction pool 4 and the block chain 5 . In this embodiment, there are multiple nodes 3, and the server 2 accesses the transaction pool 4 and the blockchain 5 through different nodes 3. In this embodiment, transaction records of various transactions are stored in the transaction pool 4 and the block chain 5 . In this embodiment, between the server 2 and the node 3, between the user terminal 1 and the server 2, between the node and the transaction pool, between the node 3 and the Blockchains 5 can be connected through 4G/5G network communication.

本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝,並將封裝後的所述交易發送給所述伺服器2。本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝包括:將所述交易封裝成包含交易編號、交易狀態、交易類別、關聯帳號、交易內容、檢查碼的交易。本實施方式中,所述交易編號用於標識交易。所述交易編號為由字母與數位組成的編號,例如,所述交易編號可以表示為“Tx4939”。所述交易狀態用於指示交易的狀態。本實施方式中,所述交易狀態包括發佈中、待上鏈、已確認及失敗。所述交易類別用於指示交易的類型。本實施方式中,所述交易類別包括金融轉帳及交易記錄保存。所述關聯帳號用於指示所述交易所關聯的帳號,例如,所述關聯帳號可以表示為“用戶帳號A”、“用戶帳號B”。所述檢查碼用於檢查所述交易的正確性。本實施方式中,所述檢查碼為雜湊(Hash)值。本實施方式中,使用者終端1將交易發送給所述伺服器2時,所述交易的狀態為發佈中。 In this embodiment, the user terminal 1 packages the transaction according to a preset method, and sends the packaged transaction to the server 2 . In this embodiment, the user terminal 1 packaging the transaction according to a preset method includes: packaging the transaction into a transaction including transaction number, transaction status, transaction category, associated account number, transaction content, and check code. In this embodiment, the transaction number is used to identify the transaction. The transaction number is a number composed of letters and digits, for example, the transaction number may be expressed as "Tx4939". The transaction status is used to indicate the status of the transaction. In this embodiment, the transaction status includes publishing, waiting to be uploaded, confirmed and failed. The transaction category is used to indicate the type of transaction. In this embodiment, the transaction category includes financial transfer and transaction record preservation. The associated account is used to indicate the account associated with the transaction, for example, the associated account may be expressed as "user account A" and "user account B". The check code is used to check the correctness of the transaction. In this embodiment, the check code is a hash (Hash) value. In this embodiment, when the user terminal 1 sends the transaction to the server 2, the status of the transaction is publishing.

所述交易類別判斷模組302用於從所述交易中提取出交易類別、關聯帳號及交易狀態,並判斷所述交易類別是否為金融轉帳。 The transaction type judging module 302 is used to extract the transaction type, associated account number and transaction status from the transaction, and judge whether the transaction type is financial transfer.

所述篩選模組303用於當確定所述交易類別為金融轉帳時藉由節點3訪問交易池4及/或區塊鏈5並判斷從所述交易池4及/或區塊鏈5中是否篩選出與所述關聯帳號有關的目標交易。 The screening module 303 is used to access the transaction pool 4 and/or the block chain 5 through the node 3 and determine whether the transaction pool 4 and/or the block chain 5 are Target transactions related to the linked account are filtered out.

所述交易結果判斷模組304用於當篩選出與所述關聯帳號有關的目標交易時根據時間順序依次計算所述目標交易的結果並根據所述目標交易的 結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。 The transaction result judging module 304 is used to calculate the result of the target transaction in sequence according to the time sequence when the target transaction related to the associated account is screened out and calculate the result of the target transaction according to the target transaction As a result, it is judged whether the transaction is correct, and the transaction status of the correct transaction is marked as waiting to be uploaded, and the marked transaction is sent to the user terminal 1 for confirmation by the user terminal 1 .

例如,當確定所述交易的關聯帳號為用戶帳號A及用戶帳號B時交易結果判斷模組304藉由節點3訪問交易池4及/或區塊鏈5,並篩選出與用戶帳號A及用戶帳號B相關的目標交易,並根據時間順序依次計算所述目標交易的結果,根據所述目標交易的結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。 For example, when it is determined that the associated accounts of the transaction are user account A and user account B, the transaction result judging module 304 accesses the transaction pool 4 and/or block chain 5 through the node 3, and screens out transactions related to user account A and user account B. The target transaction related to account B, and calculate the result of the target transaction in sequence according to the time sequence, judge whether the transaction is correct according to the result of the target transaction, mark the transaction status of the correct transaction as pending, and mark The subsequent transaction is sent to the user terminal 1 for confirmation by the user terminal 1 .

本實施方式中,交易結果判斷模組304根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確包括:根據時間順序依次計算所述目標交易的內容是否一致;在所述目標交易的內容一致時確定所述交易為正確;及在所述交易的內容不一致時確定所述交易不正確。 In this embodiment, the transaction result judging module 304 sequentially calculates the result of the target transaction according to the time sequence and judges whether the transaction is correct according to the result of the target transaction includes: sequentially calculating whether the content of the target transaction according to the time sequence Consistent; determining that the transaction is correct when the content of the target transaction is consistent; and determining that the transaction is incorrect when the content of the transaction is inconsistent.

所述交易結果判斷模組304還用於當沒有篩選出與所述關聯帳號有關的目標交易時藉由節點3從所述區塊鏈5中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。 The transaction result judging module 304 is also used to read the balance of the associated account of the transaction from the block chain 5 by the node 3 when the target transaction related to the associated account is not screened out, and according to the Determine whether the transaction is correct based on the balance of the associated account, mark the transaction status of the correct transaction as waiting to be linked, and send the marked transaction to the user terminal 1 for the user terminal 1 to carry out confirm.

本實施方式中,所述交易結果判斷模組304藉由節點3從所述區塊鏈5中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確包括:當所述交易的關聯帳號中的轉帳帳號的餘額不小於轉帳金額時確定所述交易正確,否則確定所述交易不正確。 In this embodiment, the transaction result judging module 304 uses the node 3 to read the balance of the associated account of the transaction from the block chain 5 and judges whether the transaction is correct according to the balance of the associated account. : When the balance of the transfer account in the associated account of the transaction is not less than the transfer amount, it is determined that the transaction is correct, otherwise it is determined that the transaction is incorrect.

所述上鏈模組305用於接收使用者終端1發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中。 The on-chain module 305 is used to receive the confirmation information of successful transaction or transaction failure sent by the user terminal 1, and when receiving the confirmation information of successful transaction, mark the transaction status of the transaction as confirmed and pass the The node 3 packages the transaction into a block and chains it into the block chain 5.

本實施方式中,所述在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中包括:伺服器2將交易狀態為待上鏈的交易藉由節點3傳送至交易池4中,當接收到使用者終端1發送的交易成功的確認資訊時藉由節點3從所述交易池4中提取出所述交易,並藉由節點3將所述交易打包成區塊上鏈到所述區塊鏈5中。 In this embodiment, when the confirmation information of the successful transaction is received, the transaction status of the transaction is marked as confirmed and the node 3 packages the transaction into a block and chains it to the block chain 5 includes: the server 2 sends the transaction whose transaction status is to be linked to the chain to the transaction pool 4 through the node 3, and when receiving the confirmation information of the successful transaction sent by the user terminal 1, the node 3 from the transaction The transaction is extracted from the pool 4, and the transaction is packaged into a block and linked to the block chain 5 by the node 3.

所述上鏈模組305還用於當確定所述交易類別為交易記錄保存時所述伺服器2藉由節點3訪問交易池4及/或區塊鏈5,並從所述交易池4及/或區塊鏈5中篩選出與所述交易相關聯的所有目標交易,根據時間順序依次計算所述目標交易的結果,並將計算結果正確的目標交易所對應的交易藉由節點3將打包成區塊上鏈到所述區塊鏈5中。 The on-chain module 305 is also used for the server 2 to access the transaction pool 4 and/or the block chain 5 through the node 3 when it is determined that the transaction type is stored as a transaction record, and from the transaction pool 4 and /or all target transactions associated with the transaction are screened out in the block chain 5, the results of the target transactions are calculated sequentially according to the time sequence, and the transactions corresponding to the target transactions with correct calculation results are packaged by node 3 Blocks are uploaded to the blockchain 5.

所述通知模組306在接收到交易失敗的資訊時將所述交易的交易狀態標記為失敗,並藉由所述節點3將標記後的所述交易發送給使用者終端1。 The notification module 306 marks the transaction status of the transaction as failed when receiving the transaction failure information, and sends the marked transaction to the user terminal 1 through the node 3 .

本實施方式中,所述通知模組306還用於將不正確的交易的交易狀態標記為失敗,並將標記後的交易發送給使用者終端1,並通知所述使用者終端1刪除所述交易。 In this embodiment, the notification module 306 is also used to mark the transaction status of the incorrect transaction as failure, send the marked transaction to the user terminal 1, and notify the user terminal 1 to delete the trade.

本案中所述伺服器2當從所述交易池4及區塊鏈5中篩選出與所述交易的關聯帳號有關的目標交易並在目標交易的計算結果正確時確定所述交易正確,及當從所述交易池4及區塊鏈5中沒有篩選出與所述交易的關聯帳號有關的目標交易時,根據關聯帳號的餘額判斷出所述交易是否正確,及在所述交易正確時及接收到使用者終端1發送的交易成功的確認資訊時藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中,從而提高區塊鏈的處理效率,滿足區塊鏈在商業上的交易的次數需求。 In this case, when the server 2 screens out the target transaction related to the account associated with the transaction from the transaction pool 4 and the block chain 5 and determines that the transaction is correct when the calculation result of the target transaction is correct, and when When the target transaction related to the associated account of the transaction is not screened out from the transaction pool 4 and block chain 5, judge whether the transaction is correct according to the balance of the associated account, and when the transaction is correct and receive When the confirmation information of the successful transaction is sent by the user terminal 1, the node 3 packs the transaction into a block and chains it to the block chain 5, thereby improving the processing efficiency of the block chain and satisfying the requirements of the block chain. The number of transactions required by the chain in the business.

實施例3 Example 3

圖4為本發明一實施方式中電子設備6的示意圖。 FIG. 4 is a schematic diagram of an electronic device 6 in an embodiment of the present invention.

所述電子設備6包括記憶體61、處理器62以及存儲在所述記憶體61中並可在所述處理器62上運行的電腦程式63。所述處理器62執行所述電腦程式63時實現上述基於區塊鏈的交易方法實施例中的步驟,例如圖1所示的步驟S11~S18。或者,所述處理器62執行所述電腦程式63時實現上述基基於區塊鏈的交易裝置實施例中各模組/單元的功能,例如圖3中的模組301~306。 The electronic device 6 includes a memory 61 , a processor 62 and a computer program 63 stored in the memory 61 and executable on the processor 62 . When the processor 62 executes the computer program 63, it realizes the steps in the above embodiment of the blockchain-based transaction method, such as steps S11-S18 shown in FIG. 1 . Alternatively, when the processor 62 executes the computer program 63, it realizes the functions of each module/unit in the embodiment of the above-mentioned blockchain-based transaction device, such as the modules 301-306 in FIG. 3 .

示例性的,所述電腦程式63可以被分割成一個或多個模組/單元,所述一個或者多個模組/單元被存儲在所述記憶體61中,並由所述處理器62執行,以完成本發明。所述一個或多個模組/單元可以是能夠完成特定功能的一系列電腦程式指令段,所述指令段用於描述所述電腦程式63在所述電子設備6中的執行過程。例如,所述電腦程式63可以被分割成圖3中的接收模組301、交易類別判斷模組302、篩選模組303、交易結果判斷模組304、上鏈模組305及通知模組306,各模組具體功能參見實施例2。 Exemplarily, the computer program 63 can be divided into one or more modules/units, and the one or more modules/units are stored in the memory 61 and executed by the processor 62 , to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program 63 in the electronic device 6 . For example, the computer program 63 can be divided into a receiving module 301, a transaction category judgment module 302, a screening module 303, a transaction result judgment module 304, an uplink module 305 and a notification module 306 in FIG. The specific functions of each module refer to Embodiment 2.

本實施方式中,所述電子設備6與伺服器2為同一裝置。本領域技術人員可以理解,所述示意圖僅僅是電子設備6的示例,並不構成對電子設備6的限定,可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如所述電子設備6還可以包括輸入輸出設備、網路接入設備、匯流排等。 In this embodiment, the electronic device 6 and the server 2 are the same device. Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 6, and does not constitute a limitation to the electronic device 6, and may include more or less components than those shown in the illustration, or combine certain components, or have different Components, for example, the electronic device 6 may also include input and output devices, network access devices, bus bars, and the like.

所稱處理器62可以是中央處理模組(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現場可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者所述處理器62也可以是任何常規的處理器等,所述處理器62是所述電子設備6的控制中心,利用各種介面和線路連接整個電子設備6的各個部分。 The so-called processor 62 can be a central processing module (Central Processing Unit, CPU), and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC) ), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor 62 can also be any conventional processor, etc., the processor 62 is the control center of the electronic device 6, and uses various interfaces and lines to connect the entire electronic device 6. various parts.

所述記憶體61可用於存儲所述電腦程式63和/或模組/單元,所述處理器62藉由運行或執行存儲在所述記憶體61內的電腦程式和/或模組/單元, 以及調用存儲在記憶體61內的資料,實現所述電子設備6的各種功能。所述記憶體61可主要包括存儲程式區和存儲資料區,其中,存儲程式區可存儲作業系統、至少一個功能所需的應用程式(比如聲音播放功能、圖像播放功能等)等;存儲資料區可存儲根據電子設備6的使用所創建的資料(比如音訊資料、電話本等)等。此外,記憶體61可以包括高速隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟,智慧存儲卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,快閃記憶體卡(Flash Card)、至少一個磁碟記憶體件、快閃記憶體器件、或其他易失性固態記憶體件。 The memory 61 can be used to store the computer program 63 and/or module/unit, and the processor 62 runs or executes the computer program and/or module/unit stored in the memory 61, And call the data stored in the memory 61 to realize various functions of the electronic device 6 . The memory 61 can mainly include a stored program area and a stored data area, wherein the stored program area can store an operating system, at least one application program required by a function (such as a sound playback function, an image playback function, etc.); The area can store data created according to the use of the electronic device 6 (such as audio data, phonebook, etc.) and the like. In addition, memory 61 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash memory card (Flash Card), at least one disk memory component, flash memory device, or other volatile solid state memory components.

所述電子設備6集成的模組/單元如果以軟體功能模組的形式實現並作為獨立的產品銷售或使用時,可以存儲在一個電腦可讀取存儲介質中。基於這樣的理解,本發明實現上述實施例方法中的全部或部分流程,也可以藉由電腦程式來指令相關的硬體來完成,所述的電腦程式可存儲於一電腦可讀存儲介質中,所述電腦程式在被處理器執行時,可實現上述各個方法實施例的步驟。其中,所述電腦程式包括電腦程式代碼,所述電腦程式代碼可以為原始程式碼形式、物件代碼形式、可執行檔或某些中間形式等。所述電腦可讀介質可以包括:能夠攜帶所述電腦程式代碼的任何實體或裝置、記錄介質、U盤、移動硬碟、磁碟、光碟、電腦記憶體、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、電載波信號、電信信號以及軟體分發介質等。需要說明的是,所述電腦可讀介質包含的內容可以根據司法管轄區內立法和專利實踐的要求進行適當的增減,例如在某些司法管轄區,根據立法和專利實踐,電腦可讀介質不包括電載波信號和電信信號。 If the integrated module/unit of the electronic device 6 is realized in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention realizes all or part of the processes in the methods of the above embodiments, and can also be completed by instructing related hardware through computer programs, and the computer programs can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can realize the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code may be in the form of original code, object code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read- Only Memory), Random Access Memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable Excludes electrical carrier signals and telecommunication signals.

在本發明所提供的幾個實施例中,應該理解到,所揭露的電子設備和方法,可以藉由其它的方式實現。例如,以上所描述的電子設備實施例僅僅是示意性的,例如,所述模組的劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。 In the several embodiments provided by the present invention, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the electronic device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

另外,在本發明各個實施例中的各功能模組可以集成在相同處理模組中,也可以是各個模組單獨物理存在,也可以兩個或兩個以上模組集成在相同模組中。上述集成的模組既可以採用硬體的形式實現,也可以採用硬體加軟體功能模組的形式實現。 In addition, each functional module in each embodiment of the present invention may be integrated into the same processing module, or each module may exist separately physically, or two or more modules may be integrated into the same module. The above-mentioned integrated modules can be implemented in the form of hardware, or in the form of hardware plus software function modules.

對於本領域技術人員而言,顯然本發明不限於上述示範性實施例的細節,而且在不背離本發明的精神或基本特徵的情況下,能夠以其他的具體形式實現本發明。因此,無論從哪一點來看,均應將實施例看作是示範性的,而且是非限制性的,本發明的範圍由所附請求項而不是上述說明限定,因此旨在將落在請求項的等同要件的含義和範圍內的所有變化涵括在本發明內。不應將請求項中的任何附圖標記視為限制所涉及的請求項。此外,顯然“包括”一詞不排除其他模組或步驟,單數不排除複數。電子設備請求項中陳述的多個模組或電子設備也可以由同一個模組或電子設備藉由軟體或者硬體來實現。第一,第二等詞語用來表示名稱,而並不表示任何特定的順序。 It will be apparent to those skilled in the art that the invention is not limited to the details of the above-described exemplary embodiments, but that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, no matter from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, so it is intended to All changes within the meaning and range of equivalents of the elements are embraced in the present invention. Any reference sign in a claim should not be construed as limiting the claim to which it relates. Furthermore, it is clear that the word "comprising" does not exclude other modules or steps, and the singular does not exclude the plural. Multiple modules or electronic devices stated in the electronic device claim can also be realized by the same module or electronic device through software or hardware. The words first, second, etc. are used to denote names and do not imply any particular order.

最後應說明的是,以上實施例僅用以說明本發明的技術方案而非限制,儘管參照較佳實施例對本發明進行了詳細說明,本領域的普通技術人員應當理解,可以對本發明的技術方案進行修改或等同替換,而不脫離本發明技術方案的精神和範圍。 Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention without limitation. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent replacements can be made without departing from the spirit and scope of the technical solutions of the present invention.

S11-S18:步驟 S11-S18: Steps

Claims (8)

一種基於區塊鏈的交易方法,其改良在於,所述方法包括:伺服器接收使用者終端發送的交易,其中所述交易包括交易類別、關聯帳號及交易狀態;所述伺服器從所述交易中提取出交易類別、關聯帳號及交易狀態,並判斷所述交易類別是否為金融轉帳;當所述交易類別是為金融轉帳時,所述伺服器藉由節點訪問交易池及/或區塊鏈並判斷從所述交易池及/或區塊鏈中是否篩選出與所述關聯帳號有關的目標交易;當篩選出與所述關聯帳號有關的目標交易時,所述伺服器根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端以供所述使用者終端進行確認,其中所述伺服器根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確包括:根據時間順序依次計算所述目標交易的內容是否一致;在所述目標交易的內容一致時確定所述交易為正確;及在所述交易的內容不一致時確定所述交易不正確;及所述伺服器接收使用者終端發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中,包括:所述伺服器將交易狀態為待上鏈的所述交易藉由所述節點傳送至所述交易池中,當接收到使用者終端發送的交易成功的確認資訊時藉由所述節點從所述交易池中提取出所述交易,並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中。 A block chain-based transaction method, the improvement of which is that the method includes: a server receives a transaction sent by a user terminal, wherein the transaction includes a transaction category, an associated account number, and a transaction status; the server receives the transaction from the transaction Extract the transaction type, associated account number, and transaction status from it, and judge whether the transaction type is a financial transfer; when the transaction type is a financial transfer, the server accesses the transaction pool and/or the block chain through the node and judge whether the target transaction related to the associated account is screened out from the transaction pool and/or block chain; when the target transaction related to the associated account is screened out, the server calculates the According to the result of the target transaction and judging whether the transaction is correct or not, mark the transaction status of the correct transaction as pending on-chain, and send the marked transaction to the user terminal for For the user terminal to confirm, wherein the server sequentially calculates the result of the target transaction according to the time sequence and judges whether the transaction is correct according to the result of the target transaction includes: sequentially calculating the target transaction according to the time sequence Whether the content of the target transaction is consistent; when the content of the target transaction is consistent, determine that the transaction is correct; and when the content of the transaction is inconsistent, determine that the transaction is incorrect; and the server receives the transaction sent by the user terminal successfully Or the confirmation information of the transaction failure, and when receiving the confirmation information of the transaction success, mark the transaction status of the transaction as confirmed and package the transaction into a block and chain it to the block chain by the node , including: the server transmits the transaction whose transaction status is to be linked to the transaction pool through the node, and when receiving the confirmation information of the successful transaction sent by the user terminal, through the The node extracts the transaction from the transaction pool, and packages the transaction into a block and links it to the block chain through the node. 如請求項1所述的基於區塊鏈的交易方法,其中,所述方法還包括: 當所述交易類別是為交易記錄保存時,所述伺服器藉由所述節點訪問所述交易池及/或區塊鏈,並從所述交易池及/或區塊鏈中篩選出與所述交易相關聯的所有目標交易,根據時間順序依次計算所述目標交易的結果,並將計算結果正確的目標交易所對應的交易藉由節點將打包成區塊上鏈到所述區塊鏈中。 The transaction method based on block chain as described in claim 1, wherein, the method also includes: When the transaction type is reserved for transaction records, the server accesses the transaction pool and/or block chain through the node, and screens the transaction pool and/or block chain from the transaction pool and/or block chain All target transactions associated with the above transactions, calculate the results of the target transactions in sequence according to the time sequence, and package the transactions corresponding to the target transactions with correct calculation results into blocks and chain them to the blockchain by nodes . 如請求項1所述的基於區塊鏈的交易方法,其中,所述方法還包括:當沒有篩選出與所述關聯帳號有關的目標交易時,所述伺服器藉由所述節點從所述區塊鏈中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端以供所述使用者終端進行確認。 The transaction method based on block chain as described in claim 1, wherein the method further includes: when no target transaction related to the associated account is screened out, the server uses the node from the Read the balance of the associated account of the transaction in the block chain and judge whether the transaction is correct according to the balance of the associated account, mark the transaction status of the correct transaction as waiting to be uploaded, and mark the marked transaction sent to the user terminal for confirmation by the user terminal. 如請求項1所述的基於區塊鏈的交易方法,其中,所述方法還包括:所述伺服器在接收到交易失敗的資訊時將所述交易的交易狀態標記為失敗,並藉由所述節點將標記後的所述交易發送給使用者終端。 The transaction method based on block chain as described in Claim 1, wherein the method further includes: when the server receives the information of transaction failure, it marks the transaction status of the transaction as failed, and through the The node sends the marked transaction to the user terminal. 如請求項1所述的基於區塊鏈的交易方法,其中,所述方法還包括:所述伺服器將不正確的交易的交易狀態標記為失敗,並將標記後的交易發送給所述使用者終端,並通知所述使用者終端刪除所述交易。 The blockchain-based transaction method as described in claim 1, wherein the method further includes: the server marks the transaction status of the incorrect transaction as failure, and sends the marked transaction to the user user terminal, and notify the user terminal to delete the transaction. 如請求項3所述的基於區塊鏈的交易方法,其中,所述伺服器藉由所述節點從所述區塊鏈中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確包括:當所述交易的關聯帳號中的轉帳帳號的餘額不小於轉帳金額時確定所述交易正確,否則確定所述交易不正確。 The transaction method based on block chain as described in claim 3, wherein, the server uses the node to read the balance of the associated account of the transaction from the block chain and according to the balance of the associated account The balance judging whether the transaction is correct includes: determining that the transaction is correct when the balance of the transfer account in the account associated with the transaction is not less than the transfer amount, otherwise determining that the transaction is incorrect. 一種基於區塊鏈的交易裝置,其改良在於,所述裝置包括:接收模組,用於接收使用者終端發送的交易,其中所述交易包括交易類別、關聯帳號及交易狀態; 交易類別判斷模組,用於從所述交易中提取出交易類別、關聯帳號及交易狀態,並判斷所述交易類別是否為金融轉帳;篩選模組,用於當所述交易類別是為金融轉帳時,藉由節點訪問交易池及/或區塊鏈並判斷從所述交易池及/或區塊鏈中是否篩選出與所述關聯帳號有關的目標交易;交易結果判斷模組,用於當篩選出與所述關聯帳號有關的目標交易時,根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端以供所述使用者終端進行確認,其中根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確包括:根據時間順序依次計算所述目標交易的內容是否一致;在所述目標交易的內容一致時確定所述交易為正確;及在所述交易的內容不一致時確定所述交易不正確;及上鏈模組,用於接收使用者終端發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中,包括:所述伺服器將交易狀態為待上鏈的所述交易藉由所述節點傳送至所述交易池中,當接收到使用者終端發送的交易成功的確認資訊時藉由所述節點從所述交易池中提取出所述交易,並藉由所述節點將所述交易打包成區塊上鏈到所述區塊鏈中。 A block chain-based transaction device, the improvement of which is that the device includes: a receiving module for receiving a transaction sent by a user terminal, wherein the transaction includes a transaction category, an associated account number, and a transaction status; The transaction category judging module is used to extract the transaction category, associated account number and transaction status from the transaction, and judges whether the transaction category is a financial transfer; the screening module is used when the transaction category is a financial transfer When the node accesses the transaction pool and/or block chain and judges whether the target transaction related to the associated account is screened out from the transaction pool and/or block chain; the transaction result judgment module is used for when When screening out the target transactions related to the associated account, calculate the results of the target transactions in sequence according to the time sequence and judge whether the transactions are correct according to the results of the target transactions, and mark the transaction status of the correct transaction as pending chain, and send the marked transaction to the user terminal for confirmation by the user terminal, wherein the result of the target transaction is calculated sequentially according to the time sequence and the target transaction is judged according to the result of the target transaction Whether the transaction is correct includes: sequentially calculating whether the content of the target transaction is consistent according to the time sequence; determining that the transaction is correct when the content of the target transaction is consistent; and determining that the transaction is incorrect when the content of the transaction is inconsistent ; and an on-chain module, which is used to receive the confirmation information of successful transaction or transaction failure sent by the user terminal, and when receiving the confirmation information of successful transaction, mark the transaction status of the transaction as confirmed and pass the The node packs the transaction into a block and uploads it to the blockchain, including: the server sends the transaction whose transaction status is to be linked to the transaction pool through the node, when When the transaction success confirmation information sent by the user terminal is received, the node extracts the transaction from the transaction pool, and the node packages the transaction into a block and chains it to the block in the block chain. 一種電子設備,其改良在於,所述電子設備包括處理器及記憶體,所述處理器用於執行所述記憶體中存儲的電腦程式時實現如請求項1至6中任一項所述基於區塊鏈的交易方法。 An electronic device, the improvement of which is that the electronic device includes a processor and a memory, and the processor is used to execute the computer program stored in the memory to implement the region-based Blockchain transaction method.
TW109119039A 2020-06-05 2020-06-05 A blockchain-based transaction method, a blockchain-based transaction device and electronic device TWI810464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW109119039A TWI810464B (en) 2020-06-05 2020-06-05 A blockchain-based transaction method, a blockchain-based transaction device and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW109119039A TWI810464B (en) 2020-06-05 2020-06-05 A blockchain-based transaction method, a blockchain-based transaction device and electronic device

Publications (2)

Publication Number Publication Date
TW202147225A TW202147225A (en) 2021-12-16
TWI810464B true TWI810464B (en) 2023-08-01

Family

ID=80783769

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109119039A TWI810464B (en) 2020-06-05 2020-06-05 A blockchain-based transaction method, a blockchain-based transaction device and electronic device

Country Status (1)

Country Link
TW (1) TWI810464B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170085555A1 (en) * 2015-07-14 2017-03-23 Fmr Llc Point-to-Point Transaction Guidance Apparatuses, Methods and Systems
CN110599177A (en) * 2019-09-23 2019-12-20 腾讯科技(深圳)有限公司 Transaction verification method and related equipment
CN111008836A (en) * 2019-11-15 2020-04-14 哈尔滨工业大学(深圳) Privacy safe transfer payment method, device and system based on monitorable block chain and storage medium
CN111161078A (en) * 2020-01-06 2020-05-15 江苏恒为信息科技有限公司 One-to-many block chain transfer realization method
TW202018645A (en) * 2018-11-05 2020-05-16 香港商阿里巴巴集團服務有限公司 Blockchain-based data processing method and apparatus, and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170085555A1 (en) * 2015-07-14 2017-03-23 Fmr Llc Point-to-Point Transaction Guidance Apparatuses, Methods and Systems
TW202018645A (en) * 2018-11-05 2020-05-16 香港商阿里巴巴集團服務有限公司 Blockchain-based data processing method and apparatus, and server
CN110599177A (en) * 2019-09-23 2019-12-20 腾讯科技(深圳)有限公司 Transaction verification method and related equipment
CN111008836A (en) * 2019-11-15 2020-04-14 哈尔滨工业大学(深圳) Privacy safe transfer payment method, device and system based on monitorable block chain and storage medium
CN111161078A (en) * 2020-01-06 2020-05-15 江苏恒为信息科技有限公司 One-to-many block chain transfer realization method

Also Published As

Publication number Publication date
TW202147225A (en) 2021-12-16

Similar Documents

Publication Publication Date Title
EP3859644B1 (en) Block chain-based data check system and method, computing device, and storage medium
US11823178B2 (en) Optimization of high volume transaction performance on a blockchain
CN108376364B (en) Payment system account checking method and device and terminal device
CN111382164B (en) Service processing method based on block chain network
TW202042100A (en) Method and device for cooperatively editting document, computer device and storage media
CN113762956A (en) Transaction method and device based on block chain and electronic equipment
CN110020846B (en) Transfer service processing method and system
WO2021114025A1 (en) Incremental data determination method, incremental data determination apparatus, server and terminal device
CN111723159A (en) Data verification method and device based on block chain
CN111161071A (en) Data processing method, device, equipment and storage medium based on block chain
TWI810464B (en) A blockchain-based transaction method, a blockchain-based transaction device and electronic device
CN112437155B (en) Service data processing method and device and server device
CN113034275B (en) Management system and method based on block chain network and terminal equipment
WO2024060759A1 (en) Supply chain financial asset auditing method and apparatus, and device and medium
CN111598693A (en) Block chain-based account management method, system and device
WO2020103573A1 (en) Block chain-based network transaction signature method and device, and terminal equipment
CN114296651B (en) Method and device for storing custom data information
US20210383469A1 (en) Currency trading method based on blockchain and electronic device
CN112488857B (en) Event identification method, device, electronic equipment and storage medium
CN116263926A (en) Accounting method, device and system based on blockchain
TWI734151B (en) Parameter synchronization method, device, and storage medium
TWI795645B (en) A currency trading method、a device based on a block chain and an electronic device
CN112600756B (en) Service data processing method and device
CN113077241B (en) Approval processing method, device, equipment and storage medium
US20230034850A1 (en) Method to determine that a credit card number change has occurred