WO2022205959A1 - 在区块链中发送交易和执行交易的方法和装置 - Google Patents

在区块链中发送交易和执行交易的方法和装置 Download PDF

Info

Publication number
WO2022205959A1
WO2022205959A1 PCT/CN2021/133037 CN2021133037W WO2022205959A1 WO 2022205959 A1 WO2022205959 A1 WO 2022205959A1 CN 2021133037 W CN2021133037 W CN 2021133037W WO 2022205959 A1 WO2022205959 A1 WO 2022205959A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
access node
digital signature
account
blockchain
Prior art date
Application number
PCT/CN2021/133037
Other languages
English (en)
French (fr)
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 WO2022205959A1 publication Critical patent/WO2022205959A1/zh

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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • 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/3827Use of message hashing
    • 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

Definitions

  • the embodiments of this specification relate to the field of blockchain technology, and more particularly, to a method and device for sending transactions in a blockchain, and a method and device for executing transactions in the blockchain.
  • each external account has a pair of public and private keys, where the private key is used for digital signatures and the public key is used for signature verification.
  • the data table of all the accounts in the blockchain is maintained in the form of a state tree in the local database of the node.
  • the state tree is the mapping between the account address and the account content, and the account content includes: Balance, account key information, etc.
  • the user can obtain the balance of the counterparty, key information of the counterparty, etc. by querying the state tree.
  • the blockchain is, for example, an asset platform, and the accounts in the blockchain are used to record the digital assets of users and the circulation of digital assets.
  • asset platforms need to fulfill relevant regulatory rules, such as customer understanding (kyc), anti-money laundering and other regulatory rules. Therefore, asset platforms based on blockchain also need to meet regulatory requirements.
  • the centralized access system is used for supervision, and users of the blockchain asset platform need to select a centralized service point for access. In some schemes, users are also required to custody assets.
  • the embodiments of this specification aim to provide a more efficient solution for sending and executing transactions in the blockchain, so as to solve the deficiencies in the prior art.
  • one aspect of this specification provides a method for sending a transaction in a blockchain
  • the blockchain includes a first access node
  • the method is executed by the first access node
  • the a first access node is connected to a first client of a first user
  • the method includes: receiving a first transaction and its first digital signature from the first client, the first digital signature being the first User's digital signature; verify the first transaction; in the case of passing the verification of the first transaction, generate a second digital signature of the first transaction;
  • the node sends the first transaction, the first digital signature, and the second digital signature.
  • the first transaction is a transaction for creating an account of the first user, wherein the first transaction includes an identifier of the first access node.
  • the identifier of the first access node is the public key of the first access node or the account of the first access node.
  • the blockchain further includes a second access node
  • the first transaction is a transaction for modifying the access node of the first client
  • the first transaction includes all the identifier of the second access node
  • Another aspect of this specification provides a method for executing a transaction in a blockchain
  • the blockchain includes a first access node, the first access node is connected to a first client of a first user, so The method is executed by any node in the blockchain, and includes: obtaining a first transaction, a first digital signature and a second digital signature of the first transaction, wherein the first transaction is executed by the first transaction.
  • sent by the client the first digital signature is the digital signature of the first user
  • the second digital signature is the digital signature of the first access node; the first digital signature and the second digital signature are The digital signatures are verified respectively; in the case of passing the verification, the first transaction is executed.
  • the first transaction is a transaction for creating an account of the first user, wherein the first transaction includes an identifier of the first access node.
  • verifying the first digital signature and the second digital signature respectively includes, based on the identifier of the first access node, acquiring the public key of the first access node, and using The public key of the first access node verifies the second digital signature.
  • the first client corresponds to the first account of the first user
  • executing the first transaction includes, in the case of passing the verification, executing all
  • the first transaction is performed to create data of the first account in a local account database, wherein the data of the first account includes the identifier of the first access node.
  • the first client terminal corresponds to the first account of the first user
  • the local account database includes data of the first account
  • the data of the first account includes The identity of the first access node
  • verifying the first digital signature and the second digital signature respectively includes reading the first access node's data from the data of the first account. identification, obtaining the public key of the first access node based on the identification of the first access node, and verifying the second digital signature based on the public key of the first access node.
  • the first client corresponds to the first account of the first user
  • the blockchain further includes a second access node
  • the first transaction is to modify the first transaction.
  • a transaction of a client's access node the first transaction includes the identifier of the second access node, wherein, in the case of passing the verification, executing the first transaction includes, in the case of passing the verification, The first transaction is executed to modify the identity of the first access node in the data of the first account to the identity of the second access node in the local account database.
  • the blockchain includes a first access node, the apparatus is deployed on the first access node, the first access node The node is connected to the first client of the first user, and the apparatus includes: a receiving unit configured to receive, from the first client, a first transaction and its first digital signature, the first digital signature being the a digital signature of the first user; a verification unit, configured to verify the first transaction; a generation unit, configured to generate the first transaction when the verification of the first transaction is passed a second digital signature of a transaction; a sending unit, configured to send the first transaction, the first digital signature, and the second digital signature to other nodes of the blockchain.
  • the blockchain includes a first access node, the first access node is connected to a first client of a first user, so The device is deployed on any node in the blockchain, comprising: an acquisition unit configured to acquire a first transaction, a first digital signature and a second digital signature of the first transaction, wherein the first The transaction is sent by the first client, the first digital signature is the digital signature of the first user, and the second digital signature is the digital signature of the first access node; the verification unit is configured to: The first digital signature and the second digital signature are respectively verified; the execution unit is configured to execute the first transaction when the verification is passed.
  • the verification unit includes a first acquisition subunit configured to acquire the public key of the first access node based on the identifier of the first access node, and the first verification subunit , and is configured to use the public key of the first access node to verify the second digital signature.
  • the first client terminal corresponds to the first account of the first user
  • the execution unit is further configured to, in the case of passing the verification, execute the first transaction to
  • the data of the first account is created in a local account database, wherein the data of the first account includes the identifier of the first access node.
  • the first client terminal corresponds to the first account of the first user
  • the local account database includes data of the first account
  • the data of the first account includes The identifier of the first access node
  • the verification unit includes a reading subunit configured to read the identifier of the first access node from the data of the first account, and the second obtains the identifier of the first access node.
  • a subunit configured to obtain the public key of the first access node based on the identifier of the first access node
  • a second verification subunit configured to, based on the public key of the first access node, The second digital signature is verified.
  • the first client corresponds to the first account of the first user
  • the blockchain further includes a second access node
  • the first transaction is to modify the first transaction.
  • a transaction of a client's access node, the first transaction includes the identifier of the second access node, wherein the execution unit is further configured to, in the case of passing the verification, execute the first transaction,
  • the identifier of the first access node in the data of the first account is modified to the identifier of the second access node in the local account database.
  • Another aspect of the present specification provides a computer-readable storage medium on which a computer program or instruction is stored, and when the computer program or instruction is executed in a computer, causes the computer to execute any one of the above methods.
  • Another aspect of the present specification provides a computing device, including a memory and a processor, where a computer program or instruction is stored in the memory, and the processor implements any one of the above methods when executing the computer program or instruction.
  • the operation of the service access point is stored in the blockchain in the form of the digital signature of the transaction, so that the operation of the service access point can be performed through the blockchain.
  • Supervision, and through this scheme the characteristics of decentralization are maintained, the user's assets are maintained by the user's private key, and the service access point cannot misappropriate the user's assets without authorization, thus providing higher security.
  • FIG. 1 shows a schematic diagram of a blockchain system according to an embodiment of the present specification
  • FIG. 2 shows a sequence diagram of creating an account in a blockchain according to an embodiment of the present specification
  • FIG. 3 schematically shows a form of transaction 1 (Tx1) and its digital signature S1;
  • FIG. 4 schematically shows another form of transaction 1 (Tx1) and its digital signature S1;
  • Figure 5 schematically shows the data of account A1 in the state tree
  • FIG. 6 shows a sequence diagram of a method for modifying an access point of a client according to an embodiment of the present specification
  • FIG. 7 schematically shows a form of transaction 2 (Tx2) and its digital signature S1;
  • FIG 8 schematically shows another form of transaction 2 (Tx2) and its digital signature S1;
  • Figure 9 schematically shows the data of account A1 in the state tree after modification
  • FIG. 10 shows an apparatus 1000 for sending a transaction in a blockchain according to an embodiment of the present specification
  • FIG. 11 shows an apparatus 1100 for performing a transaction in a blockchain according to an embodiment of the present specification.
  • FIG. 1 shows a schematic diagram of a blockchain system according to an embodiment of the present specification.
  • the blockchain system includes a blockchain 11 , and the blockchain 11 is a node network formed by interconnecting a plurality of blockchain nodes.
  • the multiple nodes include multiple service access points, the figure schematically shows the access point E1 and the access point E2, wherein each access point has a node account in the blockchain, and its local storage has data in the blockchain.
  • Each access point is connected to multiple user clients.
  • the figure schematically shows that the access point E1 is connected to the client of user U1 and the client of user U2, and the access point E2 is connected to the client and user of user U3.
  • U4 client connection The user's client also has an account in the blockchain, which reads and writes to the blockchain by connecting to its corresponding access point.
  • the user U1 in order to read and write the blockchain, the user U1 first needs to use the client of the blockchain 11 to generate an account, for example, the account A1 (ie the account address A1), the private key and the public key of the account A1 are generated. User U1 then needs to send transaction 1 for creating an account to any access point in blockchain 11 (eg access point E1 ). After receiving the transaction 1, the access point E1 verifies the transaction 1, generates the digital signature of the transaction 1, and interprets the transaction 1 and its digital signature (including the digital signature of the user U1 and the digital signature of the access point E1). digital signature) to other nodes in the blockchain 11.
  • the access point E1 verifies the transaction 1, generates the digital signature of the transaction 1, and interprets the transaction 1 and its digital signature (including the digital signature of the user U1 and the digital signature of the access point E1). digital signature) to other nodes in the blockchain 11.
  • node P1 When a node in the blockchain (for example, node P1) executes a transaction, it can obtain the identity of the access point E1 from the data of the account A1 in the account database, so as to obtain the public key of the access point E1, and use the access point The public key of E1 verifies the digital signature of the access point E1 of the transaction 2, and executes the transaction 2 after the verification is passed.
  • the user U1 wishes to read the ledger data in the blockchain 11, it reads the ledger data in the access point E1 by connecting to the access point E1.
  • FIG. 2 shows a sequence diagram of creating an account in a blockchain according to an embodiment of the present specification.
  • the sequence diagram is executed by the user U1 device, the access point E1, and the blockchain 11.
  • the device of the user U1 is the client that the user U1 logs in through his account A1.
  • step S202 the user U1 device sends a transaction 1 and its digital signature S1 to the access point E1, wherein the transaction 1 includes the identifier of the access point E1.
  • each access point in the blockchain 11 and its public key are pre-set in the user U1 device, for example, in the form of a system contract, so that the user U1 can select, for example, the access point E1 as the read/write area through the user U1 device.
  • FIG 3 schematically shows a form of transaction 1 (Tx1) and its digital signature S1.
  • transaction 1 is a transaction used to create an account in the blockchain
  • the From field of the transaction is the account address that sends the transaction, that is, account A1
  • the To field is the account address of the access point of the user U1 device, that is, the connection Enter the E1 account.
  • the digital signature S1 is a digital signature signed by the private key of the account A1.
  • the data (Data) field of the transaction 1 includes, for example, "CreatAccount” as a specific identifier, which is used to indicate that the transaction is a transaction for creating an account in the blockchain.
  • a node in the blockchain (such as Node P1) can determine that the account to be created is the transaction sending account of transaction 1, that is, "account A1", and the account A1 accesses the blockchain through the access point corresponding to the transaction receiving account (that is, the access point E1 account).
  • the public key of access point E1 may also be included in the data field of transaction 1 .
  • FIG 4 schematically shows another form of transaction 1 (Tx1) and its digital signature S1.
  • the transaction 1 is, for example, a transaction that invokes a smart contract (contract C1) for creating an account. Therefore, the From field of the transaction 1 is the account A1, and the To field is the account of the contract C1.
  • the contract C1 includes, for example, the CreateAcount() function, and the incoming parameter of the function is the "access point E1 account", which is used to indicate that the account A1 accesses the blockchain through the access point E1.
  • the incoming parameter of the function is not limited to the account of the access point E1, as long as it is an identifier that can uniquely identify the access point E1, for example, the incoming parameter of the function can also be is the public key of access point E1.
  • the user U1 device may include the public key of account A1 in the transaction data in this transaction 1 . In one embodiment, the user U1 device may additionally send its public key to the access point E1 for use in disclosing its public key.
  • the transaction data of transaction 1 may also include other data required to be submitted by the specific platform for creating an account.
  • the blockchain 11 is an asset platform, and the transaction data of transaction 1, for example, also needs to provide the identity of the user U1. evidence, etc. It can be understood that although the asset platform is used as an example for description, the blockchain 11 is not limited to an asset platform, but can be other platforms that need to be supervised.
  • the data for creating an account that users are required to provide may be Include other data without limitation.
  • the digital signature S1 may be a multi-signature, that is, the account A1 has multiple public keys, and the digital signature S1 includes a multi-signature that is signed sequentially by multiple public keys.
  • the account A1 has N public keys, each public key has its own weight, the weight is a value between 1 and 100, in this case, the digital signature S1 may include passing N public keys The multi-signature of the M public key signatures in the key, as long as the sum of the weights of the M public keys is greater than or equal to 100.
  • step S204 the access point E1 verifies the transaction 1.
  • the access point E1 verifies whether the identity certificate of the user U1 is authentic and complies with the asset supervision rules, and verifies whether the digital signature of the transaction 1 is the account through the public key of the account A1 A1's digital signature.
  • step S206 the access point E1 generates the digital signature S2 of the transaction 1 after the verification is passed.
  • the access point E1 encrypts the hash value of the transaction 1 using its account private key, thereby generating the digital signature S2 of the transaction 1 .
  • the digital signature S2 can also be a multi-signature.
  • step S208 the access point E1 sends transaction 1, its digital signature S1 and digital signature S2 to the blockchain 11.
  • Access point E1 can send transaction 1 , digital signature S1 and digital signature S2 to any node of blockchain 11 to diffuse them into blockchain 11 .
  • the transaction 1, the digital signature S1, and the digital signature S2 can be written into three predetermined parts of a file similarly to FIG. 3, so that they can be read separately.
  • the blockchain 11 verifies the digital signature before executing transaction 1.
  • the nodes determined by the consensus execute transaction 1, package transaction 1 into block 1, for example, and block the block. 1 is sent to each other node. After receiving block 1, other nodes will also execute transaction 1 in it. That is, every node in blockchain 11 gets transaction 1 and executes transaction 1.
  • the node P1 in the blockchain 11 is going to execute the transaction 1. Before executing the transaction 1, the node P1 needs to verify the digital signature S1 and the digital signature S2 of the transaction 1 respectively.
  • the node P1 In order to verify the digital signature S1 and the digital signature S2, the node P1 first obtains the public key of the account A1 and the public key of the access point E1.
  • the transaction data of transaction 1 may include the public key of account A1 and the public key of access point E1, so that node P1 can obtain the public key of account A1 and the public key of access point E1 from transaction 1.
  • the node P1 obtains the public keys of each account in advance, including the public key of the account A1 and the public key of the access point E1, and the transaction data of the transaction 1 includes the accounts of the account A1 and the access point E1, so that the node P1 can Based on the account A1 and the access point E1 account, its public key is obtained locally.
  • the node P1 After acquiring the public key of the account A1 and the public key of the access point E1, the node P1 can verify the digital signature S1 and the digital signature S2. Specifically, in node P1, the hash value of transaction 1 is calculated, the digital signature S1 is decrypted by the public key of account A1, and it is determined whether the hash value of transaction 1 is the same as the value obtained by decryption. If they are the same, it can be verified.
  • the digital signature S1 is a signature generated by the private key of the account A1.
  • the digital signature S2 is verified by the public key of the access point E1 in the node P1 to verify whether the digital signature S2 is a signature obtained by the private key of the access point E1.
  • the node P1 can acquire multiple public keys of the digital signature S1, and use the multiple public keys to verify the digital signature S1 in a predetermined order, and similarly verify the digital signature S1.
  • step S212 the blockchain 11 executes transaction 1 to create account A1.
  • the block chain 11 is, for example, a block chain of the Ethereum chain type, wherein the state data of each account in the block chain is recorded by a state tree, that is, the state tree is the account database in the block chain.
  • a state tree that is, the state tree is the account database in the block chain.
  • each leaf node corresponds to an account
  • the state data of the corresponding account is recorded in the leaf node, such as account balance, key information, etc.
  • the state tree goes from the root node to the leaf node
  • Each node of includes at least some characters in the account address of the corresponding account, that is, in the state tree, addressing can be performed based on the account address to read account data.
  • any node in the blockchain 11 (such as node P1) is executing transaction 1, for example, as shown in Figure 4, the transaction 1 calls the contract C1 for creating an account, then the node P1 executes the contract C1 by executing the contract C1. , adding the account A1 to the locally stored state tree, that is, adding a leaf node corresponding to the account A1 in the state tree, and storing the data of the account A1 in the leaf node.
  • Figure 5 schematically shows the data of account A1 in the state tree.
  • the data of the account A1 includes the account balance of the account A1 .
  • the account balance of the account A1 can be set to a predetermined value, such as 0.
  • the data of the account A1 also includes the public key of the account A1 and the public key of the access point E1.
  • the digital signature S1 and the digital signature S2 may be multi-signatures, that is, the public key of the account A1 may include multiple public keys, and each public key may include its own weight , the weight of each public key can be a natural number between 1 and 100.
  • the public key of the account A1 may include each public key of the account A1 and the corresponding weight
  • the public key of the access point E1 may include each public key of the access point E1 and the corresponding weight.
  • Each node in the blockchain 11 will perform the same process of executing transaction 1 as the above process performed in node P1, so that each node updates the state database locally, that is, adds account A1's account in the state database. data.
  • the blockchain 11 is not limited to the Ethereum chain type, and when the blockchain 11 is other types of blockchains, the account database therein may have other forms.
  • the data of the account A1 is not limited to include the content shown in FIG. 5 , for example, the data of the account A1 may not include the public key of the account A1 and the public key of the access point E1, but may include An identification such as the account of the access point E1 is used to indicate that the account A1 is associated with the access point E1.
  • FIG. 6 shows a sequence diagram of a method for modifying an access point of a client according to an embodiment of the present specification.
  • step S602 the user U1 device sends a transaction 2 and its digital signature S1 to the access point E1, wherein the transaction 2 includes the identifier of the access point E2.
  • the user U1 can obtain the account and public key of the access point E2 from the user U1 device, so that the transaction 2 and its digital signature S1 can be sent to the access point E1 through the user U1 device.
  • FIG 7 schematically shows a form of transaction 2 (Tx2) and its digital signature S1.
  • transaction 2 is a transaction for modifying the account access point in the blockchain
  • the From field of the transaction is the account address that sends the transaction, that is, account A1
  • the To field is the account of the new access point of the user U1 device
  • the address is the account of the access point E2.
  • the digital signature S1 is a digital signature signed by the private key of the account A1.
  • the data (Data) field of the transaction 2 includes, for example, "AmendAccount" as a specific identifier, which is used to indicate that the transaction is a transaction for modifying the account access point in the blockchain.
  • a node eg, node P1 may determine that transaction 2 is for modifying the "Account A1" access point to access point E2.
  • the public key of access point E2 may also be included in the data field of transaction 2.
  • FIG 8 schematically shows another form of transaction 2 (Tx2) and its digital signature S1.
  • the transaction 2 is, for example, a transaction for calling a smart contract (contract C2) for modifying the account access point. Therefore, the From field of the transaction 2 is the account A1, and the To field is the account of the contract C2.
  • the contract C2 includes, for example, the AmendAcount() function, and the incoming parameter of the function is "access point E2 account", which is used to instruct to modify the access point of the account A1 to the access point E2.
  • the incoming parameter of the function is not limited to the account of the access point E2, as long as it is an identifier that can uniquely identify the access point E2, for example, the incoming parameter of the function can also be is the public key of access point E2.
  • step S604 the access point E1 verifies the transaction 2.
  • the access point E1 verifies whether the transaction 2 satisfies a predetermined rule, such as a regulatory rule in the asset platform, and whether the digital signature of the transaction 2 is the digital signature of the user U1.
  • a predetermined rule such as a regulatory rule in the asset platform
  • step S606 the access point E1 generates a digital signature S2 after the verification is passed.
  • the access point E1 encrypts the hash value of the transaction 2 using its account private key, thereby generating the digital signature S2 of the transaction 2.
  • step S608 the access point E1 sends transaction 2, its digital signature S1 and digital signature S2 to the blockchain 11.
  • the access point E1 can send the transaction 2, the digital signature S1 and the digital signature S2 to any node of the blockchain 11 to diffuse them into the blockchain 11.
  • the transaction 2, the digital signature S1, and the digital signature S2 can be written into three predetermined parts of a file similarly to Fig. 7, so as to be read separately.
  • the blockchain 11 verifies the digital signature of transaction 2.
  • each node in the blockchain 11 will obtain transaction 2 and execute transaction 2 to modify the local account Access point data for A1.
  • node P1 verifies digital signature S1 and digital signature S2 before executing transaction 2.
  • the node P1 first determines from the transaction 2 that the sending account of the transaction is the account A1, and then the node P1 obtains the public key of the account A1 and the access point E1 based on the data of the account A1 shown in Figure 5 in the locally stored account database and use the public key of account A1 and the public key of access point E1 to verify the digital signature S1 and digital signature S2 of transaction 2 respectively.
  • the account of the access point E1 of the account A1 is stored in the local account database of the node P1, so that the node P1 can find the account of the access point E1 from the client based on the account of the access point E1.
  • the public key is used to verify the digital signature S2 of transaction 2.
  • step S612 the blockchain 11 executes transaction 2 to modify the access point data of account A1.
  • FIG. 8 schematically shows the data of account A1 in the state tree after modification.
  • the data of the account A1 includes the account balance of the account A1, the public key of the account A1 and the public key of the access point E2.
  • the transaction data of transaction 2 includes the public key of access point E2, so that when node P1 executes transaction 2, it can obtain the public key of access point E2 from transaction 2, and transfer the access point in account A1 in the state tree to the public key.
  • the access point E1 public key is changed to the access point E2 public key.
  • the node P1 obtains the public keys of each account in advance, including the public key of the access point E2, and the transaction data of the transaction 2 includes the account of the access point E2, so that the node P1 can execute the transaction 2 based on the access point.
  • the account of E2 obtains its public key locally to modify the public key of the access point E1 in the account A1 to the public key of the access point E2.
  • the account system according to the embodiment of the present specification and the method for sending and executing transactions based on the account system are described above by taking transaction 1 and transaction 2 as examples. It can be understood that when the user U1 corresponds to the access point E1, it is not limited to send transaction 1 and transaction 2 to the access point E1, but can send any transaction, such as transaction 3. Similarly for transaction 1 and transaction 2, user U1 needs to send transaction 3 and its digital signature S1 to access point E1 to send it into blockchain 11. After receiving the transaction 3, the access point E1 also needs to perform compliance verification and digital signature verification on the transaction 3. After the verification is passed, the digital signature S2 of the transaction 3 is generated, and the digital signature S1 of the transaction 3 and its digital signature S1 is generated. and digital signature S2 are sent to the blockchain 11.
  • FIG. 10 shows an apparatus 1000 for sending a transaction in a blockchain according to an embodiment of the present specification
  • the blockchain includes a first access node, the apparatus is deployed on the first access node, and the The first access node is connected to the first client of the first user
  • the apparatus includes: a receiving unit 101, configured to receive a first transaction and its first digital signature from the first client, the first transaction A digital signature is the digital signature of the first user; the verification unit 102 is configured to verify the first transaction; the generating unit 103 is configured to verify the first transaction after passing the verification.
  • a second digital signature of the first transaction is generated; the sending unit 104 is configured to send the first transaction, the first digital signature, and the second digital signature to other nodes of the blockchain digital signature.
  • FIG. 11 shows an apparatus 1100 for executing a transaction in a blockchain according to an embodiment of the present specification
  • the blockchain includes a first access node, the first access node and the first user's first access node
  • the client is connected, the device is deployed on any node in the blockchain, and includes: an obtaining unit 111, configured to obtain a first transaction, a first digital signature and a second digital signature of the first transaction, Wherein, the first transaction is sent by the first client, the first digital signature is the digital signature of the first user, and the second digital signature is the digital signature of the first access node;
  • the verification unit 112 is configured to verify the first digital signature and the second digital signature respectively;
  • the execution unit 113 is configured to execute the first transaction when the verification is passed.
  • the verification unit 112 includes a first acquisition subunit 1121, configured to acquire the public key of the first access node based on the identifier of the first access node, and the first verification The subunit 1122 is configured to use the public key of the first access node to verify the second digital signature.
  • the first client terminal corresponds to the first account of the first user
  • the execution unit 113 is further configured to, in the case of passing the verification, execute the first transaction to
  • the data of the first account is created in a local account database, wherein the identification of the first access node is included in the data of the first account.
  • the first client terminal corresponds to the first account of the first user
  • the local account database includes data of the first account
  • the data of the first account includes The identifier of the first access node
  • the verification unit 112 includes a reading subunit 1123 configured to read the identifier of the first access node from the data of the first account
  • the first The second obtaining subunit 1124 is configured to obtain the public key of the first access node based on the identifier of the first access node
  • the second verification subunit 1125 is configured to obtain the public key of the first access node based on the identifier of the first access node. the public key to verify the second digital signature.
  • the first client corresponds to the first account of the first user
  • the blockchain further includes a second access node
  • the first transaction is to modify the first transaction.
  • a transaction of a client's access node, the first transaction includes the identifier of the second access node
  • the execution unit 113 is further configured to, in the case of passing the verification, execute the first transaction , so as to modify the identifier of the first access node in the data of the first account to the identifier of the second access node in the local account database.
  • Another aspect of the present specification provides a computer-readable storage medium on which a computer program or instruction is stored, and when the computer program or instruction is executed in a computer, causes the computer to execute any one of the above methods.
  • Another aspect of the present specification provides a computing device, including a memory and a processor, where a computer program or instruction is stored in the memory, and the processor implements any one of the above methods when executing the computer program or instruction.
  • the operation of the service access point is stored in the blockchain in the form of the digital signature of the transaction, so that the operation of the service access point can be performed through the blockchain.
  • Supervision, and through this scheme the characteristics of decentralization are maintained, the user's assets are maintained by the user's private key, and the service access point cannot misappropriate the user's assets without authorization, thus providing higher security.
  • a software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.
  • RAM random access memory
  • ROM read only memory
  • electrically programmable ROM electrically erasable programmable ROM
  • registers hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.

