CN114331446B - Method, device, equipment and medium for realizing out-of-chain service of block chain - Google Patents

Method, device, equipment and medium for realizing out-of-chain service of block chain Download PDF

Info

Publication number
CN114331446B
CN114331446B CN202210251193.2A CN202210251193A CN114331446B CN 114331446 B CN114331446 B CN 114331446B CN 202210251193 A CN202210251193 A CN 202210251193A CN 114331446 B CN114331446 B CN 114331446B
Authority
CN
China
Prior art keywords
service
chain
contract
chain service
source
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.)
Active
Application number
CN202210251193.2A
Other languages
Chinese (zh)
Other versions
CN114331446A (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202210251193.2A priority Critical patent/CN114331446B/en
Publication of CN114331446A publication Critical patent/CN114331446A/en
Application granted granted Critical
Publication of CN114331446B publication Critical patent/CN114331446B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The disclosure provides a method, a device, equipment and a medium for realizing out-of-chain service of a block chain, relates to the technical field of computers, and particularly relates to a block chain technology. The method is applied to the block chain node and comprises the following steps: calling a presupposition machine contract to generate an out-of-chain service calling request in the process of executing the service transaction request; processing the out-of-chain service calling request through a preplan contract, selecting and determining a target out-of-chain service source according to out-of-chain service description data recorded in the block chain, and enabling the target out-of-chain service source to respond to the out-of-chain service calling request; acquiring a service result fed back by an off-chain service source through a prediction machine contract; checking a service result according to the out-link service description data of the target out-link service source; and responding the verified service result to the execution process of the business transaction request through the prediction machine contract. The technical scheme realizes the efficient utilization of the block chain to the out-of-chain service application.

Description

Method, device, equipment and medium for realizing out-of-chain service of block chain
Technical Field
The present disclosure relates to the field of computer technology, and more particularly, to a blockchain technique.
Background
Since blockchains are deterministic execution environments and therefore do not allow for indeterminate things or factors, business functions are typically provided by intelligent contracts deployed on the chains. The prior art introduces a prediction engine mechanism for implementing out-of-chain services for block chain calls.
With the rapid development of Web Services (Web Services) applications, more and more off-link Services also slowly adopt the development structure of the Web Services. The sources of the off-link services are many, so the problem of how to select the appropriate off-link service source arises.
However, a gap exists between the blockchain and the out-of-chain service architecture, which results in the blockchain not being able to efficiently utilize the out-of-chain service application.
Disclosure of Invention
The present disclosure provides a method, apparatus, device, and medium for implementing out-of-chain service of a blockchain. To enable efficient utilization of out-of-chain service applications by the blockchain.
According to an aspect of the present disclosure, there is provided a method for implementing out-of-chain service of a blockchain, applied to a blockchain node, the method including:
calling a presupposition machine contract to generate an out-of-chain service calling request in the process of executing the service transaction request;
processing the out-of-chain service invoking request through the preplan contract to select and determine a target out-of-chain service source according to out-of-chain service description data recorded in a block chain, and enabling the target out-of-chain service source to respond to the out-of-chain service invoking request;
obtaining a service result fed back by the out-of-chain service source through the president contract;
checking the service result according to the out-link service description data of the target out-link service source;
and responding the checked service result to the execution process of the business transaction request through the prediction machine contract.
According to another aspect of the present disclosure, there is provided an off-chain service implementation method of a blockchain, applied to an off-chain service source, the method including:
initiating, by a blockchain client, a service binding transaction request based on a predictive engine contract deployed in a blockchain to request registration of description data of an out-of-chain service provided;
acquiring an out-of-chain service calling request generated by the president contract;
and executing the out-of-chain service calling request, generating a service result and feeding back the service result to the prediction machine contract.
According to another aspect of the present disclosure, an apparatus for implementing an out-of-chain service of a blockchain is provided, where the apparatus is applied to a blockchain node, and the apparatus includes:
the transaction request execution module is used for calling a prediction machine contract in the process of executing the service transaction request so as to generate an out-of-chain service calling request;
the calling request processing module is used for processing the out-chain service calling request through the prompter contract, selecting and determining a target out-chain service source according to out-chain service description data recorded in the block chain, and enabling the target out-chain service source to respond to the out-chain service calling request;
the service result acquisition module is used for acquiring a service result fed back by the off-chain service source through the forecast contract;
the service result checking module is used for checking the service result according to the out-link service description data of the target out-link service source;
and the service result response module is used for responding the checked service result to the execution process of the business transaction request through the president contract.
According to another aspect of the present disclosure, an apparatus for implementing an out-of-chain service of a blockchain is provided, where the apparatus is applied to an out-of-chain service source, and the apparatus includes:
a binding transaction request initiating module, configured to initiate, by a blockchain client, a service binding transaction request based on a prompter contract deployed in a blockchain to request registration of description data of an out-of-chain service provided;
the calling request acquisition module is used for acquiring an out-of-chain service calling request generated by the prompter contract;
and the service result generation module is used for executing the out-link service calling request, generating a service result and feeding back the service result to the prediction machine contract.
According to another aspect of the present disclosure, there is also provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any one of the out-of-chain service implementation methods of a blockchain provided by embodiments of the present disclosure.
According to another aspect of the present disclosure, there is also provided a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform any one of the out-of-chain service implementation methods of a blockchain provided by the embodiments of the present disclosure.
According to another aspect of the present disclosure, there is also provided a computer program product including a computer program, which when executed by a processor, implements any one of the out-of-chain service implementation methods of a blockchain provided by the embodiments of the present disclosure.
According to the technology disclosed by the invention, the efficient utilization of the out-of-chain service application by the block chain is realized.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a schematic diagram of an out-of-chain service implementation method of a block chain according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of another out-of-chain service implementation method for a blockchain provided in accordance with an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a method for implementing out-of-chain services for a blockchain provided according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an out-of-chain service implementation apparatus of a block chain according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an out-of-chain service implementation apparatus of a block chain according to an embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device for implementing an out-of-chain service implementation method of a blockchain of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a method for implementing an out-of-chain service of a blockchain according to an embodiment of the present disclosure, which is applicable to a case where the blockchain calls the out-of-chain service. The method may be performed by an out-of-chain service implementation apparatus of a blockchain, which may be implemented in hardware and/or software and may be configured in an electronic device, which may be a blockchain node. Referring to fig. 1, the method is applied to a blockchain node, and specifically includes the following steps:
and S110, calling a presupposition machine contract in the process of executing the service transaction request to generate an out-of-chain service calling request.
The service transaction request may be a transaction request initiated by a user to a service intelligent contract through a client of the block chain according to a requirement of the user. The service intelligent contract can be an intelligent contract which is deployed in the blockchain system and can realize corresponding service functions. For example, the business function may be an electronic goods purchase function or the like; the service function may also be a function that needs to be provided for other service intelligent contracts in the blockchain system, such as face recognition, authority verification, and the like.
The preplan contract may be an intelligent contract which is pre-deployed in a block chain node and used for providing external service invocation for the users on the chain, that is, the preplan contract can provide the users on the chain with the off-chain services and can administer the off-chain services based on an administration mechanism. The out-of-link service invocation request may be a request generated when a call to an out-of-link service is required during execution of a business transaction request. For example, the out-of-chain service invocation request may be a request to invoke an out-of-chain face recognition service.
It should be noted that the service type of the down-link service that can be currently invoked can be obtained by the on-link user through the language-prediction contract, for example, the service type may include a face recognition service, a voice recognition service, a positioning service, and the like. Specifically, the user initiates a service acquisition request to the language predictive contract, and the language predictive contract displays the service types of the available downlink services to the user in the forms of characters, lists and the like; or, the user may also initiate a service query request to the language predictive contract in a search or query mode, so that the language predictive contract determines whether the offline service queried by the user exists or not, and feeds the query result back to the user.
For example, a user may obtain an interface provided by a language predictive contract through a client of the blockchain; according to the actual requirement of a user, the out-of-chain service to be called can be selected from at least one out-of-chain service type displayed on an interface provided by the predictive engine, and the predictive engine contract is called by the block link point to generate an out-of-chain service calling request.
Illustratively, the user can also initiate a service transaction request to the block link node according to the actual demand, and run a service intelligent contract to execute the service transaction request. In the process of executing the service transaction request, if the off-chain service needs to be called, the block chain node may call a presupposition machine contract deployed in the block chain, and the off-chain service call request is generated by the presupposition machine contract.
In an alternative embodiment, invoking the president contract to generate the out-of-chain service invocation request during execution of the service transaction request comprises: in the process of executing a service transaction request by operating a service intelligent contract, calling a preplan contract according to an instruction for calling the preplan contract, and inputting a calling parameter to generate an out-link service calling request; wherein the calling parameter comprises at least one of the following: service name, service input data, address of candidate out-of-chain service source, consumption element upper limit, service quality requirement data, and callback address of service result.
The instructions for invoking the predictive machine contract may be used to invoke the predictive machine contract during an execution phase of the business intelligence contract. It should be noted that the instruction of the predictive machine contract may be regarded as an out-of-chain service call request because a call parameter is usually included in addition to the interface function that calls the predictive machine contract. The call parameter may include at least one of a service name, service input data, an address of a candidate out-of-chain service source, a consumption element upper limit, quality of service requirement data, a callback address of a service result, and the like. The service input data may be data required to be provided for invoking the service, and different services may correspond to different service input data.
It should be noted that there may be a plurality of off-chain service sources providing the same type of service, and the address of at least one off-chain service source corresponding to different types of services is different, and the address is used to characterize a unique off-chain service source. Accordingly, the address of the candidate out-of-chain service source may be the address of at least one service source supporting the service corresponding to the called out-of-chain service.
Where the consumption element upper limit may be the maximum fee a user invoking the out-of-chain service is willing to pay. For example, the consumption element may be virtual currency or tokens, or other on-chain digital resources, and the like. The qos requirement data may be a qos requirement of a service for a user who invokes an out-of-chain service, and may include a requirement for a service response time or a response block number, for example, within which a service result is returned. The callback address of the service result may be an address of a predictive machine contract for receiving the service result.
In the optional embodiment, in the process of executing the service transaction request by running the intelligent service contract, the preplan contract is called according to the instruction for calling the preplan contract, and the calling parameter is input to generate the out-of-chain service calling request, so that the cross-contract calling of the preplan contract is realized, the out-of-chain service calling request can be generated without independently initiating the service transaction request for calling the preplan contract, and the efficiency of requesting and calling is improved. By calling the preplan contract and based on the input calling parameter, the out-link service calling request is generated, and the accuracy of subsequently selecting the target out-link service source is improved.
And S120, processing the out-of-chain service calling request through a prediction machine contract, selecting and determining a target out-of-chain service source according to the out-of-chain service description data recorded in the block chain, and enabling the target out-of-chain service source to respond to the out-of-chain service calling request.
Wherein the off-chain service description data comprises description data of at least two off-chain service sources for the provided service.
The off-link service description data may be data for describing an off-link service source, for example, the off-link service description data may include a service quality of the off-link service source, such as an off-link service response time, a response block number, and the like. Or, it may also include the fees or the like that need to be paid to invoke the out-of-chain service source. It should be noted that the off-chain service description data may be pre-recorded in the blockchain, so that the subsequent prediction engine contract can determine the target off-chain service source according to the pre-recorded off-chain service description data, and check the service result of the subsequent feedback.
The target out-of-chain service source may be an out-of-chain service source selected from the candidate out-of-chain service sources and finally used for responding to the out-of-chain service invocation request. The candidate out-of-chain service sources may be at least one out-of-chain service source capable of satisfying the out-of-chain service invocation request.
For example, a block link point may call a president contract to handle an out-of-chain service invocation request, and may be able to determine candidate out-of-chain service sources from the out-of-chain service invocation request; the predictive engine contract may select and determine a target off-chain service source from the candidate off-chain service sources according to off-chain service description data recorded in the block chain, for example, service quality data, that is, may select an off-chain service source with a shorter service response time from the candidate off-chain service sources as the target off-chain service source. The oracle contract may cause the target out-of-chain service source to respond to the out-of-chain service invocation request.
It should be noted that the prediction machine contract may implement the target out-of-chain service source responding to the out-of-chain service invocation request by using an interface invocation mode. Specifically, each block link point in the block chain network may be respectively interfaced with an out-of-chain service source, so as to implement a response of the out-of-chain service source to the out-of-chain service invocation request. However, the blockchain network includes a plurality of blockchain nodes, and if the out-of-chain service sources are respectively called, a large number of call requests may be generated.
Optionally, the target out-of-chain service source may respond to the out-of-chain service invocation request by using an event log monitoring mode.
In an alternative embodiment, the block link point call predictor contract processes the out-of-chain service call request, generates an out-of-chain call event log, and records in the block header or block body. The out-of-chain service source can monitor an out-of-chain call event log in the block chain, and when the out-of-chain call event log is monitored, the target out-of-chain service source responds to the out-of-chain service call request.
The block body may record detailed data of the block, for example, at least one piece of request data generated or received during the execution of the block chain. The block header may record the hash value of the previous block, the hash value of the current block, and at least one tree for recording information. For example, the event log may be recorded in a log tree in the chunk header. The log tree may be a data structure for recording event information in the block. The event information may be information related to an out-of-chain call event.
And S130, acquiring a service result fed back by the off-chain service source through the prediction machine contract.
The service result may be a result generated by the out-of-link service source based on the service content provided by the out-of-link service source according to the out-of-link call service request.
For example, the out-of-chain service source may respond to the out-of-chain call request after monitoring the out-of-chain call event, and feed back a service result generated based on the out-of-chain call service request to the prediction machine contract.
S140, checking the service result according to the out-link service description data of the target out-link service source.
It should be noted that when the target out-of-chain service source responds to the out-of-chain service invocation request, the predictive machine contract may monitor the target out-of-chain service source of the invocation request, for example, the predictive machine contract may monitor the actual response time of the target out-of-chain service source to the out-of-chain service invocation request.
Illustratively, when the predictive machine contract acquires a service result fed back by the target out-of-chain service source, the predictive machine contract may check the service result according to actual response time corresponding to the monitored service result and recorded service response time in out-of-chain service description data of the target out-of-chain service source. If the actual response time of the service result is not greater than the service response time recorded in the service description data, the checking of the service result is passed; if the actual response time of the service result is greater than the service response time recorded in the service description data, it may be determined that the verification of the service result failed.
S150, responding the service transaction request execution process by the verified service result through the prediction machine contract.
For example, the prediction machine contract can respond the detected service result to the business intelligent contract as a feedback result in the execution process of the business transaction request.
In the scheme of the embodiment of the disclosure, in the process of executing the service transaction request, a preplan contract is called to generate and process an out-link service calling request, so that a target out-link service source is determined according to out-link service description data, and the out-link service calling request is responded by the target out-link service source; acquiring a service result fed back by an off-chain service source through a prediction machine contract; and checking the service result according to the out-link service description data of the target out-link service source and responding the checked service result to the execution process of the service transaction request. According to the scheme, the block chain can be used for efficiently utilizing the off-chain service application in a mode that the off-chain service source responds to the off-chain service calling request so as to generate the service result, so that the on-chain user can select various services provided under the chain according to the actual requirements of the on-chain user, more service selections are provided for the user, and the convenience of the user is improved; and the preplan contract controls the out-of-chain service source to respond to the out-of-chain service calling request, and the service result is checked according to the pre-stored out-of-chain service description data, so that the out-of-chain service source is managed while the out-of-chain service is provided for the user, and the service provider and the service consumer are ensured to benefit to the maximum extent.
Fig. 2 is a schematic diagram of another out-of-chain service implementation method for a blockchain provided in accordance with an embodiment of the present disclosure, which is an alternative proposed scheme based on the above-described embodiment.
Referring to fig. 2, the method for implementing out-of-chain service of a block chain provided in this embodiment includes:
s210, calling a presupposition machine contract in the process of executing the service transaction request to generate an out-of-chain service calling request.
It should be noted that an out-of-chain provider may provide various types of out-of-chain services to users (consumers) on the blockchain. For example, the service types of the out-of-link service may include a face recognition service, an intelligent voice service, a navigation service, and the like. When an out-of-chain provider wants to provide a brand new type of service to the blockchain, such as a fingerprinting service, it is necessary to initiate a request to define a new service to the blockchain node and process the defined request by a prediction engine contract. Alternatively, other organization parties such as the platform side of the blockchain may determine that there is a need for the out-of-chain service and initiate the definition of the new service.
In an optional embodiment, before invoking the president contract to generate the out-of-chain service invocation request in the process of executing the service transaction request, the method further comprises: acquiring a service definition transaction request; calling a presupposition machine contract execution service definition transaction request to obtain a definition standard of an off-chain service, and recording the definition standard in a block chain; wherein the definition criteria of the out-of-chain service are used to determine the content of the out-of-chain service description data.
The service definition transaction request may be a request initiated by any user, such as a provider or manager of the service, for standard definition of the out-of-chain service. The definition criteria may be specific content defining the description that the service provider needs to provide the service for itself. All the out-of-chain service sources providing the service need to determine the content of the out-of-chain description data according to the definition standard of the service.
For example, if the service provided by the provider of the out-of-chain service is not recorded or defined on the blockchain chain, a service definition transaction request may be initiated by the service provider to the blockchain node. After the block link node acquires the service definition transaction request, calling a presupposition machine contract to execute the service definition transaction request, and acquiring a definition standard of an off-chain service according to the service definition transaction request so as to record the off-chain service in the block chain. If there is an out-of-chain service source that wants to provide the service, the out-of-chain service source needs to determine the content of the out-of-chain service description data according to the definition standard recorded by the service in the block chain.
In the optional embodiment, the obtained service definition transaction request is executed by calling the preplan contract to obtain the definition standard of the off-chain service, and the definition standard is recorded in the blockchain, so that the definition of the off-chain service and the storage of the definition standard of the blockchain on the off-chain service are realized, and the off-chain service source which subsequently provides the service can determine the description data of the off-chain service according to the definition standard, thereby facilitating the subsequent call of the off-chain service source which provides the service.
It should be noted that, if there is an out-of-chain data source that wants to provide an out-of-chain service, registration needs to be performed on the chain in advance to complete binding with the out-of-chain service, specifically, a binding request may be initiated on the chain according to a definition standard of the service that is stored in advance in a language-prediction machine contract to implement binding with the service.
In an optional embodiment, in the process of executing the service transaction request, calling a presupposition machine contract to obtain a service binding transaction request before generating an out-of-chain service calling request; calling a presupposition machine contract to execute a service binding transaction request so as to obtain out-of-chain service description data, and recording the out-of-chain service description data in a block chain; wherein the out-of-chain service description data comprises at least one of: the address of the out-of-chain service source, quality of service data, service penalty data, pre-stored mortgage element and consumption element data.
Wherein the service binding transaction request may be a transaction request initiated by an out-of-chain service source for service binding. The quality of service data may include a service response time or a number of service response blocks; the service penalty data can comprise the number of prestored mortgage elements of the account which the service source outside the target chain belongs to in the block chain; the pre-stored mortgage elements and consumption elements may be virtual currency or tokens. The consumption element data may be the fee that needs to be paid to invoke the out-of-chain service.
It should be noted that before initiating a service binding transaction request to the blockchain, the out-of-chain data source may determine in advance whether a definition standard of the service is recorded in the blockchain; if yes, a service binding transaction request is sent to the block chain; if not, a service definition transaction request may be initiated to the blockchain.
For example, the out-of-chain service source may obtain a definition standard of the provided out-of-chain service from the block link point in advance, so as to determine out-of-chain service description data according to the definition standard; the out-of-chain service source initiates a service binding transaction request to the blockchain; after the block chain acquires the service binding transaction request, calling a president machine contract to execute the service binding transaction request; the presupposing machine contract determines the off-chain service description data of the off-chain data source according to the service binding transaction request and records the off-chain service description data in the blockchain so as to realize the binding between the off-chain service source and the service defined on the chain.
The optional embodiment binds the transaction request by obtaining the service; calling a president contract to execute a service binding transaction request so as to obtain off-chain service description data, and recording the off-chain service description data in a block chain, so that binding between an off-chain service source and a service defined on the chain is realized; according to the out-of-chain service description data provided by the out-of-chain service source in the service binding process, the treatment of the out-of-chain service source by the blockchain is realized, so that the fairness between the provider to which the out-of-chain service source belongs and the user is ensured.
In order to ensure that the off-link service source can better provide service for the on-link user, a prediction machine contract can be adopted to monitor the off-link service source, so that the off-link service source is punished when the quality of service provided by the off-link service source is poor.
In an alternative embodiment, after acquiring the off-chain service description data and recording in the blockchain, monitoring the off-chain service description data through a prediction machine contract; if the pre-stored elements of the account number of the out-of-link service source are lower than the pre-stored mortgage elements, the out-of-link service source is forbidden; and if the account number pre-stored element to which the out-of-chain service source belongs is higher than the pre-stored mortgage element, starting the out-of-chain service source.
The prediction machine contract can monitor the off-link service description data at regular time, or monitor the off-link service description data once every time the pre-stored mortgage elements of the off-link service source are deducted, and the like. The pre-stored elements of the account to which the out-of-chain service source belongs may be the remaining mortgage elements after deducting the pre-stored mortgage elements in the account due to various factors.
Illustratively, pre-stored pledge elements in the out-of-chain service description data can be monitored through a pre-dialer contract, and whether the pre-stored elements of the account number to which the out-of-chain service source belongs are lower than the pre-stored pledge elements is judged; if yes, forbidding an out-of-chain service source; if not, the out-of-chain service source is started.
The optional embodiment realizes prohibition and starting of the off-chain service source by monitoring the off-chain service description data through the president contract, thereby realizing management of the off-chain service source, and avoiding the occurrence of poor service quality frequently occurring in the off-chain service source by prohibiting use punishment when fraudulent behaviors exist in the off-chain service source.
S220, processing the out-of-chain service call request through a preplan contract, selecting and determining a target out-of-chain service source according to service quality data and consumption element data in out-of-chain service description data recorded in the block chain, and enabling the target out-of-chain service source to respond to the out-of-chain service call request; wherein the off-chain service description data comprises description data of the provided service by at least two off-chain service source pairs.
The service quality data may include a service response time or a service response block number. The service response time may be the time required to be consumed by the out-of-chain service source to respond to the invocation request; the number of service response blocks may be the number of blocks that need to be consumed by the out-of-chain service source in response to the call request. The longer the service response time or the fewer the number of service response blocks, the lower the service quality is; the more the service response time or the more the number of service response blocks, the higher the service quality.
Wherein the consumption element data may be a fee to be paid by the request out-of-chain service source to respond to the service invocation request and provide the service. For example, the consumption element may be a virtual currency or a token. It should be noted that the service quality data or consumption element data corresponding to different off-link service sources supporting the same service may be the same or different. For example, both the out-of-chain service source a and the out-of-chain service source B support face recognition service, the service response time required for the out-of-chain service source a to support the service is 10ms, and consumption element data is such that 10 tokens are consumed for each service provided; whereas the service response time required for the out-of-chain service source B to support the service is 15ms, consuming element data consumes 8 tokens per service provided.
The block link node may invoke a prescient contract to process the out-of-link service invocation request and determine a candidate out-of-link service source according to the out-of-link service invocation request. Wherein the candidate out-of-chain service source may be at least one out-of-chain service source capable of satisfying the out-of-chain service invocation request. And the prediction engine contract determines a target off-chain service source from the candidate off-chain service sources according to the service quality data and the consumption element data in the prerecorded off-chain service description data.
For example, the predictive contract may select a target off-chain service source from the candidate off-chain service sources by comprehensively considering factors such as the service response time of the candidate off-chain service sources, the number of service response blocks, and the cost required to be paid by using the candidate off-chain service sources.
For example, the prediction engine contract may also determine a candidate out-of-chain service source according to the out-of-chain service invocation request, and show the candidate out-of-chain service source and out-of-chain service description data corresponding to the candidate service source to the user who initiated the invocation request in the form of a list or characters, so that the user selects a target out-of-chain service source from the candidate out-of-chain service source according to actual needs.
For example, the prediction engine contract may further determine candidate off-chain service sources according to the off-chain service invocation request, and select an off-chain service source to be confirmed with the best effect from the candidate off-chain service sources based on the service quality data and the consumption element data in the off-chain service description data recorded in the block in advance; the preplan contract shows the to-be-confirmed out-of-link service source to the user who initiates the call request, and the user determines whether to use the to-be-confirmed out-of-link service source as a target out-of-link service source; if so, taking the out-of-chain service source to be confirmed as a target out-of-chain service source, and enabling the target out-of-chain service source to respond to the out-of-chain service calling request; if not, the prediction engine contract is used for re-determining the out-chain service source to be confirmed based on the candidate out-chain service source and the out-chain service description data, and the user confirms the out-chain service source again.
And S230, acquiring a service result fed back by the off-chain service source through the prediction machine contract.
S240, according to the service quality data in the out-link service description data of the target out-link service source, the service quality of the service result is checked.
The quality of service of the service result may be checked based on quality of service data, such as service response time and/or number of service response blocks, pre-recorded in the out-of-chain service description data of the target out-of-chain service source in the block chain.
Illustratively, a block link point calls a predictive machine contract to control an off-chain service source to respond to an off-chain service calling request, and obtains a service result fed back by the off-chain service source, and after the predictive machine contract obtains the service result, the actual response time and the actual response block number of the target off-chain service source to the calling request are determined. The prediction machine contract compares the actual response time of the target out-of-chain service source with the service response time recorded in the service description data of the block chain in advance, and determines the check result of the service response time of the service result; and comparing the actual number of the response blocks of the target out-of-chain service source with the number of the service response blocks pre-recorded in the service description data of the block chain, and determining the checking result of the number of the service response blocks of the service result.
And determining the inspection result of the service quality of the service result according to the inspection result of the service response time of the service result and/or the inspection result of the service response block number of the service result. If the check on the service response time and the check on the number of service response blocks both pass, it can be considered that the check on the service quality passes.
For example, it may be determined by the prediction engine contract whether the actual response time of the target out-of-chain service source is not greater than the service response time recorded in advance in the service description data of the blockchain; if so, the service response time can be considered to pass the inspection; if not, the check on the service response time is not passed; or, if the actual response time of the target out-of-chain service source is greater than the service response time pre-recorded in the service description data of the blockchain, the prediction contract may further determine whether a time difference between the actual response time of the target out-of-chain service source and the service response time pre-recorded in the service description data of the blockchain exceeds a preset time threshold; if so, the check for service response time may be considered failed; if not, the service response time can be considered to pass the inspection. The preset time threshold may be preset by a skilled person.
For example, whether the actual number of response blocks of the target out-of-chain service source is not less than the number of service response blocks pre-recorded in the service description data of the block chain may be determined by the prediction machine contract; if yes, the checking of the number of the service response blocks is passed; if not, the check for the number of service response blocks may be deemed to have failed. Or, if the number of actual response blocks of the target out-of-chain service source is less than the number of service response blocks pre-recorded in the service description data of the block chain, the number difference between the number of actual response blocks of the target out-of-chain service source and the number of service response blocks pre-recorded in the service description data of the block chain can be judged by the prediction machine contract, and whether the difference exceeds the preset number threshold value or not; if yes, the check of the number of the service response blocks is not passed; if not, the service response time can be considered to pass the inspection. Wherein the preset number threshold may be preset by a skilled person.
And S250, if the checking is passed, continuing to execute the service result response operation.
Illustratively, if the detection of the service quality of the service result passes, that is, the detection of the service response time and the number of service response blocks of the service result passes, the service result response operation is continuously executed.
And S260, if the verification fails, performing punishment operation on the target out-of-chain service source according to the service quality of the service result and the service punishment rule in the out-of-chain service description data.
The service punishment rule can include freezing or destroying prestored mortgage elements of accounts belonging to the service sources outside the target chain in the block chain. For example, a mortgage element may be a virtual currency or a token.
For example, if the detection of the service quality of the service result fails, a penalty operation may be performed on the target out-of-chain service source according to the detection result of the service response time of the service result and the detection result of the number of service response blocks, and the service penalty rule in the out-of-chain service description data.
Specifically, if the detection of the service response time of the service result is not passed or the detection of the number of service response blocks of the service result is not passed, the pre-stored mortgage element of the account to which the target out-of-chain service source belongs in the block chain is executed with the freezing operation. For example, a freeze time period during which frozen mortgage elements are not available may be preset by a person of ordinary skill in the art. And if the detection on the service response time of the service result is not passed and the detection on the service response block number of the service result is not passed, executing destruction operation on the pre-stored mortgage element of the account of the target out-of-chain service source in the block chain.
And S270, responding the verified service result to the execution process of the business transaction request through the prediction machine contract.
According to the method and the device, the out-of-chain service invoking request is processed through the preplan contract, the target out-of-chain service source is selected and determined according to the service quality data and the consumption element data in the out-of-chain service description data recorded in the block chain, and the target out-of-chain service source is accurately determined, so that the target out-of-chain service source is accurately invoked, a better service is provided for a user, and good service experience is brought to the user. The method for checking the service quality of the service result according to the service quality data in the out-of-chain service description data of the target out-of-chain service source improves the detection accuracy of the service quality of the service result, when the check fails, punishment operation is executed on the target out-of-chain service source according to the service quality of the service result and the service punishment rule in the out-of-chain service description data, the treatment on the out-of-chain service source is realized when the service quality of the out-of-chain service source has problems, the frequent occurrence of the service quality problem of the out-of-chain service source is avoided, and therefore the service provider and the service consumer can be guaranteed to benefit to the maximum extent.
Fig. 3 is a schematic diagram of an implementation method of an out-of-chain service of a blockchain according to an embodiment of the present disclosure, where the embodiment of the present disclosure is applicable to a case where the blockchain calls the out-of-chain service. The method can be executed by an off-chain service implementation apparatus of a block chain, the apparatus can be implemented in a hardware and/or software manner, and can be configured in an electronic device, and the electronic device can be an off-chain service source. Referring to fig. 3, the method is applied to an out-of-chain service source, and specifically includes the following steps:
and S310, initiating a service binding transaction request based on a prescient contract deployed in the blockchain through the blockchain client to request to register description data of the provided out-of-chain service.
Wherein the service binding transaction request may be a transaction request initiated by an out-of-chain service source for service binding. The description data of the out-of-chain service includes at least one of: the address of the out-of-chain service source, quality of service data, service penalty data, pre-stored mortgage element and consumption element data.
For example, the out-of-chain service source may initiate a service binding transaction request to the blockchain through the blockchain client to request registration of the provided out-of-chain service description data in the blockchain for the blockchain to invoke a oracle contract to process the service binding transaction request.
In an optional embodiment, before initiating the service binding transaction request based on a president contract deployed in the blockchain, the method further comprises: inquiring definition standards of off-chain services recorded on the block chain through a presupposition machine contract; wherein the definition criteria of the out-of-chain service are used to determine the content of the out-of-chain service description data.
The off-chain service source can acquire an interface provided by the preplan contract through a client of the blockchain, inquire a definition standard of off-chain services which are recorded on the blockchain and are desired to be provided by the off-chain service source in the interface, and initiate a service binding transaction request based on the preplan contract according to the definition standard.
It should be noted that, if the out-of-chain service source does not query the interface that the definition standard of the out-of-chain service that the out-of-chain service source wants to provide is recorded on the blockchain, the out-of-chain service source may initiate a service definition transaction request to the blockchain to request to invoke a predictive engine contract to record the definition standard of the out-of-chain service in the blockchain. Wherein the definition criteria of the out-of-chain service are used to determine the content of the out-of-chain service description data.
In the optional embodiment, before the preplan contract initiates the service binding transaction request, the preplan contract queries the definition standard of the off-link service recorded on the block chain, so that whether the off-link service exists on the chain is predetermined, and the subsequent registration and binding of the off-link service are facilitated.
And S320, acquiring an out-of-chain service calling request generated by the president contract.
The off-chain service source can acquire the off-chain service call request generated by the forecast machine contract in an interface call mode, and can also acquire the off-chain service call request generated by the forecast machine contract in an event log monitoring mode.
Illustratively, the chunk link point call presupposes the off-chain service call request, generates an off-chain call event log, and records in the chunk header or chunk. The out-of-chain service source can monitor an out-of-chain call event log in the block chain, and when the out-of-chain call event log is monitored, the target out-of-chain service source responds to the out-of-chain service call request. The target out-of-chain service source may be an out-of-chain service source selected from the candidate out-of-chain service sources and finally used for responding to the out-of-chain service invocation request. The candidate out-of-chain service sources may be at least one out-of-chain service source capable of satisfying the out-of-chain service invocation request.
And S330, executing the out-of-chain service calling request, generating a service result and feeding back the service result to the prediction machine contract.
For example, the out-of-chain service source may respond to the out-of-chain call request after monitoring the out-of-chain call event, and feed back a service result generated based on the out-of-chain call service request to the prediction machine contract.
The method comprises the steps that a service binding transaction request is initiated through a block chain client based on a prediction machine contract deployed in a block chain so as to request for registering description data of the provided out-of-chain service; acquiring an out-of-chain service calling request generated by a president contract; and executing the out-of-chain service calling request, generating a service result and feeding back the service result to the prediction machine contract. According to the scheme, the out-of-chain service source is registered in the block chain, so that the service binding of the down-chain service source in the block chain is realized, users on the chain can select various services provided under the chain according to the actual requirements of the users, more service selections are provided for the users, and the convenience of the users is improved.
Fig. 4 is a schematic diagram of an apparatus for implementing an out-of-chain service of a block chain according to an embodiment of the present disclosure, where this embodiment is applicable to an application scenario in which the block chain invokes the out-of-chain service, and the apparatus is configured in an electronic device, and is capable of implementing a method for implementing an out-of-chain service of a block chain according to any embodiment of the present disclosure. The electronic device may be a block chain node, and referring to fig. 4, the apparatus 400 for implementing out-of-chain service of a block chain specifically includes the following:
a transaction request executing module 401, configured to invoke a preplan contract to generate an out-of-link service invocation request in a process of executing a service transaction request;
a calling request processing module 402, configured to process the out-of-chain service calling request through the preplan contract, to select and determine a target out-of-chain service source according to out-of-chain service description data recorded in a block chain, and enable the target out-of-chain service source to respond to the out-of-chain service calling request; wherein the off-chain service description data comprises description data of the provided service by at least two off-chain service sources;
a service result obtaining module 403, configured to obtain, through the pre-senter contract, a service result fed back by the off-link service source;
a service result checking module 404, configured to check the service result according to the out-link service description data of the target out-link service source;
and a service result response module 405, configured to respond to the execution process of the business transaction request with the checked service result through the prediction machine contract.
According to the scheme of the embodiment of the disclosure, the block chain is used for efficiently utilizing the off-chain service application in a mode that the off-chain service source responds to the off-chain service calling request so as to generate the service result, so that the user on the chain can select various services provided under the chain according to the actual requirements of the user, more service choices are provided for the user, and the convenience of the user is improved; and the service result is checked according to the prestored out-of-chain service description data, so that the out-of-chain service is provided for the user and the out-of-chain service source is managed, and the service provider and the service consumer can benefit to the maximum extent.
In an alternative embodiment, the off-chain service description data includes description data of services provided by at least two off-chain service sources.
In an alternative embodiment, the service result verification module 404 includes:
the service quality inspection unit is used for inspecting the service quality of the service result according to the service quality data in the out-link service description data of the target out-link service source;
a response operation execution unit for continuing to execute the service result response operation if the check is passed;
and the punishment operation executing unit is used for executing punishment operation on the target off-chain service source according to the service quality of the service result and the service punishment rule in the off-chain service description data if the verification fails.
In an optional implementation manner, the call request processing module 402 includes:
and the target out-of-chain service source determining unit is used for processing the out-of-chain service calling request through the president contract so as to select and determine a target out-of-chain service source according to the service quality data and the consumption element data in the out-of-chain service description data recorded in the block chain.
In an alternative embodiment, the quality of service includes: service response time or number of service response blocks; the penalty operations include: and freezing or destroying prestored mortgage elements of the account of the target out-of-chain service source in the block chain.
In an alternative embodiment, the apparatus 400 further comprises:
a defined transaction request acquisition module for acquiring a service defined transaction request;
a definition standard obtaining module, configured to invoke the presupposition machine contract to execute the service definition transaction request, so as to obtain a definition standard of an off-chain service, and record the definition standard in a block chain;
wherein the definition criteria of the out-of-chain service are used to determine the content of the out-of-chain service description data.
In an alternative embodiment, the apparatus 400 further comprises:
a binding transaction request obtaining module, configured to obtain a service binding transaction request;
the description data acquisition module is used for calling the prompter contract to execute the service binding transaction request so as to acquire out-of-chain service description data and record the out-of-chain service description data in a block chain;
wherein the out-of-chain service description data comprises at least one of: the address of the out-of-chain service source, quality of service data, service penalty data, pre-stored mortgage element and consumption element data.
In an alternative embodiment, the apparatus 400 further comprises:
the description data monitoring module is used for monitoring the out-chain service description data through the forecast contract;
the chain outside service source forbidding module is used for forbidding the chain outside service source if the account number prestored element to which the chain outside service source belongs is lower than the prestored mortgage element;
and the out-of-chain service source starting module is used for starting the out-of-chain service source if the account number pre-stored element to which the out-of-chain service source belongs is higher than the pre-stored mortgage element.
In an alternative embodiment, the transaction request execution module 401 includes:
the transaction request execution unit is used for calling the foresight contract according to an instruction for calling the foresight contract and inputting a calling parameter to generate an out-of-chain service calling request in the process of executing the service transaction request by the service intelligent contract;
wherein the invocation parameter includes at least one of: service name, service input data, address of candidate out-of-chain service source, consumption element upper limit, service quality requirement data, and callback address of service result.
The device for implementing out-of-chain service of a block chain provided by the technical scheme of the embodiment of the disclosure can execute the method for implementing out-of-chain service of a block chain provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the method for implementing out-of-chain service of a block chain.
Fig. 5 is a schematic diagram of an apparatus for implementing an out-of-chain service of a block chain according to an embodiment of the present disclosure, where this embodiment is applicable to an application scenario in which the block chain invokes the out-of-chain service, and the apparatus is configured in an electronic device, and is capable of implementing a method for implementing an out-of-chain service of a block chain according to any embodiment of the present disclosure. The electronic device may be an out-of-chain service source, and referring to fig. 5, the out-of-chain service implementing apparatus 500 of the block chain specifically includes the following:
a binding transaction request initiating module 501, configured to initiate, by a blockchain client, a service binding transaction request based on a prompter contract deployed in a blockchain to request to register description data of an out-of-chain service provided by registration;
a calling request obtaining module 502, configured to obtain an out-of-chain service calling request generated by the language predictive engine contract;
a service result generating module 503, configured to execute the out-of-chain service invocation request, generate a service result, and feed back the service result to the prediction machine contract.
The method comprises the steps that a service binding transaction request is initiated through a block chain client based on a prediction machine contract deployed in a block chain so as to request for registering description data of the provided out-of-chain service; acquiring an out-of-chain service calling request generated by a president contract; and executing the out-of-chain service calling request, generating a service result and feeding back the service result to the prediction machine contract. According to the scheme, the out-of-chain service source is registered in the block chain, so that the service binding of the down-chain service source in the block chain is realized, users on the chain can select various services provided under the chain according to the actual requirements of the users, more service selections are provided for the users, and the convenience of the users is improved.
In an alternative embodiment, the apparatus 500 further comprises:
the system comprises a definition standard query module, a block chain management module and a service binding module, wherein the definition standard query module is used for querying definition standards of off-chain services recorded on the block chain through a preplanning machine contract before a service binding transaction request is initiated based on the preplanning machine contract deployed in the block chain;
wherein the definition criteria of the out-of-chain service are used to determine the content of the out-of-chain service description data.
In an alternative embodiment, the description data of the out-of-chain service comprises at least one of: the address of the out-of-link service source, quality of service data, service penalty data, pre-stored mortgage elements, and consumption element data.
The device for implementing out-of-chain service of a block chain provided by the technical scheme of the embodiment of the disclosure can execute the method for implementing out-of-chain service of a block chain provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the method for implementing out-of-chain service of a block chain.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and the like of the related business transaction request, the out-of-chain service invoking request, the out-of-chain service description data, the service result and the like all accord with the regulation of related laws and regulations without violating the good custom of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 6 illustrates a schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the device 600 comprises a computing unit 601, which may perform various suitable actions and processes according to a computer program stored in a Read Only Memory (ROM) 602 or loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The calculation unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, or the like; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The computing unit 601 performs the various methods and processes described above, such as the block chain out-of-chain service implementation method. For example, in some embodiments, the method of out-of-chain service implementation of a blockchain may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into RAM 603 and executed by computing unit 601, one or more steps of the block chain out-of-chain service implementation method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured by any other suitable means (e.g., by means of firmware) to perform the out-of-chain service implementation method of the blockchain.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program code, when executed by the processor or controller, causes the functions/acts specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Network (WAN) blockchain networks, and the internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome. The server may also be a server of a distributed system, or a server incorporating a blockchain.
Artificial intelligence is the subject of research that makes computers simulate some human mental processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), both at the hardware level and at the software level. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology mainly comprises a computer vision technology, a voice recognition technology, a natural language processing technology, a machine learning/deep learning technology, a big data processing technology, a knowledge map technology and the like.
Cloud computing (cloud computing) refers to a technology system that accesses a flexibly extensible shared physical or virtual resource pool through a network, where resources may include servers, operating systems, networks, software, applications, storage devices, and the like, and may be deployed and managed in a self-service manner as needed. Through the cloud computing technology, high-efficiency and strong data processing capacity can be provided for technical application and model training of artificial intelligence, block chains and the like.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in this disclosure may be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions provided by this disclosure can be achieved, and are not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (15)

1. An out-of-chain service implementation method for a blockchain, the method being applied to a blockchain node and comprising:
calling a presupposition machine contract to generate an out-of-chain service calling request in the process of executing the service transaction request;
processing the off-chain service calling request through the preplan contract, so as to select and determine a target off-chain service source according to the service quality data and the consumption element data in the off-chain service description data recorded in the block chain, and enabling the target off-chain service source to respond to the off-chain service calling request;
obtaining a service result fed back by the out-of-chain service source through the president contract;
checking the service result according to the out-link service description data of the target out-link service source;
and responding the checked service result to the execution process of the business transaction request through the prediction machine contract.
2. The method of claim 1, wherein the out-of-chain service description data comprises description data of services provided by at least two out-of-chain service sources.
3. The method of claim 1, wherein verifying the service result from the out-of-chain service description data of the target out-of-chain service source comprises:
according to the service quality data in the out-link service description data of the target out-link service source, the service quality of the service result is checked;
if the checking is passed, continuing to execute the service result response operation;
and if the verification fails, performing penalty operation on the target out-of-chain service source according to the service quality of the service result and the service penalty rule in the out-of-chain service description data.
4. The method of claim 3, wherein:
the quality of service includes: service response time or number of service response blocks;
the penalty operations include: and freezing or destroying prestored mortgage elements of the account of the target out-of-chain service source in the block chain.
5. The method of claim 1, prior to invoking a presupposition machine contract to generate an out-of-chain service invocation request during execution of the service transaction request, further comprising:
acquiring a service definition transaction request;
calling the presupposition machine contract to execute the service definition transaction request so as to obtain definition standards of the off-chain service, and recording the definition standards in a block chain;
wherein the definition criteria of the out-of-chain service are used to determine the content of the out-of-chain service description data.
6. The method of claim 1 or 5, prior to invoking the president contract to generate the out-of-chain service invocation request during execution of the service transaction request, further comprising:
acquiring a service binding transaction request;
calling the presupposition machine contract to execute the service binding transaction request so as to obtain out-of-chain service description data, and recording the out-of-chain service description data in a block chain;
wherein the out-of-chain service description data comprises at least one of: the address of the out-of-chain service source, quality of service data, service penalty data, pre-stored mortgage element and consumption element data.
7. The method of claim 6, after obtaining the out-of-chain service description data and recording in the blockchain, further comprising:
monitoring the out-of-chain service description data by the prophetic contract;
if the account number pre-stored element to which the out-of-chain service source belongs is lower than the pre-stored mortgage element, the out-of-chain service source is forbidden;
and if the account number pre-stored element to which the out-of-chain service source belongs is higher than the pre-stored mortgage element, starting the out-of-chain service source.
8. The method of claim 1, wherein invoking a president contract to generate an out-of-chain service invocation request during execution of the service transaction request comprises:
in the process of executing the service transaction request by operating the service intelligent contract, calling the preplan contract according to an instruction for calling the preplan contract, and inputting a calling parameter to generate an out-link service calling request;
wherein the invocation parameter includes at least one of: service name, service input data, address of candidate out-of-chain service source, consumption element upper limit, service quality requirement data, and callback address of service result.
9. An off-chain service implementation method for a block chain, applied to an off-chain service source, the method comprising:
initiating, by a blockchain client, a service binding transaction request based on a preplan contract deployed in the blockchain to request registration of description data of the provided out-of-chain service;
acquiring an out-of-chain service calling request generated by the president contract;
and executing the out-chain service calling request, generating a service result, and feeding back the service result to the prediction machine contract so that the prediction machine contract can check the service result according to the service quality data and the consumption element data in the description data of the out-chain service.
10. The method of claim 9, further comprising, prior to initiating a service binding transaction request based on a president contract deployed in the blockchain:
inquiring definition standards of off-chain services recorded on the block chain through a presupposition machine contract;
wherein the definition criteria of the out-of-chain service are used to determine the content of the out-of-chain service description data.
11. The method of claim 9, wherein the description data of the out-of-chain service comprises at least one of: the address of the out-of-chain service source, quality of service data, service penalty data, pre-stored mortgage element and consumption element data.
12. An apparatus for implementing out-of-chain service of a blockchain, applied to a blockchain node, the apparatus comprising:
the transaction request execution module is used for calling a prediction machine contract in the process of executing the service transaction request so as to generate an out-of-chain service calling request;
the calling request processing module is used for processing the out-chain service calling request through the prompter contract, selecting and determining a target out-chain service source according to out-chain service description data recorded in the block chain, and enabling the target out-chain service source to respond to the out-chain service calling request;
the service result acquisition module is used for acquiring a service result fed back by the off-chain service source through the forecast contract;
the service result checking module is used for checking the service result according to the out-link service description data of the target out-link service source;
the service result response module is used for responding the checked service result to the execution process of the business transaction request through the prediction machine contract;
wherein, the calling request processing module comprises:
and the target out-of-chain service source determining unit is used for processing the out-of-chain service calling request through the preplan contract so as to select and determine a target out-of-chain service source according to the service quality data and the consumption element data in the out-of-chain service description data recorded in the block chain.
13. An apparatus for implementing an out-of-chain service of a block chain, applied to an out-of-chain service source, the apparatus comprising:
a binding transaction request initiating module, configured to initiate, by a blockchain client, a service binding transaction request based on a prompter contract deployed in a blockchain to request registration of description data of an out-of-chain service provided;
the calling request acquisition module is used for acquiring an out-of-chain service calling request generated by the prompter contract;
and the service result generation module is used for executing the out-chain service calling request, generating a service result and feeding back the service result to the prediction machine contract so that the prediction machine contract can check the service result according to the service quality data and the consumption element data in the description data of the out-chain service.
14. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; it is characterized in that the preparation method is characterized in that,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method for out-of-chain service implementation of a blockchain of any of claims 1-8 or 9-11.
15. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method for out-of-chain service implementation of a blockchain of any of claims 1-8 or 9-11.
CN202210251193.2A 2022-03-15 2022-03-15 Method, device, equipment and medium for realizing out-of-chain service of block chain Active CN114331446B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210251193.2A CN114331446B (en) 2022-03-15 2022-03-15 Method, device, equipment and medium for realizing out-of-chain service of block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210251193.2A CN114331446B (en) 2022-03-15 2022-03-15 Method, device, equipment and medium for realizing out-of-chain service of block chain

Publications (2)

Publication Number Publication Date
CN114331446A CN114331446A (en) 2022-04-12
CN114331446B true CN114331446B (en) 2022-06-21

Family

ID=81033884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210251193.2A Active CN114331446B (en) 2022-03-15 2022-03-15 Method, device, equipment and medium for realizing out-of-chain service of block chain

Country Status (1)

Country Link
CN (1) CN114331446B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116029729B (en) * 2023-03-22 2023-06-06 安徽省大数据中心 Cross-link method and system based on dynamic access application link management contract mode

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111092914B (en) * 2020-03-18 2020-06-26 支付宝(杭州)信息技术有限公司 Method and device for accessing external data
CN111401903B (en) * 2020-06-03 2020-09-11 腾讯科技(深圳)有限公司 Block chain message processing method, device, computer and readable storage medium
CN111930852B (en) * 2020-09-29 2022-03-25 北京百度网讯科技有限公司 Data processing method, device and equipment based on block chain and storage medium
CN113205416A (en) * 2021-04-19 2021-08-03 杭州溪塔科技有限公司 Service processing method and system based on block chain prediction machine
CN113726890A (en) * 2021-08-31 2021-11-30 百保(上海)科技有限公司 Block chain data service-oriented federal prediction method and system
CN114172662A (en) * 2021-12-03 2022-03-11 工银科技有限公司 Block chain external data acquisition method and device

