CN112669147A - Service request method and device based on block chain - Google Patents

Service request method and device based on block chain Download PDF

Info

Publication number
CN112669147A
CN112669147A CN202011529847.0A CN202011529847A CN112669147A CN 112669147 A CN112669147 A CN 112669147A CN 202011529847 A CN202011529847 A CN 202011529847A CN 112669147 A CN112669147 A CN 112669147A
Authority
CN
China
Prior art keywords
access key
key
contract
service
digital signature
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202011529847.0A
Other languages
Chinese (zh)
Other versions
CN112669147B (en
Inventor
顾俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai Co Ltd
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 Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202011529847.0A priority Critical patent/CN112669147B/en
Publication of CN112669147A publication Critical patent/CN112669147A/en
Application granted granted Critical
Publication of CN112669147B publication Critical patent/CN112669147B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/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
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The present specification provides a service request method and apparatus based on a blockchain, where the blockchain stores a secure access key and a corresponding access key ID generated by a service caller; the security access key is encrypted in advance based on a public key of a service provider; the method comprises the following steps: the service provider receives a service request sent by the service caller; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on the request parameters based on the secure access key; inquiring a corresponding encrypted security access key based on the access key ID; decrypting the secure access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted secure access key; executing the service request based on the request parameters when the first digital signature is verified.

Description

Service request method and device based on block chain
Technical Field
One or more embodiments of the present disclosure relate to the field of block chain technologies, and in particular, to a service request method and apparatus based on a block chain.
Background
The block chain technology, also called distributed ledger technology, is an emerging technology in which several computing devices participate in "accounting" together, and a complete distributed database is maintained together. The blockchain technology has been widely used in many fields due to its characteristics of decentralization, transparency, participation of each computing device in database records, and rapid data synchronization between computing devices.
Disclosure of Invention
In view of the above, one or more embodiments of the present specification provide a service request method, apparatus, computer device and computer-readable storage medium based on a block chain.
To achieve the above object, one or more embodiments of the present specification provide a service request method based on a blockchain storing a secure access key and a corresponding access key ID generated by a service caller; the safe access key stored in the blockchain is encrypted in advance based on a public key of a service provider; the method comprises the following steps:
the service provider receives a service request sent by the service caller; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on the request parameters based on the secure access key;
inquiring a corresponding encrypted security access key based on the access key ID;
decrypting the secure access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted secure access key;
executing the service request based on the request parameters when the first digital signature is verified.
In yet another illustrated embodiment, a smart contract for managing security access keys is deployed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key inquiry logic;
the querying of the corresponding encrypted secure access key based on the access key ID includes:
constructing an intelligent contract calling transaction; wherein the smart contract invocation transaction includes the access key ID;
issuing the smart contract invocation transaction to a blockchain network to invoke the key query logic in the smart contract in response to the smart contract invocation transaction by a node device in the blockchain network to query a corresponding cryptographically processed secure access key based on the access key ID.
In yet another illustrated embodiment, the secure access key and the corresponding access key ID are stored in an account storage space of a contract account to which the smart contract corresponds;
the querying of the corresponding encrypted secure access key based on the access key ID includes:
and inquiring a corresponding encrypted secure access key in the account storage space of the contract account corresponding to the intelligent contract based on the access key ID.
In yet another illustrated embodiment, the processing logic corresponding to the contract code in the intelligent contract further comprises digital signature verification logic;
the decrypting the secure access key based on the private key of the service caller and verifying the first digital signature based on the decrypted secure access key include:
and after inquiring a corresponding encrypted security access key based on the access key ID, further calling the digital signature verification logic in the intelligent contract, decrypting the security access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted security access key.
In yet another illustrated embodiment, the verifying the first digital signature based on the decrypted secure access key includes:
performing digital signature on the request parameter based on the decrypted secure access key to obtain a second digital signature;
determining whether the first digital signature and the second digital signature match; if so, determining that the first digital signature is verified.
In yet another illustrative embodiment, prior to further invoking the key query logic in the smart contract, further comprising:
verifying whether the sender of the smart contract invocation transaction is a service provider; if so, further invoking the key query logic in the smart contract.
In yet another illustrated embodiment, the smart contract invocation transaction further includes an identification ID of the service provider; the verifying whether the sender of the smart contract invocation transaction is the service provider comprises:
inquiring whether the identification ID of the service provider belongs to a key inquiry authority white list stored in the intelligent contract;
if so, the smart contract invokes the sender of the transaction as the service provider.
Accordingly, one or more embodiments of the present specification further provide a blockchain-based service request method for a service caller to send a service request to a service provider, including:
the service caller generates a secure access key and a corresponding access key ID, and encrypts the secure access key based on a public key of the service provider;
sending the encrypted secure access key and the access key ID to the block chain, so that the encrypted secure access key and the access key ID are identified and verified by the node equipment of the block chain and then stored in the block chain;
sending a service request to the service provider; the service request comprises request parameters, the access key ID and a first digital signature obtained by carrying out digital signature processing on the request parameters based on the secure access key, so that the service caller inquires a corresponding encrypted secure access key based on the access key ID, decrypts the secure access key based on a private key of the service caller, verifies the first digital signature based on the decrypted secure access key, and executes the service request based on the request parameters when the first digital signature is verified.
In yet another illustrated embodiment, a smart contract for managing security access keys is deployed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key issuing logic;
the sending the encrypted secure access key and the access key ID to the blockchain so that the encrypted secure access key and the access key ID are identified and verified by the node devices of the blockchain and then stored in the blockchain includes:
constructing a key issuing invoking transaction, wherein the key issuing invoking transaction comprises the encrypted security access key and the access key ID;
and issuing the key issuing call transaction to a blockchain network, so that node equipment in the blockchain network responds to the key issuing call transaction to invoke the key issuing logic in the intelligent contract, and storing the encrypted security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
In yet another illustrated embodiment, the storing the encrypted and corresponding access key ID in the account storage space of the contract account corresponding to the smart contract includes:
inquiring whether the access key ID is matched with an existing access key ID stored in the account storage space;
and if not, storing the security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
Correspondingly, the present specification also provides a service request device based on a blockchain, where the blockchain stores a secure access key generated by a service caller and a corresponding access key ID; the safe access key stored in the blockchain is encrypted in advance based on a public key of a service provider; the device is applied to the service provider and comprises:
the receiving unit is used for receiving the service request sent by the service calling party; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on the request parameters based on the secure access key;
the inquiring unit inquires a corresponding encrypted security access key based on the access key ID;
the verification unit is used for decrypting the security access key based on a private key of the service calling party and verifying the first digital signature based on the decrypted security access key;
an execution unit to execute the service request based on the request parameter when the first digital signature is verified.
In yet another illustrated embodiment, a smart contract for managing security access keys is deployed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key inquiry logic;
the query unit is further configured to:
constructing an intelligent contract calling transaction; wherein the smart contract invocation transaction includes the access key ID;
issuing the smart contract invocation transaction to a blockchain network to invoke the key query logic in the smart contract in response to the smart contract invocation transaction by a node device in the blockchain network to query a corresponding cryptographically processed secure access key based on the access key ID.
In yet another illustrated embodiment, the secure access key and the corresponding access key ID are stored in an account storage space of a contract account to which the smart contract corresponds;
the querying of the corresponding encrypted secure access key based on the access key ID includes:
and inquiring a corresponding encrypted secure access key in the account storage space of the contract account corresponding to the intelligent contract based on the access key ID.
In yet another illustrated embodiment, the processing logic corresponding to the contract code in the intelligent contract further comprises digital signature verification logic;
the verification unit is further configured to:
and after inquiring a corresponding encrypted security access key based on the access key ID, further calling the digital signature verification logic in the intelligent contract, decrypting the security access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted security access key.
In yet another illustrated embodiment, the verifying the first digital signature based on the decrypted secure access key includes:
performing digital signature on the request parameter based on the decrypted secure access key to obtain a second digital signature;
determining whether the first digital signature and the second digital signature match; if so, determining that the first digital signature is verified.
In a further illustrated embodiment, prior to further invoking the key lookup logic in the smart contract, the validation unit is further configured to:
verifying whether the sender of the smart contract invocation transaction is a service provider; if so, further invoking the key query logic in the smart contract.
In yet another illustrated embodiment, the smart contract invocation transaction further includes an identification ID of the service provider; the verifying whether the sender of the smart contract invocation transaction is the service provider comprises:
inquiring whether the identification ID of the service provider belongs to a key inquiry authority white list stored in the intelligent contract;
if so, the smart contract invokes the sender of the transaction as the service provider.
Accordingly, the present specification also provides a block chain-based service request apparatus for a service caller to send a service request to a service provider, the apparatus being applied to the service caller, and including:
a generation unit that generates a secure access key and a corresponding access key ID, and encrypts the secure access key based on a public key of the service provider;
a sending unit, configured to send the encrypted secure access key and the access key ID to the block chain, so that the encrypted secure access key and the access key ID are identified and verified by the node device of the block chain and then stored in the block chain;
the sending unit is further configured to: sending a service request to the service provider; the service request comprises request parameters, the access key ID and a first digital signature obtained by carrying out digital signature processing on the request parameters based on the secure access key, so that the service caller inquires a corresponding encrypted secure access key based on the access key ID, decrypts the secure access key based on a private key of the service caller, verifies the first digital signature based on the decrypted secure access key, and executes the service request based on the request parameters when the first digital signature is verified.
In yet another illustrated embodiment, a smart contract for managing security access keys is deployed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key issuing logic;
the sending unit is further configured to:
constructing a key issuing invoking transaction, wherein the key issuing invoking transaction comprises the encrypted security access key and the access key ID;
and issuing the key issuing call transaction to a blockchain network, so that node equipment in the blockchain network responds to the key issuing call transaction to invoke the key issuing logic in the intelligent contract, and storing the encrypted security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
In yet another illustrated embodiment, the storing the encrypted and corresponding access key ID in the account storage space of the contract account corresponding to the smart contract includes:
inquiring whether the access key ID is matched with an existing access key ID stored in the account storage space;
and if not, storing the security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
Accordingly, this specification also provides a computer device comprising: a memory and a processor; the memory having stored thereon a computer program executable by the processor; the processor executes the computer program to perform the service request method based on the block chain executed by the service provider according to the embodiments.
The present specification also provides a computer device comprising: a memory and a processor; the memory having stored thereon a computer program executable by the processor; when the computer program is executed, the processor executes the service request method based on the block chain executed by the service caller according to the embodiments.
Accordingly, the present specification also provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, performs the blockchain-based service request method performed by the service provider according to the embodiments described above.
The present specification also provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, executes the blockchain-based service request method executed by a service caller according to the embodiments described above.
In the service request method, device, computer device, or computer-readable storage medium based on the block chain provided in each embodiment of the present specification, a secure access key and an access key ID corresponding to a service caller are stored in the block chain, and based on a tamper-resistant mechanism of the block chain, the secure access key is effectively prevented from being tampered, and the security of the secure access key is ensured; moreover, since the secure access key stored in the blockchain is encrypted in advance based on the public key of the service provider, only the service provider holding the private key can decrypt the secure access key, thereby ensuring the privacy of the secure access key corresponding to the service caller.
Drawings
FIG. 1 is a schematic diagram of creating an intelligent contract provided by an exemplary embodiment;
FIG. 2 is a schematic diagram of a calling smart contract provided by an exemplary embodiment;
FIG. 3 is a schematic diagram of creating an intelligent contract and invoking an intelligent contract provided by an exemplary embodiment;
FIG. 4 is a flowchart illustrating a block chain based service request method according to an exemplary embodiment;
FIG. 5 is a schematic diagram of a blockchain-based service request device applied to a service provider according to an exemplary embodiment;
FIG. 6 is a block chain based service request mechanism applied to a service caller according to an exemplary embodiment;
fig. 7 is a hardware block diagram for implementing an embodiment of a block chain based service request apparatus provided in the present specification.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims which follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the methods may include more or less steps than those described herein. Moreover, a single step described in this specification may be divided into multiple steps for description in other embodiments; however, in other embodiments, multiple steps described in this specification may be combined into a single step for description.
The service provider is an operator providing specific service content for the service invoker, and the service invoker is a client providing a service request to the service provider based on self requirements. When receiving a specific service invocation request sent by a service invoker, a service provider needs to verify the identity of the service invoker.
The identity authentication of the service request sent by the service caller based on the access key ID and the access key pair (generally referred to as AK/SK pair) is one of the common API authentication methods in public cloud. The access key ID and the access key pair corresponding to the service invoker are usually generated and distributed by the service provider, on one hand, the service provider needs a centralized database system to store and maintain the access key ID and the access key pair, and the centralized database system may be maliciously modified, which may result in that the service invoker cannot pass identity authentication; on the other hand, the access key ID and the access key pair are generated by a service provider, and generally need to be transmitted to a service caller in a network through https or the like, and the access key ID and the access key pair may be intercepted during transmission, which brings a risk to the identity authentication of the service caller.
In view of the above, one or more embodiments of the present specification provide a blockchain-based service request method for a service invoker to send a service request to a service provider.
The block chain network according to one or more embodiments of the present disclosure may specifically refer to a P2P network system having a distributed data storage structure, where each node device achieves data sharing via a common knowledge mechanism, and data in the block chain is distributed in temporally consecutive "blocks" (where a latter block may contain a data digest of a former block, and a full backup of data of all or part of nodes is achieved according to different common knowledge mechanisms (e.g., POW, POS, DPOS, PBFT, etc.).
The real data generated by the physical world can be constructed into a standard transaction (transaction) format supported by a block chain, then is issued to the block chain, the node equipment in the block chain performs consensus processing on the received transaction, and after the consensus is achieved, the node equipment serving as an accounting node in the block chain packs the transaction into a block and performs persistent evidence storage in the block chain.
The consensus algorithm supported in the blockchain may include:
the first kind of consensus algorithm, namely the consensus algorithm that the node device needs to contend for the accounting right of each round of accounting period; consensus algorithms such as Proof of Work (POW), Proof of equity (POS), Proof of commission rights (DPOS), etc.;
the second kind of consensus algorithm, namely the consensus algorithm which elects accounting nodes in advance for each accounting period (without competing for accounting right); for example, a consensus algorithm such as a Practical Byzantine Fault Tolerance (PBFT) is used.
In a blockchain network employing a first type of consensus algorithm, node devices competing for billing rights can execute a transaction upon receipt. One of the node devices competing for the accounting right may win in the process of competing for the accounting right in the current round, and become an accounting node. The accounting node may package the received transaction with other transactions to generate a latest block and send the generated latest block or a block header of the latest block to other node devices for consensus.
In the block chain network adopting the second type of consensus algorithm, the node equipment with the accounting right is agreed before accounting in the current round. Thus, the node device, after receiving the transaction, may send the transaction to the accounting node if it is not the accounting node of its own round. For the accounting node of the current round, the transaction may be performed during or before packaging the transaction with other transactions to generate the latest block. After generating the latest block, the accounting node may send the latest block or a block header of the latest block to other node devices for consensus.
As described above, regardless of which consensus algorithm is adopted by the blockchain, the accounting node of the current round may pack the received transaction to generate the latest block, and send the generated latest block or the block header of the latest block to other node devices for consensus verification. If no problem is verified after other node equipment receives the latest block or the block header of the latest block, the latest block can be added to the tail of the original block chain, so that the accounting process of the block chain is completed. The transaction contained in the block may also be performed by other nodes in verifying the new block or block header sent by the accounting node.
As is well known to those skilled in the art, since the blockchain network system operates under a corresponding consensus mechanism, data that has been recorded in the blockchain database is difficult to be tampered with by any node, for example, a blockchain with Pow consensus is adopted, and it is possible to tamper with existing data only by an attack that requires at least 51% of effort over the entire network, so the blockchain system has characteristics of ensuring data security and preventing tampering against attacks, which are incomparable with other centralized database systems. Therefore, the data recorded in the distributed database of the blockchain cannot be attacked or tampered, and the authenticity and reliability of the data information of the distributed database of the blockchain are guaranteed.
Example types of blockchain networks may include public blockchain networks, private blockchain networks, and federation blockchain networks. Although the term blockchain is typically associated with bitcoin cryptocurrency networks, blockchains as used herein may refer to DLS (distributed ledger system) that do not reference any particular use case.
In a public blockchain network, the consensus process is controlled by nodes of the consensus network. For example, hundreds, thousands, or even millions of entities may cooperate in a public blockchain network, each entity operating at least one node in the public blockchain network. Thus, a public blockchain network may be considered a public network with respect to participating entities. Example public blockchain networks include bitcoin networks, which are peer-to-peer payment networks. Bitcoin networks utilize a distributed ledger, called blockchains. However, as noted above, the term blockchain is generally used to refer to distributed ledgers that do not specifically refer to bitcoin networks.
Typically, public blockchain networks support public transactions. The public transaction is shared with all nodes within the public blockchain network and stored in the global blockchain. A global blockchain is a chain of blocks that is replicated across all nodes. That is, for a global blockchain, all nodes are in a completely consistent state. To achieve consensus (e.g., agree to add blocks to a blockchain), a consensus protocol is implemented within a public blockchain network. Example consensus protocols include, but are not limited to, proof of work (POW) implemented in bitcoin networks.
Typically, a private blockchain network is provided for a particular entity that centrally controls read and write permissions. The entity controls which nodes can participate in the blockchain network. Thus, private blockchain networks are often referred to as licensed networks, which impose restrictions on who is allowed to participate in the network and its level of participation (e.g., only in certain transactions). Various types of access control mechanisms may be used (e.g., existing participants vote to add a new entity, and regulatory authorities may control admission).
Typically, a federated blockchain network is private among the participating entities. In a federated blockchain network, the consensus process is controlled by an authorized set of nodes (federation member nodes), one or more of which are operated by respective entities (e.g., enterprises). For example, a federation consisting of ten (10) entities (e.g., enterprises) may operate a federated blockchain network in which each entity operates at least one node. Thus, a federated blockchain network may be considered a private network in terms of participating entities. In some examples, each entity (node) must sign each block to validate the block and add the validated block to the blockchain. In some examples, at least a subset of the entities (nodes) (e.g., at least 7 entities) must sign each block to validate the block and add the validated block to the blockchain.
It is contemplated that the embodiments provided herein can be implemented in any suitable type of blockchain network.
In practical applications, whether public, private, or alliance, it is possible to provide the functionality of a Smart contract (Smart contract). An intelligent contract on a blockchain is a contract on a blockchain that can be executed triggered by a transaction. An intelligent contract may be defined in the form of code.
Taking an Etherhouse as an example, a user is supported to create and call some complex logic in the Etherhouse network. The ethernet workshop is used as a programmable block chain, and the core of the ethernet workshop is an ethernet workshop virtual machine (EVM), and each ethernet workshop node can run the EVM. The EVM is a well-behaved virtual machine through which various complex logic can be implemented. The user issuing and invoking smart contracts in the etherhouse is running on the EVM. In fact, the EVM directly runs virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"), so the intelligent contract deployed on the blockchain may be bytecode.
After Bob sends a Transaction (Transaction) containing information to create a smart contract to the ethernet network, each node can execute the Transaction in the EVM, as shown in fig. 1. The From field of the transaction in the figure is used for recording the address of the account initiating the creation of the intelligent contract, the contract code stored in the field value of the Data field of the transaction can be byte code, and the field value of the To field of the transaction is a null account. After the nodes reach the agreement through the consensus mechanism, the intelligent contract is successfully created, and the follow-up user can call the intelligent contract.
After the intelligent contract is established, a contract account corresponding to the intelligent contract appears on the block chain, and the block chain has a specific address; for example, "0 x68e12cf284 …" in each node in fig. 1 represents the address of the contract account created; the contract Code (Code) and account store (Storage) will be maintained in the account store for that contract account. The behavior of the intelligent contract is controlled by the contract code, while the account storage of the intelligent contract preserves the state of the contract. In other words, the intelligent contract causes a virtual account to be generated on the blockchain that contains the contract code and account storage.
As mentioned above, the Data field containing the transaction that created the intelligent contract may hold the byte code of the intelligent contract. A bytecode consists of a series of bytes, each of which can identify an operation. Based on the multiple considerations of development efficiency, readability and the like, a developer can select a high-level language to write intelligent contract codes instead of directly writing byte codes. For example, the high-level language may employ a language such as Solidity, Serpent, LLL, and the like. For intelligent contract code written in a high-level language, the intelligent contract code can be compiled by a compiler to generate byte codes which can be deployed on a blockchain.
Taking the Solidity language as an example, the contract code written by it is very similar to a Class (Class) in the object-oriented programming language, and various members including state variables, functions, function modifiers, events, etc. can be declared in one contract. A state variable is a value permanently stored in an account Storage (Storage) field of an intelligent contract to save the state of the contract.
As shown in FIG. 2, still taking the Etherhouse as an example, after Bob sends a transaction containing the information of the calling intelligent contract to the Etherhouse network, each node can execute the transaction in the EVM. The From field of the transaction in the figure is used for recording the address of the account initiating the intelligent contract calling, the To field is used for recording the address of the intelligent contract called, and the Data field of the transaction is used for recording the method and the parameters for calling the intelligent contract. After invoking the smart contract, the account status of the contract account may change. Subsequently, a certain client can check the account status of the contract account through the accessed block chain node.
The intelligent contract can be independently executed at each node in the blockchain network in a specified mode, and all execution records and data are stored on the blockchain, so that after the transaction is executed, transaction certificates which cannot be tampered and lost are stored on the blockchain.
A schematic diagram of creating an intelligent contract and invoking the intelligent contract is shown in fig. 3. An intelligent contract is created in an Ethernet workshop and needs to be subjected to the processes of compiling the intelligent contract, changing the intelligent contract into byte codes, deploying the intelligent contract to a block chain and the like. The intelligent contract is called in the Ethernet workshop, a transaction pointing to the intelligent contract address is initiated, the EVM of each node can respectively execute the transaction, and the intelligent contract code is distributed and operated in the virtual machine of each node in the Ethernet workshop network.
In one or more embodiments provided in this specification, the terminal device corresponding to the service caller or the service provider may be a node device of the blockchain network according to each embodiment; the system may also be a blockchain client connected to the node device in the blockchain network, or may also be a linked terminal device or a server connected to the node device in the blockchain network, and the system may transmit data to the blockchain or obtain data from the blockchain by communicating with the node device in the blockchain network. For the sake of simplicity, in the following description, a "service caller" represents an offline terminal used by the service caller, or a terminal device such as a service caller node device or a service caller blockchain client, and a "service provider" represents an offline server terminal used by the service provider, or a terminal device such as a service provider node device or a service provider blockchain client, and executes the service request method based on the blockchain according to each embodiment.
Fig. 4 illustrates the flow steps of a service request method based on a block chain according to an exemplary embodiment of the present specification, including:
at step 402, the service invoker generates a secure access key and a corresponding access key ID.
In the embodiment, the access key ID and the secure access key pair (i.e., AK/SK pair) can be locally generated by the service caller, so that the risk that the secure access key is leaked or tampered in the conventional manner due to the fact that the access key ID and the secure access key pair (i.e., AK/SK pair) are generated and transmitted by the service provider is avoided.
In step 404, the service caller encrypts the secure access key based on the public key of the service provider.
The service provider may generate a public key-private key pair (public key-secrekey pair) based on an asymmetric encryption algorithm, and publish the public key thereof, where a specific publishing manner is not limited to receiving an identity certificate transmitted by the service provider when each service caller runs a service registration program, or publishing the public key as public information, and the like. The service invoker may Encrypt the secure access key SK it generates, such as generating Encrypt _ SK, using the public key of the service provider.
The asymmetric encryption algorithm used by the service provider to generate the public-private key pair is not limited in the various embodiments of the present description, and for example, an RSA algorithm, an ECC algorithm, or the like may be used.
Step 406, the service caller sends the encrypted secure access key and the access key ID to the block chain, so that the encrypted secure access key and the access key ID are identified and verified by the node devices of the block chain and then stored in the block chain.
When the service caller directly acts as the node device of the blockchain system, the service caller may pack the encrypted secure access key (Encrypt _ SK) and the corresponding access key id (ak) into a transaction format, and then broadcast the transaction to the node device of the blockchain, so that the transaction is identified and verified by the node device of the blockchain and then stored in the blockchain. When the service caller is not directly used as the node device of the blockchain system but as a terminal device in communication connection with the node device, the encrypted secure access key (Encrypt _ SK) and the corresponding access key id (AK) may be transmitted to the node device of the blockchain system, and the Encrypt _ SK and the AK are packaged by the node device into a transaction format upload blockchain. As mentioned above, the common consensus algorithm in the blockchain is briefly described, and the consensus algorithm in the blockchain network is not limited herein.
In this embodiment, the service caller stores the encrypted secure access key (Encrypt _ SK) and the corresponding access key id (AK) in a blockchain, and based on a tamper-resistant mechanism of the blockchain, the Encrypt _ SK and the corresponding AK can be effectively prevented from being tampered; and the safe access key SK of the service calling party is stored in the block chain in an encrypted state, so that the privacy of the safe access key SK is further protected, and the safety of calling the service by the service calling party is improved.
In an account-mode blockchain network system (e.g., ethernet blockchain, hyper-leader, etc.), the storage space of the blockchain includes, in addition to BLOCKS (BLOCKS), storage spaces corresponding to account models such as user accounts and smart contract accounts. Therefore, the storing of Encrypt _ SK and the corresponding access key ID in the block chain according to this embodiment may include storing Encrypt _ SK and the corresponding access key ID in a Block (BLOCKS) of the block chain, and may also include storing Encrypt _ SK and the corresponding access key ID in a storage space corresponding to an account model, for example, a storage space of a smart contract account.
In yet another illustrative embodiment, a smart contract for managing a security access key is deployed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key issuing logic; the foregoing process of sending the encrypted secure access key and the access key ID to the block chain, so that the encrypted secure access key and the access key ID are identified and verified by the node device of the block chain and then stored in the block chain may specifically include the following steps:
the service caller constructs a key issuing call transaction, wherein the key issuing call transaction comprises the encrypted secure access key (Encrypt _ SK) and the access key id (ak);
issuing the key issuance call transaction to a blockchain network to invoke the key issuance logic in the smart contract by a node device in the blockchain network in response to the key issuance call transaction, storing the secure access key (Encrypt _ SK) and a corresponding access key id (ak) in an account storage space of a contract account corresponding to the smart contract.
The key issuing call transaction may further include a blockchain address of the smart contract, a function name of the key issuing logic, interface information, and the like; the calling process of the intelligent contract has been discussed in detail before this specification, and is not described in detail herein. Compared with the implementation mode that only the Encrypt _ SK and the corresponding AK are stored in the Block (BLOCKS) in the form of transaction, the Encrypt _ SK and the corresponding AK are stored in the storage space of the contract account through the intelligent contract, and the service provider can manage the security access keys of a plurality of service invokers more conveniently. The service provider can be used as the issuing party of the intelligent contract, and the corresponding key management mode is completed by setting the corresponding key issuing logic for the intelligent contract.
In yet another illustrated embodiment, the specific process of storing the secure access key and the corresponding access key ID in the account storage space of the contract account corresponding to the smart contract, which is declared by the key issuing logic, may include:
inquiring whether the access key ID is matched with an existing access key ID stored in the account storage space;
if yes, sending out a key issuing failure prompt;
and if not, storing the security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
In a blockchain network system based on an account model, such as an ether house blockchain system, a transaction tree and a receipt tree corresponding to a block are maintained locally at a node device (in the ether house blockchain system, a status tree corresponding to an account global status is also maintained locally at the node device). The result of the smart contract running the key issuing logic (including a key issuing failure prompt, a key storage success prompt, a key storage address, or the like) is written into a transaction log of the blockchain, and the transaction log or an encoded value of the transaction log may be recorded in a receipt tree (recipes tree) of the blockchain. The service invoker can obtain the result of the key issuing logic recorded in the transaction log by monitoring the receipt tree of the block chain.
Through the processing process, the access key ID (AK) generated by the service calling party can be effectively prevented from being repeated, if a plurality of service calling parties generate the same access key ID or the access key IDs generated by one service calling party for multiple times are the same, each access key ID is ensured to only uniquely correspond to one service calling party, and therefore key management and identity authentication are facilitated.
Step 408, the service caller sends a service request to the service provider; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on the request parameters based on the security access key.
The request parameters sent by the service caller may include one or more of request service content parameters, or service type parameters, or call interfaces, etc. to facilitate the service provider to execute the service request based on the request parameters.
It should be noted that the first digital signature is obtained by the service caller digitally signing at least the request parameter based on the security access key thereof, and those skilled in the art may also obtain the first digital signature by digitally signing the request parameter and other technical or business parameters in the process from the technical or business requirements, which is not limited herein.
Step 410, the service provider receives the service request sent by the service caller.
In step 412, the service provider queries the corresponding encrypted secure access key based on the access key ID.
The specific process of the service provider querying the corresponding encrypted secure access key based on the access key ID is different based on the difference between the access key ID and the space where the encrypted secure access key is stored.
In an illustrated embodiment, when the access key ID and the encrypted secure access key are stored in a blockchain (including a block or account storage space maintained locally by a node device), the service provider may act as or connect to a node device of the blockchain, and may query the access key ID and the encrypted secure access key pair based on the access key ID and a storage address (e.g., Txhash) of the encrypted secure access key.
In yet another illustrated embodiment, when a smart contract for managing a secure access key is deployed on the blockchain network, the access key ID and the encrypted secure access key are stored in the blockchain by invoking the smart contract with the key issuance invocation transaction according to the above-described embodiment (including a block or an account space locally maintained by a node device, such as an account space of the smart contract), and the execution result of the key issuance invocation transaction may include the access key ID and an encrypted secure access key address (such as a transaction hash value or a smart contract address); the processing logic corresponding to the contract code in the intelligent contract may include a key inquiry logic; accordingly, the specific process for querying the corresponding encrypted secure access key based on the access key ID may include the following steps:
constructing an intelligent contract calling transaction; wherein the smart contract invocation transaction includes the access key ID;
issuing the smart contract invocation transaction to a blockchain network to invoke the key query logic in the smart contract in response to the smart contract invocation transaction by a node device in the blockchain network to query a corresponding cryptographically processed secure access key based on the access key ID.
In a blockchain network system based on an account model, such as an ether house blockchain system, a transaction tree and a receipt tree corresponding to a block are maintained locally at a node device (in the ether house blockchain system, a status tree corresponding to an account global status is also maintained locally at the node device). The result of the smart contract executing the key inquiry logic is stored in a transaction log corresponding to the smart contract invocation transaction, and the transaction log (which may be encoded by a predetermined code such as rlp) is stored in a receipt tree (recipes tree) in the form of a transaction receipt. The service provider can obtain the result that the intelligent contract inquires the corresponding encrypted security access key based on the access key ID by monitoring a locally maintained receipt tree.
In yet another illustrated embodiment, when the access key ID and the encrypted secure access key are stored in the account storage space of the smart contract for managing the secure access key, that is, when the access key ID and the encrypted secure access key are stored in the account storage space of the smart contract by executing the key issuing logic based on the key issuing invoking transaction sent by the service caller, the processing logic corresponding to the contract code in the smart contract may further include key inquiry logic in addition to the key issuing logic; accordingly, the specific process for querying the corresponding encrypted secure access key based on the access key ID may include the following steps:
constructing an intelligent contract calling transaction; wherein the smart contract invocation transaction includes the access key ID;
issuing the smart contract invocation transaction to a blockchain network to invoke the key query logic in the smart contract in response to the smart contract invocation transaction by a node device in the blockchain network, and querying a corresponding encrypted secure access key in an account storage space of a contract account corresponding to the smart contract based on the access key ID.
The smart contract invocation transaction may include a function name and an interface address corresponding to the key lookup logic to complete the invocation of the key lookup logic.
In a blockchain network system based on an account model, such as an ether house blockchain system, a transaction tree and a receipt tree corresponding to a block are maintained locally at a node device (in the ether house blockchain system, a status tree corresponding to an account global status is also maintained locally at the node device). The result of the smart contract executing the key inquiry logic in the storage space of the contract account is stored in a transaction log corresponding to the smart contract invocation transaction, and the transaction log (which may be encoded by a preset code such as rlp) is stored in a receipt tree (recipes tree) in the form of a transaction receipt. The service provider can obtain the result that the intelligent contract inquires the corresponding encrypted security access key based on the access key ID by monitoring a locally maintained receipt tree.
Step 414, the service provider decrypts the secure access key based on the private key of the service caller, and verifies the first digital signature based on the decrypted secure access key.
After the service provider acquires the security access key corresponding to the service caller, the service provider can decrypt the security access key corresponding to the service caller locally at the terminal of the service provider, and verify the first digital signature based on the decrypted security access key. There are various methods for verifying the first digital signature, and in an illustrated embodiment, the process of verifying the first digital signature based on the decrypted secure access key may specifically include the following steps:
performing digital signature on the request parameter based on the decrypted secure access key to obtain a second digital signature;
determining whether the first digital signature and the second digital signature match; if so, determining that the first digital signature is verified.
The above-mentioned process of decrypting the security access key based on the private key of the service invoker and verifying the first digital signature based on the decrypted security access key may also be performed by invoking a transaction by the smart contract to further invoke the digital signature verification logic of the smart contract. Specifically, the processing logic corresponding to the contract code in the intelligent contract further includes digital signature verification logic; the smart contract invocation transaction may further include a function name and an interface address corresponding to the digital signature verification logic to complete the invocation of the digital signature verification logic.
The decrypting the secure access key based on the private key of the service caller and verifying the first digital signature based on the decrypted secure access key include: and after inquiring a corresponding encrypted security access key based on the access key ID, further calling the digital signature verification logic in the intelligent contract, decrypting the security access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted security access key.
It should be noted that, since the private key of the service provider is important data related to the privacy of the service provider and the security of the service information, the smart contract is usually required to execute the above-mentioned process of decrypting the secure access key based on the private key of the service caller and verifying the first digital signature based on the decrypted secure access key in a secure computing environment. Deploying the private key of the service provider and the logic code of the smart contract in a Trusted Execution Environment (TEE) may enable secure and private decryption of the secure access key and verification of the first digital signature.
When the first digital signature is verified, the service provider executes the service request based on the request parameters, step 416.
Because the node devices on the blockchain can initiate a calling transaction to the intelligent contract deployed on the blockchain, further, in order to standardize the security access key management of the service caller and prevent malicious attack on the intelligent contract, the intelligent contract can also set an authority control logic to limit the key inquiry logic to be executable only by the caller of the service provider. In an illustrative embodiment, prior to further invoking the key query logic in the smart contract, the smart contract executable processing logic further includes: verifying whether a sender of the intelligent contract invoking transaction is the service provider; if so, further invoking the key query logic in the smart contract.
There are various specific ways of verifying whether the sender of the smart contract invocation transaction is the service provider, and in an illustrated embodiment, the smart contract invocation transaction further includes an identification ID of the service provider; the verifying whether the sender of the smart contract invocation transaction is the service provider comprises: inquiring whether the identification ID of the service provider belongs to a key inquiry authority white list stored in the intelligent contract; if so, the sender of the verification transaction is the service provider.
The intelligent contract declares a series of executable program code that may be executed on the EVM of the block-linked node device. Because the intelligent contract is deployed to the block chain, any change or change of the intelligent contract is traceable on the block chain, so that the block chain network has lower human intervention risk and decentralized authority characteristics, node devices of the block chain network can accurately execute and achieve a consensus execution result, and compared with a centralized executable program provided by a service provider which can be subjected to human intervention, a more fair, fair and accurate execution result can be obtained by calling key inquiry or electronic signature verification executed by the intelligent contract.
Corresponding to the above flow implementation, the embodiments of the present specification further provide service request devices 50 and 60 based on block chains. The means 50 and 60 may be implemented by software, by hardware or by a combination of both. Taking a software implementation as an example, the logical device is formed by reading a corresponding computer program instruction into a memory for running through a Central Processing Unit (CPU) of the device. In terms of hardware, the device in which the apparatus is located generally includes other hardware such as a chip for transmitting and receiving wireless signals and/or other hardware such as a board for implementing a network communication function, in addition to the CPU, the memory, and the storage shown in fig. 7.
As shown in fig. 5, the present specification further provides a service request apparatus 50 based on a blockchain, where the blockchain stores a secure access key and a corresponding access key ID generated by a service caller; the safe access key stored in the blockchain is encrypted in advance based on a public key of a service provider; the device 50 is applied to the service provider and comprises:
a receiving unit 502, configured to receive a service request sent by the service invoker; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on the request parameters based on the secure access key;
an inquiring unit 504 that inquires a corresponding encrypted secure access key based on the access key ID;
a verification unit 506 that decrypts the secure access key based on a private key of the service caller, and verifies the first digital signature based on the decrypted secure access key;
an execution unit 508, executing the service request based on the request parameter when the first digital signature is verified.
In yet another illustrated embodiment, a smart contract for managing security access keys is deployed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key inquiry logic;
the querying unit 504 is further configured to:
constructing an intelligent contract calling transaction; wherein the smart contract invocation transaction includes the access key ID;
issuing the smart contract invocation transaction to a blockchain network to invoke the key query logic in the smart contract in response to the smart contract invocation transaction by a node device in the blockchain network to query a corresponding cryptographically processed secure access key based on the access key ID.
In yet another illustrated embodiment, the secure access key and the corresponding access key ID are stored in an account storage space of a contract account to which the smart contract corresponds;
the querying of the corresponding encrypted secure access key based on the access key ID includes:
and inquiring a corresponding encrypted secure access key in the account storage space of the contract account corresponding to the intelligent contract based on the access key ID.
In yet another illustrated embodiment, the processing logic corresponding to the contract code in the intelligent contract further comprises digital signature verification logic;
the verification unit 506 is further configured to:
and after inquiring a corresponding encrypted security access key based on the access key ID, further calling the digital signature verification logic in the intelligent contract, decrypting the security access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted security access key.
In yet another illustrated embodiment, the verifying the first digital signature based on the decrypted secure access key includes:
performing digital signature on the request parameter based on the decrypted secure access key to obtain a second digital signature;
determining whether the first digital signature and the second digital signature match; if so, determining that the first digital signature is verified.
In yet another illustrated embodiment, before further invoking the key query logic in the smart contract, the verification unit 506 is further configured to:
verifying whether the sender of the smart contract invocation transaction is a service provider; if so, further invoking the key query logic in the smart contract.
In yet another illustrated embodiment, the smart contract invocation transaction further includes an identification ID of the service provider; the verifying whether the sender of the smart contract invocation transaction is the service provider comprises:
inquiring whether the identification ID of the service provider belongs to a key inquiry authority white list stored in the intelligent contract;
if so, the smart contract invokes the sender of the transaction as the service provider.
The implementation process of the functions and actions of each unit in the apparatus 50 is specifically described in the implementation process of the corresponding step in the service request method based on the block chain executed by the service provider of the block chain, and related points may be referred to part of the description of the method embodiment, which is not described herein again.
As shown in fig. 6, the present specification further provides a block chain-based service request apparatus 60 for a service caller to send a service request to a service provider, where the apparatus 60 is applied to the service caller, and includes:
a generating unit 602 that generates a secure access key and a corresponding access key ID, and encrypts the secure access key based on a public key of the service provider;
a sending unit 604, configured to send the encrypted secure access key and the access key ID to the block chain, so that the encrypted secure access key and the access key ID are identified and verified by the node devices of the block chain and then stored in the block chain;
the sending unit 604 is further configured to: sending a service request to the service provider; the service request comprises request parameters, the access key ID and a first digital signature obtained by carrying out digital signature processing on the request parameters based on the secure access key, so that the service caller inquires a corresponding encrypted secure access key based on the access key ID, decrypts the secure access key based on a private key of the service caller, verifies the first digital signature based on the decrypted secure access key, and executes the service request based on the request parameters when the first digital signature is verified.
In yet another illustrated embodiment, a smart contract for managing security access keys is deployed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key issuing logic;
the sending unit 602 is further configured to:
constructing a key issuing invoking transaction, wherein the key issuing invoking transaction comprises the encrypted security access key and the access key ID;
and issuing the key issuing call transaction to a blockchain network, so that node equipment in the blockchain network responds to the key issuing call transaction to invoke the key issuing logic in the intelligent contract, and storing the encrypted security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
In yet another illustrated embodiment, the storing the encrypted and corresponding access key ID in the account storage space of the contract account corresponding to the smart contract includes:
inquiring whether the access key ID is matched with an existing access key ID stored in the account storage space;
and if not, storing the security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
The implementation process of the function and the action of each unit in the apparatus 60 is specifically detailed in the implementation process of the corresponding step in the service request method based on the block chain executed by the service caller of the block chain, and related points may be referred to part of the description of the method embodiment, which is not described herein again.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the units or modules can be selected according to actual needs to achieve the purpose of the solution in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
The apparatuses, units and modules described in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
Corresponding to the above method embodiment, the embodiment of the present specification further provides a computer device, as shown in fig. 7, including a memory and a processor. Wherein the memory has stored thereon a computer program executable by the processor; the processor, when executing the stored computer program, performs the steps of the blockchain-based service request method performed by the service provider described above in the embodiments of the present specification. For a detailed description of each step of the block chain based service request method performed by the service provider, please refer to the previous contents, which is not repeated.
Corresponding to the above method embodiment, the embodiment of the present specification further provides a computer device, as shown in fig. 7, including a memory and a processor. Wherein the memory has stored thereon a computer program executable by the processor; the processor, when executing the stored computer program, performs the steps of the block chain based service request method performed by the service invoker in the embodiments of the present specification. For a detailed description of each step of the block chain based service request method executed by the service caller, please refer to the previous contents, which is not repeated.
Corresponding to the above method embodiments, embodiments of the present specification also provide a computer-readable storage medium having stored thereon computer programs, which, when executed by a processor, perform the steps of the blockchain-based service request method performed by the service provider in the embodiments of the present specification. For a detailed description of each step of the block chain based service request method performed by the service provider, please refer to the previous contents, which is not repeated.
Corresponding to the above method embodiments, the embodiments of the present specification further provide a computer-readable storage medium, on which computer programs are stored, which, when executed by a processor, perform the steps of the block chain based service request method performed by the service caller in the embodiments of the present specification. For a detailed description of each step of the block chain based service request method executed by the service caller, please refer to the previous contents, which is not repeated.
The above description is only for the purpose of illustrating the preferred embodiments of the present disclosure and is not to be construed as limiting the present disclosure, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present disclosure are intended to be included within the scope of the present disclosure.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.

Claims (26)

1. A service request method based on a block chain, wherein the block chain stores a security access key generated by a service calling party and a corresponding access key ID; the safety access key is encrypted in advance based on a public key of a service provider; the method is applied to the service provider and comprises the following steps:
receiving a service request sent by the service calling party; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on at least the request parameters based on the secure access key;
inquiring a corresponding encrypted security access key in the block chain based on the access key ID;
decrypting the secure access key and verifying the first digital signature based on the decrypted secure access key;
executing the service request based on the request parameters when the first digital signature is verified.
2. The method of claim 1, the blockchain having disposed thereon a smart contract for managing secure access keys; the processing logic corresponding to the contract code in the intelligent contract comprises a key inquiry logic;
the querying of the corresponding encrypted secure access key based on the access key ID includes:
constructing an intelligent contract calling transaction; wherein the smart contract invocation transaction includes the access key ID;
and calling the key inquiry logic in the intelligent contract to inquire the encrypted security access key corresponding to the access key ID in the block chain.
3. The method of claim 2, wherein the secure access key and the corresponding access key ID are generated based on a key issuance invocation transaction triggered by the service invoker, invoking key issuance logic of the smart contract declaration, and stored in an account storage space of a contract account corresponding to the smart contract;
the querying, in the blockchain, the encrypted secure access key corresponding to the access key ID includes:
and inquiring the encrypted security access key corresponding to the access key ID in the account storage space of the contract account corresponding to the intelligent contract.
4. The method of claim 2 or 3, wherein the processing logic corresponding to contract code in the intelligent contract further comprises digital signature verification logic;
the decrypting the secure access key based on the private key of the service caller and verifying the first digital signature based on the decrypted secure access key include:
and after inquiring a corresponding encrypted security access key based on the access key ID, further calling the digital signature verification logic in the intelligent contract, decrypting the security access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted security access key.
5. The method of claim 1, the verifying the first digital signature based on the decrypted secure access key comprising:
performing digital signature on the request parameter based on the decrypted secure access key to obtain a second digital signature;
determining whether the first digital signature and the second digital signature match; if so, determining that the first digital signature is verified.
6. The method of claim 2 or 3, further comprising, prior to further executing the key lookup logic in the smart contract:
verifying whether the sender of the smart contract invocation transaction is a service provider; if so, further invoking the key query logic in the smart contract.
7. The method of claim 6, the smart contract invocation transaction further comprising an identification ID of the service provider; the verifying whether the sender of the smart contract invocation transaction is the service provider comprises:
inquiring whether the identification ID of the service provider belongs to a key inquiry authority white list stored in the intelligent contract;
if so, the sender of the intelligent contract invocation transaction is confirmed as the service provider.
8. A blockchain-based service request method for a service caller to send a service request to a service provider, the method applied to the service caller, comprising:
generating a secure access key and a corresponding access key ID, and encrypting the secure access key based on a public key of the service provider;
sending the encrypted secure access key and the access key ID to the block chain, so that the encrypted secure access key and the access key ID are identified and verified by the node equipment of the block chain and then stored in the block chain;
sending a service request to the service provider; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on the request parameters based on the security access key.
9. The method of claim 8, the blockchain having disposed thereon a smart contract for managing security access keys; the processing logic corresponding to the contract code in the intelligent contract comprises a key issuing logic;
the sending the encrypted security access key and the access key ID to the blockchain includes:
constructing a key issuing invoking transaction, wherein the key issuing invoking transaction comprises the encrypted security access key and the access key ID;
issuing the key issuance invocation transaction to a blockchain network to invoke, by a node device in the blockchain network, the key issuance logic in the smart contract in response to the key issuance invocation transaction, storing the encrypted secure access key and the corresponding access key ID in the blockchain.
10. The method of claim 9, the storing the cryptographically processed secure access key and corresponding access key ID in the blockchain, comprising:
and storing the encrypted security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
11. The method of claim 10, wherein storing the cryptographically processed secure access key and corresponding access key ID in an account storage space of a contract account corresponding to the smart contract, comprises:
inquiring whether the access key ID is matched with an existing access key ID stored in the account storage space;
and if not, storing the security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
12. A service request device based on a blockchain, wherein the blockchain stores a security access key generated by a service calling party and a corresponding access key ID; the safety access key is encrypted in advance based on a public key of a service provider; the device is applied to the service provider and comprises:
the receiving unit is used for receiving the service request sent by the service calling party; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on at least the request parameters based on the secure access key;
the inquiring unit inquires a corresponding encrypted security access key in the block chain based on the access key ID;
a verification unit that decrypts the secure access key and verifies the first digital signature based on the decrypted secure access key;
an execution unit to execute the service request based on the request parameter when the first digital signature is verified.
13. The apparatus of claim 12, the blockchain having disposed thereon a smart contract for managing secure access keys; the processing logic corresponding to the contract code in the intelligent contract comprises a key inquiry logic;
the query unit is further used for constructing an intelligent contract calling transaction; the intelligent contract invoking transaction comprises the access key ID, the key inquiring logic in the intelligent contract is invoked, and the encrypted security access key corresponding to the access key ID is inquired in the block chain based on the access key ID.
14. The apparatus of claim 13, the secure access key and the corresponding access key ID generated based on a key issuance invocation transaction triggered by the service invoker, invoking key issuance logic of the smart contract claim, and stored in an account storage space of a contract account corresponding to the smart contract;
the querying, in the blockchain, the encrypted secure access key corresponding to the access key ID includes:
and inquiring the encrypted security access key corresponding to the access key ID in the account storage space of the contract account corresponding to the intelligent contract.
15. The apparatus of claim 13 or 14, wherein the processing logic corresponding to contract code in the intelligent contract further comprises digital signature verification logic;
the verification unit is further configured to:
and after inquiring a corresponding encrypted security access key based on the access key ID, further calling the digital signature verification logic in the intelligent contract, decrypting the security access key based on a private key of the service caller, and verifying the first digital signature based on the decrypted security access key.
16. The apparatus of claim 12, the authentication unit, further to:
performing digital signature on the request parameter based on the decrypted secure access key to obtain a second digital signature;
determining whether the first digital signature and the second digital signature match; if so, determining that the first digital signature is verified.
17. The apparatus of claim 13 or 14, the verification unit, prior to further executing the key inquiry logic in the smart contract, further verifying whether a sender of the smart contract invocation transaction is a service provider; if so, further invoking the key query logic in the smart contract.
18. The apparatus of claim 17, the smart contract invocation transaction further including an identification ID of the service provider; the verifying whether the sender of the smart contract invocation transaction is the service provider comprises:
inquiring whether the identification ID of the service provider belongs to a key inquiry authority white list stored in the intelligent contract;
if so, the sender of the intelligent contract invocation transaction is confirmed as the service provider.
19. A blockchain-based service request apparatus for a service caller to send a service request to a service provider, the apparatus being applied to the service caller, comprising:
a generation unit that generates a secure access key and a corresponding access key ID, and encrypts the secure access key based on a public key of the service provider;
a sending unit, configured to send the encrypted secure access key and the access key ID to the block chain, so that the encrypted secure access key and the access key ID are identified and verified by the node device of the block chain and then stored in the block chain;
the sending unit is further used for sending a service request to the service provider; the service request comprises request parameters, the access key ID and a first digital signature obtained by performing digital signature processing on the request parameters based on the security access key.
20. The apparatus of claim 19, a smart contract for managing a secure access key disposed on the blockchain; the processing logic corresponding to the contract code in the intelligent contract comprises a key issuing logic;
the sending unit is further configured to construct a key issuing invocation transaction, where the key issuing invocation transaction includes the encrypted secure access key and the access key ID; and issuing the key issuance invocation transaction to a blockchain network, so that node devices in the blockchain network invoke the key issuance logic in the smart contract in response to the key issuance invocation transaction, and store the encrypted security access key and the corresponding access key ID in the blockchain.
21. The apparatus of claim 20, the storing of the cryptographically processed secure access key and corresponding access key ID in the blockchain, comprising:
and storing the encrypted security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
22. The apparatus of claim 21, the storing the cryptographically processed secure access key and corresponding access key ID in an account storage space of a contract account corresponding to the smart contract, comprising:
inquiring whether the access key ID is matched with an existing access key ID stored in the account storage space;
and if not, storing the security access key and the corresponding access key ID in the account storage space of the contract account corresponding to the intelligent contract.
23. A computer device, comprising: a memory and a processor; the memory having stored thereon a computer program executable by the processor; the processor, when executing the computer program, performs the method of any of claims 1 to 7.
24. A computer device, comprising: a memory and a processor; the memory having stored thereon a computer program executable by the processor; the processor, when executing the computer program, performs the method of any of claims 8 to 11.
25. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
26. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 8 to 11.
CN202011529847.0A 2019-12-31 2019-12-31 Service request method and device based on block chain Active CN112669147B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011529847.0A CN112669147B (en) 2019-12-31 2019-12-31 Service request method and device based on block chain

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911421292.5A CN111127021B (en) 2019-12-31 2019-12-31 Service request method and device based on block chain
CN202011529847.0A CN112669147B (en) 2019-12-31 2019-12-31 Service request method and device based on block chain

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201911421292.5A Division CN111127021B (en) 2019-12-31 2019-12-31 Service request method and device based on block chain

Publications (2)

Publication Number Publication Date
CN112669147A true CN112669147A (en) 2021-04-16
CN112669147B CN112669147B (en) 2023-09-26

Family

ID=70507622

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202011529847.0A Active CN112669147B (en) 2019-12-31 2019-12-31 Service request method and device based on block chain
CN201911421292.5A Active CN111127021B (en) 2019-12-31 2019-12-31 Service request method and device based on block chain

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN201911421292.5A Active CN111127021B (en) 2019-12-31 2019-12-31 Service request method and device based on block chain

Country Status (1)

Country Link
CN (2) CN112669147B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112070500B (en) * 2020-09-20 2022-03-01 中科柏诚科技(北京)股份有限公司 Block chain payment processing method based on digital financial service and cloud computing center
CN113487202B (en) * 2021-07-14 2023-04-07 海南马良师傅网络科技有限公司 Instrument relocation supervision method based on block chain management
CN113676483B (en) * 2021-08-26 2023-04-07 中国联合网络通信集团有限公司 Multi-block chain access management method and system and capacity opening device thereof
CN114722431B (en) * 2022-04-11 2023-05-12 北京神州邦邦技术服务有限公司 Block chain-based method, device and storage medium for monitoring general IT service flow

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108616539A (en) * 2018-05-03 2018-10-02 东莞市翔实信息科技有限公司 A kind of method and system that block chain transaction record accesses
CN109194633A (en) * 2018-08-21 2019-01-11 山东智慧云链网络科技有限公司 Address book backup method and system
CN109660485A (en) * 2017-10-10 2019-04-19 中兴通讯股份有限公司 A kind of authority control method and system based on the transaction of block chain
CN110046996A (en) * 2019-01-18 2019-07-23 阿里巴巴集团控股有限公司 The generation method and device of block chain transaction
US20190294817A1 (en) * 2018-03-26 2019-09-26 Commissariat A L'energie Atomique Et Aux Energies Alternatives Method and system for managing access to personal data by means of a smart contract
CN110599137A (en) * 2019-09-16 2019-12-20 腾讯科技(深圳)有限公司 Electronic bill data processing method and device and computer equipment
CN110602138A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Data processing method and device for block chain network, electronic equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11151553B2 (en) * 2017-03-23 2021-10-19 At&T Intellectual Property I, L.P. Time and geographically restrained blockchain services
CN107464117B (en) * 2017-08-04 2021-06-22 平安科技(深圳)有限公司 Block chain based data management method and block chain system
CN113095822A (en) * 2018-06-27 2021-07-09 创新先进技术有限公司 Intelligent contract calling method and device based on block chain and electronic equipment
CN109144961B (en) * 2018-08-22 2021-09-17 矩阵元技术(深圳)有限公司 Authorization file sharing method and device
CN109361663B (en) * 2018-10-10 2021-05-28 中航信托股份有限公司 Method, system and device for accessing encrypted data
CN109559124B (en) * 2018-12-17 2023-04-18 重庆大学 Cloud data security sharing method based on block chain
CN109509099B (en) * 2018-12-27 2021-02-02 石更箭数据科技(上海)有限公司 Data transaction method and device, computing equipment and storage medium
CN110245117A (en) * 2019-06-13 2019-09-17 南开大学 The credible delet method of data and system on a kind of cloud based on block chain
CN110505210B (en) * 2019-07-22 2021-12-14 福建智恒优水科技有限公司 Intelligent household data asset safe transaction method and device based on block chain

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109660485A (en) * 2017-10-10 2019-04-19 中兴通讯股份有限公司 A kind of authority control method and system based on the transaction of block chain
US20190294817A1 (en) * 2018-03-26 2019-09-26 Commissariat A L'energie Atomique Et Aux Energies Alternatives Method and system for managing access to personal data by means of a smart contract
CN108616539A (en) * 2018-05-03 2018-10-02 东莞市翔实信息科技有限公司 A kind of method and system that block chain transaction record accesses
CN109194633A (en) * 2018-08-21 2019-01-11 山东智慧云链网络科技有限公司 Address book backup method and system
CN110046996A (en) * 2019-01-18 2019-07-23 阿里巴巴集团控股有限公司 The generation method and device of block chain transaction
CN110599137A (en) * 2019-09-16 2019-12-20 腾讯科技(深圳)有限公司 Electronic bill data processing method and device and computer equipment
CN110602138A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Data processing method and device for block chain network, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111127021B (en) 2020-10-30
CN111127021A (en) 2020-05-08
CN112669147B (en) 2023-09-26

Similar Documents

Publication Publication Date Title
CN111475849B (en) Private data query method and device based on blockchain account
CN110580414B (en) Private data query method and device based on block chain account
CN110245506B (en) Intelligent contract management method and device based on block chain and electronic equipment
CN110580413B (en) Private data query method and device based on down-link authorization
CN111241557B (en) Service request method and device based on block chain
CN110580262B (en) Private data query method and device based on intelligent contract
TWI734090B (en) Block chain transaction method and device, and electronic equipment
CN111127021B (en) Service request method and device based on block chain
CN110580412B (en) Permission query configuration method and device based on chain codes
CN110580245B (en) Private data sharing method and device
CN113438289A (en) Block chain data processing method and device based on cloud computing
CN111047450A (en) Method and device for calculating down-link privacy of on-link data
CN113114476B (en) Privacy evidence storing method and device based on contract
CN110580411B (en) Permission query configuration method and device based on intelligent contract
CN111475850B (en) Intelligent contract-based privacy data query method and device
CN110264192B (en) Receipt storage method and node based on transaction type
CN110245947B (en) Receipt storage method and node combining conditional restrictions of transaction and user types
CN113869901B (en) Key generation method, key generation device, computer-readable storage medium and computer equipment
CN113536384B (en) Block chain-based private data mapping method, block chain-based private data mapping device, block chain-based private data mapping medium and electronic equipment
EP4287560A1 (en) Encryption and decryption of transactions of a distributed ledger
CN116308314A (en) Block chain-based point issuing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant