TWI719651B - Transfer method and system based on blockchain smart contract - Google Patents

Transfer method and system based on blockchain smart contract Download PDF

Info

Publication number
TWI719651B
TWI719651B TW108134610A TW108134610A TWI719651B TW I719651 B TWI719651 B TW I719651B TW 108134610 A TW108134610 A TW 108134610A TW 108134610 A TW108134610 A TW 108134610A TW I719651 B TWI719651 B TW I719651B
Authority
TW
Taiwan
Prior art keywords
smart contract
asset
verification
virtual machine
business
Prior art date
Application number
TW108134610A
Other languages
Chinese (zh)
Other versions
TW202027530A (en
Inventor
戚奕統
謝桂魯
Original Assignee
開曼群島商創新先進技術有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 開曼群島商創新先進技術有限公司 filed Critical 開曼群島商創新先進技術有限公司
Publication of TW202027530A publication Critical patent/TW202027530A/en
Application granted granted Critical
Publication of TWI719651B publication Critical patent/TWI719651B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • G06Q20/102Bill distribution or payments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

公開了一種基於區塊鏈智慧合約的轉帳方法及系統。一方面,定義出入校驗指令並添加到區塊鏈虛擬機的指令集中,同時,在區塊鏈虛擬機中部署對應於所述出入校驗指令的出入校驗邏輯。另一方面,還需要將定義的出入校驗指令添加到智慧合約編譯器的指令集中,使得經智慧合約編譯器編譯的業務智慧合約中包含出入校驗指令。所述出入校驗邏輯為,採用同態加密演算法,校驗轉帳交易指定的轉帳資產的金額與該轉帳交易指定的找零資產的金額之和,是否等於該轉帳交易指定的各花銷資產的金額之和。A transfer method and system based on a blockchain smart contract are disclosed. On the one hand, the access check instruction is defined and added to the instruction set of the blockchain virtual machine, and at the same time, the access check logic corresponding to the access check instruction is deployed in the blockchain virtual machine. On the other hand, it is also necessary to add the defined access verification instructions to the instruction set of the smart contract compiler, so that the business smart contracts compiled by the smart contract compiler include access verification instructions. The in-out verification logic is to use a homomorphic encryption algorithm to verify whether the sum of the amount of the transfer asset specified by the transfer transaction and the amount of the change asset specified by the transfer transaction is equal to the spending assets specified by the transfer transaction The sum of the amounts.

Description

基於區塊鏈智慧合約的轉帳方法及系統Transfer method and system based on blockchain smart contract

本說明書實施例涉及資訊技術領域,尤其涉及一種基於區塊鏈智慧合約的轉帳方法及系統。The embodiments of this specification relate to the field of information technology, and in particular to a method and system for transferring funds based on a blockchain smart contract.

在以太坊架構中,各外部帳戶與各用戶一一對應,兩個用戶之間的轉帳行為實際上就是兩個外部帳戶之間的轉帳行為。 假設外部帳戶A想要向外部帳戶B轉帳,那麽,外部帳戶A首先會構建包含轉帳金額與外部帳戶B的帳戶地址的轉帳交易,隨後,該轉帳交易會被廣播給區塊鏈網路中的各節點。各節點對轉帳交易進行驗證通過後,執行轉帳交易,將轉帳金額寫入外部帳戶B。 需要說明的是,各節點對轉帳交易的驗證事項一般包括驗證外部帳戶A的餘額是否充足,即外部帳戶A的餘額是否大於或等於轉帳金額,若是,則驗證通過。這意味著,在現有的以太坊架構中,如果要進行轉帳,那麽轉帳人的帳戶餘額以及轉帳金額都會暴露給區塊鏈網路中的各節點。In the Ethereum architecture, each external account has a one-to-one correspondence with each user, and the transfer behavior between two users is actually the transfer behavior between two external accounts. Assuming that external account A wants to transfer money to external account B, then external account A will first construct a transfer transaction containing the transfer amount and the account address of external account B, and then the transfer transaction will be broadcast to the blockchain network Each node. After each node verifies the transfer transaction, it executes the transfer transaction and writes the transfer amount to external account B. It should be noted that the verification items of each node for the transfer transaction generally include verifying whether the balance of the external account A is sufficient, that is, whether the balance of the external account A is greater than or equal to the transfer amount, and if so, the verification is passed. This means that in the existing Ethereum architecture, if a transfer is to be made, the transferor's account balance and transfer amount will be exposed to all nodes in the blockchain network.

為了現有的基於區塊鏈的轉帳方法無法隱藏帳戶餘額與轉帳金額的問題,本說明書實施例提供一種基於區塊鏈智慧合約的轉帳方法及系統,技術方案如下: 根據本說明書實施例的第1態樣,提供一種基於區塊鏈智慧合約的轉帳方法,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯; 智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令; 區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的; 所述轉帳方法包括: 所述區塊鏈網路中的節點透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產; 針對所述區塊鏈網路中的每個節點,該節點在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約並根據所述業務智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和; 若校驗結果為是,則該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係。 根據本說明書實施例的第2態樣,提供另一種基於區塊鏈智慧合約的轉帳方法,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯; 智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約; 區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的; 所述轉帳方法包括: 所述區塊鏈網路中的節點透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產; 針對所述區塊鏈網路中的每個節點,該節點在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約,並根據所述業務智慧合約中的所述出入校驗智慧合約的合約標識,調用所述出入校驗智慧合約; 該節點根據所述出入校驗智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和; 若校驗結果為是,則該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係。 根據本說明書實施例的第3態樣,提供一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的; 所述區塊鏈網路中的節點,透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產; 所述區塊鏈網路中的每個節點,在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約並根據所述業務智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係。 根據本說明書實施例的第4態樣,提供一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的; 所述區塊鏈網路中的節點,透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產; 所述區塊鏈網路中的每個節點,在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約,並根據所述業務智慧合約中的所述出入校驗智慧合約的合約標識,調用所述出入校驗智慧合約;根據所述出入校驗智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係。 根據本說明書實施例的第5態樣,提供一種區塊鏈虛擬機,用於實現上述第1態樣與第2態樣的方法; 其中,所述區塊鏈虛擬機的指令集中包括出入校驗指令,並且,所述區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯; 所述出入校驗邏輯包括: 針對任一轉帳交易,採用同態加密演算法,校驗該轉帳交易指定的轉帳資產的金額與該轉帳交易指定的找零資產的金額之和,是否等於該轉帳交易指定的各花銷資產的金額之和。 根據本說明書實施例的第6態樣,提供一種智慧合約編譯器,用於實現上述第1態樣的方法; 其中,所述智慧合約編譯器的指令集中包括出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令。 根據本說明書實施例的第7態樣,提供一種智慧合約編譯器,用於實現上述第2態樣的方法; 其中,智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 本說明書實施例所提供的技術方案,一方面,定義出入校驗指令並添加到區塊鏈虛擬機的指令集中,同時,在區塊鏈虛擬機中部署對應於所述出入校驗指令的出入校驗邏輯。另一方面,還需要將定義的出入校驗指令添加到智慧合約編譯器的指令集中,使得經智慧合約編譯器編譯的業務智慧合約中包含出入校驗指令。所述出入校驗邏輯為,採用同態加密演算法,校驗轉帳交易指定的轉帳資產的金額與該轉帳交易指定的找零資產的金額之和,是否等於該轉帳交易指定的各花銷資產的金額之和。此外,業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的。 這樣一來,倘若將所述業務智慧合約部署到區塊鏈網路中,那麽,用戶在獲得轉帳交易時,就可以同時指定調用所述業務智慧合約執行該轉帳交易,進而,虛擬機在執行該轉帳交易時,就會調用所述業務智慧合約,並根據所述業務智慧合約中的出入校驗指令,觸發執行預先部署的出入校驗邏輯。如果校驗結果為是,就證明轉帳交易可行,區塊鏈虛擬機就可以執行轉帳交易並更新用戶資產表。 透過本說明書實施例,透過對區塊鏈虛擬機與智慧合約編譯器的指令集進行擴展,使得區塊鏈虛擬機可以預設支持在不暴露帳戶餘額與轉帳金額的前提下,校驗帳戶餘額是否足夠支付轉帳金額。 應當理解的是,以上的一般描述和後文的細節描述僅是示例性和解釋性的,並不能限制本說明書實施例。 此外,本說明書實施例中的任一實施例並不需要達到上述的全部效果。In order that the existing blockchain-based transfer method cannot hide the problem of account balance and transfer amount, the embodiments of this specification provide a blockchain smart contract-based transfer method and system. The technical solutions are as follows: According to the first aspect of the embodiment of the present specification, a method for transferring funds based on a blockchain smart contract is provided. The instruction set of the blockchain virtual machine includes an access verification instruction, and the blockchain virtual machine is deployed corresponding to all State the access verification logic of the access verification instruction; The instruction set of the smart contract compiler includes the entry and exit verification instructions, and the business smart contract compiled by the smart contract compiler includes the entry and exit verification instructions; The business smart contract is deployed in the blockchain network, and the business smart contract corresponds to a user asset table. The user asset table is used to record the asset corresponding to each external account. For any asset, the asset contains Encrypted amount of data, the encrypted amount is obtained after encrypting the amount of the asset; The transfer method includes: Nodes in the blockchain network obtain transfer transactions through transfer external accounts and broadcast them to other nodes; the transfer transactions include transfer assets, change assets, and at least one expense asset; For each node in the blockchain network, when the node executes the transfer transaction, it uses the blockchain virtual machine to call the business smart contract and verify the entry and exit instructions in the business smart contract , Triggering the execution of the access verification logic, so as to use a homomorphic encryption algorithm to verify whether the sum of the amount of the transfer asset and the amount of the change asset is equal to the sum of the amount of each spent asset; If the verification result is yes, the node executes the user asset table modification logic in the business smart contract through the blockchain virtual machine, so as to cancel the correspondence between the transfer external account and each expense asset, and establish the The corresponding relationship between the transfer external account and the change asset, and the establishment of the corresponding relationship between the external account for collection and the transfer asset. According to the second aspect of the embodiment of this specification, another transfer method based on the blockchain smart contract is provided. The instruction set of the blockchain virtual machine includes access verification instructions, and the blockchain virtual machine is deployed corresponding to The access check logic of the access check instruction; The instruction set of the smart contract compiler includes the entry and exit verification instructions, and the business smart contract compiled by the smart contract compiler includes the contract identification of the entry and exit verification smart contract, and the entry and exit verification smart contract is pre-deployed in all Describe the smart contract in the blockchain network; The business smart contract is deployed in the blockchain network, and the business smart contract corresponds to a user asset table. The user asset table is used to record the asset corresponding to each external account. For any asset, the asset contains Encrypted amount of data, the encrypted amount is obtained after encrypting the amount of the asset; The transfer method includes: Nodes in the blockchain network obtain transfer transactions through transfer external accounts and broadcast them to other nodes; the transfer transactions include transfer assets, change assets, and at least one expense asset; For each node in the blockchain network, when the node executes the transfer transaction, it calls the business smart contract through the blockchain virtual machine, and according to the access and exit of the business smart contract Verify the contract identifier of the smart contract, and call the smart contract for access verification; The node triggers the execution of the access verification logic according to the access verification instruction in the access verification smart contract, so as to use a homomorphic encryption algorithm to verify the amount of the transfer asset and the amount of the change asset Whether the sum is equal to the sum of the amount of each spent asset; If the verification result is yes, the node executes the user asset table modification logic in the business smart contract through the blockchain virtual machine, so as to cancel the correspondence between the transfer external account and each expense asset, and establish the The corresponding relationship between the transfer external account and the change asset, and the establishment of the corresponding relationship between the external account for collection and the transfer asset. According to the third aspect of the embodiments of this specification, a blockchain system is provided, including a blockchain network; Wherein, the instruction set of the blockchain virtual machine includes access verification instructions, and the blockchain virtual machine is deployed with access verification logic corresponding to the access verification instructions; the instruction set of the smart contract compiler includes the Access verification instruction, the business smart contract compiled by the smart contract compiler includes the business smart contract; the business smart contract is deployed in the blockchain network, and the business smart contract corresponds to a user asset table The user asset table is used to record the assets corresponding to each external account. For any asset, the asset is a data containing an encrypted amount, and the encrypted amount is obtained by encrypting the amount of the asset; The nodes in the blockchain network obtain transfer transactions through transfer external accounts and broadcast them to other nodes; the transfer transactions include transfer assets, change assets, and at least one expense asset; Each node in the blockchain network, when executing the transfer transaction, invokes the business smart contract through the blockchain virtual machine and triggers the execution according to the access verification instructions in the business smart contract The access verification logic is to use a homomorphic encryption algorithm to verify whether the sum of the amount of the transfer asset and the amount of the change asset is equal to the sum of the amount of each spent asset; if the verification result is yes , Execute the user asset table modification logic in the business smart contract through the blockchain virtual machine, so as to cancel the correspondence between the transfer external account and each expense asset, and establish the transfer external account and the change Correspondence between assets, and establish the correspondence between external accounts for collection and the transfer assets. According to the fourth aspect of the embodiments of this specification, a blockchain system is provided, including a blockchain network; Wherein, the instruction set of the blockchain virtual machine includes access verification instructions, and the blockchain virtual machine is deployed with access verification logic corresponding to the access verification instructions; the instruction set of the smart contract compiler includes the Access verification instruction, the business smart contract compiled by the smart contract compiler includes the contract identifier of the access verification smart contract, and the access verification smart contract is pre-deployed in the blockchain network Smart contract; the business smart contract is deployed in the blockchain network, and the business smart contract corresponds to a user asset table. The user asset table is used to record the assets corresponding to each external account. For any asset, the The asset is the data containing the encrypted amount, and the encrypted amount is obtained after encrypting the amount of the asset; The nodes in the blockchain network obtain transfer transactions through transfer external accounts and broadcast them to other nodes; the transfer transactions include transfer assets, change assets, and at least one expense asset; When executing the transfer transaction, each node in the blockchain network invokes the business smart contract through the blockchain virtual machine, and verifies the wisdom based on the access and exit in the business smart contract The contract identifier of the contract calls the access verification smart contract; according to the access verification instruction in the access verification smart contract, the execution of the access verification logic is triggered, so that the homomorphic encryption algorithm is used to verify the Whether the sum of the amount of transferred assets and the amount of the change assets is equal to the sum of the amount of each spent asset; if the verification result is yes, the user assets in the business smart contract will be executed through the blockchain virtual machine Table modification logic to remove the correspondence between the transfer external account and each expense asset, establish the correspondence between the transfer external account and the change asset, and establish the correspondence between the collection external account and the transfer asset . According to the fifth aspect of the embodiments of the present specification, a blockchain virtual machine is provided for implementing the methods of the first aspect and the second aspect described above; Wherein, the instruction set of the blockchain virtual machine includes an access check instruction, and the blockchain virtual machine is deployed with an access check logic corresponding to the access check instruction; The access check logic includes: For any transfer transaction, use a homomorphic encryption algorithm to verify whether the sum of the amount of the transfer asset specified in the transfer transaction and the amount of the change asset specified in the transfer transaction is equal to the amount of each spent asset specified in the transfer transaction The sum of the amounts. According to the sixth aspect of the embodiments of this specification, a smart contract compiler is provided for implementing the method of the first aspect described above; Wherein, the instruction set of the smart contract compiler includes an access verification instruction, and the business smart contract compiled by the smart contract compiler includes the access verification instruction. According to the seventh aspect of the embodiments of this specification, a smart contract compiler is provided for implementing the method of the second aspect; Wherein, the instruction set of the smart contract compiler includes the entry and exit verification instructions, the business smart contract compiled by the smart contract compiler includes the contract identification of the entry and exit verification smart contract, and the entry and exit verification smart contract is pre-deployed Smart contracts in the blockchain network. The technical solution provided by the embodiment of this specification, on the one hand, defines the access check instruction and adds it to the instruction set of the blockchain virtual machine, and at the same time, deploys the access check instruction corresponding to the access check instruction in the blockchain virtual machine. Check logic. On the other hand, it is also necessary to add the defined access verification instructions to the instruction set of the smart contract compiler, so that the business smart contracts compiled by the smart contract compiler include access verification instructions. The in-out verification logic is to use a homomorphic encryption algorithm to verify whether the sum of the amount of the transfer asset specified by the transfer transaction and the amount of the change asset specified by the transfer transaction is equal to the spending assets specified by the transfer transaction The sum of the amounts. In addition, the business smart contract corresponds to a user asset table. The user asset table is used to record the assets corresponding to each external account. For any asset, the asset is data containing the encrypted amount, and the encrypted amount is the amount of the asset. Obtained after encryption. In this way, if the business smart contract is deployed to the blockchain network, then when the user obtains the transfer transaction, he can specify to call the business smart contract to execute the transfer transaction at the same time, and then the virtual machine is executing During the transfer transaction, the business smart contract is called, and the execution of the pre-deployed access verification logic is triggered according to the access verification instruction in the business smart contract. If the verification result is yes, it proves that the transfer transaction is feasible, and the blockchain virtual machine can execute the transfer transaction and update the user's asset table. Through the embodiments of this specification, by extending the instruction set of the blockchain virtual machine and the smart contract compiler, the blockchain virtual machine can preset to support the verification of the account balance without exposing the account balance and the transfer amount. Whether it is enough to pay the transfer amount. It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the embodiments of this specification. In addition, any one of the embodiments of the present specification does not need to achieve all the above-mentioned effects.

在本文中,區塊鏈虛擬機,是指每個區塊鏈節點在執行交易時所依賴的執行程式。區塊鏈虛擬機為區塊鏈交易提供了執行環境。 需要說明的是,區塊鏈虛擬機不僅可以是以太坊協議中記載的以太坊虛擬機(Ethereum Virtual Machine,EVM),還可以是除以太坊協議之外的其他區塊鏈協議中所指的虛擬機。 在本文中,智慧合約編譯器,是指用於將使用程式語言(如solidity語言)編寫的智慧合約,編譯成區塊鏈虛擬機可以識別並執行的機器語言(如位元組碼、二進制碼等)的程式。需要說明的是,部署於區塊鏈網路中的智慧合約,一般是指經過智慧合約編譯器編譯後的智慧合約,即位元組碼形式或二進制碼形式的智慧合約。 在以太坊協議或其他類似於以太坊協議的區塊鏈協議中,區塊鏈虛擬機在本地維護了若干組指令與操作之間的映射關係(如下表1所示),並且,區塊鏈虛擬機本地還部署有表1中的每個操作的代碼邏輯。指令1~指令N都是區塊鏈虛擬機所預設支持的指令,指令1~指令N組成了區塊鏈虛擬機的指令集。區塊鏈虛擬機在調用智慧合約時,如果從智慧合約中讀取到表1中的任一指令,就會觸發執行該指令對應的操作的代碼邏輯。需要說明的是,本文所述的指令一般是位元組碼形式或二進制碼形式的。 指令1 操作1 指令2 操作2 指令3 操作3 …… …… 指令N 操作N 表1 因此,如果想讓區塊鏈虛擬機執行表1中的任一操作,就需要在區塊鏈虛擬機所要調用智慧合約中,預先寫入該操作對應的指令。這意味著,智慧合約編譯器在預先對該智慧合約進行編譯時,能夠將智慧合約(使用程式語言編寫的)中聲明實現表1中任一操作的內容編譯成對應的指令,以便區塊鏈虛擬機可以識別。這就要求,智慧合約編譯器也需要預設支持表1中的指令1~指令N,指令1~指令N組成了智慧合約編譯器的指令集。 總之,在以太坊協議或其他類似於以太坊協議的區塊鏈協議中,一般是由區塊鏈虛擬機、智慧合約編譯器以及智慧合約協同實現特定的業務需求。 但是,現有的以太坊虛擬機在本地預設支持的操作是有限的,而業務需求是複雜多樣的。例如,現有的以太坊虛擬機與以太坊的智慧合約編譯器並不預設支持如下操作,導致在現有的以太坊架構中,無法實現一些依賴於如下操作的業務需求: 1、基於64個可列印字元(BASE64)的編解碼操作。 2、RSA簽名驗證操作;其中,RSA演算法是1977年由羅納德・李維斯特(Ron Rivest)、阿迪・薩莫爾(Adi Shamir)和倫納德・阿德曼(Leonard Adleman),RSA演算法也因此得名。 3、對JS物件表示法(JavaScript Object Notation,JSON)資料的處理操作;其中,JSON是一種常見的資料交換格式,JSON資料是具有這種資料交換格式的資料。 4、對可延伸標示語言(eXtensible Markup Language,XML)資料的處理操作;其中,XML是一種常見的資料交換格式,XML資料是具有這種資料交換格式的資料。 5、獲取當前執行的交易的交易哈希的操作。 6、對於一筆轉帳交易,在不暴露轉帳人的資產餘額與轉帳金額的前提下,判斷轉帳人的資產餘額是否足夠支付這筆轉帳交易的轉帳金額。 由於現有的以太坊虛擬機與以太坊的智慧合約編譯器不預設支持上述操作的問題,因此,在現有技術中,針對上述任一種操作,一般採用將實現該操作的代碼邏輯直接寫入智慧合約的方式,使得以太坊虛擬機在執行交易時,調用智慧合約來執行該操作的代碼邏輯。也就是說,以太坊虛擬機雖然不預設支持上述操作,但是將上述操作的代碼邏輯寫入智慧合約,並讓以太坊虛擬機調用該智慧合約,也可以實現以太坊虛擬機執行上述操作的目的。 但是,實踐中,相比於以太坊虛擬機直接執行本地預先部署的代碼邏輯,以太坊虛擬機執行智慧合約中的代碼邏輯的效率較低。 而本發明的核心思想在於,一方面,對區塊鏈虛擬機的指令集進行擴展,增加上述操作對應的指令,同時在區塊鏈虛擬機本地預先部署上述操作對應的代碼邏輯,使得區塊鏈虛擬機可以預設支持上述操作。另一方面,對智慧合約編譯器的指令集也進行擴展,增加上述操作對應的指令。其中,針對同一操作,為區塊鏈虛擬機的指令集增加的對應於該操作的指令與為智慧合約編譯器的指令集增加的對應於該操作的指令應當一致。如表2所示。 指令1 操作1 指令2 操作2 指令3 操作3 BASE64編碼指令 BASE64編碼操作 …… …… 指令N 操作N 表2 如此,以上述的BASE64編碼操作為例,可以在使用程式語言編寫智慧合約時,在智慧合約中聲明調用BASE64編碼操作,智慧合約編譯器在對智慧合約進行編譯時,將這段聲明編譯成BASE64編碼指令。該智慧合約被部署到區塊鏈網路中之後,用戶在發起業務時,可以在業務發起交易中指定調用該智慧合約,這樣,區塊鏈虛擬機在執行業務發起交易時,就會調用該智慧合約,並當從該智慧合約中讀取到BASE64編碼指令,觸發在本地執行相應的BASE64編碼邏輯,以實現BASE64編碼操作。 為了使本領域技術人員更好地理解本說明書實施例中的技術方案,下面將結合本說明書實施例中的圖式,對本說明書實施例中的技術方案進行詳細地描述,顯然,所描述的實施例僅僅是本說明書的一部分實施例,而不是全部的實施例。基於本說明書中的實施例,本領域普通技術人員所獲得的所有其他實施例,都應當屬保護的範圍。 以下結合圖式,詳細說明本說明書各實施例提供的技術方案。需要說明的是,由於以下的各實施例所基於的技術思想都是類似的,因此,下文的各實施例可互相參照理解。 實施例一 圖1是本說明書實施例提供的一種基於區塊鏈智慧合約的編碼方法的流程示意圖,包括以下步驟: S100:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S102:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S104:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的BASE64編碼指令,觸發執行所述BASE64編碼邏輯,以對待編碼資料進行編碼操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括BASE64編碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64編碼指令的BASE64編碼邏輯。 2)智慧合約編譯器的指令集中包括所述BASE64編碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述BASE64編碼指令。 3)區塊鏈網路中部署有所述業務智慧合約。 所述業務智慧合約是需要調用BASE64編碼功能的業務所對應的智慧合約。 在本說明的各實施例中,區塊鏈網路包括多個節點。其中,從軟體層面上看,節點是指用於實現區塊鏈功能的區塊鏈程式;從硬體層面上看,節點是指安裝有區塊鏈程式的用戶設備。在實際應用中,每個節點可以對接至少一個客戶端(或稱錢包),區塊鏈中的交易通常是客戶端構建的。 在本說明的各實施例中所描述的交易(transaction),是指用戶透過區塊鏈的客戶端創建,並需要最終發佈至區塊鏈的分佈式資料庫中的一筆資料。交易是區塊鏈協議中所約定的一種資料結構,一筆資料要存入區塊鏈,就需要被封裝成交易。 區塊鏈中的交易,存在狹義的交易以及廣義的交易之分。狹義的交易是指用戶向區塊鏈發佈的一筆價值轉移;例如,在傳統的比特幣區塊鏈網路中,交易可以是用戶在區塊鏈中發起的一筆轉帳。而廣義的交易是指用戶向區塊鏈發佈的一筆具有業務意圖的業務資料;例如,運營方可以基於實際的業務需求搭建一個聯盟鏈,依托於聯盟鏈部署一些與價值轉移無關的其它類型的在線業務(比如,租房業務、車輛調度業務、保險理賠業務、信用服務、醫療服務等),而在這類聯盟鏈中,交易可以是用戶在聯盟鏈中發佈的一筆具有業務意圖的業務消息或者業務請求。 在區塊鏈網路中,用戶通常以交易的形式發起業務。具體地,節點需要獲得業務發起交易如果上述的業務智慧合約不是區塊鏈網路中部署的唯一的智慧合約,業務發起交易中還會注明所述業務智慧合約的合約標識,以明確交易執行時所需要調用的智慧合約。 其中,業務發起交易通常是用戶透過客戶端構建並發送給節點的。一般而言,區塊鏈網路對接的客戶端與各用戶一一對應。 節點在將業務發起交易廣播給其他節點之後,針對每個節點,該節點在接收到所述業務發起交易之後,需要透過區塊鏈虛擬機調用所述業務智慧合約來執行該業務發起交易。此處需要說明的是,在區塊鏈網路中,每個節點上都部署有區塊鏈虛擬機,節點執行交易時,實際上是節點上部署的區塊鏈虛擬機在執行交易。 在實施例一中,區塊鏈虛擬機調用所述業務智慧合約之後,會讀取所述業務智慧合約中的位元組碼或二進制碼並執行,當讀取到所述業務智慧合約中的BASE64編碼指令時,相當於明確了此時需要進行BASE64編碼操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的BASE64編碼邏輯,以對待編碼資料進行編碼操作。 在實際應用中,視具體的業務需求的不同,待編碼資料可以是包含於所述業務發起交易中的,也可以包含於所述業務智慧合約中的,還可以是區塊鏈虛擬機在執行所述業務發起交易時產生的。 此外,各節點除了透過區塊鏈虛擬機執行業務發起交易之外,還需要基於共識機制,將所述業務發起交易寫入區塊鏈。 另外需要說明的是,區塊鏈虛擬機如果根據所述業務智慧合約中的BASE64編碼指令觸發執行BASE64編碼邏輯,那麽,在執行過程中所採用的資料傳遞方式通常是棧傳遞(即一般會將BASE64編碼後的資料寫入棧中),但是,對於經過BASE64編碼後的資料而言,其資料長度是不固定的,如果採用棧傳遞的方式,就要求針對各種可能當資料長度都預先設置相應的BASE64編碼指令,實現起來較為複雜。 為此,以下的實施例二提供了另一種基於區塊鏈智慧合約的編碼方法。 實施例二 圖2是本說明書實施例提供的另一種基於區塊鏈智慧合約的編碼方法的流程示意圖,包括以下步驟: S200:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S202:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S204:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述BASE64編碼智慧合約的合約標識,調用所述BASE64編碼智慧合約。 S206:該節點透過區塊鏈虛擬機,根據所述BASE64編碼智慧合約中的BASE64編碼指令,觸發執行所述BASE64編碼邏輯,以對待編碼資料進行編碼操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括BASE64編碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64編碼指令的BASE64編碼邏輯。 2)智慧合約編譯器的指令集中包括所述BASE64編碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含BASE64編碼智慧合約的合約標識,所述BASE64編碼智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 3)區塊鏈網路中部署有所述業務智慧合約。 實施例二與實施例一的區別主要在於,在實施例二中,區塊鏈虛擬機調用所述業務智慧合約之後,當讀取到所述BASE64編碼智慧合約的合約標識時,相當於明確了此時需要進一步調用所述BASE64編碼智慧合約。區塊鏈虛擬機調用所述BASE64編碼智慧合約,也會讀取所述BASE64編碼智慧合約中的位元組碼或二進制碼,當讀取到所述BASE64編碼指令時,相當於明確了此時需要執行BASE64編碼操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的BASE64編碼邏輯,以對待編碼資料進行編碼操作。 也就是說,在實施例二中,智慧合約編譯器在編譯業務智慧合約時,如果發現業務智慧合約中聲明調用BASE64編碼操作,則不會將這段聲明編譯BASE64編碼指令,而是編譯成所述BASE64編碼智慧合約的合約標識。這樣,區塊鏈虛擬機在調用業務智慧合約時,會進一步調用所述BASE64編碼智慧合約。 在區塊鏈技術領域,所述BASE64編碼智慧合約實際上是一種預編譯合約,區塊鏈虛擬機在調用並執行如BASE64編碼智慧合約這樣的預編譯合約時,並不會採用棧傳遞的方式進行參數傳遞,而是會採用記憶體傳遞的方式進行參數傳遞(支持不固定長度的資料讀寫)。 實施例三 圖3是本說明書實施例提供的一種基於區塊鏈智慧合約的編碼方法的流程示意圖,包括以下步驟: S300:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S302:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 In this article, the blockchain virtual machine refers to the execution program that each blockchain node relies on when executing transactions. The blockchain virtual machine provides an execution environment for blockchain transactions. It should be noted that the blockchain virtual machine can not only be the Ethereum Virtual Machine (EVM) recorded in the Ethereum protocol, but also refer to other blockchain protocols other than the Ethereum protocol. virtual machine. In this article, the smart contract compiler refers to a smart contract written in a programming language (such as solidity language) and compiled into a machine language (such as byte code, binary code) that can be recognized and executed by the blockchain virtual machine. Etc.). It should be noted that the smart contract deployed in the blockchain network generally refers to a smart contract compiled by a smart contract compiler, that is, a smart contract in the form of byte code or binary code. In the Ethereum protocol or other blockchain protocols similar to the Ethereum protocol, the blockchain virtual machine locally maintains the mapping relationship between several sets of instructions and operations (as shown in Table 1 below), and the blockchain The code logic of each operation in Table 1 is also deployed locally on the virtual machine. Instruction 1~Instruction N are all the instructions supported by the blockchain virtual machine by default. Instruction 1~Instruction N form the instruction set of the blockchain virtual machine. When the blockchain virtual machine calls the smart contract, if any instruction in Table 1 is read from the smart contract, it will trigger the code logic to execute the operation corresponding to the instruction. It should be noted that the instructions described in this article are generally in the form of byte code or binary code. Instruction 1 Operation 1 Instruction 2 Operation 2 Instruction 3 Operation 3 ... ... Instruction N Operation N Table 1 Therefore, if you want the blockchain virtual machine to perform any of the operations in Table 1, you need to pre-write the instructions corresponding to the operation in the smart contract to be called by the blockchain virtual machine. This means that when the smart contract compiler compiles the smart contract in advance, it can compile the content declared in the smart contract (written in a programming language) to implement any of the operations in Table 1 into corresponding instructions for the blockchain The virtual machine can be identified. This requires that the smart contract compiler also needs to preset support for instruction 1~instruction N in Table 1. Instruction 1~instruction N form the instruction set of the smart contract compiler. In short, in the Ethereum protocol or other blockchain protocols similar to the Ethereum protocol, the blockchain virtual machine, smart contract compiler, and smart contract are generally used to coordinate specific business requirements. However, the existing Ethereum virtual machine supports limited operations locally, and the business requirements are complex and diverse. For example, the existing Ethereum virtual machine and Ethereum's smart contract compiler do not support the following operations by default. As a result, some business requirements that depend on the following operations cannot be achieved in the existing Ethereum architecture: 1. Based on 64 available The encoding and decoding operations of printing characters (BASE64). 2. RSA signature verification operation; among them, the RSA algorithm was developed by Ron Rivest, Adi Shamir and Leonard Adleman in 1977, RSA The algorithm also got its name. 3. Processing operations on JS object notation (JavaScript Object Notation, JSON) data; among them, JSON is a common data exchange format, and JSON data is data with this data exchange format. 4. Processing operations on eXtensible Markup Language (XML) data; among them, XML is a common data exchange format, and XML data is data with this data exchange format. 5. The operation of obtaining the transaction hash of the currently executed transaction. 6. For a transfer transaction, under the premise of not revealing the transferor's asset balance and transfer amount, determine whether the transferor's asset balance is sufficient to cover the transfer amount of the transfer transaction. Since the existing Ethereum virtual machine and the Ethereum smart contract compiler do not support the above-mentioned operation problems by default, in the prior art, for any of the above-mentioned operations, it is generally adopted to directly write the code logic to realize the operation into the smart contract. The contract method allows the Ethereum virtual machine to call the smart contract to execute the code logic of the operation when executing the transaction. In other words, although the Ethereum virtual machine does not support the above operations by default, writing the code logic of the above operations into a smart contract and letting the Ethereum virtual machine call the smart contract can also realize the Ethereum virtual machine to perform the above operations purpose. However, in practice, compared to the Ethereum virtual machine directly executing locally pre-deployed code logic, the Ethereum virtual machine is less efficient in executing the code logic in the smart contract. The core idea of the present invention is that, on the one hand, the instruction set of the blockchain virtual machine is expanded, and the instructions corresponding to the above operations are added. At the same time, the code logic corresponding to the above operations is pre-deployed locally in the blockchain virtual machine, so that the block The chain virtual machine can preset to support the above operations. On the other hand, the instruction set of the smart contract compiler is also expanded, adding instructions corresponding to the above operations. Among them, for the same operation, the instruction corresponding to the operation added to the instruction set of the blockchain virtual machine and the instruction corresponding to the operation added to the instruction set of the smart contract compiler should be consistent. As shown in table 2. Instruction 1 Operation 1 Instruction 2 Operation 2 Instruction 3 Operation 3 BASE64 encoding instruction BASE64 encoding operation ... ... Instruction N Operation N Table 2 In this way, taking the above-mentioned BASE64 encoding operation as an example, when writing a smart contract in a programming language, the BASE64 encoding operation can be declared in the smart contract, and the smart contract compiler will compile this statement when compiling the smart contract. Into BASE64 encoding instructions. After the smart contract is deployed in the blockchain network, when the user initiates a business, he can specify to call the smart contract in the business initiation transaction. In this way, the blockchain virtual machine will call the smart contract when executing the business initiation transaction. The smart contract, and when the BASE64 encoding instruction is read from the smart contract, it triggers the execution of the corresponding BASE64 encoding logic locally to implement the BASE64 encoding operation. In order to enable those skilled in the art to better understand the technical solutions in the embodiments of this specification, the technical solutions in the embodiments of this specification will be described in detail below in conjunction with the drawings in the embodiments of this specification. Obviously, the described implementation The examples are only a part of the embodiments in this specification, not all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art should fall within the scope of protection. The following describes in detail the technical solutions provided by the embodiments of this specification in conjunction with the drawings. It should be noted that since the following embodiments are based on similar technical ideas, the following embodiments can be understood with reference to each other. Embodiment 1 Fig. 1 is a schematic flow chart of an encoding method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S100: A node in the blockchain network obtains a business to initiate a transaction and broadcasts it to other nodes. S102: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S104: The node triggers the execution of the BASE64 encoding logic through the blockchain virtual machine according to the BASE64 encoding instruction in the business smart contract to perform an encoding operation on the encoded data. In this embodiment, the blockchain network needs to be pre-configured, so that: 1) The instruction set of the blockchain virtual machine includes BASE64 encoding instructions, and the blockchain virtual machine is deployed corresponding to the BASE64 encoding The BASE64 encoding logic of the instruction. 2) The instruction set of the smart contract compiler includes the BASE64 encoding instruction, and the business smart contract compiled by the smart contract compiler includes the BASE64 encoding instruction. 3) The business smart contract is deployed in the blockchain network. The business smart contract is a smart contract corresponding to a business that needs to call the BASE64 encoding function. In the embodiments of this description, the blockchain network includes a plurality of nodes. Among them, from the software level, the node refers to the blockchain program used to realize the blockchain function; from the hardware level, the node refers to the user equipment installed with the blockchain program. In practical applications, each node can connect to at least one client (or wallet), and transactions in the blockchain are usually constructed by the client. The transaction described in each embodiment of this description refers to a piece of data created by a user through a client terminal of the blockchain and that needs to be finally published to the distributed database of the blockchain. A transaction is a data structure agreed in the blockchain protocol. To store a piece of data in the blockchain, it needs to be encapsulated into a transaction. There are narrow transactions and broad transactions in the transactions in the blockchain. A transaction in a narrow sense refers to a transfer of value issued by a user to the blockchain; for example, in a traditional Bitcoin blockchain network, a transaction can be a transfer initiated by the user in the blockchain. In a broad sense, a transaction refers to a piece of business data with business intentions released by a user to the blockchain; for example, an operator can build a consortium chain based on actual business needs, and rely on the consortium chain to deploy some other types that have nothing to do with value transfer. Online business (for example, renting business, vehicle dispatching business, insurance claims business, credit service, medical service, etc.), and in this kind of alliance chain, the transaction can be a business message with business intent issued by the user in the alliance chain or Business request. In the blockchain network, users usually initiate business in the form of transactions. Specifically, the node needs to obtain the business initiation transaction. If the above-mentioned business smart contract is not the only smart contract deployed in the blockchain network, the business initiation transaction will also indicate the contract identifier of the business smart contract to clarify the transaction execution The smart contract that needs to be called at the time. Among them, the business initiation transaction is usually constructed by the user through the client and sent to the node. Generally speaking, there is a one-to-one correspondence between the clients connected to the blockchain network and each user. After the node broadcasts the business initiation transaction to other nodes, for each node, after receiving the business initiation transaction, the node needs to invoke the business smart contract through the blockchain virtual machine to execute the business initiation transaction. What needs to be explained here is that in a blockchain network, a blockchain virtual machine is deployed on each node. When a node executes a transaction, the blockchain virtual machine deployed on the node is actually executing the transaction. In the first embodiment, after the blockchain virtual machine invokes the business smart contract, it reads and executes the byte code or binary code in the business smart contract. When the BASE64 encoding instruction is used, it is equivalent to clarifying that the BASE64 encoding operation is required at this time. Therefore, the blockchain virtual machine will trigger the execution of the BASE64 encoding logic pre-deployed locally to perform the encoding operation on the encoded data. In practical applications, depending on the specific business requirements, the data to be encoded can be included in the business initiation transaction, can also be included in the business smart contract, or it can be executed by the blockchain virtual machine. Generated when the business initiates a transaction. In addition, in addition to executing business-initiated transactions through the blockchain virtual machine, each node also needs to write the business-initiated transactions into the blockchain based on a consensus mechanism. In addition, it should be noted that if the blockchain virtual machine triggers the execution of BASE64 encoding logic according to the BASE64 encoding instruction in the business smart contract, then the data transfer method used in the execution process is usually stack transfer (that is, generally BASE64-encoded data is written into the stack), but for the BASE64-encoded data, the data length is not fixed. If the stack transfer method is used, it is required to preset the corresponding data length for various possible data lengths. The BASE64 encoding instruction is more complicated to implement. For this reason, the second embodiment below provides another coding method based on the blockchain smart contract. Embodiment 2 Fig. 2 is a schematic flow diagram of another coding method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S200: A node in the blockchain network obtains a business, initiates a transaction, and broadcasts it to other nodes . S202: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S204: The node uses the blockchain virtual machine to call the BASE64-encoded smart contract according to the contract identifier of the BASE64-encoded smart contract in the business smart contract. S206: The node triggers the execution of the BASE64 encoding logic according to the BASE64 encoding instruction in the BASE64 encoding smart contract through the blockchain virtual machine to perform an encoding operation on the encoded data. In this embodiment, the blockchain network needs to be pre-configured, so that: 1) The instruction set of the blockchain virtual machine includes BASE64 encoding instructions, and the blockchain virtual machine is deployed corresponding to the BASE64 encoding The BASE64 encoding logic of the instruction. 2) The instruction set of the smart contract compiler includes the BASE64 encoded instruction, and the business smart contract compiled by the smart contract compiler includes the contract identifier of the BASE64 encoded smart contract, and the BASE64 encoded smart contract is pre-deployed in the Smart contracts in the blockchain network. 3) The business smart contract is deployed in the blockchain network. The main difference between the second embodiment and the first embodiment is that in the second embodiment, after the blockchain virtual machine invokes the business smart contract, when the contract identifier of the BASE64-encoded smart contract is read, it is equivalent to clear At this time, the BASE64 coded smart contract needs to be further invoked. When the blockchain virtual machine calls the BASE64-encoded smart contract, it will also read the byte code or binary code in the BASE64-encoded smart contract. When the BASE64 encoding instruction is read, it is equivalent to clarifying this time. The BASE64 encoding operation needs to be performed. Therefore, the blockchain virtual machine will trigger the execution of the BASE64 encoding logic pre-deployed locally to perform the encoding operation on the encoded data. That is to say, in the second embodiment, when the smart contract compiler compiles the business smart contract, if it finds that the business smart contract declares to call the BASE64 encoding operation, it will not compile this statement into the BASE64 encoding instruction, but will compile it into all The contract identifier of the BASE64-encoded smart contract. In this way, when the blockchain virtual machine calls the business smart contract, it will further call the BASE64 encoded smart contract. In the field of blockchain technology, the BASE64-encoded smart contract is actually a pre-compiled contract. When the blockchain virtual machine calls and executes a pre-compiled contract such as the BASE64-encoded smart contract, it does not use the stack transfer method. For parameter transfer, it will use memory transfer for parameter transfer (supports reading and writing of data with variable lengths). Embodiment 3 Fig. 3 is a schematic flow chart of an encoding method based on a blockchain smart contract provided by an embodiment of this specification, which includes the following steps: S300: A node in the blockchain network obtains a service to initiate a transaction and broadcasts it to other nodes. S302: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction.

S304:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的BASE64解碼指令,觸發執行所述BASE64解碼邏輯,以對待解碼資料進行解碼操作。 S304: The node uses the blockchain virtual machine to trigger the execution of the BASE64 decoding logic according to the BASE64 decoding instruction in the business smart contract to perform a decoding operation on the data to be decoded.

在本實施例中,需要針對區塊鏈網路進行預先配置,使得: In this embodiment, the blockchain network needs to be pre-configured so that:

1)區塊鏈虛擬機的指令集中包括BASE64解碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64解碼指令的BASE64解碼邏輯。 1) The instruction set of the blockchain virtual machine includes BASE64 decoding instructions, and the blockchain virtual machine is equipped with BASE64 decoding logic corresponding to the BASE64 decoding instructions.

2)智慧合約編譯器的指令集中包括所述BASE64解碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述BASE64解碼指令。 2) The instruction set of the smart contract compiler includes the BASE64 decoding instruction, and the business smart contract compiled by the smart contract compiler includes the BASE64 decoding instruction.

3)區塊鏈網路中部署有所述業務智慧合約。 3) The business smart contract is deployed in the blockchain network.

由於BASE64解碼操作與BASE64編碼操作是相對應的一組操作,因此,相關說明參見實施例一即可,不再贅述。 Since the BASE64 decoding operation and the BASE64 encoding operation are a set of corresponding operations, the related description can be referred to the first embodiment, and will not be repeated.

需要說明的是,在實際應用中,視具體的業務需求的不同,待解碼資料可以是包含於所述業務發起交易中的,也可以包含於所述業務智慧合約中的,還可以是區塊鏈虛擬機在執行所述業務發起交易時產生的。 It should be noted that in practical applications, depending on the specific business requirements, the data to be decoded can be included in the business initiation transaction, can also be included in the business smart contract, or block The chain virtual machine is generated when executing the business initiation transaction.

此外,在實施例三中,也存在前文所述的棧傳遞實現複雜的問題,為此,以下的實施例四提供了另一種基於區塊鏈智慧合約的解碼方法。 In addition, in the third embodiment, there is also the problem of the complexity of the stack transfer implementation described above. For this reason, the following embodiment four provides another decoding method based on the blockchain smart contract.

實施例四 Example four

圖4是本說明書實施例提供的另一種基於區塊鏈智慧合約的解碼方法的流程示意圖,包括以下步驟: Fig. 4 is a schematic flowchart of another decoding method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps:

S400:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S400: A node in the blockchain network obtains a business to initiate a transaction and broadcast it to other nodes.

S402:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S402: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction.

S404:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述BASE64解碼智慧合約的合約標識,調用所述BASE64解碼智慧合約。 S404: The node uses the blockchain virtual machine to call the BASE64 decoding smart contract according to the contract identifier of the BASE64 decoding smart contract in the business smart contract.