Abstract

本说明书实施例提供了一种在区块链中发送交易和执行交易的方法和装置,所述区块链中包括第一接入节点,所述方法由所述第一接入节点执行,所述第一接入节点与第一用户的第一客户端连接,所述方法包括:从所述第一客户端接收第一交易及其第一数字签名,所述第一数字签名为所述第一用户的数字签名;对所述第一交易进行校验;在对所述第一交易的校验通过的情况中,生成所述第一交易的第二数字签名;向所述区块链的其它节点发送所述第一交易、所述第一数字签名、及所述第二数字签名。

Description

在区块链中发送交易和执行交易的方法和装置 技术领域
本说明书实施例涉及区块链技术领域,更具体地,涉及一种在区块链中发送交易的方法和装置、以及一种在区块链中执行交易的方法和装置。
背景技术
在新一代区块链中,例如在以太坊中,新增了账户的概念,其中,由用户创建的账户为以太坊中的外部账户。通常,每个外部账户拥有一对公私钥,其中,私钥用于进行数字签名,公钥用于验证签名。另外,在各个节点中,在节点本地的数据库中以状态树的形式维持区块链中全部账户的数据表,该状态树为账户地址与账户内容之间的映射,所述账号内容包括,账户余额、账户密钥信息等。用户在进行交易之前,可通过查询状态树而获取对方余额、对方密钥信息等。
所述区块链例如为资产平台,区块链中的账户用于记录用户的数字资产、及数字资产流转。通常,资产平台需要履行相关的监管规则,如客户了解(kyc)、反洗钱等监管规则。因此,基于区块链实现的资产平台也需要满足监管要求。在现有的方案中,使用中心化接入系统的方式进行监管,区块链资产平台的用户需要选择一个中心化的服务点进行接入,在一些方案中,还需要用户托管资产。
因此,需要一种更有效的在区块链平台中进行监管的方案。
发明内容
本说明书实施例旨在提供一种更有效的在区块链中发送交易和执行交易的方案,以解决现有技术中的不足。
为实现上述目的,本说明书一个方面提供一种在区块链中发送交易的方法,所述区块链中包括第一接入节点,所述方法由所述第一接入节点执行,所述第一接入节点与第一用户的第一客户端连接,所述方法包括:从所述第一客户端接收第一交易及其第一数字签名,所述第一数字签名为所述第一用户的数字签名;对所述第一交易进行校验;在对所述第一交易的校验通过的情况中,生成所述第一交易的第二数字签名;向所述区块链的其它节点发送所述第一交易、所述第一数字签名、及所述第二数字签名。
在一种实施方式中,所述第一交易为用于创建所述第一用户的账户的交易,其中,所述第一交易中包括所述第一接入节点的标识。
在一种实施方式中,所述第一接入节点的标识为所述第一接入节点的公钥或所述第一接入节点的账户。
在一种实施方式中,所述区块链中还包括第二接入节点,所述第一交易为用于修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识。
本说明书另一方面提供一种在区块链中执行交易的方法,所述区块链中包括第一接入节点,所述第一接入节点与第一用户的第一客户端连接,所述方法由所述区块链中的任一节点执行,包括:获取第一交易、所述第一交易的第一数字签名和第二数字签名,其中,所述第一交易由所述第一客户端发送,所述第一数字签名为所述第一用户的数字签名,所述第二数字签名为所述第一接入节点的数字签名;对所述第一数字签名和所述第二数字签名分别进行验证;在验证通过的情况中,执行所述第一交易。
在一种实施方式中,所述第一交易为用于创建所述第一用户的账户的交易,其中,所述第一交易中包括所述第一接入节点的标识。
在一种实施方式中,对所述第一数字签名和所述第二数字签名分别进行验证包括,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,使用所述第一接入节点的公钥对所述第二数签名进行验证。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,在验证通过的情况中,执行所述第一交易包括,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中创建所述第一账户的数据,其中,在所述第一账户的数据中包括所述第一接入节点的标识。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,在本地的账户数据库中包括所述第一账户的数据,所述第一账户的数据中包括所述第一接入节点的标识,其中,对所述第一数字签名和所述第二数字签名分别进行验证包括,从所述第一账户的数据中读取所述第一接入节点的标识,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,基于所述第一接入节点的公钥,对所述第二数字签名进行验证。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,所述区块链中还包括第二接入节点,所述第一交易为修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识,其中,在验证通过的情况中,执行所述第 一交易包括,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中将第一账户的数据中的第一接入节点的标识修改为所述第二接入节点的标识。
本说明书另一方面提供一种在区块链中发送交易的装置,所述区块链中包括第一接入节点,所述装置部署于所述第一接入节点,所述第一接入节点与第一用户的第一客户端连接,所述装置包括:接收单元,配置为,从所述第一客户端接收第一交易及其第一数字签名,所述第一数字签名为所述第一用户的数字签名;校验单元,配置为,对所述第一交易进行校验;生成单元,配置为,在对所述第一交易的校验通过的情况中,生成所述第一交易的第二数字签名;发送单元,配置为,向所述区块链的其它节点发送所述第一交易、所述第一数字签名、及所述第二数字签名。
本说明书另一方面提供一种在区块链中执行交易的装置,所述区块链中包括第一接入节点,所述第一接入节点与第一用户的第一客户端连接,所述装置部署于所述区块链中的任一节点,包括:获取单元,配置为,获取第一交易、所述第一交易的第一数字签名和第二数字签名,其中,所述第一交易由所述第一客户端发送,所述第一数字签名为所述第一用户的数字签名,所述第二数字签名为所述第一接入节点的数字签名;验证单元,配置为,对所述第一数字签名和所述第二数字签名分别进行验证;执行单元,配置为,在验证通过的情况中,执行所述第一交易。
在一种实施方式中,所述验证单元包括,第一获取子单元,配置为,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,第一验证子单元,配置为,使用所述第一接入节点的公钥对所述第二数签名进行验证。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,所述执行单元还配置为,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中创建所述第一账户的数据,其中,在所述第一账户的数据中包括所述第一接入节点的标识。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,在本地的账户数据库中包括所述第一账户的数据,所述第一账户的数据中包括所述第一接入节点的标识,其中,所述验证单元包括,读取子单元,配置为,从所述第一账户的数据中读取所述第一接入节点的标识,第二获取子单元,配置为,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,第二验证子单元,配置为,基于所述第一接入节点的公钥,对所述第二数字签名进行验证。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,所述区块 链中还包括第二接入节点,所述第一交易为修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识,其中,所述执行单元还配置为,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中将第一账户的数据中的第一接入节点的标识修改为所述第二接入节点的标识。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序或指令,当所述计算机程序或指令在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序或指令,所述处理器在执行所述计算机程序或指令时,实现上述任一项方法。
通过本说明书实施例的账户体系及基于该账户体系的交易方案,服务接入点的操作以交易的数字签名的形式存入区块链中,从而可通过区块链对服务接入点的操作进行监管,而且通过该方案,保持了去中心化的特性,用户的资产通过用户的私钥维护,服务接入点无法擅自挪用用户的资产,从而提供了更高的安全性。
附图说明
通过结合附图描述本说明书实施例,可以使得本说明书实施例更加清楚:
图1示出根据本说明书实施例的区块链系统示意图;
图2示出根据本说明书实施例的在区块链中创建账户的时序图;
图3示意示出交易1(Tx1)及其数字签名S1的一种形式;
图4示意示出交易1(Tx1)及其数字签名S1的另一种形式;
图5示意示出状态树中的账户A1的数据;
图6示出根据本说明书实施例的修改客户端的接入点的方法时序图;
图7示意示出交易2(Tx2)及其数字签名S1的一种形式;
图8示意示出交易2(Tx2)及其数字签名S1的另一种形式;
图9示意示出在经过修改之后的状态树中的账户A1的数据;
图10示出根据本说明书实施例的一种在区块链中发送交易的装置1000;
图11示出根据本说明书实施例的一种在区块链中执行交易的装置1100。
具体实施方式
下面将结合附图描述本说明书实施例。
图1示出根据本说明书实施例的区块链系统示意图。如图1中所示,该区块链系统中包括区块链11,该区块链11为多个区块链节点相互连接构成节点网络。所述多个节点中包括多个服务接入点,图中示意示出接入点E1和接入点E2,其中,每个接入点具有区块链中的节点账户,并且其本地存储有区块链中的数据。每个接入点与多个用户客户端连接,图中示意示出了,接入点E1与用户U1的客户端和用户U2的客户端连接,接入点E2与用户U3的客户端和用户U4的客户端连接。所述用户的客户端也具有区块链中的账户,其通过连接其对应的接入点而对区块链进行读写。
具体是,用户U1为了对区块链进行读写,首先需要使用区块链11的客户端生成账户,例如生成了账户A1(即账户地址A1)、账户A1的私钥和公钥。然后,用户U1需要向区块链11中的任一接入点(例如接入点E1)发送用于创建账户的交易1。接入点E1在接收到该交易1之后,对该交易1进行校验,生成该交易1的数字签名,并将交易1及其数字签名(其中包括用户U1的数字签名和接入点E1的数字签名)发送给区块链11中的其它节点。当该区块链中任一节点在执行交易1时,在对交易1的数字签名进行验证之后,在账户数据库中创建与账户A1对应的数据,其中,在与账户A1对应的数据中包括接入点E1的标识。之后,当用户U1通过账户A1发送任何交易(例如交易2)时,都需要首先发送给接入点E1,由接入点E1对该交易2验证签名并发送到区块链中。区块链中的节点(例如节点P1)在执行交易时,可从账户数据库中的账户A1的数据中获取接入点E1的标识,从而获取接入点E1的公钥,并使用接入点E1的公钥对交易2的接入点E1的数字签名进行验证,并在验证通过之后执行交易2。当用户U1希望读取区块链11中的账本数据时,其通过连接接入点E1而对接入点E1中的账本数据进行读取。
下面将详细描述上述账户体系、基于该账户体系的交易过程。
图2示出根据本说明书实施例的在区块链中创建账户的时序图。该时序图由用户U1设备、接入点E1、区块链11三方执行。其中,用户U1设备为用户U1通过其账户A1登录的客户端。
首先,在步骤S202,用户U1设备向接入点E1发送交易1及其数字签名S1,其中,所述交易1中包括接入点E1的标识。
用户U1设备中例如预先以系统合约的方式设置有区块链11中的各个接入点的账户及其公钥,从而用户U1可通过用户U1设备选择例如接入点E1作为用于读写区块链11的接入点,并从用户U1设备中获取接入点E1的账户和公钥。
图3示意示出交易1(Tx1)及其数字签名S1的一种形式。其中,交易1为用于在区块链中创建账户的交易,该交易的From字段为发送该交易的账户地址,即账户A1,To字段为用户U1设备的接入点的账户地址,即接入点E1的账户。数字签名S1为通过账户A1的私钥进行签名的数字签名。该交易1的数据(Data)字段中包括例如“CreatAccount”作为特定标识,用于标示该交易为用于在区块链中创建账户的交易,基于该特征标识,区块链中的节点(例如节点P1)可以确定,需要创建的账户为交易1的交易发送账户,即“账户A1”,并且该账户A1通过交易接收账户(即接入点E1账户)对应的接入点访问区块链。在交易1的数据字段中还可以包括接入点E1的公钥。
图4示意示出交易1(Tx1)及其数字签名S1的另一种形式。该交易1例如为调用用于创建账户的智能合约(合约C1)的交易,因此,该交易1的From字段为账户A1,To字段为合约C1的账户。合约C1中例如包括CreatAcount()函数,该函数的传入参数为“接入点E1账户”,从而用于指示,账户A1通过接入点E1访问区块链。可以理解,在该实施方式中,该函数的传入参数不限于为接入点E1的账户,只要其为可唯一标识接入点E1的标识即可,例如,该函数的传入参数也可以为接入点E1的公钥。
在一种实施方式中,用户U1设备可在该交易1中的交易数据中包括账户A1的公钥。在一种实施方式中,用户U1设备可向接入点E1另外发送其公钥,以用于公开其公钥。
交易1的交易数据中还可以包括具体平台要求提交的用于创建账户的其它数据,例如,所述区块链11为资产平台,所述交易1的交易数据中例如还需要提供用户U1的身份证明等数据。可以理解,虽然这里以资产平台为例进行描述,所述区块链11不限于为资产平台,而可以为其它需要进行监管的平台,相对应地,要求用户提供的用于创建账户的数据可能包括其它数据,对此不作限定。
在一种实施方式中,数字签名S1可以为多重签名,即账户A1具有多个公钥,数字签名S1包括通过多个公钥依次签名的多重签名。在一种实施方式中,账户A1具有N个公钥,每个公钥具有各自的权重,所述权重为1到100之间的数值,在该情况中,数字签名S1可包括通过N个公钥中的M个公钥签名的多重签名,只要M个公钥的权重之和大于等于100即可。
在步骤S204,接入点E1校验交易1。
例如,在区块链11为资产平台的情况中,接入点E1校验用户U1的身份证明是否真实、是否符合资产监管规则,通过账户A1的公钥校验交易1的数字签名是否为账户A1的数字签名。
在步骤S206,接入点E1在校验通过之后生成交易1的数字签名S2。
即,接入点E1使用其账户私钥对交易1的哈希值进行加密,从而生成交易1的数字签名S2。类似地,所述数字签名S2也可以为多重签名。
在步骤S208,接入点E1向区块链11发送交易1、其数字签名S1及数字签名S2。
接入点E1可向区块链11的任一节点发送交易1、数字签名S1和数字签名S2,以将其扩散到区块链11中。其中,所述交易1、数字签名S1、数字签名S2可与图3类似地被写入一个文件的预定3个部分中,以便于对其分别进行读取。
在步骤S210,区块链11在执行交易1之前验证数字签名。
区块链11中的多个节点在接收到交易1及其数字签名之后,在经过节点共识之后,由共识确定的节点执行交易1,将交易1打包到例如区块1中,并将区块1发送给其它各个节点。其它各个节点在接收到区块1之后,也将执行其中的交易1。也就是说,区块链11中的每个节点都会获取交易1并执行交易1。
例如区块链11中的节点P1将要执行交易1,在执行交易1之前,节点P1需要对交易1的数字签名S1和数字签名S2分别进行验证。
为了验证数字签名S1和数字签名S2,节点P1首先获取账户A1的公钥和接入点E1的公钥。例如,如上文所述,交易1的交易数据中可包括账户A1公钥和接入点E1公钥,从而节点P1可从交易1获取账户A1公钥和接入点E1公钥。或者,节点P1预先获取了各个账户的公钥,其中包括账户A1的公钥和接入点E1的公钥,交易1的交易数据中包括账户A1和接入点E1的账户,从而节点P1可基于账户A1和接入点E1账户分别从本地获取其公钥。
节点P1在获取账户A1公钥和接入点E1公钥之后,可进行对数字签名S1和数字签名S2的验证。具体是,在节点P1中,计算交易1的哈希值,通过账户A1的公钥对数字签名S1进行解密,确定交易1的哈希值与解密获取的值是否相同,如果相同,则可验证数字签名S1是通过账户A1的私钥生成的签名。同样地,在节点P1中通过接入点 E1的公钥对数字签名S2进行验证,以验证数字签名S2是否为通过接入点E1的私钥获取的签名。
在数字签名S1和数字签名S2为多重签名的情况中,节点P1可获取数字签名S1的多个公钥,并依据预定顺序使用该多个公钥对数字签名S1进行验证,并类似地验证数字签名S2。
在步骤S212,区块链11执行交易1,创建账户A1。
区块链11例如为以太坊链类型的区块链,其中,以状态树记录区块链中各个账户的状态数据,即,状态树即为该区块链中的账户数据库。在该状态树中,每个叶子节点与一个账户相对应,并且该叶子节点中记录了相应账户的状态数据,如账户余额、密钥信息等,并且,该状态树从根节点到该叶子节点的各个节点中包括对应账户的账户地址中的至少部分字符,即,在该状态树中,可基于账户地址进行寻址,以读取账户数据。
当区块链11中的任一节点(例如节点P1)在执行交易1时,例如如图4所示,该交易1中调用用于创建账户的合约C1,则该节点P1通过执行该合约C1,在本地存储的状态树中添加账户A1,即在状态树中添加与账户A1对应的叶子节点,并在叶子节点中存入账户A1的数据。图5示意示出状态树中的账户A1的数据。如图5所示,账户A1的数据中包括账户A1的账户余额,在创建账户时,可将账户A1的账户余额设定为预定数值,例如0。账户A1的数据中还包括账户A1公钥和接入点E1的公钥。
在一种实施方式中,所述数字签名S1和所述数字签名S2可以是多重签名,也就是说,账户A1的公钥可以包括多个公钥,并且,每个公钥可包括各自的权重,各个公钥的权重可以为1到100之间的自然数。在该情况中,在图5中,账户A1公钥中可包括账户A1的各个公钥及对应的权重,接入点E1公钥中可包括接入点E1的各个公钥及对应的权重。
区块链11中的每个节点都将执行与节点P1中执行的上述过程相同的执行交易1的过程,从而每个节点都在本地更新了状态数据库,即在状态数据库中添加了账户A1的数据。
可以理解,区块链11不限于为以太坊链类型,当区块链11为其它类型区块链时,其中的账户数据库可具有其它形式。另外,在节点的账户数据库中,账户A1的数据不限于包括如图5所示的内容,例如,账户A1的数据中可以不包括账户A1公钥和接入点E1公钥,而是可以包括接入点E1的账户等标识,以用于指示账户A1与接入点E1 相关联。
图6示出根据本说明书实施例的修改客户端的接入点的方法时序图。
如图6所示,首先在步骤S602,用户U1设备向接入点E1发送交易2及其数字签名S1,其中,所述交易2中包括接入点E2的标识。
与上文类似地,用户U1可从用户U1设备获取接入点E2的账户及公钥,从而可通过用户U1设备向接入点E1发送交易2及其数字签名S1。
图7示意示出交易2(Tx2)及其数字签名S1的一种形式。其中,交易2为用于在区块链中修改账户接入点的交易,该交易的From字段为发送该交易的账户地址,即账户A1,To字段为用户U1设备的新接入点的账户地址,即接入点E2的账户。数字签名S1为通过账户A1的私钥进行签名的数字签名。该交易2的数据(Data)字段中包括例如“AmendAccount”作为特定标识,用于标示该交易为用于在区块链中修改账户接入点的交易,基于该特征标识,区块链中的节点(例如节点P1)可以确定,交易2用于将“账户A1”接入点修改为接入点E2。在交易2的数据字段中还可以包括接入点E2的公钥。
图8示意示出交易2(Tx2)及其数字签名S1的另一种形式。该交易2例如为调用用于修改账户接入点的智能合约(合约C2)的交易,因此,该交易2的From字段为账户A1,To字段为合约C2的账户。合约C2中例如包括AmendAcount()函数,该函数的传入参数为“接入点E2账户”,从而用于指示,将账户A1接入点修改为接入点E2。可以理解,在该实施方式中,该函数的传入参数不限于为接入点E2的账户,只要其为可唯一标识接入点E2的标识即可,例如,该函数的传入参数也可以为接入点E2的公钥。
在步骤S604,接入点E1校验交易2。
这里与上文中对步骤S204的描述类似地,接入点E1校验交易2是否满足预定规则,例如资产平台中的监管规则,另外,交易交易2的数字签名是否为用户U1的数字签名。
在步骤S606,接入点E1在校验通过之后生成数字签名S2。
即,接入点E1使用其账户私钥对交易2的哈希值进行加密,从而生成交易2的数字签名S2。
在步骤S608,接入点E1向区块链11发送交易2、其数字签名S1及数字签名S2。
接入点E1可向区块链11的任一节点发送交易2、数字签名S1和数字签名S2,以将其扩散到区块链11中。其中,所述交易2、数字签名S1、数字签名S2可与图7类似 地被写入一个文件的预定3个部分中,以便于对其分别进行读取。
在步骤S610,区块链11验证交易2的数字签名。
与上文类似地,当接入点E1将交易2发送到区块链11中的任一节点之后,区块链11中的每个节点将获取交易2并执行交易2,以修改本地的账户A1的接入点数据。
例如节点P1在执行交易2之前对数字签名S1和数字签名S2进行验证。节点P1首先从交易2确定该交易的发送账户为账户A1,然后,节点P1基于本地存储的账户数据库中的如图5所示的账户A1的数据,获取账户A1的公钥和接入点E1的公钥,并使用账户A1的公钥和接入点E1的公钥对交易2的数字签名S1和数字签名S2分别进行验证。在一种实施方式中,在节点P1本地的账户数据库中存入了账户A1的接入点E1的账户,从而,节点P1可基于接入点E1的账户从客户端中找到接入点E1的公钥,并用该公钥验证交易2的数字签名S2。
在步骤S612,区块链11执行交易2,修改账户A1的接入点数据。
当区块链11中的任一节点(例如图1中的节点P1)在执行交易2时,例如如图8所示,该交易2中调用用于修改账户接入点的合约C2,则该节点P1通过执行该合约C2,在本地存储的状态树中将账户A1的接入点修改为接入点E2。图9示意示出在经过修改之后的状态树中的账户A1的数据。如图9所示,账户A1的数据中包括账户A1的账户余额、账户A1公钥和接入点E2的公钥。例如,交易2的交易数据中包括接入点E2的公钥,从而节点P1在执行交易2时,可从交易2获取接入点E2的公钥,并将状态树中的账户A1中的接入点E1公钥修改为接入点E2公钥。或者,节点P1预先获取了各个账户的公钥,其中包括接入点E2的公钥,交易2的交易数据中包括接入点E2的账户,从而节点P1在执行交易2时可基于接入点E2的账户从本地获取其公钥,以将账户A1中的接入点E1的公钥修改为接入点E2的公钥。
上文中以交易1和交易2为例描述了根据本说明书实施例的账户体系、以及基于该账户体系的发送交易和执行交易的方法。可以理解,用户U1在与接入点E1对应时,其不限于向接入点E1发送交易1和交易2,而是可以发送任何交易,例如交易3。对交易1和交易2的处理类似地,用户U1需要向接入点E1发送交易3及其数字签名S1,以将其发送到区块链11中。接入点E1在接收到交易3之后,同样需要对交易3进行合规校验和数字签名校验等,在校验通过之后生成交易3的数字签名S2,并将交易3、其数字签名S1和数字签名S2发送到区块链11中。区块链11中的节点在执行交易3时, 也需要在验证交易3的数字签名S1和数字签名S2之后再继续执行交易3,其中,在验证交易3时,可同样地基于本地的账户数据库中的账户A1的数据中获取接入点E1的公钥。
图10示出根据本说明书实施例的一种在区块链中发送交易的装置1000,所述区块链中包括第一接入节点,所述装置部署于所述第一接入节点,所述第一接入节点与第一用户的第一客户端连接,所述装置包括:接收单元101,配置为,从所述第一客户端接收第一交易及其第一数字签名,所述第一数字签名为所述第一用户的数字签名;校验单元102,配置为,对所述第一交易进行校验;生成单元103,配置为,在对所述第一交易的校验通过的情况中,生成所述第一交易的第二数字签名;发送单元104,配置为,向所述区块链的其它节点发送所述第一交易、所述第一数字签名、及所述第二数字签名。
图11示出根据本说明书实施例的一种在区块链中执行交易的装置1100,所述区块链中包括第一接入节点,所述第一接入节点与第一用户的第一客户端连接,所述装置部署于所述区块链中的任一节点,包括:获取单元111,配置为,获取第一交易、所述第一交易的第一数字签名和第二数字签名,其中,所述第一交易由所述第一客户端发送,所述第一数字签名为所述第一用户的数字签名,所述第二数字签名为所述第一接入节点的数字签名;验证单元112,配置为,对所述第一数字签名和所述第二数字签名分别进行验证;执行单元113,配置为,在验证通过的情况中,执行所述第一交易。
在一种实施方式中,所述验证单元112包括,第一获取子单元1121,配置为,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,第一验证子单元1122,配置为,使用所述第一接入节点的公钥对所述第二数签名进行验证。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,所述执行单元113还配置为,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中创建所述第一账户的数据,其中,在所述第一账户的数据中包括所述第一接入节点的标识。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,在本地的账户数据库中包括所述第一账户的数据,所述第一账户的数据中包括所述第一接入节点的标识,其中,所述验证单元112包括,读取子单元1123,配置为,从所述第一账户的数据中读取所述第一接入节点的标识,第二获取子单元1124,配置为,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,第二验证子单元1125,配置为,基于所述第一接入节点的公钥,对所述第二数字签名进行验证。
在一种实施方式中,所述第一客户端与所述第一用户的第一账户相对应,所述区块链中还包括第二接入节点,所述第一交易为修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识,其中,所述执行单元113还配置为,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中将第一账户的数据中的第一接入节点的标识修改为所述第二接入节点的标识。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序或指令,当所述计算机程序或指令在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序或指令,所述处理器在执行所述计算机程序或指令时,实现上述任一项方法。
通过本说明书实施例的账户体系及基于该账户体系的交易方案,服务接入点的操作以交易的数字签名的形式存入区块链中,从而可通过区块链对服务接入点的操作进行监管,而且通过该方案,保持了去中心化的特性,用户的资产通过用户的私钥维护,服务接入点无法擅自挪用用户的资产,从而提供了更高的安全性。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
本领域普通技术人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执轨道,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执轨道的 软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (22)

  1. 一种在区块链中发送交易的方法,所述区块链中包括第一接入节点,所述方法由所述第一接入节点执行,所述第一接入节点与第一用户的第一客户端连接,所述方法包括:
    从所述第一客户端接收第一交易及其第一数字签名,所述第一数字签名为所述第一用户的数字签名;
    对所述第一交易进行校验;
    在对所述第一交易的校验通过的情况中,生成所述第一交易的第二数字签名;
    向所述区块链的其它节点发送所述第一交易、所述第一数字签名、及所述第二数字签名。
  2. 根据权利要求1所述的方法,其中,所述第一交易为用于创建所述第一用户的账户的交易,其中,所述第一交易中包括所述第一接入节点的标识。
  3. 根据权利要求2所述的方法,其中,所述第一接入节点的标识为所述第一接入节点的公钥或所述第一接入节点的账户。
  4. 根据权利要求1所述的方法,其中,所述区块链中还包括第二接入节点,所述第一交易为用于修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识。
  5. 一种在区块链中执行交易的方法,所述区块链中包括第一接入节点,所述第一接入节点与第一用户的第一客户端连接,所述方法由所述区块链中的任一节点执行,包括:
    获取第一交易、所述第一交易的第一数字签名和第二数字签名,其中,所述第一交易由所述第一客户端发送,所述第一数字签名为所述第一用户的数字签名,所述第二数字签名为所述第一接入节点的数字签名;
    对所述第一数字签名和所述第二数字签名分别进行验证;
    在验证通过的情况中,执行所述第一交易。
  6. 根据权利要求5所述的方法,其中,所述第一交易为用于创建所述第一用户的账户的交易,其中,所述第一交易中包括所述第一接入节点的标识。
  7. 根据权利要求6所述的方法,其中,对所述第一数字签名和所述第二数字签名分别进行验证包括,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,使用所述第一接入节点的公钥对所述第二数签名进行验证。
  8. 根据权利要求6所述的方法,其中,所述第一客户端与所述第一用户的第一账户相对应,在验证通过的情况中,执行所述第一交易包括,在验证通过的情况中,执行所 述第一交易,以在本地的账户数据库中创建所述第一账户的数据,其中,在所述第一账户的数据中包括所述第一接入节点的标识。
  9. 根据权利要求5所述的方法,其中,所述第一客户端与所述第一用户的第一账户相对应,在本地的账户数据库中包括所述第一账户的数据,所述第一账户的数据中包括所述第一接入节点的标识,其中,对所述第一数字签名和所述第二数字签名分别进行验证包括,从所述第一账户的数据中读取所述第一接入节点的标识,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,基于所述第一接入节点的公钥,对所述第二数字签名进行验证。
  10. 根据权利要求9所述的方法,其中,所述区块链中还包括第二接入节点,所述第一交易为修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识,其中,在验证通过的情况中,执行所述第一交易包括,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中将第一账户的数据中的第一接入节点的标识修改为所述第二接入节点的标识。
  11. 一种在区块链中发送交易的装置,所述区块链中包括第一接入节点,所述装置部署于所述第一接入节点,所述第一接入节点与第一用户的第一客户端连接,所述装置包括:
    接收单元,配置为,从所述第一客户端接收第一交易及其第一数字签名,所述第一数字签名为所述第一用户的数字签名;
    校验单元,配置为,对所述第一交易进行校验;
    生成单元,配置为,在对所述第一交易的校验通过的情况中,生成所述第一交易的第二数字签名;
    发送单元,配置为,向所述区块链的其它节点发送所述第一交易、所述第一数字签名、及所述第二数字签名。
  12. 根据权利要求11所述的装置,其中,所述第一交易为用于创建所述第一用户的账户的交易,其中,所述第一交易中包括所述第一接入节点的标识。
  13. 根据权利要求12所述的装置,其中,所述第一接入节点的标识为所述第一接入节点的公钥或所述第一接入节点的账户。
  14. 根据权利要求11所述的装置,其中,所述区块链中还包括第二接入节点,所述第一交易为用于修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识。
  15. 一种在区块链中执行交易的装置,所述区块链中包括第一接入节点,所述第一接 入节点与第一用户的第一客户端连接,所述装置部署于所述区块链中的任一节点,包括:
    获取单元,配置为,获取第一交易、所述第一交易的第一数字签名和第二数字签名,其中,所述第一交易由所述第一客户端发送,所述第一数字签名为所述第一用户的数字签名,所述第二数字签名为所述第一接入节点的数字签名;
    验证单元,配置为,对所述第一数字签名和所述第二数字签名分别进行验证;
    执行单元,配置为,在验证通过的情况中,执行所述第一交易。
  16. 根据权利要求15所述的装置,其中,所述第一交易为用于创建所述第一用户的账户的交易,其中,所述第一交易中包括所述第一接入节点的标识。
  17. 根据权利要求16所述的装置,其中,所述验证单元包括,第一获取子单元,配置为,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,第一验证子单元,配置为,使用所述第一接入节点的公钥对所述第二数签名进行验证。
  18. 根据权利要求16所述的装置,其中,所述第一客户端与所述第一用户的第一账户相对应,所述执行单元还配置为,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中创建所述第一账户的数据,其中,在所述第一账户的数据中包括所述第一接入节点的标识。
  19. 根据权利要求15所述的装置,其中,所述第一客户端与所述第一用户的第一账户相对应,在本地的账户数据库中包括所述第一账户的数据,所述第一账户的数据中包括所述第一接入节点的标识,其中,所述验证单元包括,读取子单元,配置为,从所述第一账户的数据中读取所述第一接入节点的标识,第二获取子单元,配置为,基于所述第一接入节点的标识,获取所述第一接入节点的公钥,第二验证子单元,配置为,基于所述第一接入节点的公钥,对所述第二数字签名进行验证。
  20. 根据权利要求19所述的装置,其中,所述区块链中还包括第二接入节点,所述第一交易为修改所述第一客户端的接入节点的交易,所述第一交易中包括所述第二接入节点的标识,其中,所述执行单元还配置为,在验证通过的情况中,执行所述第一交易,以在本地的账户数据库中将第一账户的数据中的第一接入节点的标识修改为所述第二接入节点的标识。
  21. 一种计算机可读存储介质,其上存储有计算机程序或指令,当所述计算机程序或指令在计算机中执行时,令计算机执行权利要求1-10中任一项的所述的方法。
  22. 一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序或指令,所述处理器在执行所述计算机程序或指令时,实现权利要求1-10中任一项所述的方法。
