TWI646487B - Smart contract executing system with permission rating and avoid duplication and method thereof - Google Patents
Smart contract executing system with permission rating and avoid duplication and method thereof Download PDFInfo
- Publication number
- TWI646487B TWI646487B TW106120976A TW106120976A TWI646487B TW I646487 B TWI646487 B TW I646487B TW 106120976 A TW106120976 A TW 106120976A TW 106120976 A TW106120976 A TW 106120976A TW I646487 B TWI646487 B TW I646487B
- Authority
- TW
- Taiwan
- Prior art keywords
- contract
- transaction
- blockchain
- identification code
- controlled
- Prior art date
Links
Landscapes
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
一種具權限分級和避免重複執行的智能合約執行系統及其方法,透過權責端在區塊鏈網路上發布存取清單合約以實現權限分級,以及發布帶入存取清單合約地址的受控合約,使區塊鏈客戶端執行受控合約的交易函式時,能夠受到存取清單合約中的權限管控,並且判斷帶入交易函式的識別碼是否記錄在受控合約,以便選擇是否執行交易函式,用以達到提高權限管理的便利性及避免重複交易之技術功效。A smart contract execution system and method for privilege grading and avoiding repetitive execution, by issuing an access list contract on the blockchain network through the rights and responsibilities to achieve privilege grading, and issuing a controlled contract with an access list contract address When the blockchain client executes the transaction function of the controlled contract, it can be controlled by the rights in the access list contract, and judge whether the identification code brought into the transaction function is recorded in the controlled contract, so as to select whether to execute the transaction. The function is to improve the convenience of rights management and avoid the technical effect of repeated transactions.
Description
本發明涉及一種智能合約的執行系統及其方法,特別是具權限分級和避免重複執行的智能合約執行系統及其方法。The invention relates to an execution system of a smart contract and a method thereof, in particular to a smart contract execution system with a privilege grading and avoiding repeated execution and a method thereof.
近年來,隨著金融科技的推廣與蓬勃發展,各種基於金融科技的應用便如雨後春筍般出現,其中又以基於區塊鏈技術的應用最受矚目。In recent years, with the promotion and vigorous development of financial technology, various applications based on financial technology have sprung up, and the application based on blockchain technology has attracted the most attention.
一般而言,數位資產的操作通常是在區塊鏈的公開帳本上運行,每個使用者都可以操作自己的餘額,如:比特幣。然而,此方式無法提供多重角色管理及定義權限內容(即:權限分級)等等,故具有權限管理不便的問題。另外,在數位資產的操作上,也很難避免因為程式(例如:區塊鏈客戶端程式、銀行後台程式)問題而造成重複發送交易的情況,舉例來說,當同時發送許多交易時,程式可能因為無法承受多線並行而使交易卡在某個環節,進而使程式或操作者誤認為交易失敗而重複發送交易,以致發送出比預期更多的數位貨幣至接收方,故具有重複交易的問題。In general, the operation of digital assets is usually run on the public ledger of the blockchain, and each user can operate his own balance, such as bitcoin. However, this method cannot provide multiple role management and define permission content (ie, privilege grading), etc., so it has the problem of inconvenient authority management. In addition, in the operation of digital assets, it is difficult to avoid repeated transmission of transactions due to problems with programs (for example, blockchain client programs, bank daemons). For example, when many transactions are sent simultaneously, the program It may be because the transaction card is unable to withstand the multi-line parallelism, so that the program or the operator mistakenly believes that the transaction failed and repeatedly sends the transaction, so that more digital currency than expected is sent to the receiver, so there is a duplicate transaction. problem.
有鑑於此,便有廠商提出使用授權端定義角色管理及權限內容的技術手段,每次交易時需連線至授權端取得授權並記錄。然而,此一方式將使區塊鏈去中心化的優點蕩然無存,當授權端損毀時,將造成所有交易停擺,倘若授權端的資料流失或被竄改,甚至會造成授權管理的困擾。除此之外,授權端也無法避免重複授權,導致產生重複交易的情況。因此,上述方式同樣無法有效解決權限管理不便及重複交易的問題。In view of this, there are vendors who propose to use the authorization side to define the role management and permission content. Each transaction needs to be connected to the authorized end to obtain authorization and record. However, this method will make the advantages of the decentralization of the blockchain disappear. When the authorization end is damaged, all transactions will be shut down. If the data of the authorized end is lost or tampered with, it may even cause the problem of authorization management. In addition, the authorization side cannot avoid duplicate authorizations, resulting in duplicate transactions. Therefore, the above method cannot effectively solve the problem of inconvenient management and repeated transactions.
綜上所述,可知先前技術中長期以來一直存在權限管理不便及重複交易之問題,因此實有必要提出改進的技術手段,來解決此一問題。In summary, it can be seen that in the prior art, there has been a problem of inconvenient management and repeated transactions for a long time, so it is necessary to propose an improved technical means to solve this problem.
本發明揭露一種具權限分級和避免重複執行的智能合約執行系統及其方法。The invention discloses a smart contract execution system with authority grading and avoiding repeated execution and a method thereof.
首先,本發明揭露一種具權限分級和避免重複執行的智能合約執行系統,應用在執行智能合約的區塊鏈網路,此系統包含:權責端、整合端及區塊鏈客戶端。其中,權責端用以於初始時,透過區塊鏈交易發布存取清單合約以取得對應的存取清單合約地址,以及透過區塊鏈交易發布帶入所述存取清單合約地址的受控合約,所述存取清單合約包含多個權限類別,每一權限類別分別包含帳戶地址,所述受控合約包含允許改變狀態的交易函式,每一交易函式允許帶入具唯一性的識別碼;整合端用以在交易時,產生包含識別碼的交易訊息以進行傳送,並且在預設期間未收到交易確認時,再次傳送包含相同的識別碼的交易訊息。First of all, the present invention discloses a smart contract execution system with permission grading and avoiding repeated execution, which is applied to a blockchain network that executes a smart contract. The system includes: a rights and an end, an integration end, and a blockchain client. Wherein, the rights and responsibilities are used to initially issue an access list contract through a blockchain transaction to obtain a corresponding access list contract address, and to release controlled access to the access list contract address through the blockchain transaction. The contract, the access list contract includes a plurality of permission categories, each of the permission categories respectively including an account address, the controlled contract includes a transaction function that allows a change of state, and each transaction function allows for unique identification The integration end is configured to generate a transaction message including the identification code for transmission during the transaction, and transmit the transaction message containing the same identification code again when the transaction confirmation is not received within the preset period.
接著,所述區塊鏈客戶端包含:介面模組及執行模組。其中,介面模組用以提供應用程式介面以允許整合端連接,並且透過應用程式介面接收來自整合端的交易訊息;執行模組用以透過區塊鏈交易將交易訊息發布至區塊鏈網路,當交易訊息包含的識別碼未記錄在受控合約時,根據交易訊息及權限類別執行相應的交易函式,並且在成功執行後將識別碼記錄在受控合約中,當交易訊息包含的識別碼已記錄在受控合約時,取消執行交易函式。Then, the blockchain client includes: an interface module and an execution module. The interface module is configured to provide an application interface to allow integration of the connection, and to receive transaction information from the integration terminal through the application interface; the execution module is used to publish the transaction information to the blockchain network through the blockchain transaction. When the identifier contained in the transaction message is not recorded in the controlled contract, the corresponding transaction function is executed according to the transaction message and the permission category, and the identification code is recorded in the controlled contract after successful execution, when the transaction message contains the identification code When the controlled contract has been recorded, the execution of the trading function is cancelled.
另外,本發明揭露一種具權限分級和避免重複執行的智能合約執行方法,應用在執行智能合約的區塊鏈網路,其步驟包括:提供權責端及區塊鏈客戶端作為區塊鏈網路的節點,每一區塊鏈客戶端皆提供應用程式介面以允許整合端連接;權責端於初始時,透過區塊鏈交易發布存取清單合約以取得對應的存取清單合約地址,以及透過區塊鏈交易發布帶入存取清單合約地址的受控合約,其中,所述存取清單合約包含權限類別,每一權限類別分別包含帳戶地址,所述受控合約包含允許改變狀態的交易函式,每一交易函式允許帶入具唯一性的識別碼;所述整合端在交易時,產生包含識別碼的交易訊息以進行傳送,並且在預設期間未收到交易確認時,再次傳送包含相同的識別碼的交易訊息;所述區塊鏈客戶端透過應用程式介面接收來自整合端的交易訊息;區塊鏈客戶端透過區塊鏈交易將交易訊息發布至區塊鏈網路,當交易訊息包含的識別碼未記錄在受控合約時,根據交易訊息及權限類別執行相應的交易函式,並且在成功執行後將識別碼記錄在受控合約中,當交易訊息包含的識別碼已記錄在受控合約時,取消執行此交易函式。In addition, the present invention discloses a smart contract execution method with permission grading and avoiding repeated execution, which is applied to a blockchain network that executes a smart contract, and the steps include: providing a blame and a blockchain client as a blockchain network a node of the road, each blockchain client provides an application interface to allow the integration end to connect; the rights end initially issues an access list contract through the blockchain transaction to obtain the corresponding access list contract address, and A controlled contract that brings in an access list contract address is issued through a blockchain transaction, wherein the access list contract includes a permission category, each permission category respectively including an account address, the controlled contract including a transaction allowing change of status a function, each transaction function allows for a unique identification code; the integration end generates a transaction message containing the identification code for transmission during the transaction, and does not receive the transaction confirmation during the preset period, again Transmitting a transaction message containing the same identification code; the blockchain client receives the transaction message from the integration terminal through the application interface; The client issues the transaction message to the blockchain network through the blockchain transaction. When the identifier contained in the transaction message is not recorded in the controlled contract, the corresponding transaction function is executed according to the transaction message and the permission category, and is successfully executed. The identification code is then recorded in the controlled contract, and when the transaction code contains the identification code that has been recorded in the controlled contract, the transaction function is cancelled.
本發明所揭露之系統與方法如上,與先前技術的差異在於本發明是透過權責端在區塊鏈網路上發布存取清單合約以實現權限分級,以及發布帶入存取清單合約地址的受控合約,使區塊鏈客戶端執行受控合約的交易函式時,能夠受到存取清單合約中的權限管控,並且判斷帶入交易函式的識別碼是否記錄在受控合約,以便選擇是否執行交易函式。The system and method disclosed by the present invention are as above, and the difference from the prior art is that the present invention distributes the access list contract on the blockchain network through the rights and responsibilities to achieve the privilege grading, and the release of the access list entry address. Controlling the contract, so that when the blockchain client executes the trading function of the controlled contract, it can be controlled by the authority in the access list contract, and judge whether the identification code brought into the trading function is recorded in the controlled contract, so as to select whether Execute the transaction function.
透過上述的技術手段,本發明可以達成提高權限管理的便利性及避免重複交易之技術功效。Through the above technical means, the present invention can achieve the convenience of improving the authority management and the technical effect of avoiding repeated transactions.
以下將配合圖式及實施例來詳細說明本發明之實施方式,藉此對本發明如何應用技術手段來解決技術問題並達成技術功效的實現過程能充分理解並據以實施。The embodiments of the present invention will be described in detail below with reference to the drawings and embodiments, so that the application of the technical means to solve the technical problems and achieve the technical effects can be fully understood and implemented.
在說明本發明所揭露之具權限分級和避免重複執行的智能合約執行系統及其方法之前,先對本發明所應用的環境作說明,本發明是應用在執行智能合約的區塊鏈網路中,在區塊鏈網路中的計算機設備皆可視為區塊鏈節點,所述區塊鏈節點透過點對點(Peer to Peer)方式連接,並且用以處理區塊鏈交易(Blockchain Transactions)。在實際實施上,計算機設備可為伺服器、電腦主機、筆記型電腦、平板電腦等等,用以執行電腦程式指令,例如:區塊鏈程式「Ethereum」。另外,所述智能合約是指依據既定的條件及傳輸的資訊來驅動執行指令的電腦程式,在實際實施上,所述智能合約係透過程式語言,如:Solidity、Serpent、LLL、EtherScript、Sidechain等等來撰寫,其可包含各種不同的函式、事件、參數狀態等等,以區塊鏈程式「Ethereum」為例,其智能合約是經編譯後得到二進位編碼及應用二進位介面(Application Binary Interface, ABI),以便將智能合約廣播至區塊鏈網路,等候礦工(Miner)將智能合約放上區塊鏈並得到相應的地址,至此即完成智能合約的發布。之後,便可根據此地址執行相應的智能合約,藉由不同的指令來改變智能合約在區塊鏈上的狀態。特別要說明的是,文中所述的「存取清單合約」及「受控合約」皆為智能合約。Before describing the smart contract execution system and method thereof for privilege grading and avoiding repeated execution disclosed in the present invention, the environment to which the present invention is applied is explained. The present invention is applied to a blockchain network that executes smart contracts. The computer devices in the blockchain network can be regarded as blockchain nodes, which are connected by peer-to-peer (Peer to Peer) and used to process blockchain transactions. In practical implementation, the computer device can be a server, a computer host, a notebook computer, a tablet computer, etc., for executing computer program instructions, such as the blockchain program "Ethereum". In addition, the smart contract refers to a computer program that drives an execution instruction according to a predetermined condition and transmitted information. In actual implementation, the smart contract is through a programming language such as Solidity, Serpent, LLL, EtherScript, Sidechain, etc. To write, it can contain a variety of different functions, events, parameter states, etc., using the blockchain program "Ethereum" as an example, its smart contract is compiled to obtain binary encoding and application binary interface (Application Binary Interface, ABI), in order to broadcast the smart contract to the blockchain network, waiting for the miner (Miner) to put the smart contract on the blockchain and get the corresponding address, thus completing the release of the smart contract. After that, the corresponding smart contract can be executed according to this address, and the state of the smart contract in the blockchain can be changed by different instructions. In particular, the "Access List Contracts" and "Controlled Contracts" described in the text are all smart contracts.
以下配合圖式對本發明具權限分級和避免重複執行的智能合約執行系統及其方法做進一步說明,請先參閱「第1圖」,「第1圖」為本發明具權限分級和避免重複執行的智能合約執行系統之系統方塊圖,應用在執行智能合約的區塊鏈網路10,此系統包含:權責端100、整合端110及區塊鏈客戶端120。其中,權責端100用以於初始時,透過區塊鏈交易發布存取清單合約以取得對應的存取清單合約地址,以及透過區塊鏈交易發布帶入所述存取清單合約地址的受控合約,所述存取清單合約包含多個權限類別,每一權限類別分別包含帳戶地址;所述受控合約包含允許改變狀態的交易函式,每一交易函式允許帶入具唯一性的識別碼。在實際實施上,所述權責端100可為設置在政府權責單位或政府合法授權單位的伺服器,並且作為區塊鏈網路10中的區塊鏈節點。另外,所述受控合約是指需要由存取清單合約中記載的權限進行控管的智能合約,換句話說,帶入存取清單合約地址的智能合約皆為受控合約。特別要說明的是,存取清單合約的內容可被擁有權限的人員透過區塊鏈交易改變其內容,例如:在權限類別中增加新的帳戶地址或刪除原有的帳戶地址、變更管理者的帳戶地址、增加或刪除金融機構的帳戶地址等等。上述提及的帳戶地址可以是公開金鑰,或是將公開金鑰經過SHA-256雜湊運算後,再通過RIPEMD-160雜湊運算而得到的地址。The following is a description of the smart contract execution system and method for the privilege grading and avoiding repeated execution of the present invention in conjunction with the drawings. Please refer to "FIG. 1" first, and "FIG. 1" is the privilege grading and avoiding repeated execution of the present invention. The system block diagram of the smart contract execution system is applied to the blockchain network 10 that executes the smart contract. The system includes: the rights side 100, the integration end 110, and the blockchain client 120. Wherein, the authority 100 is used to initially issue an access list contract through a blockchain transaction to obtain a corresponding access list contract address, and issue the access list entry address through the blockchain transaction. Controlling the contract, the access list contract includes a plurality of permission categories, each of the permission categories respectively including an account address; the controlled contract includes a transaction function that allows a change of state, and each transaction function allows for uniqueness Identifier. In actual implementation, the rights end 100 may be a server disposed in a government authority or a legally authorized unit of the government, and serves as a blockchain node in the blockchain network 10. In addition, the controlled contract refers to a smart contract that needs to be controlled by the authority recorded in the access list contract. In other words, the smart contract brought into the access list contract address is a controlled contract. In particular, the content of the access list contract can be changed by the owner of the permission through the blockchain transaction, for example, adding a new account address or deleting the original account address in the permission category, changing the manager's Account address, add or delete the financial institution's account address, and more. The account address mentioned above may be a public key, or an address obtained by passing the public key through a SHA-256 hash operation and then using the RIPEMD-160 hash operation.
整合端110用以在交易時,產生包含識別碼的交易訊息以進行傳送,並且在預設期間未收到交易確認時,再次傳送包含相同的識別碼的交易訊息。在實際實施上,整合端110可為設置在銀行機構的伺服器,其傳送交易訊息是透過區塊鏈客戶端120所提供的應用程式介面(Application Programming Interface, API)來實現,也就是說,區塊鏈客戶端120為API的提供者;整合端110則為區塊鏈客戶端120的API的使用者。以帳聯網為例,整合端110為銀行後台系統,除了進行帳務清算之外,更透過區塊鏈客戶端120發布交易訊息至區塊鏈網路10以增減智能合約中的餘額。另外,所述識別碼可為通用唯一識別符(Universally unique identifier, UUID),並且儲存於資料庫或分散式儲存系統中,而識別碼的產生方式則可使用任意字元排列組合以產生具有唯一性的字串;至於所述交易訊息則可包含交易發起者的帳戶地址、交易對象的帳戶地址及交易金額。要補充說明的是,狹義來說只有區塊鏈客戶端120為區塊鏈網路10的節點,但是廣義來說,區塊鏈網路10的節點還可擴大為「區塊鏈客戶端120」及「整合端110」。不過,一般來說都是以狹義的方式定義節點。The integration terminal 110 is configured to generate a transaction message including the identification code for transmission during the transaction, and transmit the transaction message including the same identification code again when the transaction confirmation is not received during the preset period. In actual implementation, the integration end 110 can be a server disposed in the banking institution, and the delivery transaction message is implemented by using an application programming interface (API) provided by the blockchain client 120, that is, The blockchain client 120 is the provider of the API; the integration terminal 110 is the user of the API of the blockchain client 120. Taking the account network as an example, the integration terminal 110 is a bank back-end system. In addition to performing account clearing, the blockchain client 120 issues a transaction message to the blockchain network 10 to increase or decrease the balance in the smart contract. In addition, the identification code may be a Universally Unique Identifier (UUID) and stored in a database or a distributed storage system, and the identification code may be generated by using any combination of characters to generate a unique The transaction string may include the transaction initiator's account address, the transaction object's account address, and the transaction amount. It should be added that, in a narrow sense, only the blockchain client 120 is a node of the blockchain network 10, but in a broad sense, the nodes of the blockchain network 10 can also be expanded to "blockchain client 120". And "integration end 110". However, in general, nodes are defined in a narrow sense.
至於區塊鏈客戶端120包含:介面模組121及執行模組122。其中,介面模組121用以提供應用程式介面以允許整合端110連接,並且透過應用程式介面接收來自整合端110的交易訊息。在實際實施上,整合端110與區塊鏈客戶端120可經由網際網路或區域網路相互連接,以便整合端110將交易訊息傳送至應用程式介面。至於區塊鏈客戶端120則作為區塊鏈節點,並且與其它區塊鏈節點連接以組成區塊鏈網路10。The blockchain client 120 includes an interface module 121 and an execution module 122. The interface module 121 is configured to provide an application interface to allow the integration terminal 110 to connect, and receive transaction information from the integration terminal 110 through the application interface. In actual implementation, the integration end 110 and the blockchain client 120 can be connected to each other via the Internet or a regional network, so that the integration terminal 110 transmits the transaction message to the application interface. As for the blockchain client 120, it acts as a blockchain node and is connected to other blockchain nodes to form a blockchain network 10.
執行模組122用以透過區塊鏈交易將交易訊息發布至區塊鏈網路10,當交易訊息包含的識別碼未記錄在受控合約時,根據交易訊息及權限類別執行相應的交易函式,並且在成功執行後將識別碼記錄在受控合約中,當交易訊息包含的識別碼已記錄在受控合約時,取消執行交易函式。如此一來,在進行交易而執行智能合約(即:存取清單合約、受控合約)時,即可根據存取清單合約中的權限類別判斷是否允許執行受控合約的交易函式,以及藉由識別碼的存在與否來確認交易函式是否已成功執行過。在實際實施上,假設識別碼存在,即代表交易函式已經成功執行過,故自動退出交易函式以避免重複執行;假設識別碼不存在,即代表交易函式未曾被成功執行過,所以允許執行交易函式。The execution module 122 is configured to post the transaction message to the blockchain network 10 through the blockchain transaction. When the identifier included in the transaction message is not recorded in the controlled contract, the corresponding transaction function is executed according to the transaction message and the permission category. And after successful execution, the identification code is recorded in the controlled contract, and when the transaction code contains the identification code that has been recorded in the controlled contract, the execution of the transaction function is cancelled. In this way, when the transaction is executed and the smart contract is executed (ie, the access list contract, the controlled contract), the transaction function of the controlled contract can be judged according to the permission category in the access list contract, and the transaction function can be borrowed. Whether the transaction function has been successfully executed is confirmed by the presence or absence of the identification code. In practical implementation, if the identification code exists, that is, the transaction function has been successfully executed, the transaction function is automatically exited to avoid repeated execution; if the identification code does not exist, it means that the transaction function has not been successfully executed, so it is allowed. Execute the transaction function.
接著,請參閱「第2圖」,「第2圖」為本發明具權限分級和避免重複執行的智能合約執行方法之方法流程圖,應用在執行智能合約的區塊鏈網路10,其步驟包括:提供權責端100及區塊鏈客戶端120作為區塊鏈網路10的節點,每一區塊鏈客戶端120皆提供應用程式介面以允許整合端110連接(步驟210);權責端100於初始時,透過區塊鏈交易發布存取清單合約以取得對應的存取清單合約地址,以及透過區塊鏈交易發布帶入存取清單合約地址的受控合約,其中,所述存取清單合約包含權限類別,每一權限類別分別包含帳戶地址,所述受控合約包含允許改變狀態的交易函式,每一交易函式允許帶入具唯一性的識別碼(步驟220);所述整合端110在交易時,產生包含識別碼的交易訊息以進行傳送,並且在預設期間未收到交易確認時,再次傳送包含相同的識別碼的交易訊息(步驟230);所述區塊鏈客戶端120透過應用程式介面接收來自整合端110的交易訊息(步驟240);區塊鏈客戶端120透過區塊鏈交易將交易訊息發布至區塊鏈網路10,當交易訊息包含的識別碼未記錄在受控合約時,根據交易訊息及權限類別執行相應的交易函式,並且在成功執行後將識別碼記錄在受控合約中,當交易訊息包含的識別碼已記錄在受控合約時,取消執行此交易函式(步驟250)。透過上述步驟,即可透過權責端100在區塊鏈網路10上發布存取清單合約以實現權限分級,以及發布帶入存取清單合約地址的受控合約,使區塊鏈客戶端120執行受控合約的交易函式時,能夠受到存取清單合約中的權限管控,並且判斷帶入交易函式的識別碼是否記錄在受控合約,以便選擇是否執行交易函式。Next, please refer to "Fig. 2", which is a flow chart of a method for implementing a smart contract execution method with permission grading and avoiding repeated execution, applied to the blockchain network 10 executing the smart contract, and the steps thereof The method includes: providing the rights holder 100 and the blockchain client 120 as nodes of the blockchain network 10, each blockchain client 120 providing an application interface to allow the integration terminal 110 to connect (step 210); At the beginning, the terminal 100 issues an access list contract through the blockchain transaction to obtain a corresponding access list contract address, and issues a controlled contract brought into the access list contract address through the blockchain transaction, wherein the deposit The pick list contract includes a permission category, each permission category respectively including an account address, the controlled contract includes a transaction function allowing a change of state, each transaction function allowing a unique identification code to be brought in (step 220); The integration terminal 110 generates a transaction message including the identification code for transmission when the transaction is performed, and transmits the transaction message containing the same identification code again when the transaction confirmation is not received within the preset period. (Step 230); the blockchain client 120 receives the transaction message from the integration terminal 110 through the application interface (step 240); the blockchain client 120 issues the transaction message to the blockchain network through the blockchain transaction. Road 10, when the transaction message contains an identification code that is not recorded in the controlled contract, the corresponding transaction function is executed according to the transaction message and the permission category, and the identification code is recorded in the controlled contract after successful execution, when the transaction message contains When the identification code has been recorded in the controlled contract, the transaction function is cancelled (step 250). Through the above steps, the access list contract can be issued on the blockchain network 10 through the right-of-charge terminal 100 to realize the privilege grading, and the controlled contract brought into the access list contract address is issued, so that the blockchain client 120 When executing the trading function of the controlled contract, it can be controlled by the rights in the access list contract, and judge whether the identification code brought into the trading function is recorded in the controlled contract to select whether to execute the trading function.
特別要說明的是,在步驟230之後,整合端110在同一交易時,可連線另一區塊鏈客戶端120,發送包含相同識別碼的交易訊息(步驟231)。此方式可稱為高可用性(High Availability, HA)的機制,並且能夠有效增加交易處理速度,而由於相同識別碼的交易訊息只會被執行一次,所以整合端110即使將相同識別碼的交易訊息傳送至另一區塊鏈客戶端120也不會造成重複執行的問題。In particular, after step 230, the integration terminal 110 may connect another blockchain client 120 to transmit a transaction message containing the same identification code (step 231). This method can be called a high availability (HA) mechanism, and can effectively increase the transaction processing speed, and since the transaction information of the same identification code is only executed once, the integration terminal 110 even if the transaction information of the same identification code is used. Transferring to another blockchain client 120 also does not cause a problem of repeated execution.
以下配合「第3圖」及「第4圖」以實施例的方式進行如下說明,請先參閱「第3圖」,「第3圖」為應用本發明使交易函式要求外部傳入識別碼之示意圖。前面提到,交易函式允許帶入具唯一性的識別碼。在實際實施上,可以使用如「第3圖」所示意的宣告參數(311、321)帶入32位元組的識別碼,並且在交易函式(310、320)執行之前,先透過修改器(modifier)(312、322),如:「verify UUID()」,用以檢查傳入(或稱為帶入)的識別碼是否已經執行過,倘若已經執行過,則離開此交易函式;倘若不曾執行過,那麼,在成功執行交易函式後,會透過記錄函式(313、323),如:「recordUUID()」,用以記錄此識別碼以利後續作為是否交易執行過的判斷依據。The following is a description of the following examples in conjunction with "3" and "4". Please refer to "3", "3" for applying the present invention to require the transaction function to request an external identification code. Schematic diagram. As mentioned earlier, the transaction function allows for a unique identifier. In practical implementation, the 32-bit tuple identification code can be brought into use by the announcement parameters (311, 321) as illustrated in "Figure 3", and the modifier is passed before the transaction function (310, 320) is executed. (modifier) (312, 322), such as: "verify UUID ()", to check whether the incoming (or brought in) identification code has been executed, if it has been executed, leave the transaction function; If it has not been executed, after the successful execution of the transaction function, the record function (313, 323), such as: "recordUUID ()", is used to record the identification code to facilitate subsequent judgment as to whether the transaction has been executed. in accordance with.
如「第4圖」所示意,「第4圖」為應用本發明進行權限分級之示意圖。首先,權責端100在區塊鏈網路10上發布兩個智能合約,分別為「存取清單合約」及「受控合約(或稱為帳本合約)」,存取清單合約中定義各項權限類別,分別為:清單管理員(Admin)、金融機構管理員(Bank Admin)、金融機構(Bank)及使用者(User)。其中,權限類別為清單管理員時,可變更清單管理員清單的內容,以便新增或刪除管理員;權限類別為金融機構管理員時,可新增或刪除金融機構;權限類別為金融機構時,可增加或減少受控合約中,某客戶在金融機構之餘額;權限類別為使用者時,可增加或減少客戶本身在受控合約中之餘額。如此一來,便可根據帳戶地址判斷權限類別,進而實現權限分級。接著,受控合約則需參考到存取清單合約的內容,使受控合約同樣受到存取清單合約的權限類別控管,並且受控合約提供增加、刪除、傳送餘額等等的交易函式,這些交易函式需要帶入識別碼以避免相同交易重複執行。As shown in "Fig. 4", "Fig. 4" is a schematic diagram of the privilege grading by applying the present invention. First, the rights holder 100 issues two smart contracts on the blockchain network 10, namely "access list contract" and "controlled contract (or called book contract)", each defined in the access list contract. The permission categories are: Admin, Financial Admin, Bank, and User. When the permission category is the list administrator, the content of the list administrator list can be changed to add or delete the administrator; when the permission category is the financial institution administrator, the financial institution can be added or deleted; when the permission category is a financial institution It can increase or decrease the balance of a customer in a financial institution in a controlled contract; when the privilege category is a user, it can increase or decrease the balance of the customer in the controlled contract. In this way, the permission category can be determined based on the account address, thereby realizing the privilege rating. Then, the controlled contract needs to refer to the contents of the access list contract, so that the controlled contract is also controlled by the permission category of the access list contract, and the controlled contract provides the transaction function of adding, deleting, transferring the balance, and the like. These trading functions need to bring in an identification code to avoid repeated execution of the same transaction.
接著,假設有二間銀行,分別為銀行A及銀行B。當要將這二間銀行加入銀行清單時,需要由具有權限類別為金融機構管理員(例如:金融監管單位)的帳戶地址,透過區塊鏈交易將銀行A的帳戶地址及銀行B的帳戶地址新增至存取清單合約中,也就是加入至權限類別為金融機構的陣列411中,以便銀行A及銀行B具有權限能夠透過智能合約增減客戶的餘額。以下分別針對存款、跨行轉帳、支付、提領及清算作詳細說明。Next, assume that there are two banks, Bank A and Bank B. When the two banks are to be added to the bank list, the account address of the financial institution administrator (for example, the financial supervision unit) must be used, and the account address of the bank A and the account address of the bank B are transmitted through the blockchain transaction. Added to the access list contract, that is, to the array 411 whose privilege category is financial institution, so that Bank A and Bank B have the authority to increase or decrease the balance of the customer through the smart contract. The following is a detailed description of deposits, interbank transfers, payments, withdrawals and liquidation.
針對存款的部分,假設客戶A存款至銀行A,由於銀行A的帳戶地址在存取清單合約中,且權限類別為金融機構,所以銀行A能夠透過區塊鏈交易執行相應的交易函式,以便在受控合約中增加客戶A在銀行A的餘額。For the deposit part, assume that customer A deposits to bank A. Since bank A's account address is in the access list contract and the privilege category is financial institution, bank A can execute the corresponding transaction function through blockchain transaction, so that Increase the balance of Customer A at Bank A in the controlled contract.
針對跨行轉帳的部分,假設銀行A的客戶A欲轉帳新台幣100元給銀行B的客戶B,其流程如下:For the cross-bank transfer part, assume that customer A of bank A wants to transfer NT$100 to customer B of bank B. The process is as follows:
1. 客戶A透過區塊鏈交易,將自己於受控合約中銀行A的餘額轉帳新台幣100元給客戶B。此時,客戶B於銀行A的餘額會增加新台幣100元。1. Customer A transfers the balance of Bank A in the controlled contract to NT$100 to Customer B through the blockchain transaction. At this point, Customer B's balance on Bank A will increase NT$100.
2. 客戶B將自己銀行A的餘額新台幣100元,透過受控合約執行交易函式轉帳給銀行B。此時,銀行B在銀行A的餘額會增加新台幣100元,客戶B於銀行A的餘額會減少新台幣100元。2. Customer B transfers the balance of his bank A, NT$100, to Bank B through a controlled contract execution transaction. At this point, the balance of Bank B in Bank A will increase NT$100, and the balance of Customer B in Bank A will be reduced by NT$100.
3. 銀行B增加客戶B在銀行B的餘額,即:餘額增加新台幣100元。3. Bank B increases the balance of Customer B in Bank B, ie the balance is increased by NT$100.
至此,客戶B在銀行B有餘額(即:餘額增加新台幣100元),而銀行B在銀行A有餘額(即:餘額增加新台幣100元)。特別要說明的是,雖然跨行轉帳以上述舉例說明,然本發明並不以此為限,只要能夠使客戶之間的金額直接清算,並且將最終的清算工作交給銀行之方式皆不脫離本發明的應用範疇。At this point, customer B has a balance at bank B (ie, the balance is increased by NT$100), while bank B has a balance at bank A (ie, the balance is increased by NT$100). In particular, although the interbank transfer is illustrated by the above examples, the present invention is not limited thereto, as long as the amount of the customer can be directly liquidated, and the final liquidation work is handed over to the bank. The scope of application of the invention.
針對支付的部分,假設客戶A支付給使用者C(此處的客戶是指原先在銀行A有帳戶,使用者則是原先在銀行A沒有帳戶)。客戶A透過區塊鏈交易,將自己於受控合約中銀行A的餘額轉帳給使用者C。此時,使用者C在銀行A有餘額。接著,使用者C可直接至銀行A提領,或是如跨行轉帳之步驟2和步驟3,使自己銀行的餘額增加。For the part of the payment, it is assumed that the customer A pays to the user C (the customer here means that the account was originally in the bank A, and the user originally had no account in the bank A). Customer A transfers the balance of Bank A in the controlled contract to User C through the blockchain transaction. At this time, the user C has a balance at the bank A. User C can then withdraw directly to Bank A, or step 2 and Step 3, such as cross-bank transfer, to increase the balance of his bank.
針對提領的部分,假設客戶A於銀行A提領新台幣100元。當客戶A透過區塊鏈交易將自己於銀行A的餘額轉帳給銀行A的帳戶地址時,銀行A減去自己(銀行A的帳戶地址)的餘額,並交給客戶A相應數量的法幣(即:新台幣100元的現鈔或銅板)。For the part of the withdrawal, assume that Customer A withdraws NT$100 from Bank A. When customer A transfers the balance of bank A to bank A's account address through blockchain transaction, bank A subtracts the balance of himself (bank A's account address) and gives client A the corresponding amount of legal currency ( Namely: NT$100 cash or copper).
針對清算的部分,當銀行A和銀行B之間進行清算,假設銀行A在銀行B有餘額新台幣100元,銀行B在銀行A有餘額500元。那麼,清算流程如下:For the liquidation part, when bank A and bank B are liquidated, it is assumed that bank A has a balance of NT$100 in bank B and bank B has a balance of 500 yuan in bank A. Then, the clearing process is as follows:
1. 透過受控合約計算銀行A和銀行B之間收支相抵後的餘額狀況,在此例中,計算後銀行A還需支付銀行B新台幣400元。1. Calculate the balance of the balance between the bank A and the bank B through the controlled contract. In this case, the bank A also needs to pay the bank B NT$400.
2. 銀行A支付銀行B新台幣400元法幣。2. Bank A pays Bank B NT$400.
3. 銀行A及銀行B透過區塊鏈交易,各自將在對方銀行餘額轉帳給對方。在此例中,銀行A將自己於銀行B的餘額新台幣100元轉帳給銀行B帳戶地址,銀行B將自己於銀行A的餘額新台幣500元轉帳給銀行A帳戶地址。3. Bank A and Bank B will trade each other's bank balances to each other through blockchain transactions. In this example, Bank A transfers the balance of Bank B to NT$100 to the Bank B account address, and Bank B transfers the balance of Bank A to NT$500 to Bank A's account address.
4. 銀行A及銀行B透過區塊鏈交易,各自將上步驟之餘額減去,此時,銀行A在銀行B的餘額歸零,而且銀行B在銀行A的餘額也歸零,至此,清算完畢。4. Bank A and Bank B pass the blockchain transaction and each subtract the balance of the previous step. At this time, the balance of Bank A in Bank B is zero, and the balance of Bank B in Bank A is also zero. So far, liquidation Finished.
特別要說明的是,上述存款、跨行轉帳、支付、提領及清算等等,透過區塊鏈交易在執行交易函式時,均須帶入識別碼以確保交易函式不會重複執行。In particular, the above deposits, inter-bank transfers, payments, withdrawals and liquidation, etc., through the blockchain transaction, must be carried into the identification code to ensure that the transaction function will not be repeated.
綜上所述,可知本發明與先前技術之間的差異在於透過權責端在區塊鏈網路上發布存取清單合約以實現權限分級,以及發布帶入存取清單合約地址的受控合約,使區塊鏈客戶端執行受控合約的交易函式時,能夠受到存取清單合約中的權限管控,並且判斷帶入交易函式的識別碼是否記錄在受控合約,以便選擇是否執行交易函式,藉由此一技術手段可以解決先前技術所存在的問題,進而達成提高權限管理的便利性及避免重複交易之技術功效。In summary, it can be seen that the difference between the present invention and the prior art is that the rights-of-rights issue an access list contract on the blockchain network to achieve the privilege grading, and the release of the controlled contract that brings the access list contract address, When the blockchain client executes the transaction function of the controlled contract, it can be controlled by the rights in the access list contract, and judge whether the identification code brought into the transaction function is recorded in the controlled contract, so as to select whether to execute the transaction letter. By means of this technical means, the problems existing in the prior art can be solved, thereby achieving the convenience of improving the authority management and the technical effect of avoiding repeated transactions.
雖然本發明以前述之實施例揭露如上,然其並非用以限定本發明,任何熟習相像技藝者,在不脫離本發明之精神和範圍內,當可作些許之更動與潤飾,因此本發明之專利保護範圍須視本說明書所附之申請專利範圍所界定者為準。While the present invention has been described above in the foregoing embodiments, it is not intended to limit the invention, and the invention may be modified and modified without departing from the spirit and scope of the invention. The scope of patent protection shall be subject to the definition of the scope of the patent application attached to this specification.
10‧‧‧區塊鏈網路10‧‧‧ Blockchain network
100‧‧‧權責端 100‧‧‧rights
110‧‧‧整合端 110‧‧‧ integration end
120‧‧‧區塊鏈客戶端 120‧‧‧blockchain client
121‧‧‧介面模組 121‧‧‧Interface module
122‧‧‧執行模組 122‧‧‧Execution module
310、320‧‧‧交易函式 310, 320‧‧‧ transaction function
311、321‧‧‧宣告參數 311, 321‧‧‧ declaration parameters
312、322‧‧‧修改器 312, 322‧‧‧ modifier
313、323‧‧‧記錄函式 313, 323 ‧ ‧ record function
411‧‧‧金融機構的陣列 411‧‧‧Array of financial institutions
步驟210‧‧‧提供一權責端及多個區塊鏈客戶端作為區塊鏈網路的節點,每一區塊鏈客戶端皆提供一應用程式介面以允許至少一整合端連接 Step 210‧‧‧ provides a rights-of-party and multiple blockchain clients as nodes of the blockchain network, each blockchain client providing an application interface to allow at least one integrated connection
步驟220‧‧‧該權責端於初始時,透過區塊鏈交易發布一存取清單合約以取得對應的一存取清單合約地址,以及透過區塊鏈交易發布帶入該存取清單合約地址的一受控合約,其中,該存取清單合約包含多個權限類別,每一權限類別分別包含至少一帳戶地址,該受控合約包含允許改變狀態的至少一交易函式,每一交易函式允許帶入具唯一性的一識別碼 Step 220‧‧‧ The right-of-rights issue an access list contract through the blockchain transaction to obtain the corresponding access list contract address, and to bring the access list contract address through the blockchain transaction release a controlled contract, wherein the access list contract comprises a plurality of permission categories, each permission category respectively comprising at least one account address, the controlled contract comprising at least one transaction function allowing a change of state, each transaction function Allow to carry a unique identification code
步驟230‧‧‧所述整合端在交易時,產生包含該識別碼的一交易訊息以進行傳送,並且在一預設期間未收到交易確認時,再次傳送包含相同的該識別碼的該交易訊息 Step 230‧‧‧ The integration end generates a transaction message containing the identification code for transmission during the transaction, and transmits the transaction including the same identification code again when the transaction confirmation is not received within a preset period message
步驟231‧‧‧該整合端在同一交易時,連線另一所述區塊鏈客戶端,發送包含相同該識別碼的該交易訊息 Step 231‧‧‧ The integration end connects another blockchain client in the same transaction, and sends the transaction message containing the same identifier
步驟240‧‧‧所述區塊鏈客戶端透過該應用程式介面接收來自所述整合端的該交易訊息 Step 240‧‧‧ The blockchain client receives the transaction message from the integration terminal through the application interface
步驟250‧‧‧該區塊鏈客戶端透過區塊鏈交易將該交易訊息發布至該區塊鏈網路,當該交易訊息包含的該識別碼未記錄在該受控合約時,根據該交易訊息及所述權限類別執行相應的所述交易函式,並且在成功執行後將該識別碼記錄在該受控合約中,當該交易訊息包含的該識別碼已記錄在該受控合約時,取消執行所述交易函式 Step 250‧‧‧ The blockchain client issues the transaction message to the blockchain network through a blockchain transaction, and when the identifier contained in the transaction message is not recorded in the controlled contract, according to the transaction Transmitting the corresponding transaction function by the message and the permission category, and recording the identification code in the controlled contract after successful execution, when the identification code included in the transaction message is recorded in the controlled contract, Cancel the execution of the transaction function
第1圖為本發明具權限分級和避免重複執行的智能合約執行系統之系統方塊圖。 第2圖為本發明具權限分級和避免重複執行的智能合約執行方法之方法流程圖。 第3圖為應用本發明使交易函式要求外部傳入識別碼之示意圖。 第4圖為應用本發明進行權限分級之示意圖。1 is a system block diagram of a smart contract execution system with authority grading and avoiding repeated execution of the present invention. 2 is a flow chart of a method for implementing a smart contract execution method with permission grading and avoiding repeated execution. Figure 3 is a schematic diagram of the application of the present invention to enable the transaction function to require an external incoming identification code. Figure 4 is a schematic diagram of the privilege grading by applying the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW106120976A TWI646487B (en) | 2017-06-23 | 2017-06-23 | Smart contract executing system with permission rating and avoid duplication and method thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW106120976A TWI646487B (en) | 2017-06-23 | 2017-06-23 | Smart contract executing system with permission rating and avoid duplication and method thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
TWI646487B true TWI646487B (en) | 2019-01-01 |
TW201905813A TW201905813A (en) | 2019-02-01 |
Family
ID=65803995
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW106120976A TWI646487B (en) | 2017-06-23 | 2017-06-23 | Smart contract executing system with permission rating and avoid duplication and method thereof |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI646487B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020192743A1 (en) * | 2019-03-28 | 2020-10-01 | 腾讯科技(深圳)有限公司 | Permission management method, permission validation method and related apparatuses |
TWI730690B (en) * | 2019-08-30 | 2021-06-11 | 開曼群島商創新先進技術有限公司 | Method and device for simultaneously executing transactions in block chain, computer readable storage medium and computing equipment |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10853341B2 (en) | 2019-06-28 | 2020-12-01 | Advanced New Technologies Co., Ltd. | Blockchain based hierarchical data storage |
CN110347684B (en) * | 2019-06-28 | 2020-09-01 | 阿里巴巴集团控股有限公司 | Block chain based hierarchical storage method and device and electronic equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106534097A (en) * | 2016-10-27 | 2017-03-22 | 上海亿账通区块链科技有限公司 | Block chain trading based authority control method and system |
WO2017066002A1 (en) * | 2015-10-17 | 2017-04-20 | Banqu, Inc. | Blockchain-based identity and transaction platform |
CN106796688A (en) * | 2016-12-26 | 2017-05-31 | 深圳前海达闼云端智能科技有限公司 | Permission control method, device and system of block chain and node equipment |
TWM543413U (en) * | 2016-12-05 | 2017-06-11 | Taiwan United Financial Technology Co Ltd | Web lending platform using technology of blockchain for deal |
CN106850622A (en) * | 2017-02-07 | 2017-06-13 | 杭州秘猿科技有限公司 | A kind of user identity management method based on license chain |
-
2017
- 2017-06-23 TW TW106120976A patent/TWI646487B/en active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017066002A1 (en) * | 2015-10-17 | 2017-04-20 | Banqu, Inc. | Blockchain-based identity and transaction platform |
CN106534097A (en) * | 2016-10-27 | 2017-03-22 | 上海亿账通区块链科技有限公司 | Block chain trading based authority control method and system |
TWM543413U (en) * | 2016-12-05 | 2017-06-11 | Taiwan United Financial Technology Co Ltd | Web lending platform using technology of blockchain for deal |
CN106796688A (en) * | 2016-12-26 | 2017-05-31 | 深圳前海达闼云端智能科技有限公司 | Permission control method, device and system of block chain and node equipment |
CN106850622A (en) * | 2017-02-07 | 2017-06-13 | 杭州秘猿科技有限公司 | A kind of user identity management method based on license chain |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020192743A1 (en) * | 2019-03-28 | 2020-10-01 | 腾讯科技(深圳)有限公司 | Permission management method, permission validation method and related apparatuses |
US11651109B2 (en) | 2019-03-28 | 2023-05-16 | Tencent Technology (Shenzhen) Company Limited | Permission management method, permission verification method, and related apparatus |
TWI730690B (en) * | 2019-08-30 | 2021-06-11 | 開曼群島商創新先進技術有限公司 | Method and device for simultaneously executing transactions in block chain, computer readable storage medium and computing equipment |
Also Published As
Publication number | Publication date |
---|---|
TW201905813A (en) | 2019-02-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11734675B2 (en) | Systems and methods of blockchain transaction recordation | |
US20180075422A1 (en) | Financial management systems and methods | |
TWI646487B (en) | Smart contract executing system with permission rating and avoid duplication and method thereof | |
US20200082388A1 (en) | Authenticating server and method for transactions on blockchain | |
US20220156725A1 (en) | Cross-chain settlement mechanism | |
US20210110360A1 (en) | Cryptocurrency Exchange Without Bond Backing | |
US20220067125A1 (en) | Method for distributing certificate of right to use digital content, and computer program stored in medium in order to carry out method | |
TW202139127A (en) | Compute services for a platform of services associated with a blockchain | |
US20210004791A1 (en) | Guaranteeing server and method for transaction on blockchain | |
US20230082545A1 (en) | Event streams for a sequence of events associated with a blockchain | |
KR20200012688A (en) | Apparatus for KYC using KYC blockchain | |
US20230093411A1 (en) | Synchronising event streams | |
Fikri et al. | A blockchain-based decentralized microservices: Minimal architecture for accounting | |
KR102096640B1 (en) | Apparatus for KYC using Token Balance within KYC blockchain | |
KR102096646B1 (en) | Apparatus for KYC using KYC blockchain | |
KR102096642B1 (en) | Apparatus for KYC using KYC blockchain | |
KR102096644B1 (en) | Apparatus for KYC using KYC blockchain | |
TWI818171B (en) | Multi-party loan consumption system based on blockchain and smart contract and method thereof | |
WO2024116484A1 (en) | Token processing server, token processing method, and program | |
KR20200012686A (en) | Apparatus and Method for KYC using KYC blockchain | |
KR20200012690A (en) | Apparatus for KYC using KYC blockchain | |
KR20200089122A (en) | Transaction system of crypto currency and transaction method using the same |