S406;該節點透過區塊鏈虛擬機,根據所述BASE64解碼智慧合約中的BASE64解碼指令,觸發執行所述BASE64解碼邏輯,以對待解碼資料進行解碼操作。 S406: The node uses the blockchain virtual machine to trigger the execution of the BASE64 decoding logic according to the BASE64 decoding instruction in the BASE64 decoding smart contract to perform a decoding operation on the data to be decoded.

在本實施例中,需要針對區塊鏈網路進行預先配置,使得: In this embodiment, the blockchain network needs to be pre-configured so that:

1)區塊鏈虛擬機的指令集中包括BASE64解碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64解碼指令的BASE64解碼邏輯。 1) The instruction set of the blockchain virtual machine includes BASE64 decoding instructions, and the blockchain virtual machine is equipped with BASE64 decoding logic corresponding to the BASE64 decoding instructions.

2)智慧合約編譯器的指令集中包括所述BASE64解碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含BASE64解碼智慧合約的合約標識,所述BASE64解碼智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 3)區塊鏈網路中部署有所述業務智慧合約。 實施例四與實施例三的區別主要在於,在實施例四中,區塊鏈虛擬機調用所述業務智慧合約之後,當讀取到所述BASE64解碼智慧合約的合約標識時,相當於明確了此時需要進一步調用所述BASE64解碼智慧合約。區塊鏈虛擬機調用所述BASE64解碼智慧合約,也會讀取所述BASE64解碼智慧合約中的位元組碼或二進制碼,當讀取到所述BASE64解碼指令時,相當於明確了此時需要執行BASE64解碼操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的BASE64解碼邏輯,以對待解碼資料進行解碼操作。 圖5a是本說明書實施例提供的對應於實施例一與實施例三的BASE64編解碼操作的部署示意圖。如圖5a所示,其一,為區塊鏈虛擬機的指令集添加BASE64編碼指令和/或BASE64解碼指令,同時,在區塊鏈虛擬機中部署BASE64編碼邏輯和/或BASE64解碼邏輯。其二,為智慧合約編譯器的指令集添加BASE64編碼指令和/或BASE64解碼指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含BASE64編碼指令和/或BASE64解碼指令)部署於區塊鏈網路中。 需要說明的是,在為智慧合約編譯器增加功能指令(包括本文中所述的各種指令)時,一般需要相應為智慧合約編譯器增加該功能指令對應的處理邏輯,(如參數/返回值處理邏輯),以便智慧合約編譯器將該功能指令對應的處理邏輯也寫入業務智慧合約。 對於實施例二與實施例四,圖5b是本說明書實施例提供的對應於實施例二與實施例四的BASE64編解碼操作的部署示意圖。如圖5b所示,其一,為區塊鏈虛擬機的指令集添加BASE64編碼指令和/或BASE64解碼指令,同時,在區塊鏈虛擬機中部署BASE64編碼邏輯和/或BASE64解碼邏輯。其二,為智慧合約編譯器的指令集添加BASE64編碼指令和/或BASE64解碼指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含BASE64編碼智慧合約的合約標識與BASE64解碼智慧合約的合約標識)部署於區塊鏈網路中。 實施例五 圖6是本說明書實施例提供的一種基於區塊鏈智慧合約的簽名驗證方法的流程示意圖,包括如下步驟: S600:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S602:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S604:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的RSA簽名驗證指令,觸發執行所述RSA簽名驗證邏輯,以對業務簽名進行RSA簽名驗證操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括RSA簽名驗證指令,並且,區塊鏈虛擬機中部署有對應於所述RSA簽名驗證指令的RSA簽名驗證邏輯。 2)智慧合約編譯器的指令集中包括所述RSA簽名驗證指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述RSA簽名驗證指令。 3)區塊鏈網路中部署有所述業務智慧合約。 所述業務智慧合約是需要調用RSA簽名驗證功能的業務所對應的智慧合約。 在實施例一中,區塊鏈虛擬機調用所述業務智慧合約之後,會讀取所述業務智慧合約中的位元組碼或二進制碼並執行,當讀取到所述業務智慧合約中的RSA簽名驗證指令時,相當於明確了此時需要進行RSA簽名驗證操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的RSA簽名驗證邏輯,以對業務簽名進行簽名驗證操作。 在實際應用中,視具體的業務需求的不同,存在以下幾種情況: 1)所述業務發起交易包含所述業務簽名、所述業務簽名對應的被簽名資料以及用於驗證所述業務簽名的公鑰。 2)所述業務發起交易包含所述業務簽名、所述業務簽名對應的被簽名資料的摘要以及用於驗證所述業務簽名的公鑰。 3)所述業務發起交易包含所述業務簽名、所述業務簽名對應的被簽名資料,所述業務智慧合約包含用於驗證所述業務簽名的公鑰。 4)所述業務發起交易包含所述業務簽名、所述業務簽名對應的被簽名資料的摘要,所述業務智慧合約包含用於驗證所述業務簽名的公鑰。 需要說明的是,區塊鏈虛擬機如果根據所述業務智慧合約中的RSA簽名驗證指令觸發執行RSA簽名驗證邏輯,那麽,在執行過程中所採用的資料傳遞方式通常是棧傳遞。 此外,區塊鏈虛擬機也可以使用記憶體傳遞的方式執行RSA簽名驗證邏輯(預編譯合約的方式),即以下的實施例六。 實施例六 圖7是本說明書實施例提供的一種基於區塊鏈智慧合約的簽名驗證方法的流程示意圖,包括如下步驟: S700:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S702:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S704:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述RSA簽名驗證智慧合約的合約標識,調用所述RSA簽名驗證智慧合約。 S706:該節點透過區塊鏈虛擬機,根據所述RSA簽名驗證智慧合約中的RSA簽名驗證指令,觸發執行所述RSA簽名驗證邏輯,以對業務簽名進行RSA簽名驗證操作,以對業務簽名進行RSA簽名驗證操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括RSA簽名驗證指令,並且,區塊鏈虛擬機中部署有對應於所述RSA簽名驗證指令的RSA簽名驗證邏輯。 2)智慧合約編譯器的指令集中包括所述RSA簽名驗證指令,經所述智慧合約編譯器編譯的業務智慧合約中包含RSA簽名驗證智慧合約的合約標識,所述RSA簽名驗證智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 3)區塊鏈網路中部署有所述業務智慧合約。 實施例六與實施例五的區別主要在於,在實施例六中,區塊鏈虛擬機調用所述業務智慧合約之後,當讀取到所述RSA簽名驗證智慧合約的合約標識時,相當於明確了此時需要進一步調用所述RSA簽名驗證智慧合約。區塊鏈虛擬機調用所述RSA簽名驗證智慧合約,也會讀取所述RSA簽名驗證智慧合約中的位元組碼或二進制碼,當讀取到所述RSA簽名驗證指令時,相當於明確了此時需要執行RSA簽名驗證操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的RSA簽名驗證邏輯,以對業務簽名進行RSA簽名驗證操作。 也就是說,在實施例六中,智慧合約編譯器在編譯業務智慧合約時,如果發現業務智慧合約中聲明調用RSA簽名驗證操作,則不會將這段聲明編譯為RSA簽名驗證指令,而是編譯成所述RSA簽名驗證智慧合約的合約標識。這樣,區塊鏈虛擬機在調用業務智慧合約時,會進一步調用所述RSA簽名驗證智慧合約。 圖8a是本說明書實施例提供的對應於實施例五的RSA簽名驗證操作的部署示意圖。如圖8a所示,其一,為區塊鏈虛擬機的指令集添加RSA簽名驗證指令,同時,在區塊鏈虛擬機中部署RSA簽名驗證邏輯。其二,為智慧合約編譯器的指令集添加RSA簽名驗證指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含RSA簽名驗證指令)部署於區塊鏈網路中。 圖8b是本說明書實施例提供的對應於實施例六的RSA簽名驗證操作的部署示意圖。如圖8b所示,其一,為區塊鏈虛擬機的指令集添加RSA簽名驗證指令,同時,在區塊鏈虛擬機中部署RSA簽名驗證邏輯。其二,為智慧合約編譯器的指令集添加RSA簽名驗證指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含RSA簽名驗證智慧合約的合約標識)部署於區塊鏈網路中。 實施例七 圖9是本說明書實施例提供的一種基於區塊鏈智慧合約的資料處理方法的流程示意圖,包括如下步驟: S900:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S902:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S904:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的JSON處理指令,觸發執行所述JSON處理邏輯,以對待處理資料進行JSON處理操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括JSON處理指令,並且,區塊鏈虛擬機中部署有對應於所述JSON處理指令的JSON處理邏輯。 2)智慧合約編譯器的指令集中包括所述JSON處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述JSON處理指令。 3)區塊鏈網路中部署有所述業務智慧合約。 所述業務智慧合約是需要調用JSON處理功能的業務所對應的智慧合約。JSON處理具體包括JSON資料解析與JSON資料生成。 在實施例七中,區塊鏈虛擬機調用所述業務智慧合約之後,會讀取所述業務智慧合約中的位元組碼或二進制碼並執行,當讀取到所述業務智慧合約中的JSON處理指令時,相當於明確了此時需要進行JSON處理操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的JSON處理邏輯,以對待處理資料進行JSON處理操作。 在實際應用中,視具體的業務需求的不同,所述待處理資料可以包含於所述業務發起交易中,也可以包含於所述業務智慧合約中,還可以是區塊鏈虛擬機執行所述業務發起交易時產生的。 另外需要說明的是,區塊鏈虛擬機如果根據所述業務智慧合約中的JSON處理指令觸發執行JSON處理邏輯,那麽,在執行過程中所採用的資料傳遞方式通常是棧傳遞(即一般會將JSON處理出的資料寫入棧中),但是,對於JSON處理出的資料而言,其資料長度是不固定的,採用棧傳遞的方式往往會導致實現較為複雜。 為此,以下的實施例八提供了另一種基於區塊鏈智慧合約的資料處理方法(預編譯合約的方式)。 實施例八 圖10是本說明書實施例提供的一種基於區塊鏈智慧合約的資料處理方法的流程示意圖,包括如下步驟: S1000:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S1002:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S1004:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述JSON處理智慧合約的合約標識,調用所述JSON處理智慧合約。 S1006:該節點透過區塊鏈虛擬機,根據所述JSON處理智慧合約中的JSON處理指令,觸發執行所述JSON處理邏輯,以對待處理資料進行JSON處理操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括JSON處理指令,並且,區塊鏈虛擬機中部署有對應於所述JSON處理指令的JSON處理邏輯。 2)智慧合約編譯器的指令集中包括所述JSON處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含JSON處理智慧合約的合約標識,所述JSON處理智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 3)區塊鏈網路中部署有所述業務智慧合約。 實施例八與實施例七的區別主要在於,在實施例八中,區塊鏈虛擬機調用所述業務智慧合約之後,當讀取到所述JSON處理智慧合約的合約標識時,相當於明確了此時需要進一步調用所述JSON處理智慧合約。區塊鏈虛擬機調用所述JSON處理智慧合約,也會讀取所述JSON處理智慧合約中的位元組碼或二進制碼,當讀取到所述JSON處理指令時,相當於明確了此時需要執行JSON處理操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的JSON處理邏輯,以對待處理資料進行JSON處理操作。 也就是說,在實施例八中,智慧合約編譯器在編譯業務智慧合約時,如果發現業務智慧合約中聲明調用JSON處理操作,則不會將這段聲明編譯為JSON處理指令,而是編譯成所述JSON處理智慧合約的合約標識。這樣,區塊鏈虛擬機在調用業務智慧合約時,會進一步調用所述JSON處理智慧合約。 圖11a是本說明書實施例提供的對應於實施例七的JSON處理操作的部署示意圖。如圖11a所示,其一,為區塊鏈虛擬機的指令集添加JSON處理指令,同時,在區塊鏈虛擬機中部署JSON處理邏輯。其二,為智慧合約編譯器的指令集添加JSON處理指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含JSON處理指令)部署於區塊鏈網路中。 圖11b是本說明書實施例提供的對應於實施例八的JSON處理操作的部署示意圖。如圖11b所示,其一,為區塊鏈虛擬機的指令集添加JSON處理指令,同時,在區塊鏈虛擬機中部署JSON處理邏輯。其二,為智慧合約編譯器的指令集添加JSON處理指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含JSON處理智慧合約的合約標識)部署於區塊鏈網路中。 實施例九 圖12是本說明書實施例提供的一種基於區塊鏈智慧合約的資料處理方法的流程示意圖,包括如下步驟: S1200:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S1202:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S1204:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的XML處理指令,觸發執行所述XML處理邏輯,以對待處理資料進行XML處理操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括XML處理指令,並且,區塊鏈虛擬機中部署有對應於所述XML處理指令的XML處理邏輯。 2)智慧合約編譯器的指令集中包括所述XML處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述XML處理指令。 3)區塊鏈網路中部署有所述業務智慧合約。 所述業務智慧合約是需要調用XML處理功能的業務所對應的智慧合約。所述XML處理具體包括XML資料解析與XML資料生成。 在實施例九中,區塊鏈虛擬機調用所述業務智慧合約之後,會讀取所述業務智慧合約中的位元組碼或二進制碼並執行,當讀取到所述業務智慧合約中的XML處理指令時,相當於明確了此時需要進行XML處理操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的XML處理邏輯,以對待處理資料進行XML處理操作。 在實際應用中,視具體的業務需求的不同,所述待處理資料可以包含於所述業務發起交易中,也可以包含於所述業務智慧合約中,還可以是區塊鏈虛擬機執行所述業務發起交易時產生的。 另外需要說明的是,區塊鏈虛擬機如果根據所述業務智慧合約中的XML處理指令觸發執行XML處理邏輯,那麽,在執行過程中所採用的資料傳遞方式通常是棧傳遞(即一般會將XML處理出的資料寫入棧中),但是,對於XML處理出的資料而言,其資料長度是不固定的,採用棧傳遞的方式往往會導致實現較為複雜。 為此,以下的實施例十提供了另一種基於區塊鏈智慧合約的資料處理方法(預編譯合約的方式)。 實施例十 圖13是本說明書實施例提供的一種基於區塊鏈智慧合約的資料處理方法的流程示意圖,包括如下步驟: S1300:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S1302:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S1304:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述XML處理智慧合約的合約標識,調用所述XML處理智慧合約。 S1306:該節點透過區塊鏈虛擬機,根據所述XML處理智慧合約中的XML處理指令,觸發執行所述XML處理邏輯,以對待處理資料進行XML處理操作。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括XML處理指令,並且,區塊鏈虛擬機中部署有對應於所述XML處理指令的XML處理邏輯。 2)智慧合約編譯器的指令集中包括所述XML處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含XML處理智慧合約的合約標識,所述XML處理智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 3)區塊鏈網路中部署有所述業務智慧合約。 實施例十與實施例九的區別主要在於,在實施例十中,區塊鏈虛擬機調用所述業務智慧合約之後,當讀取到所述XML處理智慧合約的合約標識時,相當於明確了此時需要進一步調用所述XML處理智慧合約。區塊鏈虛擬機調用所述XML處理智慧合約,也會讀取所述XML處理智慧合約中的位元組碼或二進制碼,當讀取到所述XML處理指令時,相當於明確了此時需要執行XML處理操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的XML處理邏輯,以對待處理資料進行XML處理操作。 也就是說,在實施例十中,智慧合約編譯器在編譯業務智慧合約時,如果發現業務智慧合約中聲明調用XML處理操作,則不會將這段聲明編譯為XML處理指令,而是編譯成所述XML處理智慧合約的合約標識。這樣,區塊鏈虛擬機在調用業務智慧合約時,會進一步調用所述XML處理智慧合約。 圖14a是本說明書實施例提供的對應於實施例九的XML處理操作的部署示意圖。如圖14a所示,其一,為區塊鏈虛擬機的指令集添加XML處理指令,同時,在區塊鏈虛擬機中部署XML處理邏輯。其二,為智慧合約編譯器的指令集添加XML處理指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含XML處理指令)部署於區塊鏈網路中。 圖14b是本說明書實施例提供的對應於實施例十的XML處理操作的部署示意圖。如圖14b所示,其一,為區塊鏈虛擬機的指令集添加XML處理指令,同時,在區塊鏈虛擬機中部署XML處理邏輯。其二,為智慧合約編譯器的指令集添加XML處理指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含XML處理智慧合約的合約標識)部署於區塊鏈網路中。 實施例十一 圖15是本說明書實施例提供的一種基於區塊鏈智慧合約的交易哈希獲取方法的流程示意圖,包括如下步驟: S1500:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S1502:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S1504:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的交易哈希獲取指令,觸發執行所述交易哈希獲取邏輯,以獲取所述業務發起交易的交易哈希。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括交易哈希獲取指令,並且,區塊鏈虛擬機中部署有對應於所述交易哈希獲取指令的交易哈希獲取邏輯。 2)智慧合約編譯器的指令集中包括所述交易哈希獲取指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述交易哈希獲取指令。 3)區塊鏈網路中部署有所述業務智慧合約。 所述業務智慧合約是需要調用交易哈希獲取功能的業務所對應的智慧合約。 在實施例十一中,區塊鏈虛擬機調用所述業務智慧合約之後,會讀取所述業務智慧合約中的位元組碼或二進制碼並執行,當讀取到所述業務智慧合約中的交易哈希獲取指令時,相當於明確了此時需要進行交易哈希獲取操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的交易哈希獲取邏輯,以對待處理資料進行交易哈希獲取操作。 在實際應用中,針對所述區塊鏈網路中的每個節點,該節點在調用所述業務智慧合約之前,初始化區塊鏈虛擬機的上下文,並將所述業務發起交易的交易哈希寫入所述上下文中。 如此,在步驟S1504中,具體地,該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的交易哈希獲取指令,觸發執行所述交易哈希獲取邏輯,以從所述上下文中獲取所述業務發起交易的交易哈希。 另外需要說明的是,區塊鏈虛擬機如果根據所述業務智慧合約中的交易哈希獲取指令觸發執行交易哈希獲取邏輯,那麽,在執行過程中所採用的資料傳遞方式通常是棧傳遞。以下的實施例十二提供了另一種基於區塊鏈智慧合約的交易哈希獲取方法(預編譯合約的方式)。 實施例十二 圖16是本說明書實施例提供的一種基於區塊鏈智慧合約的交易哈希獲取方法的流程示意圖,包括如下步驟: S1600:區塊鏈網路中的節點獲得業務發起交易並廣播給其他節點。 S1602:針對所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約。 S1604:該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述交易哈希獲取智慧合約的合約標識,調用所述交易哈希獲取智慧合約。 S1606:該節點透過區塊鏈虛擬機,根據所述交易哈希獲取智慧合約中的交易哈希獲取指令,觸發執行所述交易哈希獲取邏輯,以獲取所述業務發起交易的交易哈希。 在本實施例中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括交易哈希獲取指令,並且,區塊鏈虛擬機中部署有對應於所述交易哈希獲取指令的交易哈希獲取邏輯。 2)智慧合約編譯器的指令集中包括所述交易哈希獲取指令,經所述智慧合約編譯器編譯的業務智慧合約中包含交易哈希獲取智慧合約的合約標識,所述交易哈希獲取智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 3)區塊鏈網路中部署所述業務智慧合約。 實施例十二與實施例十一的區別主要在於,在實施例十二中,區塊鏈虛擬機調用所述業務智慧合約之後,當讀取到所述交易哈希獲取智慧合約的合約標識時,相當於明確了此時需要進一步調用所述交易哈希獲取智慧合約。區塊鏈虛擬機調用所述交易哈希獲取智慧合約,也會讀取所述交易哈希獲取智慧合約中的位元組碼或二進制碼,當讀取到所述交易哈希獲取指令時,相當於明確了此時需要執行交易哈希獲取操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的交易哈希獲取邏輯,以獲取所述業務發起交易的交易哈希。 也就是說,在實施例十二中,智慧合約編譯器在編譯業務智慧合約時,如果發現業務智慧合約中聲明調用交易哈希獲取操作,則不會將這段聲明編譯為交易哈希獲取指令,而是編譯成所述交易哈希獲取智慧合約的合約標識。這樣,區塊鏈虛擬機在調用業務智慧合約時,會進一步調用所述交易哈希獲取智慧合約。 在實際應用中,針對所述區塊鏈網路中的每個節點,該節點在調用所述業務智慧合約之前,初始化區塊鏈虛擬機的上下文,並將所述業務發起交易的交易哈希寫入所述上下文中。 如此,在步驟S1606中,具體地,該節點透過區塊鏈虛擬機,根據所述交易哈希獲取智慧合約中的交易哈希獲取指令,觸發執行所述交易哈希獲取邏輯,以從所述上下文中獲取所述業務發起交易的交易哈希。 圖17a是本說明書實施例提供的對應於實施例十一的交易哈希獲取操作的部署示意圖。如圖17a所示,其一,為區塊鏈虛擬機的指令集添加交易哈希獲取指令,同時,在區塊鏈虛擬機中部署交易哈希獲取邏輯。其二,為智慧合約編譯器的指令集添加交易哈希獲取指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含交易哈希獲取指令)部署於區塊鏈網路中。 圖17b是本說明書實施例提供的對應於實施例十二的交易哈希獲取操作的部署示意圖。如圖17b所示,其一,為區塊鏈虛擬機的指令集添加交易哈希獲取指令,同時,在區塊鏈虛擬機中部署交易哈希獲取邏輯。其二,為智慧合約編譯器的指令集添加交易哈希獲取指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含交易哈希獲取智慧合約的合約標識)部署於區塊鏈網路中。 實施例十三 圖18是本說明書實施例提供的一種基於區塊鏈智慧合約的轉帳方法的流程示意圖,包括如下步驟: S1800:區塊鏈網路中的節點透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點。 即節點接收客戶端(登錄了轉帳外部帳戶)構建並發送的轉帳交易。 S1802:針對所述區塊鏈網路中的每個節點,該節點在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約並根據所述業務智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯。 S1804:若校驗結果為是,則該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯。 在以太坊架構中,各外部帳戶與各用戶一一對應,兩個用戶之間的轉帳行為實際上就是兩個外部帳戶之間的轉帳行為。 假設外部帳戶A想要向外部帳戶B轉帳,那麽,外部帳戶A首先會構建包含轉帳金額與外部帳戶B的帳戶地址的轉帳交易,隨後,該轉帳交易會被廣播給區塊鏈網路中的各節點。各節點對轉帳交易進行驗證通過後,執行轉帳交易,將轉帳金額寫入外部帳戶B。 需要說明的是,各節點對轉帳交易的驗證事項一般包括驗證外部帳戶A的餘額是否充足,即外部帳戶A的餘額是否大於或等於轉帳金額,若是,則驗證通過。這意味著,在現有的以太坊架構中,如果要進行轉帳,那麽轉帳人的帳戶餘額以及轉帳金額都會暴露給區塊鏈網路中的各節點。 在實施例十三中,實際上給出了一種業務需求,即針對區塊鏈網路中的節點之間的一筆轉帳交易,在不暴露轉帳用戶的資產餘額以及轉帳金額的前提下,判斷轉帳用戶的資產餘額是否足夠支付轉帳金額。 為了滿足這種業務需求,本發明採用了一種新的轉帳模型,不再使用區塊鏈網路中的外部帳戶中的餘額進行轉帳和收帳,而是創建業務智慧合約,在業務智慧合約中重新搭建一個用戶的資產體系。在這個資產體系中,不再有資產餘額概念,每個用戶擁有的資產相當於是一種虛擬物,用戶花出一個資產,這個資產就會消失。 具體地,在區塊鏈網路中部署所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶(與每個用戶一一對應)對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的。 2) The instruction set of the smart contract compiler includes the BASE64 decoding instruction, the business smart contract compiled by the smart contract compiler includes the contract identifier of the BASE64 decoding smart contract, and the BASE64 decoding smart contract is pre-deployed in the Smart contracts in the blockchain network. 3) The business smart contract is deployed in the blockchain network. The main difference between the fourth embodiment and the third embodiment is that in the fourth embodiment, after the blockchain virtual machine invokes the business smart contract, when the contract identifier of the BASE64 decoded smart contract is read, it is equivalent to clarifying At this time, the BASE64 decoding smart contract needs to be further invoked. When the blockchain virtual machine calls the BASE64 decoding smart contract, it will also read the byte code or binary code in the BASE64 decoding smart contract. When the BASE64 decoding instruction is read, it is equivalent to clarifying this time. The BASE64 decoding operation needs to be executed. Therefore, the blockchain virtual machine will trigger the execution of the BASE64 decoding logic pre-deployed locally to decode the data to be decoded. Figure 5a is a schematic diagram of the deployment of the BASE64 encoding and decoding operations corresponding to the first embodiment and the third embodiment provided by the embodiment of this specification. As shown in Figure 5a, one is to add BASE64 encoding instructions and/or BASE64 decoding instructions to the instruction set of the blockchain virtual machine, and at the same time, deploy BASE64 encoding logic and/or BASE64 decoding logic in the blockchain virtual machine. Second, add BASE64 encoding instructions and/or BASE64 decoding instructions to the instruction set of the smart contract compiler. Third, deploy business smart contracts (including BASE64 encoding instructions and/or BASE64 decoding instructions) compiled by the smart contract compiler in the blockchain network. It should be noted that when adding functional instructions (including the various instructions described in this article) to the smart contract compiler, it is generally necessary to add the processing logic corresponding to the functional instruction to the smart contract compiler, (such as parameter/return value processing) Logic), so that the smart contract compiler also writes the processing logic corresponding to the function instruction into the business smart contract. For the second and fourth embodiments, FIG. 5b is a schematic diagram of the deployment of the BASE64 encoding and decoding operations corresponding to the second and fourth embodiments provided by the embodiment of this specification. As shown in Figure 5b, one is to add BASE64 encoding instructions and/or BASE64 decoding instructions to the instruction set of the blockchain virtual machine, and at the same time, deploy BASE64 encoding logic and/or BASE64 decoding logic in the blockchain virtual machine. Second, add BASE64 encoding instructions and/or BASE64 decoding instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including the contract ID of the BASE64 encoded smart contract and the contract ID of the BASE64 decoded smart contract) compiled by the smart contract compiler in the blockchain network. Example five Fig. 6 is a schematic flowchart of a signature verification method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S600: A node in the blockchain network obtains a business to initiate a transaction and broadcasts it to other nodes. S602: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S604: The node triggers the execution of the RSA signature verification logic through the blockchain virtual machine according to the RSA signature verification instruction in the business smart contract to perform an RSA signature verification operation on the business signature. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes RSA signature verification instructions, and the blockchain virtual machine is deployed with RSA signature verification logic corresponding to the RSA signature verification instructions. 2) The instruction set of the smart contract compiler includes the RSA signature verification instruction, and the business smart contract compiled by the smart contract compiler includes the RSA signature verification instruction. 3) The business smart contract is deployed in the blockchain network. The business smart contract is a smart contract corresponding to a business that needs to call the RSA signature verification function. In the first embodiment, after the blockchain virtual machine invokes the business smart contract, it reads and executes the byte code or binary code in the business smart contract. When the RSA signature verification instruction is used, it is equivalent to clarifying that the RSA signature verification operation is required at this time. Therefore, the blockchain virtual machine will trigger the execution of the RSA signature verification logic pre-deployed locally to perform the signature verification operation on the business signature. In practical applications, depending on the specific business requirements, there are the following situations: 1) The business initiation transaction includes the business signature, the signed data corresponding to the business signature, and the public key used to verify the business signature. 2) The business initiation transaction includes the business signature, a digest of the signed data corresponding to the business signature, and a public key used to verify the business signature. 3) The business initiation transaction includes the business signature and the signed data corresponding to the business signature, and the business smart contract includes a public key used to verify the business signature. 4) The business initiation transaction includes the business signature and a digest of the signed data corresponding to the business signature, and the business smart contract includes a public key used to verify the business signature. It should be noted that if the blockchain virtual machine triggers the execution of the RSA signature verification logic according to the RSA signature verification instruction in the business smart contract, the data transfer method used in the execution process is usually stack transfer. In addition, the blockchain virtual machine can also execute the RSA signature verification logic (pre-compiled contract method) using memory transfer, that is, the sixth embodiment below. Example Six FIG. 7 is a schematic flowchart of a signature verification method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S700: A node in the blockchain network obtains a business to initiate a transaction and broadcasts it to other nodes. S702: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S704: The node uses the blockchain virtual machine to verify the contract identifier of the smart contract according to the RSA signature in the business smart contract, and invoke the RSA signature to verify the smart contract. S706: The node uses the blockchain virtual machine to trigger the execution of the RSA signature verification logic according to the RSA signature verification instruction in the RSA signature verification smart contract to perform an RSA signature verification operation on the business signature, so as to perform the RSA signature verification operation on the business signature. RSA signature verification operation. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes RSA signature verification instructions, and the blockchain virtual machine is deployed with RSA signature verification logic corresponding to the RSA signature verification instructions. 2) The instruction set of the smart contract compiler includes the RSA signature verification instruction, and the business smart contract compiled by the smart contract compiler includes the contract identifier of the RSA signature verification smart contract, and the RSA signature verification smart contract is pre-deployed Smart contracts in the blockchain network. 3) The business smart contract is deployed in the blockchain network. The main difference between the sixth embodiment and the fifth embodiment is that in the sixth embodiment, after the blockchain virtual machine invokes the business smart contract, when the RSA signature verification smart contract's contract identifier is read, it is equivalent to clear At this time, the RSA signature verification smart contract needs to be further invoked. The blockchain virtual machine calls the RSA signature verification smart contract, and also reads the byte code or binary code in the RSA signature verification smart contract. When the RSA signature verification instruction is read, it is equivalent to clear At this time, the RSA signature verification operation needs to be performed. Therefore, the blockchain virtual machine will trigger the execution of the RSA signature verification logic pre-deployed locally to perform the RSA signature verification operation on the service signature. That is to say, in the sixth embodiment, when the smart contract compiler compiles the business smart contract, if it finds that the business smart contract declares to call the RSA signature verification operation, it will not compile this statement into an RSA signature verification instruction, but Compile into the contract identifier of the RSA signature verification smart contract. In this way, when the blockchain virtual machine calls the business smart contract, it will further call the RSA signature to verify the smart contract. Fig. 8a is a schematic diagram of the deployment of the RSA signature verification operation corresponding to the fifth embodiment provided by the embodiment of this specification. As shown in Figure 8a, one is to add RSA signature verification instructions to the instruction set of the blockchain virtual machine, and at the same time, deploy the RSA signature verification logic in the blockchain virtual machine. Second, add RSA signature verification instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including RSA signature verification instructions) compiled by the smart contract compiler in the blockchain network. Fig. 8b is a schematic diagram of deployment of the RSA signature verification operation corresponding to the sixth embodiment provided by the embodiment of this specification. As shown in Figure 8b, one is to add RSA signature verification instructions to the instruction set of the blockchain virtual machine, and at the same time, deploy the RSA signature verification logic in the blockchain virtual machine. Second, add RSA signature verification instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including the contract identifier of the RSA signature verification smart contract) compiled by the smart contract compiler in the blockchain network. Example Seven Fig. 9 is a schematic flowchart of a data processing method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S900: A node in the blockchain network obtains a business to initiate a transaction and broadcasts it to other nodes. S902: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S904: The node uses the blockchain virtual machine to trigger the execution of the JSON processing logic according to the JSON processing instruction in the business smart contract to perform a JSON processing operation on the data to be processed. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes JSON processing instructions, and the blockchain virtual machine is deployed with JSON processing logic corresponding to the JSON processing instructions. 2) The instruction set of the smart contract compiler includes the JSON processing instruction, and the business smart contract compiled by the smart contract compiler includes the JSON processing instruction. 3) The business smart contract is deployed in the blockchain network. The business smart contract is a smart contract corresponding to a business that needs to call the JSON processing function. JSON processing specifically includes JSON data analysis and JSON data generation. In the seventh embodiment, after the blockchain virtual machine invokes the business smart contract, it will read and execute the byte code or binary code in the business smart contract. When JSON processing instructions, it is equivalent to clarifying that JSON processing operations are required at this time. Therefore, the blockchain virtual machine will trigger the execution of the JSON processing logic pre-deployed locally to perform JSON processing operations on the data to be processed. In practical applications, depending on the specific business requirements, the data to be processed may be included in the business initiation transaction, may also be included in the business smart contract, or the blockchain virtual machine may execute the Generated when the business initiates a transaction. In addition, it should be noted that if the blockchain virtual machine triggers the execution of JSON processing logic according to the JSON processing instructions in the business smart contract, then the data transfer method used in the execution process is usually stack transfer (that is, generally The data processed by JSON is written into the stack). However, for the data processed by JSON, the data length is not fixed, and the method of stack transfer often leads to more complicated implementation. To this end, the eighth embodiment below provides another data processing method based on a blockchain smart contract (a pre-compiled contract method). Example eight FIG. 10 is a schematic flowchart of a data processing method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S1000: Nodes in the blockchain network obtain services to initiate transactions and broadcast to other nodes. S1002: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S1004: The node uses the blockchain virtual machine to call the JSON processing smart contract according to the contract identifier of the JSON processing smart contract in the business smart contract. S1006: The node triggers the execution of the JSON processing logic according to the JSON processing instructions in the JSON processing smart contract through the blockchain virtual machine to perform JSON processing operations on the data to be processed. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes JSON processing instructions, and the blockchain virtual machine is deployed with JSON processing logic corresponding to the JSON processing instructions. 2) The instruction set of the smart contract compiler includes the JSON processing instruction, and the business smart contract compiled by the smart contract compiler includes the contract identifier of the JSON processing smart contract, and the JSON processing smart contract is pre-deployed in the Smart contracts in the blockchain network. 3) The business smart contract is deployed in the blockchain network. The difference between the eighth embodiment and the seventh embodiment is mainly that in the eighth embodiment, after the blockchain virtual machine invokes the business smart contract, when the contract identifier of the JSON processing smart contract is read, it is equivalent to clarifying At this time, the JSON processing smart contract needs to be further called. The blockchain virtual machine calls the JSON processing smart contract, and also reads the byte code or binary code in the JSON processing smart contract. When the JSON processing instruction is read, it is equivalent to clarifying this time JSON processing operations need to be performed. Therefore, the blockchain virtual machine will trigger the execution of the JSON processing logic pre-deployed locally to perform JSON processing operations on the processed data. That is to say, in the eighth embodiment, when the smart contract compiler compiles the business smart contract, if it finds that the business smart contract declares to call the JSON processing operation, it will not compile this statement into JSON processing instructions, but compile it into The JSON handles the contract identification of the smart contract. In this way, when the blockchain virtual machine calls the business smart contract, it will further call the JSON processing smart contract. Fig. 11a is a schematic diagram of the deployment of the JSON processing operation corresponding to the seventh embodiment provided by the embodiment of this specification. As shown in Figure 11a, one is to add JSON processing instructions to the instruction set of the blockchain virtual machine, and at the same time, deploy JSON processing logic in the blockchain virtual machine. Second, add JSON processing instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including JSON processing instructions) compiled by the smart contract compiler in the blockchain network. Fig. 11b is a schematic diagram of the deployment of the JSON processing operation corresponding to the eighth embodiment provided by the embodiment of this specification. As shown in Figure 11b, one is to add JSON processing instructions to the instruction set of the blockchain virtual machine, and at the same time, deploy JSON processing logic in the blockchain virtual machine. Second, add JSON processing instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including the contract identifier of the JSON processing smart contract) compiled by the smart contract compiler in the blockchain network. Example 9 Fig. 12 is a schematic flowchart of a data processing method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S1200: A node in the blockchain network obtains a business to initiate a transaction and broadcast it to other nodes. S1202: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S1204: The node triggers the execution of the XML processing logic according to the XML processing instruction in the business smart contract through the blockchain virtual machine to perform an XML processing operation on the data to be processed. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes XML processing instructions, and the blockchain virtual machine is deployed with XML processing logic corresponding to the XML processing instructions. 2) The instruction set of the smart contract compiler includes the XML processing instruction, and the business smart contract compiled by the smart contract compiler includes the XML processing instruction. 3) The business smart contract is deployed in the blockchain network. The business smart contract is a smart contract corresponding to a business that needs to call an XML processing function. The XML processing specifically includes XML data parsing and XML data generation. In the ninth embodiment, after the blockchain virtual machine invokes the business smart contract, it will read and execute the byte code or binary code in the business smart contract. When the XML processing instruction is used, it is equivalent to clarifying that the XML processing operation is required at this time. Therefore, the blockchain virtual machine will trigger the execution of the XML processing logic pre-deployed locally to perform the XML processing operation on the processed data. In practical applications, depending on the specific business requirements, the data to be processed may be included in the business initiation transaction, may also be included in the business smart contract, or the blockchain virtual machine may execute the Generated when the business initiates a transaction. In addition, it should be noted that if the blockchain virtual machine triggers the execution of XML processing logic according to the XML processing instructions in the business smart contract, then the data transfer method used in the execution process is usually stack transfer (that is, generally The data processed by XML is written into the stack). However, for the data processed by XML, the length of the data is not fixed, and the method of stack transfer often leads to more complicated implementation. To this end, the tenth embodiment below provides another data processing method based on a blockchain smart contract (a pre-compiled contract method). Example ten FIG. 13 is a schematic flowchart of a data processing method based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S1300: A node in the blockchain network obtains a business to initiate a transaction and broadcast it to other nodes. S1302: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S1304: The node uses the blockchain virtual machine to call the XML processing smart contract according to the contract identifier of the XML processing smart contract in the business smart contract. S1306: The node uses the blockchain virtual machine to trigger the execution of the XML processing logic according to the XML processing instruction in the XML processing smart contract to perform an XML processing operation on the data to be processed. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes XML processing instructions, and the blockchain virtual machine is deployed with XML processing logic corresponding to the XML processing instructions. 2) The instruction set of the smart contract compiler includes the XML processing instructions, and the business smart contract compiled by the smart contract compiler includes the contract identifier of the XML processing smart contract, and the XML processing smart contract is pre-deployed in the Smart contracts in the blockchain network. 3) The business smart contract is deployed in the blockchain network. The main difference between the tenth embodiment and the ninth embodiment is that in the tenth embodiment, after the blockchain virtual machine invokes the business smart contract, when the contract identifier of the XML processing smart contract is read, it is equivalent to clarifying At this time, the XML processing smart contract needs to be further invoked. The blockchain virtual machine calls the XML processing smart contract, and also reads the byte code or binary code in the XML processing smart contract. When the XML processing instruction is read, it is equivalent to clarifying this time XML processing operations need to be performed. Therefore, the blockchain virtual machine will trigger the execution of the XML processing logic pre-deployed locally to perform XML processing operations on the data to be processed. That is to say, in the tenth embodiment, when the smart contract compiler compiles the business smart contract, if it finds that the business smart contract declares to call the XML processing operation, it will not compile this statement into an XML processing instruction, but compile it into The XML processes the contract identification of the smart contract. In this way, when the blockchain virtual machine calls the business smart contract, it will further call the XML processing smart contract. Fig. 14a is a schematic diagram of the deployment of XML processing operations corresponding to the ninth embodiment provided by the embodiment of this specification. As shown in Figure 14a, one is to add XML processing instructions to the instruction set of the blockchain virtual machine, and at the same time, to deploy XML processing logic in the blockchain virtual machine. Second, add XML processing instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including XML processing instructions) compiled by the smart contract compiler in the blockchain network. Fig. 14b is a schematic diagram of the deployment of the XML processing operation corresponding to the tenth embodiment provided by the embodiment of this specification. As shown in Figure 14b, one is to add XML processing instructions to the instruction set of the blockchain virtual machine, and at the same time, to deploy XML processing logic in the blockchain virtual machine. Second, add XML processing instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including the contract identifier of the XML processing smart contract) compiled by the smart contract compiler in the blockchain network. Example 11 FIG. 15 is a schematic flowchart of a method for obtaining transaction hash based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S1500: A node in the blockchain network obtains a business to initiate a transaction and broadcast it to other nodes. S1502: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S1504: The node triggers the execution of the transaction hash acquisition logic through the blockchain virtual machine according to the transaction hash acquisition instruction in the business smart contract to acquire the transaction hash of the business initiated transaction. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes a transaction hash acquisition instruction, and the blockchain virtual machine is deployed with transaction hash acquisition logic corresponding to the transaction hash acquisition instruction. 2) The instruction set of the smart contract compiler includes the transaction hash acquisition instruction, and the business smart contract compiled by the smart contract compiler includes the transaction hash acquisition instruction. 3) The business smart contract is deployed in the blockchain network. The business smart contract is a smart contract corresponding to a business that needs to call the transaction hash acquisition function. In the eleventh embodiment, after the blockchain virtual machine invokes the business smart contract, it reads the byte code or binary code in the business smart contract and executes it. When it is read into the business smart contract When the transaction hash acquisition instruction of, it is equivalent to clarifying that the transaction hash acquisition operation needs to be performed at this time. Therefore, the blockchain virtual machine will trigger the execution of the transaction hash acquisition logic pre-deployed locally to process the data to be processed. Transaction hash acquisition operation. In practical applications, for each node in the blockchain network, the node initializes the context of the blockchain virtual machine before invoking the business smart contract, and hashes the transaction initiation of the business Write in the context. In this way, in step S1504, specifically, the node uses the blockchain virtual machine to trigger the execution of the transaction hash acquisition logic according to the transaction hash acquisition instruction in the business smart contract to acquire from the context The transaction hash of the business initiated transaction. In addition, it should be noted that if the blockchain virtual machine triggers the execution of the transaction hash acquisition logic according to the transaction hash acquisition instruction in the business smart contract, then the data transfer method used in the execution process is usually stack transfer. The twelfth embodiment below provides another method for obtaining transaction hash based on a blockchain smart contract (a pre-compiled contract method). Embodiment 12 FIG. 16 is a schematic flowchart of a method for obtaining transaction hash based on a blockchain smart contract provided by an embodiment of this specification, including the following steps: S1600: A node in the blockchain network obtains a business to initiate a transaction and broadcast it to other nodes. S1602: For each node in the blockchain network, the node invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction. S1604: The node obtains the contract identifier of the smart contract according to the transaction hash in the business smart contract through the blockchain virtual machine, and calls the transaction hash to obtain the smart contract. S1606: The node obtains the transaction hash obtaining instruction in the smart contract through the blockchain virtual machine according to the transaction hash, and triggers the execution of the transaction hash obtaining logic to obtain the transaction hash of the business initiated transaction. In this embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes a transaction hash acquisition instruction, and the blockchain virtual machine is deployed with transaction hash acquisition logic corresponding to the transaction hash acquisition instruction. 2) The instruction set of the smart contract compiler includes the transaction hash acquisition instruction, the business smart contract compiled by the smart contract compiler includes the transaction hash to acquire the smart contract's contract identifier, and the transaction hash acquires the smart contract It is a smart contract pre-deployed in the blockchain network. 3) Deploy the business smart contract in the blockchain network. The main difference between the twelfth embodiment and the eleventh embodiment is that in the twelfth embodiment, after the blockchain virtual machine invokes the business smart contract, when the transaction hash is read to obtain the contract identifier of the smart contract , Which is equivalent to clarifying that the transaction hash needs to be further called to obtain a smart contract at this time. The blockchain virtual machine calls the transaction hash to obtain the smart contract, and also reads the transaction hash to obtain the byte code or binary code in the smart contract. When the transaction hash obtaining instruction is read, It is equivalent to clarifying that the transaction hash acquisition operation needs to be performed at this time. Therefore, the blockchain virtual machine will trigger the execution of the transaction hash acquisition logic pre-deployed locally at this time to acquire the transaction hash of the business initiated transaction. That is to say, in the twelfth embodiment, when the smart contract compiler compiles the business smart contract, if it finds that the business smart contract states that the transaction hash acquisition operation is called, it will not compile this statement into a transaction hash acquisition instruction , But compiled into the transaction hash to obtain the contract identifier of the smart contract. In this way, when the blockchain virtual machine calls the business smart contract, it will further call the transaction hash to obtain the smart contract. In practical applications, for each node in the blockchain network, the node initializes the context of the blockchain virtual machine before invoking the business smart contract, and hashes the transaction initiation of the business Write in the context. In this way, in step S1606, specifically, the node obtains the transaction hash acquisition instruction in the smart contract according to the transaction hash through the blockchain virtual machine, and triggers the execution of the transaction hash acquisition logic to obtain the transaction hash from the transaction hash. Get the transaction hash of the business initiated transaction in the context. Fig. 17a is a schematic diagram of the deployment of the transaction hash obtaining operation corresponding to the eleventh embodiment provided by the embodiment of the present specification. As shown in Figure 17a, one is to add a transaction hash acquisition instruction to the instruction set of the blockchain virtual machine, and at the same time, deploy the transaction hash acquisition logic in the blockchain virtual machine. Second, add transaction hash acquisition instructions to the instruction set of the smart contract compiler. Third, deploy business smart contracts (including transaction hash acquisition instructions) compiled by the smart contract compiler in the blockchain network. Fig. 17b is a schematic diagram of the deployment of the transaction hash obtaining operation corresponding to the twelfth embodiment provided by the embodiment of this specification. As shown in Figure 17b, one is to add a transaction hash acquisition instruction to the instruction set of the blockchain virtual machine, and at the same time, deploy the transaction hash acquisition logic in the blockchain virtual machine. Second, add transaction hash acquisition instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including the contract identification of the smart contract obtained by the transaction hash) compiled by the smart contract compiler in the blockchain network. Embodiment 13 Fig. 18 is a schematic flowchart of a method for transferring funds based on a blockchain smart contract provided by an embodiment of the present specification, including the following steps: S1800: Nodes in the blockchain network obtain transfer transactions through transfers to external accounts and broadcast them to other nodes. That is, the node receives the transfer transaction constructed and sent by the client (logged in to the transfer external account). S1802: For each node in the blockchain network, when the node executes the transfer transaction, it uses the blockchain virtual machine to call the business smart contract and enter and exit the school according to the business smart contract. The verification instruction triggers the execution of the access verification logic. S1804: If the verification result is yes, the node executes the user asset table modification logic in the business smart contract through the blockchain virtual machine. In the Ethereum architecture, each external account has a one-to-one correspondence with each user, and the transfer behavior between two users is actually the transfer behavior between two external accounts. Assuming that external account A wants to transfer money to external account B, then external account A will first construct a transfer transaction containing the transfer amount and the account address of external account B, and then the transfer transaction will be broadcast to the blockchain network Each node. After each node verifies the transfer transaction, it executes the transfer transaction and writes the transfer amount to external account B. It should be noted that the verification items of each node for the transfer transaction generally include verifying whether the balance of the external account A is sufficient, that is, whether the balance of the external account A is greater than or equal to the transfer amount, and if so, the verification is passed. This means that in the existing Ethereum architecture, if a transfer is to be made, the transferor's account balance and transfer amount will be exposed to all nodes in the blockchain network. In the thirteenth embodiment, a business requirement is actually given, that is, for a transfer transaction between nodes in the blockchain network, the transfer is judged without revealing the transfer user’s asset balance and transfer amount. Whether the user’s asset balance is sufficient to cover the transfer amount. In order to meet this business demand, the present invention adopts a new transfer model, which no longer uses the balance in the external account in the blockchain network for transfer and collection, but creates a business smart contract, in the business smart contract Rebuild a user's asset system. In this asset system, there is no longer the concept of asset balance. The asset owned by each user is equivalent to a virtual thing. If the user spends an asset, the asset will disappear. Specifically, the business smart contract is deployed in the blockchain network, the business smart contract corresponds to a user asset table, and the user asset table is used to record each external account (one-to-one correspondence with each user) For any asset, the asset is a data containing an encrypted amount, and the encrypted amount is obtained by encrypting the amount of the asset.

下表3示列性地給出了所述用戶資產表。 Table 3 below exemplarily gives the user asset table.

Figure 108134610-A0305-02-0045-1
Figure 108134610-A0305-02-0045-1

例如,外部帳戶1向外部帳戶2轉帳120元,假設資產1的金額為100元,資產2的金額為50元,那麽外部帳戶1需要花銷掉自己的資產1與資產2,隨後,資產1與資產2消失,產生了資產7(金額為120元)與資產8(金額為30元),外部帳戶1得到資產8,外部帳戶2得到資產7。可見,資產1+資產2實際上是這筆轉帳的輸入,資產7+資產8實際上是這筆轉帳的輸出。經過這筆轉帳後,表3會更新為如下所示的表4。 For example, external account 1 transfers 120 yuan to external account 2. Assuming that the amount of asset 1 is 100 yuan and the amount of asset 2 is 50 yuan, then external account 1 needs to spend its own assets 1 and 2, and then asset 1 And asset 2 disappeared, resulting in asset 7 (amount of 120 yuan) and asset 8 (amount of 30 yuan), external account 1 gets asset 8, and external account 2 gets asset 7. It can be seen that asset 1 + asset 2 is actually the input of this transfer, and asset 7 + asset 8 is actually the output of this transfer. After this transfer, Table 3 will be updated to Table 4 as shown below.

Figure 108134610-A0305-02-0045-2
Figure 108134610-A0305-02-0045-2

如此,在本發明中,針對一筆轉帳交易,將驗證餘額的問題轉化成了驗證輸入輸出是否平衡的問題。由於每個資產的金額實際上是加密的,因為不會暴露給區塊鏈虛擬機,這意味著,要求區塊鏈虛擬機在執行轉帳交易時,採 用同態加密演算法(如Pedersen Commitment演算法),校驗輸入的資產與輸出的資產是否相等,如果校驗結果為是,就意味著這筆轉帳交易是可行的(相當於說明了轉帳人的餘額充足)。 In this way, in the present invention, for a transfer transaction, the problem of verifying the balance is transformed into a problem of verifying whether the input and output are balanced. Since the amount of each asset is actually encrypted, it will not be exposed to the blockchain virtual machine, which means that the blockchain virtual machine is required to perform the transfer transaction. Use a homomorphic encryption algorithm (such as Pedersen Commitment algorithm) to verify whether the input asset is equal to the output asset. If the result of the verification is yes, it means that the transfer transaction is feasible (equivalent to the transferor The balance is sufficient).

對於具體地實施方式,在本實施例十三中,需要針對區塊鏈網路進行預先配置,使得: For the specific implementation, in the thirteenth embodiment, it needs to be pre-configured for the blockchain network, so that:

1)區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述交易哈希獲取指令的出入校驗邏輯。 1) The instruction set of the blockchain virtual machine includes access verification instructions, and the blockchain virtual machine is deployed with access verification logic corresponding to the transaction hash acquisition instruction.

其中,所述出入校驗邏輯包括:針對任一轉帳交易,採用同態加密演算法,校驗該轉帳交易指定的轉帳資產的金額與該轉帳交易指定的找零資產的金額之和,是否等於該轉帳交易指定的各花銷資產的金額之和。 Wherein, the in-out verification logic includes: for any transfer transaction, using a homomorphic encryption algorithm to verify whether the sum of the amount of the transfer asset specified by the transfer transaction and the amount of the change asset specified by the transfer transaction is equal to The sum of the amount of each spent asset specified in the transfer transaction.

還需要說明的是,所述轉帳交易實際上就是前文所述的業務發起交易,只不過此處的業務具體為加密轉帳業務。 It should also be noted that the transfer transaction is actually the business initiation transaction described above, but the business here is specifically an encrypted transfer business.

2)智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令。 2) The instruction set of the smart contract compiler includes the entry and exit verification instructions, and the business smart contract compiled by the smart contract compiler includes the entry and exit verification instructions.

3)區塊鏈網路中部署有所述業務智慧合約。 3) The business smart contract is deployed in the blockchain network.

所述業務智慧合約是用於實現隱藏轉帳金額和資產餘額的轉帳功能的智慧合約。 The business smart contract is a smart contract used to realize the transfer function of hiding the transfer amount and asset balance.

在步驟S1800中,節點實際上是指轉帳用戶對應的節點。轉帳外部帳戶實際上是指轉帳用戶所控制的外部帳戶。 節點透過轉帳外部帳戶獲得轉帳交易,實際上是轉帳用戶登錄客戶端(或稱“錢包”),構建轉帳交易並發送給節點。 所述轉帳交易中包括轉帳資產、找零資產和至少一個花銷資產。其中,所述至少一個花銷資產實際上就是輸入到這筆轉帳的資產,轉帳資產與找零資產實際上就是這筆轉帳輸出的資產。 在實施例十三中,區塊鏈虛擬機調用所述業務智慧合約之後,會讀取所述業務智慧合約中的位元組碼或二進制碼並執行,當讀取到所述業務智慧合約中的出入校驗指令時,相當於明確了此時需要進行出入校驗操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和。 如果校驗結果為是,則說明這筆轉帳交易是可行的。進而,區塊鏈虛擬機需要執行這筆轉帳交易,即根據轉帳交易修改用戶資產表。修改用戶資產表的用戶資產表修改邏輯實際上是預先寫入到業務智慧合約中的。用戶資產表修改邏輯為,解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係。 此外,在實際應用中,為了防止出現如下情況:某些惡意用戶在發起轉帳交易時,將轉帳交易中包含的轉帳資產的實際金額設置為負數,以轉帳的方式偷取他人的資產;以及,用戶在發起轉帳交易操作失誤,將轉帳交易中包含的找零資產的實際金額設置為負數,導致用戶實際轉出的資產的金額大於轉帳資產的金額,可以採用零知識證明的方法,在轉帳資產的實際金額與找零資產的實際金額都不可見的情況下,校驗轉帳資產的實際金額與找零資產的實際金額是否皆落入指定數值範圍,如(0,264 ]。如果校驗結果為是,就排除了以上情況發生的可能性。 具體地,在實施例十三中,可以進一步針對區塊鏈網路進行預先配置,使得: 4)區塊鏈虛擬機的指令集中還包括金額校驗指令,並且,區塊鏈虛擬機中還部署有對應於所述金額校驗指令的金額校驗邏輯。 5)所述智慧合約編譯器的指令集中還包括所述金額校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中還包含所述金額校驗指令。 基於此,用戶發起的轉帳交易中還需要包括用於實現零知識證明的證明相關資料(如Bullet Proof、Borromean環簽名等)。 區塊鏈虛擬機在讀取到所述業務智慧合約中的金額校驗指令時,會觸發執行本地預先部署的金額校驗邏輯,即根據所述證明相關資料,校驗所述轉帳資產的金額與所述找零資產的金額是否皆落入指定數值範圍。 另外,在實施例十三中,業務智慧合約中還可以包含花銷資產校驗邏輯,使得區塊鏈虛擬機在執行業務智慧合約時,還可以根據所述用戶資產表,校驗所述轉帳外部帳戶對應的資產中是否包括各花銷資產。如果校驗結果為是,說明轉帳用戶所要使用的花銷資產是自己擁有的資產。 此外,針對任一資產,該資產的資料結構還可以包括表徵該資產已花銷或未花銷的第一狀態參數。業務智慧合約中還可以包括第一狀態參數相關邏輯,以便區塊鏈虛擬機在執行業務智慧合約時,針對轉帳交易中的每個花銷資產,該花銷資產包括的第一狀態參數,校驗該花銷資產是否未花銷。並且,所述第一狀態參數相關邏輯還包括:如果最終針對所述轉帳交易的全部校驗的結果皆為是,那麽,對該花銷資產包括的第一狀態參數進行修改,使得修改後的該第一狀態參數表徵該花銷資產已花銷。如果最終針對所述轉帳交易的全部校驗的結果中有任一結果為否,則轉帳交易會失敗,各花銷資產並沒有被花銷出去,自然沒必要對第一狀態參數進行修改。 還有,針對任一資產,該資產的資料結構還可以包括表徵該資產存在或不存在的第二狀態參數。業務智慧合約中還可以包括第二狀態參數相關邏輯,以便區塊鏈虛擬機在執行業務智慧合約時,針對所述轉帳交易中的每個花銷資產,根據該花銷資產包括的第二狀態參數,校驗該花銷資產是否存在。這樣,可以有效防止惡意用戶虛構並不存在的資產並使用虛構的資產來進行轉帳。 另外需要說明的是,區塊鏈虛擬機如果根據所述業務智慧合約中的出入校驗指令與金額校驗指令觸發執行出入校驗邏輯與金額校驗邏輯,那麽,在執行過程中所採用的資料傳遞方式通常是棧傳遞。以下的實施例十四提供了另一種基於區塊鏈智慧合約的轉帳方法(預編譯合約的方式)。 實施例十四 圖19是本說明書實施例提供的一種基於區塊鏈智慧合約的交易哈希獲取方法的流程示意圖,包括如下步驟: S1900:區塊鏈網路中的節點透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點。 S1902:針對所述區塊鏈網路中的每個節點,該節點在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約,並根據所述業務智慧合約中的所述出入校驗智慧合約的合約標識,調用所述出入校驗智慧合約。 S1904:該節點根據所述出入校驗智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯。 S1906:若校驗結果為是,則該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯。 在實施例十四中,需要針對區塊鏈網路進行預先配置,使得: 1)區塊鏈虛擬機的指令集中包括交易哈希獲取指令,並且,區塊鏈虛擬機中部署有對應於所述交易哈希獲取指令的交易哈希獲取邏輯。 2)智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 3)區塊鏈網路中部署有所述業務智慧合約。 實施例十四與實施例十三的區別主要在於,在實施例十二中,區塊鏈虛擬機調用所述業務智慧合約之後,當讀取到所述出入校驗智慧合約的合約標識時,相當於明確了此時需要進一步調用所述出入校驗智慧合約。區塊鏈虛擬機調用所述出入校驗智慧合約,也會讀取所述出入校驗智慧合約中的位元組碼或二進制碼,當讀取到所述出入校驗指令時,相當於明確了此時需要執行出入校驗操作,因此,區塊鏈虛擬機此時會觸發執行預先部署於本地的出入校驗邏輯。 也就是說,在實施例十二中,智慧合約編譯器在編譯業務智慧合約時,如果發現業務智慧合約中聲明調用出入校驗操作,則不會將這段聲明編譯為出入校驗指令,而是編譯成所述所述出入校驗智慧合約的合約標識。這樣,區塊鏈虛擬機在調用業務智慧合約時,會進一步調用所述出入校驗智慧合約。 進一步地,在實施例十四中,需要針對區塊鏈網路進行預先配置,使得: 4)區塊鏈虛擬機的指令集中還包括金額校驗指令,並且,區塊鏈虛擬機中還部署有對應於所述金額校驗指令的金額校驗邏輯。 5)所述智慧合約編譯器的指令集中還包括所述金額校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中還包含所述金額校驗智慧合約的合約標識,所述金額校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 如此,在實施例十四中,針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述金額校驗智慧合約的合約標識,調用所述金額校驗智慧合約;該節點根據所述金額校驗智慧合約中的金額校驗指令,觸發執行所述金額校驗邏輯,以便根據所述證明相關資料,校驗所述轉帳資產的金額與所述找零資產的金額是否皆落入指定數值範圍。 此外需要說明的是,在實施例十四中,執行的校驗事項與實施例十三中的一致,只不過,對於出入校驗與金額校驗,是透過調用預編譯合約(即出入校驗智慧合約與金額校驗智慧合約)的方式進行的。 在實施例十三與實施例十四中,針對轉帳交易進行的校驗事項有多個時,當全部校驗結果都為是時,區塊鏈虛擬機才會執行用戶資產表修改邏輯。 圖20a是本說明書實施例提供的對應於實施例十三的轉帳交易的相關校驗操作的部署示意圖。如圖20a所示,其一,為區塊鏈虛擬機的指令集添加出入校驗指令與金額校驗指令,同時,在區塊鏈虛擬機中部署出入校驗邏輯與金額校驗邏輯。其二,為智慧合約編譯器的指令集添加出入校驗指令與金額校驗指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含出入校驗指令與金額校驗指令)部署於區塊鏈網路中。 圖20b是本說明書實施例提供的對應於實施例十四的轉帳交易的相關校驗操作的部署示意圖。如圖20b所示,其一,為區塊鏈虛擬機的指令集添加出入校驗指令與金額校驗指令,同時,在區塊鏈虛擬機中部署出入校驗邏輯與金額校驗邏輯。其二,為智慧合約編譯器的指令集添加出入校驗指令與金額校驗指令。其三,將經過智慧合約編譯器編譯的業務智慧合約(包含出入校驗智慧合約的合約標識與金額校驗智慧合約的合約標識)部署於區塊鏈網路中。 以上,是分別對實施例一~實施例十四的解釋說明。實際上,在實際應用中,業務發起交易具體可以是轉帳交易,而為了實現轉帳交易,可能不僅需要進行相關校驗(如實施例十三中提及的各項校驗),還需要進行BASE54編碼操作、BASE54解碼操作、RSA簽名驗證操作、JSON處理操作、XML處理操作、交易哈希獲取操作中的一種或多種。 也就是說,可以將上述的BASE64編碼方法、BASE64解碼方法、RSA簽名驗證方法、JSON處理方法、XML處理方法以及交易哈希獲取方法中的一種或多種應用於實施例十三或實施例十四中的轉帳方法中,此時,前文所述業務發起交易就是轉帳交易。 此外需要說明的是,在本說明書的各實施例中,如果業務智慧合約不是所述區塊鏈網路中唯一的智慧合約,那麽,業務發起交易(以及轉帳交易)中還需要包含業務智慧合約的合約標識,以便區塊鏈虛擬機根據所述業務發起交易(以及轉帳交易)中包括的合約標識,調用對應的業務智慧合約。 還有,對於本說明書中的各實施例,所述區塊鏈虛擬機的指令集中還包括至少一個以太坊指令,以太坊指令是以太坊虛擬機的指令集中的指令;針對所述區塊鏈虛擬機的指令集中包括的每個以太坊指令,所述區塊鏈虛擬機中部署有對應於該以太坊指令的相關邏輯。所述智慧合約編譯器的指令集中還包括至少一個以太坊指令,以太坊指令是以太坊虛擬機的指令集中的指令。也就是說,本發明中的區塊鏈虛擬機可以是在以太坊虛擬機的基礎上擴展得到的,本發明中的智慧合約編譯器可以是在以太坊的智慧合約編譯器的基礎上擴展得到的。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的; 所述區塊鏈網路中的節點,透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產; 所述區塊鏈網路中的每個節點,在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約並根據所述業務智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的; 所述區塊鏈網路中的節點,透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產; 所述區塊鏈網路中的每個節點,在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約,並根據所述業務智慧合約中的所述出入校驗智慧合約的合約標識,調用所述出入校驗智慧合約;根據所述出入校驗智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括BASE64編碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64編碼指令的BASE64編碼邏輯;智慧合約編譯器的指令集中包括所述BASE64編碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述BASE64編碼指令;區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的BASE64編碼指令,觸發執行所述BASE64編碼邏輯,以對待編碼資料進行編碼操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括BASE64編碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64編碼指令的BASE64編碼邏輯;智慧合約編譯器的指令集中包括所述BASE64編碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含BASE64編碼智慧合約的合約標識,所述BASE64編碼智慧合約是預先部署於所述區塊鏈網路中的智慧合約;所述區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的所述BASE64編碼智慧合約的合約標識,調用所述BASE64編碼智慧合約;透過區塊鏈虛擬機,根據所述BASE64編碼智慧合約中的BASE64編碼指令,觸發執行所述BASE64編碼邏輯,以對待編碼資料進行編碼操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括BASE64解碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64解碼指令的BASE64解碼邏輯;智慧合約編譯器的指令集中包括所述BASE64解碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述BASE64解碼指令;區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的BASE64解碼指令,觸發執行所述BASE64解碼邏輯,以對待解碼資料進行解碼操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括BASE64解碼指令,並且,區塊鏈虛擬機中部署有對應於所述BASE64解碼指令的BASE64解碼邏輯;智慧合約編譯器的指令集中包括所述BASE64解碼指令,經所述智慧合約編譯器編譯的業務智慧合約中包含BASE64解碼智慧合約的合約標識,所述BASE64解碼智慧合約是預先部署於所述區塊鏈網路中的智慧合約;所述區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,該節點在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的所述BASE64解碼智慧合約的合約標識,調用所述BASE64解碼智慧合約;透過區塊鏈虛擬機,根據所述BASE64解碼智慧合約中的BASE64解碼指令,觸發執行所述BASE64解碼邏輯,以對待解碼資料進行解碼操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括RSA簽名驗證指令,並且,區塊鏈虛擬機中部署有對應於所述RSA簽名驗證指令的RSA簽名驗證邏輯;智慧合約編譯器的指令集中包括所述RSA簽名驗證指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述RSA簽名驗證指令;區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的RSA簽名驗證指令,觸發執行所述RSA簽名驗證邏輯,以對業務簽名進行RSA簽名驗證操作,以對業務簽名進行RSA簽名驗證操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括RSA簽名驗證指令,並且,區塊鏈虛擬機中部署有對應於所述RSA簽名驗證指令的RSA簽名驗證邏輯;智慧合約編譯器的指令集中包括所述RSA簽名驗證指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述RSA簽名驗證智慧合約的合約標識,所述RSA簽名驗證智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的所述RSA簽名驗證智慧合約的合約標識,調用所述RSA簽名驗證智慧合約;透過區塊鏈虛擬機,根據所述RSA簽名驗證智慧合約中的RSA簽名驗證指令,觸發執行所述RSA簽名驗證邏輯,以對業務簽名進行RSA簽名驗證操作,以對業務簽名進行RSA簽名驗證操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括JSON處理指令,並且,區塊鏈虛擬機中部署有對應於所述JSON處理指令的JSON處理邏輯;智慧合約編譯器的指令集中包括所述JSON處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述JSON處理指令;區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的JSON處理指令,觸發執行所述JSON處理邏輯,以對待處理資料進行JSON處理操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括JSON處理指令,並且,區塊鏈虛擬機中部署有對應於所述JSON處理指令的JSON處理邏輯;智慧合約編譯器的指令集中包括所述JSON處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含JSON處理智慧合約的合約標識,所述JSON處理智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述JSON處理智慧合約與所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的所述JSON處理智慧合約的合約標識,調用所述JSON處理智慧合約;透過區塊鏈虛擬機,根據所述JSON處理智慧合約中的JSON處理指令,觸發執行所述JSON處理邏輯,以對待處理資料進行JSON處理操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括XML處理指令,並且,區塊鏈虛擬機中部署有對應於所述XML處理指令的XML處理邏輯;智慧合約編譯器的指令集中包括所述XML處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述XML處理指令;區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的XML處理指令,觸發執行所述XML處理邏輯,以對待處理資料進行XML處理操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括XML處理指令,並且,區塊鏈虛擬機中部署有對應於所述XML處理指令的XML處理邏輯;智慧合約編譯器的指令集中包括所述XML處理指令,經所述智慧合約編譯器編譯的業務智慧合約中包含XML處理智慧合約的合約標識,所述XML處理智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述XML處理智慧合約與所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的所述XML處理智慧合約的合約標識,調用所述XML處理智慧合約;透過區塊鏈虛擬機,根據所述XML處理智慧合約中的XML處理指令,觸發執行所述XML處理邏輯,以對待處理資料進行XML處理操作。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括交易哈希獲取指令,並且,區塊鏈虛擬機中部署有對應於所述交易哈希獲取指令的交易哈希獲取邏輯;智慧合約編譯器的指令集中包括所述交易哈希獲取指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述交易哈希獲取指令;區塊鏈網路中部署有所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的交易哈希獲取指令,觸發執行所述交易哈希獲取邏輯,以獲取所述業務發起交易的交易哈希。 本說明書提供的一種區塊鏈系統,包括區塊鏈網路; 其中,區塊鏈虛擬機的指令集中包括交易哈希獲取指令,並且,區塊鏈虛擬機中部署有對應於所述交易哈希獲取指令的交易哈希獲取邏輯;智慧合約編譯器的指令集中包括所述交易哈希獲取指令,經所述智慧合約編譯器編譯的業務智慧合約中包含交易哈希獲取智慧合約的合約標識,所述交易哈希獲取智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述交易哈希獲取智慧合約與所述業務智慧合約; 所述區塊鏈網路中的節點,獲得業務發起交易並廣播給其他節點; 所述區塊鏈網路中的每個節點,在執行所述業務發起交易時,透過區塊鏈虛擬機,調用所述業務智慧合約;透過區塊鏈虛擬機,根據所述業務智慧合約中的所述交易哈希獲取智慧合約的合約標識,調用所述交易哈希獲取智慧合約;透過區塊鏈虛擬機,根據所述交易哈希獲取智慧合約中的交易哈希獲取指令,觸發執行所述交易哈希獲取邏輯,以獲取所述業務發起交易的交易哈希。 圖21示出了本說明書實施例所提供的一種區塊鏈系統的結構示意圖。 本說明書還提供一種電腦設備,其至少包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,其中,處理器執行所述程式時實現本文各實施例的方法以及各實施例中至少兩個實施例組合後的方法的功能。 圖22示出了本說明書實施例所提供的一種更為具體的計算設備硬體結構示意圖,該設備可以包括:處理器2210、記憶體2220、輸入/輸出介面2230、通信介面2240和匯流排2250。其中處理器2210、記憶體2220、輸入/輸出介面2230和通信介面2240透過匯流排2250實現彼此之間在設備內部的通信連接。 處理器2210可以採用通用的CPU(Central Processing Unit,中央處理器)、微處理器、特殊應用積體電路(Application Specific Integrated Circuit,ASIC)、或者一個或多個積體電路等方式實現,用於執行相關程式,以實現本說明書實施例所提供的技術方案。 記憶體2220可以採用ROM(Read Only Memory,唯讀記憶體)、RAM(Random Access Memory,隨機存取記憶體)、靜態儲存設備,動態儲存設備等形式實現。記憶體2220可以儲存作業系統和其他應用程式,在透過軟體或者韌體來實現本說明書實施例所提供的技術方案時,相關的程式碼保存在記憶體2220中,並由處理器2210來調用執行。 輸入/輸出介面2230用於連接輸入/輸出模組,以實現資訊輸入及輸出。輸入輸出/模組可以作為組件配置在設備中(圖中未示出),也可以外接於設備以提供相應功能。其中輸入設備可以包括鍵盤、滑鼠、觸控螢幕、麥克風、各類傳感器等,輸出設備可以包括顯示器、揚聲器、振動器、指示燈等。 通信介面2240用於連接通信模組(圖中未示出),以實現本設備與其他設備的通信互動。其中通信模組可以透過有線方式(例如USB、網線等)實現通信,也可以透過無線方式(例如移動網路、WIFI、藍牙等)實現通信。 匯流排2250包括一通路,在設備的各個組件(例如處理器2210記憶體2220、輸入/輸出介面2230和通信介面2240)之間傳輸資訊。 需要說明的是,儘管上述設備僅示出了處理器2210、記憶體2220、輸入/輸出介面2230、通信介面2240以及匯流排2250,但是在具體實施過程中,該設備還可以包括實現正常運行所必需的其他組件。此外,本領域的技術人員可以理解的是,上述設備中也可以僅包含實現本說明書實施例方案所必需的組件,而不必包含圖中所示的全部組件。 本說明書實施例還提供一種電腦可讀儲存媒體,其上儲存有電腦程式,該程式被處理器執行時實現本文各實施例的方法以及各實施例中至少兩個實施例組合後的方法的功能。 電腦可讀媒體包括永久性和非永久性、可移動和非可移動媒體可以由任何方法或技術來實現資訊儲存。資訊可以是電腦可讀指令、資料結構、程式的模組或其他資料。電腦的儲存媒體的例子包括,但不限於相變記憶體(PRAM)、靜態隨機存取記憶體(SRAM)、動態隨機存取記憶體(DRAM)、其他類型的隨機存取記憶體(RAM)、唯讀記憶體(ROM)、電可抹除可程式唯讀記憶體(EEPROM)、快閃記憶體或其他記憶體技術、唯讀光碟唯讀記憶體(CD-ROM)、數位多功能光碟(DVD)或其他光學儲存、磁盒式磁帶,磁帶磁碟儲存或其他磁性儲存設備或任何其他非傳輸媒體,可用於儲存可以被計算設備存取的資訊。按照本文中的界定,電腦可讀媒體不包括暫存電腦可讀媒體(transitory media),如調變的資料信號和載波。 透過以上的實施方式的描述可知,本領域的技術人員可以清楚地瞭解到本說明書實施例可借助軟體加必需的通用硬體平臺的方式來實現。基於這樣的理解,本說明書實施例的技術方案本質上或者說對現有技術做出貢獻的部分可以以軟體產品的形式體現出來,該電腦軟體產品可以儲存在儲存媒體中,如ROM/RAM、磁碟、光碟等,包括若干指令用以使得一台電腦設備(可以是個人電腦,伺服器,或者網路設備等)執行本說明書實施例各個實施例或者實施例的某些部分所述的方法。 上述實施例闡明的系統、方法、模組或單元,具體可以由電腦晶片或實體實現,或者由具有某種功能的產品來實現。一種典型的實現設備為電腦,電腦的具體形式可以是個人電腦、膝上型電腦、蜂巢式電話、相機電話、智慧電話、個人數位助理、媒體播放器、導航設備、電子郵件收發設備、遊戲控制台、平板電腦、穿戴式設備或者這些設備中的任意幾種設備的組合。 本說明書中的各個實施例均採用漸進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於裝置和設備實施例而言,由於其基本相似於方法實施例,所以描述得比較簡單,相關之處參見方法實施例的部分說明即可。以上所描述的方法實施例僅僅是示意性的,其中所述作為分離部件說明的模組可以是或者也可以不是物理上分開的,在實施本說明書實施例方案時可以把各模組的功能在同一個或多個軟體和/或硬體中實現。也可以根據實際的需要選擇其中的部分或者全部模組來實現本實施例方案的目的。本領域普通技術人員在不付出創造性勞動的情況下,即可以理解並實施。 以上所述僅是本說明書實施例的具體實施方式,應當指出,對於本技術領域的普通技術人員來說,在不脫離本說明書實施例原理的前提下,還可以做出若干改進和潤飾,這些改進和潤飾也應視為本說明書實施例的保護範圍。In step S1800, the node actually refers to the node corresponding to the transfer user. The transfer external account actually refers to the external account controlled by the transfer user. The node obtains the transfer transaction through the transfer of the external account, in fact, the transfer user logs in to the client (or "wallet"), constructs the transfer transaction and sends it to the node. The transfer transaction includes transfer assets, change assets and at least one expense asset. Wherein, the at least one expense asset is actually the asset input to the transfer, and the transfer asset and the change asset are actually the assets output from the transfer. In the thirteenth embodiment, after the blockchain virtual machine invokes the business smart contract, it reads and executes the byte code or binary code in the business smart contract. When it is read into the business smart contract When the access verification instruction is used, it is equivalent to clarifying that the access verification operation needs to be performed at this time. Therefore, the blockchain virtual machine will trigger the execution of the access verification logic pre-deployed locally at this time in order to adopt the homomorphic encryption algorithm. It is verified whether the sum of the amount of the transfer asset and the amount of the change asset is equal to the sum of the amount of each spent asset. If the verification result is yes, the transfer transaction is feasible. Furthermore, the blockchain virtual machine needs to execute this transfer transaction, that is, modify the user's asset table according to the transfer transaction. The user asset table modification logic for modifying the user asset table is actually pre-written into the business smart contract. The logic for modifying the user asset table is to remove the correspondence between the transfer external account and each spent asset, establish the correspondence between the transfer external account and the change asset, and establish the relationship between the external account for collection and the transfer asset Correspondence. In addition, in actual applications, in order to prevent the following situations: some malicious users set the actual amount of the transfer assets included in the transfer transaction to a negative number when initiating the transfer transaction, and steal the assets of others by way of transfer; and, The user made a mistake in initiating the transfer transaction and set the actual amount of the change asset included in the transfer transaction to a negative number, which caused the user to actually transfer the amount of assets greater than the amount of the transferred assets. You can use the zero-knowledge proof method to transfer assets If the actual amount of the transfer asset and the actual amount of the change asset are not visible, verify whether the actual amount of the transferred asset and the actual amount of the change asset fall within the specified value range, such as (0, 2 64 ). If you verify The result is yes, and the possibility of the above situation is eliminated. Specifically, in the thirteenth embodiment, the blockchain network can be further pre-configured so that: 4) The instruction set of the blockchain virtual machine also includes An amount verification instruction, and an amount verification logic corresponding to the amount verification instruction is also deployed in the blockchain virtual machine. 5) The instruction set of the smart contract compiler further includes the amount verification instruction, and the business smart contract compiled by the smart contract compiler further includes the amount verification instruction. Based on this, the transfer transaction initiated by the user also needs to include proof-related materials (such as Bullet Proof, Borromean ring signature, etc.) used to achieve zero-knowledge proof. When the blockchain virtual machine reads the amount verification instruction in the business smart contract, it will trigger the execution of the local pre-deployed amount verification logic, that is, verify the amount of the transfer asset based on the relevant certification data Whether the amount of the change asset and the change asset fall within the specified numerical range. In addition, in the thirteenth embodiment, the business smart contract may also include spending asset verification logic, so that when the blockchain virtual machine executes the business smart contract, it can also verify the transfer according to the user asset table. Whether the assets corresponding to the external account include each expense asset. If the verification result is yes, it means that the expense asset to be used by the transfer user is an asset owned by the user. In addition, for any asset, the data structure of the asset may also include a first state parameter that characterizes whether the asset has been spent or not. The business smart contract may also include the logic related to the first state parameter, so that when the blockchain virtual machine executes the business smart contract, for each spent asset in the transfer transaction, the first state parameter included in the spent asset can be adjusted. Check whether the spent asset has not been spent. Moreover, the logic related to the first state parameter further includes: if all the results of the final verification for the transfer transaction are all yes, then the first state parameter included in the expense asset is modified so that the modified The first state parameter indicates that the spent asset has been spent. If any of the final verification results for the transfer transaction is negative, the transfer transaction will fail, and each spent asset has not been spent, so it is naturally unnecessary to modify the first state parameter. Furthermore, for any asset, the data structure of the asset may also include a second state parameter that characterizes the existence or non-existence of the asset. The business smart contract may also include the logic related to the second state parameter, so that when the blockchain virtual machine executes the business smart contract, for each spent asset in the transfer transaction, according to the second state included in the spent asset Parameter to verify whether the expense asset exists. In this way, malicious users can effectively prevent fictitious assets that do not exist and use fictitious assets to transfer funds. In addition, it should be noted that if the blockchain virtual machine triggers the execution of the access verification logic and the amount verification logic according to the entry and exit verification instructions and the amount verification instructions in the business smart contract, then the The data transfer method is usually stack transfer. The fourteenth embodiment below provides another transfer method based on the blockchain smart contract (the pre-compiled contract method). Embodiment 14 FIG. 19 is a flowchart of a method for obtaining transaction hash based on a blockchain smart contract according to an embodiment of this specification, which includes the following steps: S1900: Nodes in the blockchain network obtain transfers through transfers to external accounts Transaction and broadcast to other nodes. S1902: For each node in the blockchain network, when the node executes the transfer transaction, it calls the business smart contract through the blockchain virtual machine, and according to all the business smart contracts State the contract identifier of the access verification smart contract, and call the access verification smart contract. S1904: The node triggers the execution of the access verification logic according to the access verification instruction in the access verification smart contract. S1906: If the verification result is yes, the node executes the user asset table modification logic in the business smart contract through the blockchain virtual machine. In the fourteenth embodiment, the blockchain network needs to be pre-configured so that: 1) The instruction set of the blockchain virtual machine includes the transaction hash acquisition instruction, and the blockchain virtual machine is deployed corresponding to all The transaction hash acquisition logic of the transaction hash acquisition instruction is described. 2) The instruction set of the smart contract compiler includes the entry and exit verification instructions, and the business smart contract compiled by the smart contract compiler includes the contract identification of the entry and exit verification smart contract, and the entry and exit verification smart contract is pre-deployed Smart contracts in the blockchain network. 3) The business smart contract is deployed in the blockchain network. The main difference between the fourteenth embodiment and the thirteenth embodiment is that, in the twelfth embodiment, after the blockchain virtual machine invokes the business smart contract, when it reads the contract identifier of the access verification smart contract, It is equivalent to clarifying that the smart contract for access verification needs to be further called at this time. When the blockchain virtual machine calls the access verification smart contract, it will also read the byte code or binary code in the access verification smart contract. When the access verification instruction is read, it is equivalent to clear At this time, the access verification operation needs to be performed. Therefore, the blockchain virtual machine will trigger the execution of the access verification logic pre-deployed locally at this time. That is to say, in the twelfth embodiment, when the smart contract compiler compiles the business smart contract, if it finds that the business smart contract declares to call the access verification operation, it will not compile this statement into the access verification instruction, and It is the contract identifier compiled into the smart contract for access verification. In this way, when the blockchain virtual machine invokes the business smart contract, it will further invoke the access verification smart contract. Further, in the fourteenth embodiment, the blockchain network needs to be pre-configured so that: 4) The instruction set of the blockchain virtual machine also includes an amount verification instruction, and the blockchain virtual machine is also deployed There is an amount verification logic corresponding to the amount verification instruction. 5) The instruction set of the smart contract compiler further includes the amount verification instruction, the business smart contract compiled by the smart contract compiler also includes the contract identifier of the amount verification smart contract, and the amount correction A verification smart contract is a smart contract that is pre-deployed in the blockchain network. Thus, in the fourteenth embodiment, for each node in the blockchain network, the node uses the blockchain virtual machine to verify the contract identifier of the smart contract according to the amount in the business smart contract , Call the amount verification smart contract; the node verifies the amount verification instruction in the smart contract according to the amount verification, and triggers the execution of the amount verification logic, so as to verify the transfer asset based on the proof-related information Whether the amount of and the amount of the said change asset fall within the specified numerical range. In addition, it should be noted that, in the fourteenth embodiment, the executed verification items are the same as those in the thirteenth embodiment, except that for the in-out verification and the amount verification, the pre-compiled contract is called (that is, the in-out verification Smart contract and amount verification smart contract). In the thirteenth and fourteenth embodiments, when there are multiple verification items for the transfer transaction, when all the verification results are yes, the blockchain virtual machine will execute the user asset table modification logic. Fig. 20a is a schematic diagram of the deployment of related verification operations corresponding to the thirteenth embodiment of the transfer transaction provided by the embodiment of this specification. As shown in Figure 20a, one is to add an access verification instruction and an amount verification instruction to the instruction set of the blockchain virtual machine, and at the same time, deploy an access verification logic and an amount verification logic in the blockchain virtual machine. Second, add in/out verification instructions and amount verification instructions to the instruction set of the smart contract compiler. Third, deploy business smart contracts (including access verification instructions and amount verification instructions) compiled by the smart contract compiler in the blockchain network. Figure 20b is a schematic diagram of the deployment of related verification operations corresponding to the fourteenth embodiment of the transfer transaction provided by the embodiment of this specification. As shown in Figure 20b, one is to add an access verification instruction and an amount verification instruction to the instruction set of the blockchain virtual machine, and at the same time, deploy an access verification logic and an amount verification logic in the blockchain virtual machine. Second, add in/out verification instructions and amount verification instructions to the instruction set of the smart contract compiler. Third, deploy the business smart contract (including the contract identification of the access verification smart contract and the contract identification of the amount verification smart contract) compiled by the smart contract compiler in the blockchain network. The above is the explanation of the first to the fourteenth embodiment respectively. In fact, in actual applications, the business initiation transaction can be a transfer transaction. In order to realize the transfer transaction, not only related verifications (such as the verifications mentioned in the thirteenth embodiment), but also BASE54 may be required. One or more of encoding operation, BASE54 decoding operation, RSA signature verification operation, JSON processing operation, XML processing operation, and transaction hash obtaining operation. That is to say, one or more of the aforementioned BASE64 encoding method, BASE64 decoding method, RSA signature verification method, JSON processing method, XML processing method, and transaction hash obtaining method can be applied to Embodiment 13 or Embodiment 14. In the transfer method in, at this time, the business initiation transaction described above is a transfer transaction. In addition, it should be noted that in each embodiment of this specification, if the business smart contract is not the only smart contract in the blockchain network, then the business initiation transaction (and the transfer transaction) also needs to include the business smart contract So that the blockchain virtual machine can invoke the corresponding business smart contract according to the contract identifier included in the business initiation transaction (and transfer transaction). Also, for each embodiment in this specification, the instruction set of the blockchain virtual machine also includes at least one Ethereum instruction, and the Ethereum instruction is an instruction in the instruction set of the Ethereum virtual machine; For each Ethereum instruction included in the instruction set of the virtual machine, relevant logic corresponding to the Ethereum instruction is deployed in the blockchain virtual machine. The instruction set of the smart contract compiler also includes at least one Ethereum instruction, which is an instruction in the instruction set of the Ethereum virtual machine. In other words, the blockchain virtual machine in the present invention can be extended on the basis of the Ethereum virtual machine, and the smart contract compiler in the present invention can be extended on the basis of the Ethereum smart contract compiler. of. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes an access check instruction, and the block chain virtual machine is deployed corresponding to the access check Instruction check logic; the instruction set of the smart contract compiler includes the check check instructions, and the business smart contract compiled by the smart contract compiler includes the check check instructions; deployed in a blockchain network There is the business smart contract, and the business smart contract corresponds to a user asset table. The user asset table is used to record the asset corresponding to each external account. For any asset, the asset is data containing the encrypted amount. The amount is obtained by encrypting the amount of the asset; the nodes in the blockchain network obtain transfer transactions through the transfer of external accounts and broadcast them to other nodes; the transfer transactions include transfer assets, change assets and at least A cost asset; each node in the blockchain network, when executing the transfer transaction, invokes the business smart contract through the blockchain virtual machine and enters and exits the school according to the business smart contract The verification instruction triggers the execution of the access verification logic, so that the homomorphic encryption algorithm is used to verify whether the sum of the amount of the transfer asset and the amount of the change asset is equal to the sum of the amount of each spent asset; if If the verification result is yes, execute the user asset table modification logic in the business smart contract through the blockchain virtual machine, so as to cancel the correspondence between the transfer external account and each expense asset, and establish the transfer external account The corresponding relationship with the change asset, and the corresponding relationship between the external account for collection and the transfer asset is established. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes an access check instruction, and the block chain virtual machine is deployed corresponding to the access check Instruction and exit verification logic; the instruction set of the smart contract compiler includes the entry and exit verification instructions, the business smart contract compiled by the smart contract compiler includes the contract identification of the entry and exit verification smart contract, and the entry and exit verification A smart contract is a smart contract that is pre-deployed in the blockchain network; the business smart contract is deployed in the blockchain network, and the business smart contract corresponds to a user asset table, and the user asset table is used for Record the asset corresponding to each external account. For any asset, the asset is the data containing the encrypted amount, and the encrypted amount is obtained by encrypting the amount of the asset; the nodes in the blockchain network, through The external account of the transfer obtains the transfer transaction and broadcasts it to other nodes; the transfer transaction includes transfer assets, change assets and at least one expense asset; each node in the blockchain network, when executing the transfer transaction , Call the business smart contract through the blockchain virtual machine, and call the smart contract for access verification according to the contract identifier of the smart contract in the business smart contract; The access verification instruction in the smart contract triggers the execution of the access verification logic, so that the homomorphic encryption algorithm is used to verify whether the sum of the amount of the transfer asset and the amount of the change asset is equal to each spent asset If the verification result is yes, execute the user asset table modification logic in the business smart contract through the blockchain virtual machine, so as to cancel the corresponding relationship between the transfer external account and each spent asset. The corresponding relationship between the transfer external account and the change asset is established, and the corresponding relationship between the transfer external account and the transfer asset is established. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes BASE64 encoding instructions, and the block chain virtual machine is deployed with corresponding BASE64 encoding instructions BASE64 encoding logic; the instruction set of the smart contract compiler includes the BASE64 encoding instruction, and the business smart contract compiled by the smart contract compiler includes the BASE64 encoding instruction; the business wisdom is deployed in the blockchain network Contract; the nodes in the blockchain network obtain business initiation transactions and broadcast them to other nodes; each node in the blockchain network, when executing the business initiation transactions, virtualize through the blockchain The BASE64 coding logic is triggered by the blockchain virtual machine according to the BASE64 coding instruction in the service smart contract to perform coding operations on the coded data. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes BASE64 encoding instructions, and the block chain virtual machine is deployed with corresponding BASE64 encoding instructions BASE64 encoding logic; the instruction set of the smart contract compiler includes the BASE64 encoding instruction, the business smart contract compiled by the smart contract compiler includes the contract identifier of the BASE64 encoded smart contract, and the BASE64 encoded smart contract is pre-deployed in The smart contract in the blockchain network; the business smart contract is deployed in the blockchain network; the nodes in the blockchain network obtain business initiation transactions and broadcast them to other nodes; Each node in the blockchain network invokes the business smart contract through the blockchain virtual machine when executing the business initiation transaction; through the blockchain virtual machine, according to the business smart contract The contract identifier of the BASE64-encoded smart contract calls the BASE64-encoded smart contract; through the blockchain virtual machine, according to the BASE64 encoding instruction in the BASE64-encoded smart contract, the execution of the BASE64 encoding logic is triggered to treat the encoded data Perform coding operations. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes a BASE64 decoding instruction, and the block chain virtual machine is deployed with a corresponding BASE64 decoding instruction BASE64 decoding logic; the instruction set of the smart contract compiler includes the BASE64 decoding instruction, and the business smart contract compiled by the smart contract compiler includes the BASE64 decoding instruction; the business wisdom is deployed in the blockchain network Contract; the nodes in the blockchain network obtain business initiation transactions and broadcast them to other nodes; each node in the blockchain network, when executing the business initiation transactions, virtualize through the blockchain The machine calls the business smart contract; through the blockchain virtual machine, according to the BASE64 decoding instruction in the business smart contract, the execution of the BASE64 decoding logic is triggered to decode the data to be decoded. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes a BASE64 decoding instruction, and the block chain virtual machine is deployed with a corresponding BASE64 decoding instruction BASE64 decoding logic; the instruction set of the smart contract compiler includes the BASE64 decoding instruction, the business smart contract compiled by the smart contract compiler includes the contract identifier of the BASE64 decoding smart contract, and the BASE64 decoding smart contract is pre-deployed in The smart contract in the blockchain network; the business smart contract is deployed in the blockchain network; the nodes in the blockchain network obtain business initiation transactions and broadcast them to other nodes; Each node in the blockchain network, when the node executes the business initiation transaction, calls the business smart contract through the blockchain virtual machine; through the blockchain virtual machine, according to the business smart contract The BASE64 decoding smart contract’s contract identifier in the BASE64 decoding smart contract is called, and the BASE64 decoding smart contract is called; through the blockchain virtual machine, the BASE64 decoding instruction in the BASE64 decoding smart contract is triggered to execute the BASE64 decoding logic to treat Decode the data for decoding operations. The blockchain system provided in this specification includes a blockchain network; wherein, the instruction set of the blockchain virtual machine includes RSA signature verification instructions, and the blockchain virtual machine is deployed corresponding to the RSA signature verification RSA signature verification logic of the instruction; the instruction set of the smart contract compiler includes the RSA signature verification instruction, and the business smart contract compiled by the smart contract compiler includes the RSA signature verification instruction; deployed in a blockchain network There is the business smart contract; the nodes in the blockchain network obtain the business initiation transaction and broadcast it to other nodes; each node in the blockchain network, when executing the business initiation transaction, Through the blockchain virtual machine, call the business smart contract; through the blockchain virtual machine, according to the RSA signature verification instruction in the business smart contract, trigger the execution of the RSA signature verification logic to perform RSA signature on the business signature Verification operation to perform RSA signature verification operation on the service signature. The blockchain system provided in this specification includes a blockchain network; wherein, the instruction set of the blockchain virtual machine includes RSA signature verification instructions, and the blockchain virtual machine is deployed corresponding to the RSA signature verification The RSA signature verification logic of the instruction; the instruction set of the smart contract compiler includes the RSA signature verification instruction, the business smart contract compiled by the smart contract compiler includes the contract identifier of the RSA signature verification smart contract, the RSA The signature verification smart contract is a smart contract that is pre-deployed in the blockchain network; the business smart contract is deployed in the blockchain network; the nodes in the blockchain network obtain business initiation transactions and Broadcast to other nodes; each node in the blockchain network, when executing the business initiation transaction, calls the business smart contract through the blockchain virtual machine; through the blockchain virtual machine, according to all The RSA signature verification smart contract in the business smart contract calls the RSA signature verification smart contract; through the blockchain virtual machine, the RSA signature verification command in the smart contract verifies the RSA signature to trigger execution The RSA signature verification logic is to perform an RSA signature verification operation on the service signature, and to perform an RSA signature verification operation on the service signature. The block chain system provided in this specification includes a block chain network; wherein the instruction set of the block chain virtual machine includes JSON processing instructions, and the block chain virtual machine is deployed with corresponding JSON processing instructions JSON processing logic; the instruction set of the smart contract compiler includes the JSON processing instruction, and the business smart contract compiled by the smart contract compiler includes the JSON processing instruction; the business wisdom is deployed in the blockchain network Contract; the nodes in the blockchain network obtain business initiation transactions and broadcast them to other nodes; each node in the blockchain network, when executing the business initiation transactions, virtualize through the blockchain Machine, call the business smart contract; through the blockchain virtual machine, according to the JSON processing instructions in the business smart contract, trigger the execution of the JSON processing logic to perform JSON processing operations on the data to be processed. The block chain system provided in this specification includes a block chain network; wherein the instruction set of the block chain virtual machine includes JSON processing instructions, and the block chain virtual machine is deployed with corresponding JSON processing instructions JSON processing logic; the instruction set of the smart contract compiler includes the JSON processing instruction, the business smart contract compiled by the smart contract compiler includes the contract identifier of the JSON processing smart contract, and the JSON processing smart contract is pre-deployed in The smart contract in the blockchain network; the JSON processing smart contract and the business smart contract are deployed in the blockchain network; the nodes in the blockchain network obtain business initiation transactions and broadcast them To other nodes; each node in the blockchain network, when executing the business initiation transaction, invokes the business smart contract through the blockchain virtual machine; through the blockchain virtual machine, according to the The JSON processing smart contract in the business smart contract is used to call the JSON processing smart contract; the blockchain virtual machine is used to process the JSON processing instructions in the smart contract according to the JSON processing to trigger the execution of the JSON processing logic , To perform JSON processing operations on the data to be processed. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes XML processing instructions, and the block chain virtual machine is deployed with corresponding XML processing instructions XML processing logic; the instruction set of the smart contract compiler includes the XML processing instructions, and the business smart contract compiled by the smart contract compiler includes the XML processing instructions; the business wisdom is deployed in the blockchain network Contract; the nodes in the blockchain network obtain business initiation transactions and broadcast them to other nodes; each node in the blockchain network, when executing the business initiation transactions, virtualize through the blockchain Machine, call the business smart contract; through the blockchain virtual machine, according to the XML processing instructions in the business smart contract, trigger the execution of the XML processing logic to perform XML processing operations on the data to be processed. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes XML processing instructions, and the block chain virtual machine is deployed with corresponding XML processing instructions XML processing logic; the instruction set of the smart contract compiler includes the XML processing instructions, the business smart contract compiled by the smart contract compiler includes the contract identifier of the XML processing smart contract, and the XML processing smart contract is pre-deployed in The smart contract in the blockchain network; the XML processing smart contract and the business smart contract are deployed in the blockchain network; the node in the blockchain network obtains business initiation transactions and broadcasts To other nodes; each node in the blockchain network, when executing the business initiation transaction, invokes the business smart contract through the blockchain virtual machine; through the blockchain virtual machine, according to the The XML processing smart contract’s contract identifier in the business smart contract calls the XML processing smart contract; through the blockchain virtual machine, the XML processing instructions in the XML processing smart contract are used to trigger the execution of the XML processing logic , To perform XML processing operations on the data to be processed. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes a transaction hash acquisition instruction, and the block chain virtual machine is deployed with a corresponding transaction hash It is hoped to obtain the transaction hash acquisition logic of the instruction; the instruction set of the smart contract compiler includes the transaction hash acquisition instruction, and the business smart contract compiled by the smart contract compiler includes the transaction hash acquisition instruction; block The business smart contract is deployed in the chain network; the nodes in the block chain network obtain business initiation transactions and broadcast them to other nodes; each node in the block chain network executes the When a business initiates a transaction, the business smart contract is invoked through the blockchain virtual machine; the transaction hash acquisition instruction in the business smart contract is triggered through the blockchain virtual machine to trigger the execution of the transaction hash acquisition logic, To obtain the transaction hash of the transaction initiated by the business. The block chain system provided in this specification includes a block chain network; wherein, the instruction set of the block chain virtual machine includes a transaction hash acquisition instruction, and the block chain virtual machine is deployed with a corresponding transaction hash It is desirable to obtain the transaction hash acquisition logic of the instruction; the instruction set of the smart contract compiler includes the transaction hash acquisition instruction, and the business smart contract compiled by the smart contract compiler includes the contract identification of the transaction hash acquisition smart contract, The transaction hash acquisition smart contract is a smart contract pre-deployed in the blockchain network; the transaction hash acquisition smart contract and the business smart contract are deployed in the blockchain network; The nodes in the blockchain network obtain the business initiation transaction and broadcast it to other nodes; each node in the blockchain network, when executing the business initiation transaction, calls the blockchain virtual machine Business smart contract; through the blockchain virtual machine, the contract identifier of the smart contract is obtained according to the transaction hash in the business smart contract, and the transaction hash is called to obtain the smart contract; through the blockchain virtual machine, according to all The transaction hash obtains the transaction hash obtaining instruction in the smart contract, and triggers the execution of the transaction hash obtaining logic to obtain the transaction hash of the business initiated transaction. Figure 21 shows a schematic structural diagram of a blockchain system provided by an embodiment of this specification. This specification also provides a computer device, which at least includes a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor executes the program to implement the methods of the various embodiments herein and The function of the method after at least two of the embodiments are combined. FIG. 22 shows a more specific hardware structure diagram of a computing device provided by an embodiment of this specification. The device may include: a processor 2210, a memory 2220, an input/output interface 2230, a communication interface 2240, and a bus 2250 . The processor 2210, the memory 2220, the input/output interface 2230, and the communication interface 2240 realize the communication connection between each other in the device through the bus 2250. The processor 2210 may be implemented by a general CPU (Central Processing Unit, central processing unit), a microprocessor, a special application integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc., for Execute related programs to realize the technical solutions provided in the embodiments of this specification. The memory 2220 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 2220 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the related program codes are stored in the memory 2220 and called and executed by the processor 2210. . The input/output interface 2230 is used to connect input/output modules to realize information input and output. The input/output/module can be configured in the device as a component (not shown in the figure), or can be connected to the device to provide corresponding functions. The input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, and so on. The communication interface 2240 is used to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.), or through wireless means (such as mobile network, WIFI, Bluetooth, etc.). The bus 2250 includes a path for transmitting information between various components of the device (such as the processor 2210, the memory 2220, the input/output interface 2230, and the communication interface 2240). It should be noted that although the above device only shows the processor 2210, the memory 2220, the input/output interface 2230, the communication interface 2240, and the bus 2250, in the specific implementation process, the device may also include a device for normal operation. Other required components. In addition, those skilled in the art can understand that the above-mentioned devices may also include only the components necessary to implement the solutions of the embodiments of the present specification, and not necessarily include all the components shown in the figures. The embodiments of this specification also provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the function of the method of each embodiment of this text and the method of the combination of at least two of the embodiments is realized. . Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), and other types of random access memory (RAM) , Read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, read-only CD-ROM (CD-ROM), digital multi-function disc (DVD) or other optical storage, magnetic cassette tape, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves. From the description of the above embodiments, those skilled in the art can clearly understand that the embodiments of this specification can be implemented by means of software plus a necessary universal hardware platform. Based on this understanding, the technical solutions of the embodiments of this specification can be embodied in the form of software products, which can be stored in storage media, such as ROM/RAM, magnetic A disc, an optical disc, etc., include a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in the various embodiments or some parts of the embodiments of this specification. The systems, methods, modules, or units explained in the above embodiments may be implemented by computer chips or entities, or implemented by products with certain functions. A typical implementation device is a computer. The specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control Desktop, tablet, wearable device, or any combination of these devices. The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, as for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to the partial description of the method embodiments. The method embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated. When implementing the solutions of the embodiments of this specification, the functions of the modules may be Implemented in the same one or more software and/or hardware. Some or all of the modules can also be selected according to actual needs to achieve the objectives of the solutions of the embodiments. Those of ordinary skill in the art can understand and implement it without creative work. The above are only specific implementations of the embodiments of this specification. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the embodiments of this specification, several improvements and modifications can be made. These Improvement and retouching should also be regarded as the protection scope of the embodiments of this specification.