PCT/CN2021/133037 2021-03-30 2021-11-25 在区块链中发送交易和执行交易的方法和装置 WO2022205959A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110340284.9 2021-03-30
CN202110340284.9A CN112766971A (zh) 2021-03-30 2021-03-30 在区块链中发送交易和执行交易的方法和装置

Publications (1)

Publication Number Publication Date
WO2022205959A1 true WO2022205959A1 (zh) 2022-10-06

Family

ID=75691133

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/133037 WO2022205959A1 (zh) 2021-03-30 2021-11-25 在区块链中发送交易和执行交易的方法和装置

Country Status (2)

Country Link
CN (1) CN112766971A (zh)
WO (1) WO2022205959A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112766971A (zh) * 2021-03-30 2021-05-07 支付宝(杭州)信息技术有限公司 在区块链中发送交易和执行交易的方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111161056A (zh) * 2018-11-07 2020-05-15 新明华区块链技术(深圳)有限公司 一种提高数字资产交易安全性的方法、系统及设备
CN111385350A (zh) * 2020-02-13 2020-07-07 南京如般量子科技有限公司 基于一次一变秘密共享和路由装置的抗量子计算区块链交易方法和系统
US20200336318A1 (en) * 2019-04-16 2020-10-22 Mastercard International Incorporated Method and system for using dynamic private keys to secure data file retrieval
US20200379979A1 (en) * 2017-04-26 2020-12-03 Visa International Service Association Systems and methods for recording data representing multiple interactions
CN112766971A (zh) * 2021-03-30 2021-05-07 支付宝(杭州)信息技术有限公司 在区块链中发送交易和执行交易的方法和装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA3041162A1 (en) * 2018-11-07 2019-04-18 Alibaba Group Holding Limited Managing private transactions on blockchain networks based on workflow
CN111242617B (zh) * 2020-01-02 2022-05-10 支付宝(杭州)信息技术有限公司 用于执行交易正确性验证的方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200379979A1 (en) * 2017-04-26 2020-12-03 Visa International Service Association Systems and methods for recording data representing multiple interactions
CN111161056A (zh) * 2018-11-07 2020-05-15 新明华区块链技术(深圳)有限公司 一种提高数字资产交易安全性的方法、系统及设备
US20200336318A1 (en) * 2019-04-16 2020-10-22 Mastercard International Incorporated Method and system for using dynamic private keys to secure data file retrieval
CN111385350A (zh) * 2020-02-13 2020-07-07 南京如般量子科技有限公司 基于一次一变秘密共享和路由装置的抗量子计算区块链交易方法和系统
CN112766971A (zh) * 2021-03-30 2021-05-07 支付宝(杭州)信息技术有限公司 在区块链中发送交易和执行交易的方法和装置