Also Published As

Publication number Publication date
CN114331446A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
US11526889B2 (en) Resource transferring monitoring method and device
US11153236B2 (en) Real-time integration of machine intelligence into client messaging platforms
JP2017514218A (en) Running third-party applications
CN104809132A (en) Method and device for acquiring social relation type of network subject
CN114328132A (en) Method, device, equipment and medium for monitoring state of external data source
CN114327803A (en) Method, apparatus, device and medium for accessing machine learning model by block chain
CN115174353B (en) Fault root cause determining method, device, equipment and medium
CN114331446B (en) Method, device, equipment and medium for realizing out-of-chain service of block chain
CN114070847B (en) Method, device, equipment and storage medium for limiting current of server
CN115328621B (en) Transaction processing method, device, equipment and storage medium based on block chain
CN114338051B (en) Method, device, equipment and medium for acquiring random number by block chain
CN113052509A (en) Model evaluation method, model evaluation apparatus, electronic device, and storage medium
CN112968876A (en) Content sharing method and device, electronic equipment and storage medium
CN114362968B (en) Method, device, equipment and medium for acquiring random number by block chain
CN114172823B (en) Micro-service link sampling method, device, equipment and readable storage medium
CN117519996B (en) Data processing method, device, equipment and storage medium
CN115190008B (en) Fault processing method, fault processing device, electronic equipment and storage medium
CN115361339A (en) Flow control method and device, electronic equipment and storage medium
CN118034749A (en) Updating method and electronic equipment
CN117670236A (en) Mobile-terminal-based to-be-handled flow approval method, device, equipment and medium
CN117454350A (en) Service response method, device, electronic equipment and storage medium
CN117350811A (en) Order processing method, order processing device, electronic equipment and storage medium
CN116228248A (en) Risk control method and device for financial business
CN117611180A (en) Service processing system, method, device and storage medium
CN116863601A (en) Article storage method and device, electronic equipment and storage medium

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