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 PDFInfo
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000012790 confirmation Methods 0.000 claims abstract description 31
- 238000004364 calculation method Methods 0.000 claims abstract description 10
- 238000012546 transfer Methods 0.000 claims description 22
- 238000004590 computer program Methods 0.000 claims description 20
- 238000012216 screening Methods 0.000 claims description 7
- 239000000284 extract Substances 0.000 claims description 4
- 238000012545 processing Methods 0.000 abstract description 10
- 230000006870 function Effects 0.000 description 14
- 238000010586 diagram Methods 0.000 description 7
- 238000004806 packaging method and process Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 238000004321 preservation Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000003247 decreasing effect Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 238000004804 winding Methods 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
Description
本發明涉及區塊鏈技術領域,具體涉及一種基於區塊鏈的交易方法、裝置及電子設備。 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
請參考圖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
本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝,並將封裝後的所述交易發送給所述伺服器2。本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝包括:將所述交易封裝成包含交易編號、交易狀態、交易類別、關聯帳號、交易內容、檢查碼的交易。本實施方式中,所述交易編號用於標識交易。所述交易編號為由字母與數位組成的編號,例如,所述交易編號可以表示為“Tx4939”。所述交易狀態用於指示交易的狀態。本實施方式中,所述交易狀態包括發佈中、待上鏈、已確認及失敗。所述交易類別用於指示交易的類型。本實施方式中,所述交易類別包括金融轉帳及交易記錄保存。所述關聯帳號用於指示所述交易所關聯的帳號,例如,所述關聯帳號可以表示為“用戶帳號A”、“用戶帳號B”。所述檢查碼用於檢查所
述交易的正確性。本實施方式中,所述檢查碼為雜湊(Hash)值。本實施方式中,使用者終端1將交易發送給所述伺服器2時,所述交易的狀態為發佈中。
In this embodiment, the
步驟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
步驟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
例如,當確定所述交易的關聯帳號為用戶帳號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
本實施方式中,所述伺服器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
本實施方式中,所述伺服器2藉由節點3從所述區塊鏈5中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確包括:當所述交易的關聯帳號中的轉帳帳號的餘額不小於轉帳金額時確定所述交易正確,否則確定所述交易不正確。
In this embodiment, the server 2 uses the
步驟S16,所述伺服器2接收使用者終端1發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中。
Step S16, the server 2 receives the confirmation information of transaction success or transaction failure sent by the
本實施方式中,所述在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點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
步驟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
步驟S18,所述伺服器2藉由節點3訪問交易池4及/或區塊鏈5,並從所述交易池4及/或區塊鏈5中篩選出與所述交易相關聯的所有目標交易,根據時間順序依次計算所述目標交易的結果,並將計算結果正確的目標交易所對應的交易藉由節點3將打包成區塊上鏈到所述區塊鏈5中。
Step S18, the server 2 accesses the
本實施方式中,所述方法還包括:伺服器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
本案中所述伺服器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
實施例2 Example 2
圖3為本發明一實施方式中基於區塊鏈的交易裝置30的結構圖。
FIG. 3 is a structural diagram of a blockchain-based
在一些實施例中,所述基於區塊鏈的交易裝置30運行於伺服器2中。所述基於區塊鏈的交易裝置30可以包括多個由程式碼段所組成的功能模組。所述基於區塊鏈的交易裝置30中的各個程式段的程式碼可以存儲於記憶體中,並由至少一個處理器所執行,以執行基於區塊鏈的交易功能。
In some embodiments, the blockchain-based
本實施例中,所述基於區塊鏈的交易裝置30根據其所執行的功能,可以被劃分為多個功能模組。參閱圖3所示,所述基於區塊鏈的交易裝置30可以包括接收模組301、交易類別判斷模組302、篩選模組303、交易結果判斷模組304、上鏈模組305及通知模組306。本發明所稱的模組是指一種能夠被至少一個處理器所執行並且能夠完成固定功能的一系列電腦程式段,其存儲在記憶體中。所述在一些實施例中,關於各模組的功能將在後續的實施例中詳述。
In this embodiment, the blockchain-based
所述接收模組301用於接收使用者終端1發送的交易,其中所述交易包括交易類別、關聯帳號及交易狀態。
The receiving
本實施方式中,所述伺服器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
本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝,並將封裝後的所述交易發送給所述伺服器2。本實施方式中,所述使用者終端1將所述交易按照預設方式進行封裝包括:將所述交易封裝成包含交易編號、交易狀態、交易類別、關聯帳號、交易內容、檢查碼的交易。本實施方式中,所述交易編號用於標識交易。所述交易編號為由字母與數位組成的編號,例如,所述交易編號可以表示為“Tx4939”。所述交易狀態用於指示交易的狀態。本實施方式中,所述交易狀態包括發佈中、待上鏈、已確認及失敗。所述交易類別用於指示交易的類型。本實施方式中,所述交易類別包括金融轉帳及交易記錄保存。所述關聯帳號用於指示所述交易所關聯的帳號,例如,所述關聯帳號可以表示為“用戶帳號A”、“用戶帳號B”。所述檢查碼用於檢查所述交易的正確性。本實施方式中,所述檢查碼為雜湊(Hash)值。本實施方式中,使用者終端1將交易發送給所述伺服器2時,所述交易的狀態為發佈中。
In this embodiment, the
所述交易類別判斷模組302用於從所述交易中提取出交易類別、關聯帳號及交易狀態,並判斷所述交易類別是否為金融轉帳。
The transaction
所述篩選模組303用於當確定所述交易類別為金融轉帳時藉由節點3訪問交易池4及/或區塊鏈5並判斷從所述交易池4及/或區塊鏈5中是否篩選出與所述關聯帳號有關的目標交易。
The
所述交易結果判斷模組304用於當篩選出與所述關聯帳號有關的目標交易時根據時間順序依次計算所述目標交易的結果並根據所述目標交易的
結果判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。
The transaction
例如,當確定所述交易的關聯帳號為用戶帳號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
本實施方式中,交易結果判斷模組304根據時間順序依次計算所述目標交易的結果並根據所述目標交易的結果判斷所述交易是否正確包括:根據時間順序依次計算所述目標交易的內容是否一致;在所述目標交易的內容一致時確定所述交易為正確;及在所述交易的內容不一致時確定所述交易不正確。
In this embodiment, the transaction
所述交易結果判斷模組304還用於當沒有篩選出與所述關聯帳號有關的目標交易時藉由節點3從所述區塊鏈5中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確,將正確的交易的交易狀態標記為待上鏈,並將標記後的所述交易發送給所述使用者終端1以供所述使用者終端1進行確認。
The transaction
本實施方式中,所述交易結果判斷模組304藉由節點3從所述區塊鏈5中讀取所述交易的關聯帳號的餘額並依據所述關聯帳號的餘額判斷所述交易是否正確包括:當所述交易的關聯帳號中的轉帳帳號的餘額不小於轉帳金額時確定所述交易正確,否則確定所述交易不正確。
In this embodiment, the transaction
所述上鏈模組305用於接收使用者終端1發送的交易成功或交易失敗的確認資訊,及在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點3將所述交易打包成區塊上鏈到所述區塊鏈5中。
The on-
本實施方式中,所述在接收到交易成功的確認資訊時將所述交易的交易狀態標記為已確認並藉由所述節點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
所述上鏈模組305還用於當確定所述交易類別為交易記錄保存時所述伺服器2藉由節點3訪問交易池4及/或區塊鏈5,並從所述交易池4及/或區塊鏈5中篩選出與所述交易相關聯的所有目標交易,根據時間順序依次計算所述目標交易的結果,並將計算結果正確的目標交易所對應的交易藉由節點3將打包成區塊上鏈到所述區塊鏈5中。
The on-
所述通知模組306在接收到交易失敗的資訊時將所述交易的交易狀態標記為失敗,並藉由所述節點3將標記後的所述交易發送給使用者終端1。
The
本實施方式中,所述通知模組306還用於將不正確的交易的交易狀態標記為失敗,並將標記後的交易發送給使用者終端1,並通知所述使用者終端1刪除所述交易。
In this embodiment, the
本案中所述伺服器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
實施例3 Example 3
圖4為本發明一實施方式中電子設備6的示意圖。
FIG. 4 is a schematic diagram of an
所述電子設備6包括記憶體61、處理器62以及存儲在所述記憶體61中並可在所述處理器62上運行的電腦程式63。所述處理器62執行所述電腦程式63時實現上述基於區塊鏈的交易方法實施例中的步驟,例如圖1所示的步驟S11~S18。或者,所述處理器62執行所述電腦程式63時實現上述基基於區塊鏈的交易裝置實施例中各模組/單元的功能,例如圖3中的模組301~306。
The
示例性的,所述電腦程式63可以被分割成一個或多個模組/單元,所述一個或者多個模組/單元被存儲在所述記憶體61中,並由所述處理器62執行,以完成本發明。所述一個或多個模組/單元可以是能夠完成特定功能的一系列電腦程式指令段,所述指令段用於描述所述電腦程式63在所述電子設備6中的執行過程。例如,所述電腦程式63可以被分割成圖3中的接收模組301、交易類別判斷模組302、篩選模組303、交易結果判斷模組304、上鏈模組305及通知模組306,各模組具體功能參見實施例2。
Exemplarily, the
本實施方式中,所述電子設備6與伺服器2為同一裝置。本領域技術人員可以理解,所述示意圖僅僅是電子設備6的示例,並不構成對電子設備6的限定,可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如所述電子設備6還可以包括輸入輸出設備、網路接入設備、匯流排等。
In this embodiment, the
所稱處理器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
所述記憶體61可用於存儲所述電腦程式63和/或模組/單元,所述處理器62藉由運行或執行存儲在所述記憶體61內的電腦程式和/或模組/單元,
以及調用存儲在記憶體61內的資料,實現所述電子設備6的各種功能。所述記憶體61可主要包括存儲程式區和存儲資料區,其中,存儲程式區可存儲作業系統、至少一個功能所需的應用程式(比如聲音播放功能、圖像播放功能等)等;存儲資料區可存儲根據電子設備6的使用所創建的資料(比如音訊資料、電話本等)等。此外,記憶體61可以包括高速隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟,智慧存儲卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,快閃記憶體卡(Flash Card)、至少一個磁碟記憶體件、快閃記憶體器件、或其他易失性固態記憶體件。
The
所述電子設備6集成的模組/單元如果以軟體功能模組的形式實現並作為獨立的產品銷售或使用時,可以存儲在一個電腦可讀取存儲介質中。基於這樣的理解,本發明實現上述實施例方法中的全部或部分流程,也可以藉由電腦程式來指令相關的硬體來完成,所述的電腦程式可存儲於一電腦可讀存儲介質中,所述電腦程式在被處理器執行時,可實現上述各個方法實施例的步驟。其中,所述電腦程式包括電腦程式代碼,所述電腦程式代碼可以為原始程式碼形式、物件代碼形式、可執行檔或某些中間形式等。所述電腦可讀介質可以包括:能夠攜帶所述電腦程式代碼的任何實體或裝置、記錄介質、U盤、移動硬碟、磁碟、光碟、電腦記憶體、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、電載波信號、電信信號以及軟體分發介質等。需要說明的是,所述電腦可讀介質包含的內容可以根據司法管轄區內立法和專利實踐的要求進行適當的增減,例如在某些司法管轄區,根據立法和專利實踐,電腦可讀介質不包括電載波信號和電信信號。
If the integrated module/unit of the
在本發明所提供的幾個實施例中,應該理解到,所揭露的電子設備和方法,可以藉由其它的方式實現。例如,以上所描述的電子設備實施例僅僅是示意性的,例如,所述模組的劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。 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)
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)
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 |
-
2020
- 2020-06-05 TW TW109119039A patent/TWI810464B/en active
Patent Citations (5)
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 |