Also Published As

Publication number Publication date
CN112766971A (zh) 2021-05-07

Similar Documents

Publication Publication Date Title
TWI737944B (zh) 基於區塊鏈的交易執行方法及裝置、電子設備
US11842317B2 (en) Blockchain-based authentication and authorization
US10824701B2 (en) System and method for mapping decentralized identifiers to real-world entities
CN111898153B (zh) 调用合约的方法及装置
CN110245506B (zh) 基于区块链的智能合约管理方法及装置、电子设备
US10992649B2 (en) Systems and methods for privacy in distributed ledger transactions
JP6877448B2 (ja) 分散ハッシュテーブル及びブロックチェーンを用いてコンピュータソフトウェアを保証する方法及びシステム
JP2020511017A (ja) ブロックチェーンベースのデジタル証明書を実装するためのシステム及び方法
JP2020511018A (ja) デジタル・マークを生成するためのシステム及び方法
TW201935377A (zh) 資產管理方法及裝置、電子設備
CN110009349B (zh) 区块链中生成和验证可链接环签名的方法及装置
WO2020233631A1 (zh) 基于交易类型的收据存储方法和节点
JP2020511702A (ja) ブロックチェーンベースの認証のためのシステムおよび方法
CN113114476B (zh) 基于合约的隐私存证方法及装置
WO2020258858A1 (zh) 块链式账本中的授权方法、系统、装置及设备
TW202101350A (zh) 基於處理模組跨鏈發送可認證訊息的方法和裝置
WO2020238955A1 (zh) 基于交易偏移量实现动态加密的方法及装置
WO2020238958A1 (zh) 基于合约状态的修改次序实现动态加密的方法及装置
Lee et al. Sims: Self sovereign identity management system with preserving privacy in blockchain
He et al. A novel cryptocurrency wallet management scheme based on decentralized multi-constrained derangement
KR102329221B1 (ko) 블록체인 기반 사용자 인증 방법
CN112258189A (zh) 基于区块链的签约管理方法及装置和电子设备
CN112199697A (zh) 基于共享根密钥的信息处理方法、装置、设备及介质
WO2022205959A1 (zh) 在区块链中发送交易和执行交易的方法和装置
CN110910110A (zh) 一种数据处理方法、装置及计算机存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21934595

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21934595

Country of ref document: EP

Kind code of ref document: A1