S100:步驟 S102:步驟 S104:步驟 S200:步驟 S202:步驟 S204:步驟 S206:步驟 S300:步驟 S302:步驟 S304:步驟 S400:步驟 S402:步驟 S404:步驟 S406:步驟 S600:步驟 S602:步驟 S604:步驟 S700:步驟 S702:步驟 S704:步驟 S706:步驟 S900:步驟 S902:步驟 S904:步驟 S1000:步驟 S1002:步驟 S1004:步驟 S1006:步驟 S1200:步驟 S1202:步驟 S1204:步驟 S1300:步驟 S1302:步驟 S1304:步驟 S1306:步驟 S1500:步驟 S1502:步驟 S1504:步驟 S1600:步驟 S1602:步驟 S1604:步驟 S1606:步驟 S1800:步驟 S1802:步驟 S1804:步驟 S1900:步驟 S1902:步驟 S1904:步驟 S1906:步驟 2210:處理器 2220:記憶體 2230:輸入/輸出介面 2240:通信介面 2250:匯流排S100: steps S102: Step S104: Step S200: steps S202: steps S204: Step S206: Step S300: steps S302: Step S304: Step S400: steps S402: Step S404: Step S406: Step S600: steps S602: steps S604: Step S700: steps S702: Step S704: Step S706: Step S900: steps S902: Step S904: Step S1000: steps S1002: steps S1004: steps S1006: steps S1200: steps S1202: Step S1204: Step S1300: steps S1302: steps S1304: Step S1306: steps S1500: steps S1502: Step S1504: steps S1600: steps S1602: steps S1604: steps S1606: Step S1800: steps S1802: steps S1804: steps S1900: steps S1902: Step S1904: steps S1906: steps 2210: processor 2220: memory 2230: input/output interface 2240: Communication interface 2250: bus

為了更清楚地說明本說明書實施例或現有技術中的技術方案,下面將對實施例或現有技術描述中所需要使用的圖式作簡單地介紹,顯而易見地,下面描述中的圖式僅僅是本說明書實施例中記載的一些實施例,對於本領域普通技術人員來講,還可以根據這些圖式獲得其他的圖式。 圖1是本說明書實施例提供的一種基於區塊鏈智慧合約的編碼方法的流程示意圖; 圖2是本說明書實施例提供的另一種基於區塊鏈智慧合約的編碼方法的流程示意圖; 圖3是本說明書實施例提供的一種基於區塊鏈智慧合約的解碼方法的流程示意圖; 圖4是本說明書實施例提供的另一種基於區塊鏈智慧合約的解碼方法的流程示意圖; 圖5a~b是本說明書實施例提供的BASE64編解碼操作的部署示意圖; 圖6是本說明書實施例提供的一種基於區塊鏈智慧合約的簽名驗證方法的流程示意圖; 圖7是本說明書實施例提供的另一種基於區塊鏈智慧合約的簽名驗證方法的流程示意圖; 圖8a~b是本說明書實施例提供的RSA簽名驗證操作的部署示意圖; 圖9是本說明書實施例提供的一種基於區塊鏈智慧合約的資料解析方法的流程示意圖; 圖10是本說明書實施例提供的一種基於區塊鏈智慧合約的資料解析方法的流程示意圖; 圖11a~b是本說明書實施例提供的JSON解析操作的部署示意圖; 圖12是本說明書實施例提供的一種基於區塊鏈智慧合約的資料解析方法的流程示意圖; 圖13是本說明書實施例提供的一種基於區塊鏈智慧合約的資料解析方法的流程示意圖; 圖14a~b是本說明書實施例提供的解析操作的部署示意圖; 圖15是本說明書實施例提供的一種基於區塊鏈智慧合約的交易哈希獲取方法的流程示意圖; 圖16是本說明書實施例提供的一種基於區塊鏈智慧合約的交易哈希獲取方法的流程示意圖; 圖17a~b是本說明書實施例提供的交易哈希獲取操作的部署示意圖; 圖18是本說明書實施例提供的一種基於區塊鏈智慧合約的轉帳方法的流程示意圖; 圖19是本說明書實施例提供的一種基於區塊鏈智慧合約的交易哈希獲取方法的流程示意圖; 圖20a~b是本說明書實施例提供的轉帳交易的相關校驗操作的部署示意圖; 圖21示出了本說明書實施例所提供的一種區塊鏈系統的結構示意圖; 圖22是用於配置本說明書實施例方法的一種電腦設備的結構示意圖。In order to more clearly explain the technical solutions in the embodiments of this specification or the prior art, the following will briefly introduce the drawings that need to be used in the embodiments or the description of the prior art. Obviously, the drawings in the following description are merely the present For some of the embodiments described in the embodiments of the specification, for those of ordinary skill in the art, other drawings may be obtained based on these drawings. FIG. 1 is a schematic flowchart of a coding method based on a blockchain smart contract provided by an embodiment of this specification; 2 is a schematic flowchart of another coding method based on a blockchain smart contract provided by an embodiment of this specification; FIG. 3 is a schematic flowchart of a decoding method based on a blockchain smart contract provided by an embodiment of this specification; 4 is a schematic flowchart of another decoding method based on a blockchain smart contract provided by an embodiment of this specification; Figures 5a~b are schematic diagrams of deployment of BASE64 encoding and decoding operations provided by embodiments of this specification; FIG. 6 is a schematic flowchart of a signature verification method based on a blockchain smart contract provided by an embodiment of this specification; FIG. 7 is a schematic flowchart of another signature verification method based on a blockchain smart contract provided by an embodiment of this specification; Figures 8a~b are schematic diagrams of deployment of RSA signature verification operations provided by embodiments of this specification; FIG. 9 is a schematic flowchart of a data analysis method based on a blockchain smart contract provided by an embodiment of this specification; FIG. 10 is a schematic flowchart of a data analysis method based on a blockchain smart contract provided by an embodiment of this specification; Figures 11a~b are schematic diagrams of deployment of JSON parsing operations provided by embodiments of this specification; FIG. 12 is a schematic flowchart of a data analysis method based on a blockchain smart contract provided by an embodiment of this specification; FIG. 13 is a schematic flowchart of a data analysis method based on a blockchain smart contract provided by an embodiment of this specification; Figures 14a~b are schematic diagrams of the deployment of analysis operations provided by embodiments of this specification; FIG. 15 is a schematic flowchart of a method for obtaining transaction hash based on a blockchain smart contract according to an embodiment of this specification; FIG. 16 is a schematic flowchart of a method for obtaining transaction hash based on a blockchain smart contract according to an embodiment of this specification; Figures 17a~b are schematic diagrams of deployment of transaction hash obtaining operations provided by embodiments of this specification; FIG. 18 is a schematic flowchart of a transfer method based on a blockchain smart contract provided by an embodiment of this specification; FIG. 19 is a schematic flowchart of a method for obtaining transaction hash based on a blockchain smart contract according to an embodiment of this specification; 20a~b are deployment diagrams of related verification operations for transfer transactions provided in the embodiments of this specification; FIG. 21 shows a schematic structural diagram of a blockchain system provided by an embodiment of this specification; Fig. 22 is a schematic structural diagram of a computer device used to configure the method of the embodiment of this specification.

Claims (20)

一種基於區塊鏈智慧合約的轉帳方法,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的;所述轉帳方法包括:所述區塊鏈網路中的節點透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產;針對所述區塊鏈網路中的每個節點,該節點在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約並根據所述業務智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則該節點透過區塊鏈虛擬機,執行 所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係,其中,針對任一資產,該資產的資料結構還包括:表徵該資產已花銷或未花銷的第一狀態參數;所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的第一狀態參數相關邏輯,以便針對所述轉帳交易中的每個花銷資產,根據該花銷資產包括的第一狀態參數,校驗該花銷資產是否未花銷,並且,若全部校驗結果皆為是,則對該花銷資產包括的第一狀態參數進行修改;其中,修改後的該第一狀態參數表徵該花銷資產已花銷。 A transfer method based on a blockchain smart contract. The instruction set of the blockchain virtual machine includes access verification instructions, and the blockchain virtual machine is deployed with access verification logic corresponding to the access verification instructions; wisdom; The instruction set of the contract compiler includes the entry and exit verification instructions, and the business smart contract compiled by the smart contract compiler includes the entry and exit verification instructions; the business smart contract is deployed in the blockchain network, so The business smart contract corresponds to a user asset table. The user asset table is used to record the assets corresponding to each external account. For any asset, the asset is the data containing the encrypted amount, and the encrypted amount is the amount of the asset. Obtained after encryption; the transfer method includes: a node in the blockchain network obtains a transfer transaction through a transfer external account and broadcasts it to other nodes; the transfer transaction includes transfer assets, change assets, and at least one expense Assets; for each node in the blockchain network, when the node executes the transfer transaction, it calls the business smart contract through the blockchain virtual machine and enters and exits the school according to the business smart contract The verification instruction triggers the execution of the access verification logic, so that the homomorphic encryption algorithm is used to verify whether the sum of the amount of the transfer asset and the amount of the change asset is equal to the sum of the amount of each spent asset; if If the verification result is yes, the node will execute the blockchain virtual machine The user asset table modification logic in the business smart contract is used to remove the corresponding relationship between the transfer external account and each spent asset, establish the corresponding relationship between the transfer external account and the change asset, and establish the external account collection The corresponding relationship between the account and the transfer asset, wherein, for any asset, the data structure of the asset further includes: a first state parameter that characterizes whether the asset has been spent or not; the method further includes: Each node in the blockchain network uses the blockchain virtual machine to execute the logic related to the first state parameter in the business smart contract, so as to target each asset spent in the transfer transaction, according to The first state parameter included in the cost asset is verified whether the cost asset is unspent, and if all the verification results are yes, the first state parameter included in the cost asset is modified; wherein, The modified first state parameter indicates that the spent asset has been spent. 如申請專利範圍第1項所述的方法,區塊鏈虛擬機的指令集中還包括金額校驗指令,並且,區塊鏈虛擬機中還部署有對應於所述金額校驗指令的金額校驗邏輯;所述智慧合約編譯器的指令集中還包括所述金額校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中還包含所述金額校驗指令;所述轉帳交易還包括:用於實現零知識證明的證明相關資料; 所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的金額校驗指令,觸發執行所述金額校驗邏輯,以便根據所述證明相關資料,校驗所述轉帳資產的金額與所述找零資產的金額是否皆落入指定數值範圍。 As in the method described in item 1 of the scope of patent application, the instruction set of the blockchain virtual machine also includes an amount verification instruction, and the blockchain virtual machine also has an amount verification corresponding to the amount verification instruction. Logic; the instruction set of the smart contract compiler also includes the amount verification instruction, and the business smart contract compiled by the smart contract compiler also includes the amount verification instruction; the transfer transaction also includes: Proof-related materials for achieving zero-knowledge proof; The method further includes: for each node in the blockchain network, the node triggers the execution of the amount verification logic through the blockchain virtual machine according to the amount verification instruction in the business smart contract , In order to verify whether the amount of the transfer asset and the amount of the change asset both fall within the specified numerical range based on the relevant certification data. 如申請專利範圍第2項所述的方法,所述指定數值範圍為,(0,264]。 For the method described in item 2 of the scope of the patent application, the specified numerical range is (0, 2 64 ]. 如申請專利範圍第1項所述的方法,所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的花銷資產校驗邏輯,以便根據所述用戶資產表,校驗所述轉帳外部帳戶對應的資產中是否包括各花銷資產。 As the method described in item 1 of the scope of patent application, the method further includes: for each node in the blockchain network, the node executes the flower in the business smart contract through a blockchain virtual machine. The cancellation asset verification logic is used to verify whether the assets corresponding to the transfer external account include each spent asset according to the user asset table. 如申請專利範圍第1項所述的方法,針對任一資產,該資產的資料結構還包括:表徵該資產存在或不存在的第二狀態參數;所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的第二狀態參數相關邏輯,以便針對所述轉帳交易中的每個花銷資產,根據該 花銷資產包括的第二狀態參數,校驗該花銷資產是否存在。 For example, the method described in item 1 of the scope of patent application, for any asset, the data structure of the asset further includes: a second state parameter that characterizes the existence or non-existence of the asset; the method also includes: targeting the blockchain Each node in the network, the node executes the logic related to the second state parameter in the business smart contract through the blockchain virtual machine, so that for each spent asset in the transfer transaction, according to the The second state parameter included in the expense asset is to verify whether the expense asset exists. 如申請專利範圍第1項所述的方法,所述業務智慧合約不是所述區塊鏈網路中唯一的智慧合約;所述轉帳交易還包括:所述業務智慧合約的合約標識;調用所述業務智慧合約,具體包括:根據所述轉帳交易中包括的合約標識,調用對應的業務智慧合約。 For the method described in item 1 of the scope of patent application, the business smart contract is not the only smart contract in the blockchain network; the transfer transaction also includes: the contract identifier of the business smart contract; calling the The business smart contract specifically includes: invoking the corresponding business smart contract according to the contract identifier included in the transfer transaction. 如申請專利範圍第1~6項中任一項所述的方法,若校驗結果為是,則該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,具體包括:若全部校驗結果皆為是,則該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯。 For example, if the method described in any one of items 1 to 6 in the scope of the patent application, if the verification result is yes, the node will execute the user asset table modification logic in the business smart contract through the blockchain virtual machine. Including: if all the verification results are yes, the node executes the user asset table modification logic in the business smart contract through the blockchain virtual machine. 一種區塊鏈系統,包括區塊鏈網路;其中,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶 資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的;所述區塊鏈網路中的節點,透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產;所述區塊鏈網路中的每個節點,在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約並根據所述業務智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係其中,針對任一資產,該資產的資料結構還包括:表徵該資產已花銷或未花銷的第一狀態參數;所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的第一狀態參數相關邏輯,以便針對所述轉帳交易中的每個花銷資產,根據該花銷資產包括的第一狀態參數,校驗該花銷資產是否未花銷,並且,若全部校驗結果皆為是,則對該花銷資產包括 的第一狀態參數進行修改;其中,修改後的該第一狀態參數表徵該花銷資產已花銷。 A block chain system includes a block chain network; wherein the instruction set of the block chain virtual machine includes an access check instruction, and the block chain virtual machine is equipped with an access check instruction corresponding to the access check instruction. Verification logic; the instruction set of the smart contract compiler includes the entry and exit verification instructions, and the business smart contract compiled by the smart contract compiler includes the entry and exit verification instructions; the business is deployed in the blockchain network A smart contract, the business smart contract corresponds to a user asset table, and the user The asset table is used to record the assets corresponding to each external account. For any asset, the asset is the data containing the encrypted amount, and the encrypted amount is obtained by encrypting the amount of the asset; in the blockchain network The nodes in the blockchain network obtain transfer transactions through the transfer of external accounts and broadcast them to other nodes; the transfer transactions include transfer assets, change assets, and at least one expense asset; each node in the blockchain network executes all In the transfer transaction, the business smart contract is called through the blockchain virtual machine, and the inbound and outbound verification logic is triggered according to the access verification instruction in the business smart contract, so that the homomorphic encryption algorithm is used for verification. Verify whether the sum of the amount of the transfer asset and the amount of the change asset is equal to the sum of the amount of each spent asset; if the verification result is yes, execute the business smart contract through the blockchain virtual machine The user’s asset table modification logic in order to remove the corresponding relationship between the transfer external account and each spent asset, establish the corresponding relationship between the transfer external account and the change asset, and establish the collection external account and the transfer asset Wherein, for any asset, the data structure of the asset further includes: a first state parameter that characterizes whether the asset has been spent or not; the method further includes: for any asset in the blockchain network Each node, through the blockchain virtual machine, executes the logic related to the first state parameter in the business smart contract, so that for each expense asset in the transfer transaction, according to the first state parameter included in the expense asset A status parameter to verify whether the spent asset has not been spent, and if all the verification results are yes, then the spent asset includes The first state parameter of the modified; wherein, the modified first state parameter indicates that the spent asset has been spent. 一種區塊鏈虛擬機,用於實現申請專利範圍第1~7項中任一項所述的方法;其中,所述區塊鏈虛擬機的指令集中包括出入校驗指令,並且,所述區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;所述出入校驗邏輯包括:針對任一轉帳交易,採用同態加密演算法,校驗該轉帳交易指定的轉帳資產的金額與該轉帳交易指定的找零資產的金額之和,是否等於該轉帳交易指定的各花銷資產的金額之和。 A block chain virtual machine is used to implement the method described in any one of items 1 to 7 in the scope of patent application; wherein the instruction set of the block chain virtual machine includes an access check instruction, and the area The block chain virtual machine is deployed with an access verification logic corresponding to the access verification instruction; the access verification logic includes: for any transfer transaction, using a homomorphic encryption algorithm to verify the transfer specified by the transfer transaction Whether the sum of the amount of assets and the amount of change assets specified in the transfer transaction is equal to the sum of the amounts of all spent assets specified in the transfer transaction. 如申請專利範圍第9項所述的區塊鏈虛擬機,所述區塊鏈虛擬機的指令集中還包括金額校驗指令,並且,所述區塊鏈虛擬機中還部署有對應於所述金額校驗指令的金額校驗邏輯;所述金額校驗邏輯包括:針對任一轉帳交易,根據該轉帳交易指定的用於實現零知識證明的證明相關資料,校驗該轉帳交易指定的轉帳資產的金額與該轉帳交易指定的找零資產的金額是否皆落入指定數值範圍。 For the blockchain virtual machine described in item 9 of the scope of patent application, the instruction set of the blockchain virtual machine also includes an amount verification instruction, and the blockchain virtual machine is also deployed corresponding to the The amount verification logic of the amount verification instruction; the amount verification logic includes: for any transfer transaction, verify the transfer asset designated by the transfer transaction according to the proof-related data specified by the transfer transaction for realizing zero-knowledge proof Whether the amount of and the amount of the change asset specified in the transfer transaction fall within the specified numerical range. 如申請專利範圍第9項所述的區塊鏈虛擬機,所述區塊鏈虛擬機的指令集中還包括至少一個以太坊指令,以太坊指令是以太坊虛擬機的指令集中的指令;針對所述區塊鏈虛擬機的指令集中包括的每個以太坊指令,所述區塊鏈虛擬機中部署有對應於該以太坊指令的相關邏輯。 For the blockchain virtual machine described in item 9 of the scope of patent application, the instruction set of the blockchain virtual machine also includes at least one Ethereum instruction, and the Ethereum instruction is the instruction in the instruction set of the Ethereum virtual machine; For each Ethereum instruction included in the instruction set of the blockchain virtual machine, relevant logic corresponding to the Ethereum instruction is deployed in the blockchain virtual machine. 一種智慧合約編譯器,用於實現申請專利範圍第1~7項中任一項所述的方法;其中,所述智慧合約編譯器的指令集中包括出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含所述出入校驗指令。 A smart contract compiler for implementing the method described in any one of items 1 to 7 in the scope of patent application; wherein, the instruction set of the smart contract compiler includes access check instructions, and the smart contract compiler The compiled business smart contract includes the access verification instruction. 如申請專利範圍第12項所述的智慧合約編譯器,所述智慧合約編譯器的指令集中還包括所述金額校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中還包含所述金額校驗指令。 For example, the smart contract compiler described in item 12 of the scope of patent application, the instruction set of the smart contract compiler further includes the amount verification instruction, and the business smart contract compiled by the smart contract compiler also includes the Amount verification instruction. 如申請專利範圍第12項所述的智慧合約編譯器,所述智慧合約編譯器的指令集中還包括至少一個以太坊指令,以太坊指令是以太坊虛擬機的指令集中的指令。 For example, the smart contract compiler described in item 12 of the scope of patent application, the instruction set of the smart contract compiler further includes at least one Ethereum instruction, and the Ethereum instruction is an instruction in the instruction set of the Ethereum virtual machine. 一種基於區塊鏈智慧合約的轉帳方法,區塊鏈虛擬機 的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的;所述轉帳方法包括:所述區塊鏈網路中的節點透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產;針對所述區塊鏈網路中的每個節點,該節點在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約,並根據所述業務智慧合約中的所述出入校驗智慧合約的合約標識,調用所述出入校驗智慧合約;該節點根據所述出入校驗智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則該節點透過區塊鏈虛擬機,執行 所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係其中,針對任一資產,該資產的資料結構還包括:表徵該資產已花銷或未花銷的第一狀態參數;所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的第一狀態參數相關邏輯,以便針對所述轉帳交易中的每個花銷資產,根據該花銷資產包括的第一狀態參數,校驗該花銷資產是否未花銷,並且,若全部校驗結果皆為是,則對該花銷資產包括的第一狀態參數進行修改;其中,修改後的該第一狀態參數表徵該花銷資產已花銷。 A transfer method based on blockchain smart contract, blockchain virtual machine The instruction set includes access verification instructions, and the blockchain virtual machine is equipped with access verification logic corresponding to the access verification instructions; the instruction set of the smart contract compiler includes the access verification instructions. The business smart contract compiled by the smart contract compiler includes the contract identifier of the access verification smart contract, and the access verification smart contract is a smart contract pre-deployed in the blockchain network; in the blockchain network The business smart contract is deployed, and the business smart contract corresponds to a user asset table. The user asset table is used to record the asset corresponding to each external account. For any asset, the asset is data containing the encrypted amount. The encrypted amount is obtained by encrypting the amount of the asset; the transfer method includes: the node in the blockchain network obtains the transfer transaction through the transfer of an external account and broadcasts it to other nodes; the transfer transaction includes the transfer asset , Change assets and at least one expense asset; for each node in the blockchain network, when the node executes the transfer transaction, it calls the business smart contract through the blockchain virtual machine, and Invoke the access verification smart contract according to the contract identifier of the access verification smart contract in the business smart contract; the node triggers the execution of the access verification according to the access verification instruction in the access verification smart contract Verification logic to use a homomorphic encryption algorithm to verify whether the sum of the amount of the transfer asset and the amount of the change asset is equal to the sum of the amount of each spent asset; if the verification result is yes, then this The node executes through the blockchain virtual machine The user asset table modification logic in the business smart contract is used to remove the corresponding relationship between the transfer external account and each spent asset, establish the corresponding relationship between the transfer external account and the change asset, and establish the external account collection The corresponding relationship between the account and the transfer asset. For any asset, the data structure of the asset further includes: a first state parameter that characterizes whether the asset has been spent or not; the method further includes: targeting the area Each node in the block chain network executes the logic related to the first state parameter in the business smart contract through the block chain virtual machine, so that for each spent asset in the transfer transaction, according to the The first state parameter included in the spent asset is verified whether the spent asset has not been spent, and if all the verification results are yes, the first state parameter included in the spent asset is modified; wherein, modify The latter first state parameter indicates that the spent asset has been spent. 如申請專利範圍第15項所述的方法,區塊鏈虛擬機的指令集中還包括金額校驗指令,並且,區塊鏈虛擬機中還部署有對應於所述金額校驗指令的金額校驗邏輯;所述智慧合約編譯器的指令集中還包括所述金額校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中還包含金額校驗智慧合約的合約標識,所述金額校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約;所述轉帳交易還包括:用於實現零知識證明的證明相 關資料;所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,根據所述業務智慧合約中的所述金額校驗智慧合約的合約標識,調用所述金額校驗智慧合約;該節點根據所述金額校驗智慧合約中的金額校驗指令,觸發執行所述金額校驗邏輯,以便根據所述證明相關資料,校驗所述轉帳資產的金額與所述找零資產的金額是否皆落入指定數值範圍。 For the method described in item 15 of the scope of patent application, the instruction set of the blockchain virtual machine also includes an amount verification instruction, and the blockchain virtual machine also has an amount verification corresponding to the amount verification instruction. Logic; the instruction set of the smart contract compiler also includes the amount verification instruction, the business smart contract compiled by the smart contract compiler also includes the contract identifier of the amount verification smart contract, the amount verification wisdom The contract is a smart contract pre-deployed in the blockchain network; the transfer transaction also includes: a proof phase for realizing zero-knowledge proof Related data; the method further includes: for each node in the blockchain network, the node verifies the contract identifier of the smart contract according to the amount in the business smart contract through the blockchain virtual machine , Call the amount verification smart contract; the node verifies the amount verification instruction in the smart contract according to the amount verification, and triggers the execution of the amount verification logic, so as to verify the transfer asset based on the proof-related information Whether the amount of and the amount of the said change asset fall within the specified numerical range. 一種區塊鏈系統,包括區塊鏈網路;其中,區塊鏈虛擬機的指令集中包括出入校驗指令,並且,區塊鏈虛擬機中部署有對應於所述出入校驗指令的出入校驗邏輯;智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約;區塊鏈網路中部署有所述業務智慧合約,所述業務智慧合約對應有用戶資產表,所述用戶資產表用於記錄每個外部帳戶對應的資產,針對任一資產,該資產為包含加密金額的資料,該加密金額是對該資產的金額進行加密後得到的;所述區塊鏈網路中的節點,透過轉帳外部帳戶獲得轉帳交易並廣播給其他節點;所述轉帳交易包括轉帳資產、找零資產和至少一個花銷資產; 所述區塊鏈網路中的每個節點,在執行所述轉帳交易時,透過區塊鏈虛擬機,調用所述業務智慧合約,並根據所述業務智慧合約中的所述出入校驗智慧合約的合約標識,調用所述出入校驗智慧合約;根據所述出入校驗智慧合約中的出入校驗指令,觸發執行所述出入校驗邏輯,以便採用同態加密演算法,校驗所述轉帳資產的金額與所述找零資產的金額之和是否等於各花銷資產的金額之和;若校驗結果為是,則透過區塊鏈虛擬機,執行所述業務智慧合約中的用戶資產表修改邏輯,以便解除所述轉帳外部帳戶與各花銷資產的對應關係,建立所述轉帳外部帳戶與所述找零資產的對應關係,並建立收帳外部帳戶與所述轉帳資產的對應關係,其中,針對任一資產,該資產的資料結構還包括:表徵該資產已花銷或未花銷的第一狀態參數;所述方法還包括:針對所述區塊鏈網路中的每個節點,該節點透過區塊鏈虛擬機,執行所述業務智慧合約中的第一狀態參數相關邏輯,以便針對所述轉帳交易中的每個花銷資產,根據該花銷資產包括的第一狀態參數,校驗該花銷資產是否未花銷,並且,若全部校驗結果皆為是,則對該花銷資產包括的第一狀態參數進行修改;其中,修改後的該第一狀態參數表徵該花銷資產已花銷。 A block chain system includes a block chain network; wherein the instruction set of the block chain virtual machine includes an access check instruction, and the block chain virtual machine is equipped with an access check instruction corresponding to the access check instruction. Verification logic; the instruction set of the smart contract compiler includes the entry and exit verification instructions, and the business smart contract compiled by the smart contract compiler includes the contract identification of the entry and exit verification smart contract, and the entry and exit verification smart contract is a pre- The smart contract deployed in the blockchain network; the business smart contract is deployed in the blockchain network, and the business smart contract corresponds to a user asset table, and the user asset table is used to record each external The asset corresponding to the account, for any asset, the asset is the data containing the encrypted amount, and the encrypted amount is obtained by encrypting the amount of the asset; the node in the blockchain network is obtained by transferring an external account The transfer transaction is broadcast to other nodes; the transfer transaction includes transfer assets, change assets and at least one expense asset; When executing the transfer transaction, each node in the blockchain network invokes the business smart contract through the blockchain virtual machine, and verifies the wisdom based on the access and exit in the business smart contract The contract identifier of the contract calls the access verification smart contract; according to the access verification instruction in the access verification smart contract, the execution of the access verification logic is triggered, so that the homomorphic encryption algorithm is used to verify the Whether the sum of the amount of transferred assets and the amount of the change assets is equal to the sum of the amount of each spent asset; if the verification result is yes, the user assets in the business smart contract will be executed through the blockchain virtual machine Table modification logic to remove the correspondence between the transfer external account and each expense asset, establish the correspondence between the transfer external account and the change asset, and establish the correspondence between the collection external account and the transfer asset , Wherein, for any asset, the data structure of the asset further includes: a first state parameter that characterizes whether the asset has been spent or not; the method further includes: for each of the blockchain networks A node that executes the logic related to the first state parameter in the business smart contract through the blockchain virtual machine, so as to, for each expense asset in the transfer transaction, according to the first state included in the expense asset Parameter, verify whether the spent asset is not spent, and if all the verification results are yes, then modify the first state parameter included in the spent asset; wherein the modified first state parameter represents The spending asset has been spent. 一種智慧合約編譯器,用於實現申請專利範圍第15或16項所述的方法;其中,智慧合約編譯器的指令集中包括所述出入校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中包含出入校驗智慧合約的合約標識,所述出入校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 A smart contract compiler for implementing the method described in item 15 or 16 of the scope of patent application; wherein the instruction set of the smart contract compiler includes the access check instruction, and the business intelligence compiled by the smart contract compiler The contract includes a contract identifier of an access verification smart contract, and the access verification smart contract is a smart contract pre-deployed in the blockchain network. 如申請專利範圍第18項所述的智慧合約編譯器,所述智慧合約編譯器的指令集中還包括所述金額校驗指令,經所述智慧合約編譯器編譯的業務智慧合約中還包含金額校驗智慧合約的合約標識,所述金額校驗智慧合約是預先部署於所述區塊鏈網路中的智慧合約。 For example, the smart contract compiler described in item 18 of the scope of patent application, the instruction set of the smart contract compiler further includes the amount verification instruction, and the business smart contract compiled by the smart contract compiler also includes the amount verification instruction. The contract identifier of the verification smart contract, and the amount verification smart contract is a smart contract pre-deployed in the blockchain network. 一種電腦設備,包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,其中,所述處理器執行所述程式時實現如申請專利範圍第1~7,15,16項中任一項所述的方法。 A computer device includes a memory, a processor, and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program when the program is executed as the first to 7, 15 of the scope of patent application, The method of any one of 16 items.
TW108134610A 2018-12-12 2019-09-25 Transfer method and system based on blockchain smart contract TWI719651B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811517585.9A CN110009321B (en) 2018-12-12 2018-12-12 Transfer method and system based on block chain intelligent contract
CN201811517585.9 2018-12-12

Publications (2)

Publication Number Publication Date
TW202027530A TW202027530A (en) 2020-07-16
TWI719651B true TWI719651B (en) 2021-02-21

Family

ID=67165144

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108134610A TWI719651B (en) 2018-12-12 2019-09-25 Transfer method and system based on blockchain smart contract

Country Status (3)

Country Link
CN (1) CN110009321B (en)
TW (1) TWI719651B (en)
WO (1) WO2020119393A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110009321B (en) * 2018-12-12 2020-08-11 阿里巴巴集团控股有限公司 Transfer method and system based on block chain intelligent contract
CN110597916B (en) * 2019-09-21 2021-03-26 腾讯科技(深圳)有限公司 Data processing method and device based on block chain, storage medium and terminal
CN110992021A (en) * 2019-11-19 2020-04-10 支付宝(杭州)信息技术有限公司 Intelligent contract-based fund management method, device and equipment
CN111381938B (en) * 2020-05-29 2020-09-25 支付宝(杭州)信息技术有限公司 Method and system for executing intelligent contracts in block chain based on basic instruction set
CN111835929B (en) * 2020-07-14 2022-02-25 中国联合网络通信集团有限公司 Telephone charge transaction method and system based on block chain
CN111800252A (en) * 2020-07-22 2020-10-20 深圳壹账通智能科技有限公司 Information auditing method and device based on block chain and computer equipment
CN111738724B (en) * 2020-07-31 2021-07-23 支付宝(杭州)信息技术有限公司 Cross-border resource transfer authenticity auditing method and device, and electronic equipment
CN112037062B (en) * 2020-08-31 2023-08-25 成都质数斯达克科技有限公司 Transaction consensus method, device, electronic equipment and readable storage medium
CN114553515A (en) * 2022-02-17 2022-05-27 支付宝(杭州)信息技术有限公司 Block chain based NFT asset inspection method, service processing method and hardware

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664650A (en) * 2018-05-17 2018-10-16 百度在线网络技术(北京)有限公司 A kind of transaction methods, device, equipment and the storage medium of block chain network
CN108694589A (en) * 2018-05-08 2018-10-23 杭州佑他科技有限公司 A kind of asset monitoring method based on block chain
CN108711105A (en) * 2018-05-16 2018-10-26 四川吉鼎科技有限公司 A kind of Secure Transaction verification method and system based on block chain

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103279358B (en) * 2013-06-08 2016-04-27 北京首钢自动化信息技术有限公司 A kind of explanation type Service Component dynamic fixing method of Industry-oriented application
US10521775B2 (en) * 2016-04-18 2019-12-31 R3 Ltd. Secure processing of electronic transactions by a decentralized, distributed ledger system
US20180197155A1 (en) * 2016-12-12 2018-07-12 Topl, Llc Method and Apparatus for Processing Mobile Payment Using Blockchain Techniques
CN107678865A (en) * 2017-09-20 2018-02-09 中国银行股份有限公司 The verification method and system of block chain based on transaction packet
CN107833060B (en) * 2017-11-13 2020-12-25 中国银行股份有限公司 Verification method and system for intelligent contract transaction in block chain
CN108282459B (en) * 2017-12-18 2020-12-15 中国银联股份有限公司 Data transmission method and system based on intelligent contract
CN108764875B (en) * 2018-05-17 2021-07-06 深圳前海微众银行股份有限公司 Block chain transfer method, device, system and computer readable storage medium
CN108694575A (en) * 2018-06-13 2018-10-23 深圳前海微众银行股份有限公司 Verification method of transferring accounts, device and storage medium based on block chain
CN110009321B (en) * 2018-12-12 2020-08-11 阿里巴巴集团控股有限公司 Transfer method and system based on block chain intelligent contract

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108694589A (en) * 2018-05-08 2018-10-23 杭州佑他科技有限公司 A kind of asset monitoring method based on block chain
CN108711105A (en) * 2018-05-16 2018-10-26 四川吉鼎科技有限公司 A kind of Secure Transaction verification method and system based on block chain
CN108664650A (en) * 2018-05-17 2018-10-16 百度在线网络技术(北京)有限公司 A kind of transaction methods, device, equipment and the storage medium of block chain network

Also Published As

Publication number Publication date
TW202027530A (en) 2020-07-16
WO2020119393A1 (en) 2020-06-18
CN110009321B (en) 2020-08-11
CN110009321A (en) 2019-07-12

Similar Documents

Publication Publication Date Title
TWI719651B (en) Transfer method and system based on blockchain smart contract
TWI699718B (en) Data processing method based on block chain smart contract, block chain system and smart contract compiler and computer equipment
TWI748244B (en) Signature verification method and system based on blockchain smart contract
TWI716116B (en) Transaction hash acquisition method and system based on blockchain smart contract
CN109933404B (en) Encoding and decoding method and system based on block chain intelligent contract
CN111382168B (en) Node group creating method and node group-based transaction method in alliance chain network
TWI741373B (en) Data processing method and system based on blockchain smart contract
CN111047443B (en) User scoring method and device, electronic equipment and computer readable storage medium
CN113221165A (en) User element authentication method and device based on block chain
CN114331447B (en) Cross-link message submitting method and device
CN114398082A (en) Compatible operation method and device for frame type block chain application