CN115567321B - Chain-crossing system and method based on built-in preplan contract - Google Patents

Chain-crossing system and method based on built-in preplan contract Download PDF

Info

Publication number
CN115567321B
CN115567321B CN202211418408.1A CN202211418408A CN115567321B CN 115567321 B CN115567321 B CN 115567321B CN 202211418408 A CN202211418408 A CN 202211418408A CN 115567321 B CN115567321 B CN 115567321B
Authority
CN
China
Prior art keywords
contract
chain
cross
request
service
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
CN202211418408.1A
Other languages
Chinese (zh)
Other versions
CN115567321A (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.)
Anhui Zhongke Lattice Technology Co ltd
Original Assignee
Anhui Zhongke Lattice 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 Anhui Zhongke Lattice Technology Co ltd filed Critical Anhui Zhongke Lattice Technology Co ltd
Priority to CN202211418408.1A priority Critical patent/CN115567321B/en
Publication of CN115567321A publication Critical patent/CN115567321A/en
Application granted granted Critical
Publication of CN115567321B publication Critical patent/CN115567321B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • 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/3236Cryptographic 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 using cryptographic hash functions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention belongs to the technical field of block chains, and discloses a chain crossing system and method based on a built-in preplan contract. The invention meets the cross-chain data requirements of different service contracts by calling the built-in preplan contracts and triggering the witness nodes to execute corresponding processing logics, so that cross-chain data requests, processing and calling operations are all built in the request chains, and cross-chain information interaction and contract operations are easier to realize.

Description

Chain-crossing system and method based on built-in preplan contract
Technical Field
The invention relates to the technical field of block chains, in particular to a chain crossing system and method based on a built-in preplan contract.
Background
The existing cross-link technology solves the technical difficulties of cross-link data transmission, transaction access and the like by introducing an intermediary. Introducing a trusted third party into a notary mechanism, electing a notary to automatically or request to monitor events on different chains, and verifying and forwarding cross-chain messages; in the side chain mechanism, a relay and a side chain are introduced to transfer main chain assets to side chain treatment so as to achieve the aim of relieving main chain pressure to expand main chain functions and performances. However, the traditional prophetic machine network has long development period and great difficulty, which causes great difficulty in chain crossing.
The above is only for the purpose of assisting understanding of the technical solution of the present invention, and does not represent an admission that the above is the prior art.
Disclosure of Invention
The invention mainly aims to provide a chain-crossing system and method based on a built-in predictive engine contract, and aims to solve the technical problems of long development period and high difficulty of a traditional predictive engine network in the prior art.
In order to achieve the above object, the present invention provides a built-in predictive engine contract-based cross-chain system, which includes: the system comprises a cross-chain request module, a witness node execution module and a data calling module;
the cross-chain request module is used for acquiring service contract information after a user writes a service contract for completing a cross-chain target and inputs a built-in presupposition machine contract address to complete service contract deployment, and determining cross-chain data type information according to service cross-chain requirements, so that the service contract calls the presupposition machine contract according to the cross-chain data type information and requests to call the cross-chain information;
the witness node execution module is used for constructing a target chain cross-link request according to the preplan contract request, sending the target chain cross-link request to a target chain and writing a cross-link request result into the preplan contract according to the target chain cross-link request when the preplan contract executes the requested cross-link data according to the cross-link data type information;
the data calling module is used for acquiring corresponding target chain information in a service contract according to a request identifier requestID returned by the cross-chain request module when a user calls the service contract, calling the prediction machine contract if the target chain information does not exist in the service contract, acquiring the target chain information corresponding to the request identifier requestID stored in the prediction machine contract according to the requestID, and if the acquisition is successful, determining that the uplink of the cross-chain contract transaction is successful.
Optionally, the cross-chain request module is further configured to, after a user writes a service contract for completing a cross-chain purpose and inputs a built-in predictive machine contract address to complete a service contract deployment, obtain a service contract code and a predictive machine contract address input by the user, determine a target service contract code according to the service contract code, determine a type of the service contract request cross-chain data and a corresponding calling method and method parameter according to the target service contract code, and call a predictive machine contract corresponding to the predictive machine contract address according to the type of the service contract request cross-chain data, the corresponding calling method, and the method parameter.
Optionally, the witness node execution module is further configured to, when the language predictive contract execution request is for cross-link data, construct a destination-chain cross-link request according to a language predictive contract request generated by the language predictive contract, and send the destination-chain cross-link request to a destination chain, so that the destination chain feeds back a cross-link request result, and call a preset method of the language predictive contract to write the cross-link request result into the language predictive contract.
Optionally, the witness node execution module is further configured to, when calling the predictive engine contract to return data and adopting a mode of actively writing a result, call a preset obtaining method in the service contract according to a request identifier of a service request to obtain destination chain information;
the witness node execution module is further configured to, when the language predictive machine contract is called to return data in a passive writing result manner, call a preset obtaining method in the language predictive machine contract according to the request ID returned by the cross-chain request module to obtain destination chain information corresponding to the request ID stored in the language predictive machine contract.
In addition, in order to achieve the above object, the present invention further provides a built-in predictive machine contract-based cross-chain method, which is applied to a built-in predictive machine contract-based cross-chain system as described above, where the built-in predictive machine contract-based cross-chain system includes: the system comprises a cross-chain request module, a witness node execution module and a data calling module;
the method comprises the following steps:
the cross-chain request module acquires service contract information after a user writes a service contract for completing a cross-chain and inputs a built-in president contract address to complete service contract deployment, determines cross-chain data type information according to service cross-chain requirements, so that the service contract calls the president contract according to the cross-chain data type information and requests to call the cross-chain information;
when the foresight machine contract executes request cross-chain data according to the cross-chain data type information, the witness node execution module constructs a target chain cross-chain request according to the foresight machine contract request, sends the target chain cross-chain request to a target chain, and writes a cross-chain request result into the foresight machine contract according to the target chain cross-chain request;
when a user calls the service contract, the data calling module acquires corresponding target chain information in the service contract according to the request identifier requestID returned by the cross-chain request module, if the target chain information does not exist in the service contract, the data calling module calls the prediction machine contract, acquires the target chain information corresponding to the request identifier requestID stored in the prediction machine contract according to the requestID, and if the acquisition is successful, the uplink success of the cross-chain contract transaction is determined.
Optionally, the cross-chain request module obtains service contract information after a user writes a service contract for completing a cross-chain purpose and inputs a built-in president contract address to complete a service contract deployment, and determines cross-chain data type information according to the service contract information, so that the service contract invokes a president contract according to the cross-chain data type information, including:
the cross-chain request module acquires a service contract code and a preset contract address of a presupposition machine input by a user after the user writes a service contract for completing cross-chain and inputs the preset contract address of the presupposition machine to complete the arrangement of the service contract, determines a target service contract code according to the service contract code, determines the type of cross-chain data requested by the service contract and a corresponding calling method and method parameter according to the target service contract code, and calls the presupposition machine contract corresponding to the contract address of the presupposition machine according to the type of the cross-chain data requested by the service contract, the corresponding calling method and method parameter.
Optionally, when the foresight machine contract executes the requested cross-link data according to the cross-link data type information, the witness execution module constructs a destination chain cross-link request according to the foresight machine contract request, sends the destination chain cross-link request to a destination chain, and writes a cross-link request result into the foresight machine contract according to the destination chain cross-link request, including:
when the foresight machine contract execution request cross-chain data is obtained, the witness node execution module constructs a target chain cross-chain request according to the foresight machine contract request generated by the foresight machine contract, sends the target chain cross-chain request to a target chain, enables the target chain to feed back a cross-chain request result, and calls a preset method of the foresight machine contract to write the cross-chain request result into the foresight machine contract.
Optionally, the invoking a preset method of the language predictive machine contract to write the cross-chain request result into the language predictive machine contract includes:
when the witness execution module calls the prompter contract to return data and adopts a mode of actively writing a result, calling a preset acquisition method in the service contract according to a request identifier of a service request to obtain destination chain information;
and when the witness node execution module calls the data returned by the language predictive machine contract in a passive writing result mode, calling a preset acquisition method in the language predictive machine contract according to the request ID returned by the cross-chain request module to acquire the destination chain information corresponding to the request ID stored in the language predictive machine contract.
In the invention, the cross-chain request module is used for acquiring service contract information after a user writes a service contract for completing a cross-chain purpose and inputs a built-in presupposition machine contract address to complete a service contract deployment, and determining cross-chain data type information according to service cross-chain requirements, so that the service contract calls the presupposition machine contract according to the cross-chain data type information and requests to call the cross-chain information; the witness node execution module is used for constructing a target chain cross-link request according to the preplan contract request, sending the target chain cross-link request to a target chain and writing a cross-link request result into the preplan contract according to the target chain cross-link request when the preplan contract executes the requested cross-link data according to the cross-link data type information; the data calling module is used for acquiring corresponding destination chain information in a service contract according to a request identifier requestID returned by the cross-chain request module when a user calls the service contract, calling the predictive contract if the service contract does not have the destination chain information, acquiring the destination chain information corresponding to the request identifier requestID stored in the predictive contract according to the requestID, and if the acquisition is successful, determining that the uplink of the cross-chain contract transaction is successful. The invention meets the cross-chain data requirements of different service contracts by calling the built-in preplan contracts and triggering the witness nodes to execute corresponding processing logics, so that cross-chain data requests, processing and calling operations are all built in the request chains, and cross-chain information interaction and contract operations are easier to realize.
Drawings
FIG. 1 is a schematic structural diagram of a first embodiment of a cross-chain system based on a built-in president contract according to the present invention;
FIG. 2 is a schematic flowchart illustrating a first embodiment of a chain crossing method based on a built-in predictive engine contract according to the present invention;
FIG. 3 is a flowchart illustrating an embodiment of a system and method for cross-chaining based on a built-in predictive engine contract.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a first embodiment of a cross-chain system based on a built-in president contract according to the present invention.
In this embodiment, the chain-crossing system based on the built-in president contract includes: a cross-chain request module 10, a witness node execution module 20 and a data call module 30.
It should be noted that the present embodiment is applied to multiple blockchains, so as to implement data transmission, transaction access, and the like between different blockchains.
Further, the cross-chain request module 10 is configured to obtain service contract information after a user writes a service contract that completes a cross-chain target and inputs a built-in preplan contract address to complete a service contract deployment, and determine cross-chain data type information according to a service cross-chain requirement, so that the service contract calls a preplan contract according to the cross-chain data type information, and requests to call cross-chain information.
It will be appreciated that a predictive engine is a tool that provides trusted data for a blockchain. The service contract information includes a service contract code and a predictive machine contract address, methods and related state variables are defined in the predictive machine contract, and when a user inputs the service contract code and the predictive machine contract address, a request method in the pre-compiled predictive machine contract is triggered.
It is understood that the cross-chain data type information may include a block information type, a contract operation type, contract data, and specific parameters corresponding to the calling method and method required to provide the data.
Further, the cross-chain request module 10 is further configured to, after a user writes a service contract for completing a cross-chain purpose and inputs a built-in preplan contract address to complete a service contract deployment, obtain a service contract code and a preplan contract address input by the user, determine a target service contract code according to the service contract code, determine a type of the service contract request cross-chain data and a corresponding calling method and method parameter according to the target service contract code, and call a preplan contract corresponding to the preplan contract address according to the type of the service contract request cross-chain data, the corresponding calling method and method parameter.
It can be understood that, a user writes a business contract to perform cross-linking, and a pre-compiled oracle contract needs to be referred to in the business contract to perform contract invocation, that is, the business contract needs to invoke the pre-compiled oracle contract to perform cross-linking request to trigger oracle processing cross-linking.
It should be noted that the target service contract encoding is an encoding after the service contract deployment is completed, and is different from the service contract encoding input by the user, but has a corresponding relationship, but the target service contract encoding may determine the type of the service contract request cross-link data and the corresponding calling method and method parameters.
In a specific implementation, for different service contract contents, multiple cross-link information types are requested in a prediction machine contract execution process in a supporting mode. For example: the request type of the business contract calling the presbyzer contract is a block information type blockData, the calling method required to be provided for requesting the data is getLockByHash, the specific parameter corresponding to the method is Hash, and after the business contract calls the transaction write-in chain, the event subscription is used for triggering the processing mechanism of the presbyzer.
It should be noted that the method of the predictive machine contract includes three methods of applying for a cross-link (requestOracle) to the predictive machine contract, writing a cross-link result into the predictive machine contract (responseooracle), and obtaining a cross-link result (getOracle) in the predictive machine contract. Applying for a cross-link method to a contract of a prediction machine, generating an identification code (requestID) which uniquely marks the request of the prediction machine according to a self-increment value, and writing the request into a receipt structure of transaction; writing the cross-link result into a prediction machine contract method, relating to a process that a witness node calls a prediction machine contract to request the chain linking of the result; a method for obtaining a cross-link result in a prediction machine contract relates to a process that a user calls the prediction machine contract to obtain a result corresponding to a request (request ID) after data chaining.
Further, the witness execution module 20 is configured to, when the predictive machine contract executes the requested cross-link data according to the cross-link data type information, construct a destination chain cross-link request according to the predictive machine contract request, send the destination chain cross-link request to the destination chain, and write a cross-link request result into the predictive machine contract according to the destination chain cross-link request.
Further, the witness node execution module 20 is further configured to, when the language predictive contract execution request is for cross-link data, construct a destination-chain cross-link request according to the language predictive contract request generated by the language predictive contract, send the destination-chain cross-link request to a destination chain, so that the destination chain feeds back a cross-link request result, and call a preset method of the language predictive contract to write the cross-link request result into the language predictive contract.
It will be appreciated that when the prolog machine executes to request cross-link data, the prolog machine processing mechanism (Oracle processor) in the node subscribes to the Oracle event log. And after the transaction write-in chain is called by the service contract, an Oracle event is thrown out, and after the event is received by the prediction machine processing mechanism, the cross-chain request is processed according to the request cross-chain data type in Oracle and the corresponding data request method and parameter. The witness node executes corresponding logic for different types of talker requests, constructs corresponding requests and sends the requests to the destination chain. When the request result is received, the cross-chain request result is obtained.
It can be understood that, after the witness node acquires the cross-link data, according to the requestID of the cross-link request, the responseooracle method of the language predictive contract is called, and the cross-link result is written into the language predictive contract. Wherein, the responseOracle method parameter input is a call code for writing the cross-chain data into the service contract. The parameter is optional and provides both an active and passive way of writing business contracts across linked results. If the input is empty and the passive mode is adopted, the cross-chain request data is written into the prompter contract only; if the input is not empty, the mode is active, the prediction machine contract calls the service contract, and actively writes the cross-link result data into the service contract. The method provides a more flexible data acquisition mode for the service contract.
Further, the witness node execution module 20 is further configured to, when the language predictive engine contract is called to return data and an active result writing mode is adopted, call a preset acquisition method in the service contract according to a request identifier of a service request to obtain destination link information;
the witness node execution module 20 is further configured to, when the mode of passively writing a result is adopted for calling the predictive engine contract to return data, call a preset acquisition method in the predictive engine contract according to the request ID returned by the cross-chain request module to acquire destination chain information corresponding to the request ID stored in the predictive engine contract.
It should be noted that, after the result is actively written, the call when the user uses the data includes three methods: a request method in a service contract, a response return method in the service contract, and a get acquisition method in the service contract (a preset acquisition method in the service contract).
Similarly, after the result is passively written, the call when the user uses the data includes three methods: the method comprises a request method in a built-in president contract, a response return method in the built-in president contract and a get acquisition method in the built-in president contract (a preset acquisition method in the president contract). And obtaining a service request result through a preset obtaining method in the language predictive controller contract, and obtaining destination chain information of the original chain request in a data structure field of the returned service request result in the language predictive controller.
Further, the data invoking module 30 is configured to, when the user invokes the service contract, obtain corresponding destination chain information in the service contract according to the request identifier requestID returned by the cross-chain request module, if the service contract does not have the destination chain information, invoke the predicting machine contract, obtain the destination chain information corresponding to the request identifier requestID stored in the predicting machine contract according to the requestID, and if the obtaining is successful, determine that the uplink of the cross-chain contract transaction is successful.
It should be noted that, here, destination chain information corresponding to the request ID stored in the language predictive machine contract (i.e., witness node execution module stores the language predictive machine contract) is obtained according to the request ID (i.e., request identifier) returned by the cross-chain request module.
It can be understood that the uniquely identified requestID is automatically generated in the predictive engine, thereby requesting the destination chain data; when data is returned from the destination chain, the requestID is used as a unique identifier, so that the witness node execution module can store destination chain information corresponding to the requestID into the prompter contract.
In a particular implementation, a user invokes a contract for a business contract that has been deployed across chains or invokes a contract procedure across chains. Similar to the acquisition of the destination chain information, if the contract is deployed in a cross-chain manner, the transaction hash (i.e., the transaction hash value for deployment) deployed by the contract on the destination chain is acquired from a corresponding data structure returned in the prediction machine contract; similarly, if the contract is called across chains, the transaction hash (i.e. the transaction hash value) of the contract called on the destination chain is obtained in the corresponding data structure returned in the prediction machine contract. In addition, after the contract transaction is deployed or the contract calling transaction is completed, the contract information deployed on the destination chain can be further acquired in a cross-chain mode according to the transaction hash deployed by the contract or the contract calling transaction hash, and if a return result exists, the successful uplink of the cross-chain contract transaction is confirmed.
In this embodiment, the cross-link request module is configured to obtain service contract information after a user writes a service contract that completes a cross-link destination and inputs a built-in preplan contract address to complete a service contract deployment, and determine cross-link data type information according to a service cross-link requirement, so that the service contract invokes a preplan contract according to the cross-link data type information and requests to invoke cross-link information; the witness node execution module is used for constructing a target chain cross-chain request according to the prediction machine contract request, sending the target chain cross-chain request to a target chain and writing a cross-chain request result into the prediction machine contract according to the target chain cross-chain request when the prediction machine contract executes the request cross-chain data according to the cross-chain data type information; the data calling module is used for acquiring corresponding target chain information in a service contract according to a request identifier requestID returned by the cross-chain request module when a user calls the service contract, calling the prediction machine contract if the target chain information does not exist in the service contract, acquiring the target chain information corresponding to the request identifier requestID stored in the prediction machine contract according to the requestID, and if the acquisition is successful, determining that the uplink of the cross-chain contract transaction is successful. The invention meets the cross-chain data requirements of different service contracts by calling the built-in preplan contracts and triggering the witness nodes to execute corresponding processing logics, so that cross-chain data requests, processing and calling operations are all built in the request chains, and cross-chain information interaction and contract operations are easier to realize.
An embodiment of the present invention provides a chain crossing method based on a built-in predictive engine contract, and referring to fig. 2, fig. 2 is a schematic flowchart of a first embodiment of the chain crossing method based on the built-in predictive engine contract.
In this embodiment, the chain crossing system based on the built-in president contract includes: the system comprises a cross-chain request module, a witness node execution module and a data calling module.
It should be noted that the present embodiment is applied to multiple blockchains, so as to implement data transmission, transaction access, and the like between different blockchains.
Step S10: the cross-chain request module acquires service contract information after a user writes a service contract for completing a cross-chain object and inputs a built-in president contract address to complete service contract deployment, and determines cross-chain data type information according to service cross-chain requirements, so that the service contract calls the president contract according to the cross-chain data type information and requests to call the cross-chain information.
It will be appreciated that a predictive engine is a tool that provides trusted data for a blockchain. The service contract information includes a service contract code and a predictive machine contract address, methods and associated state variables are defined in the predictive machine contract, and when a user inputs the service contract code and the predictive machine contract address, a request method in the pre-compiled predictive machine contract is triggered.
It is understood that the cross-chain data type information may include a block information type, a contract operation type, contract data, and specific parameters corresponding to the calling method and method required to provide the data.
Further, the cross-chain request module acquires service contract information after a user writes a service contract for completing a cross-chain target and inputs a built-in president contract address to complete a service contract deployment, and determines cross-chain data type information according to the service contract information, so that the service contract calls a president contract according to the cross-chain data type information, and the method includes: the cross-link request module acquires a service contract code and a preplan contract address input by a user after the user writes a service contract for completing a cross-link purpose and inputs a built-in preplan contract address to complete a service contract deployment, determines a target service contract code according to the service contract code, determines the type of service contract request cross-link data and a corresponding calling method and method parameters according to the target service contract code, and calls the preplan contract corresponding to the preplan contract address according to the type of the service contract request cross-link data, the corresponding calling method and method parameters.
It can be understood that, a user writes a business contract to perform cross-linking, and a pre-compiled oracle contract needs to be referred to in the business contract to perform contract invocation, that is, the business contract needs to invoke the pre-compiled oracle contract to perform cross-linking request to trigger oracle processing cross-linking.
It should be noted that the target service contract encoding is an encoding after the service contract deployment is completed, and is different from the service contract encoding input by the user, but has a corresponding relationship, but the target service contract encoding may determine the type of the service contract request cross-link data and the corresponding calling method and method parameter.
In a specific implementation, for different service contract contents, multiple cross-link information types are requested in a prediction machine contract execution process in a supporting mode. For example: the request type of the business contract calling prediction machine contract is a block information type, the calling method required to be provided for requesting the data is getLockByHash, the specific parameter corresponding to the method is Hash, and after the business contract calls a transaction write-in chain, event subscription is used for triggering a prediction machine processing mechanism.
The method for the predictive machine contract includes three methods, namely, applying for a cross-chain (requestOracle) to the predictive machine contract, writing a cross-chain result into the predictive machine contract (responseocle), and acquiring a cross-chain result (getOracle) in the predictive machine contract. Applying for a cross-link method to a contract of a prediction machine, generating an identification code (requestID) which uniquely marks the request of the prediction machine according to a self-increment value, and writing the request into a receipt structure of transaction; writing the cross-link result into a prediction machine contract method, relating to a process that a witness node calls a prediction machine contract to request the chaining of the result; a method for obtaining a cross-link result in a prediction machine contract relates to a process that a user calls the prediction machine contract to obtain a result corresponding to a request (request ID) after data chaining.
Step S20: and when the witness node execution module executes the request cross-link data according to the cross-link data type information in the predictive machine contract, constructing a target chain cross-link request according to the predictive machine contract request, sending the target chain cross-link request to a target chain, and writing a cross-link request result into the predictive machine contract according to the target chain cross-link request.
Further, when the foresight machine contract execution request is executed to obtain the data of the cross-link, the witness node execution module constructs a target chain cross-link request according to the foresight machine contract request generated by the foresight machine contract, and sends the target chain cross-link request to the target chain, so that the target chain feeds back a cross-link request result, and calls a preset method of the foresight machine contract to write the cross-link request result into the foresight machine contract.
It will be appreciated that when the prolog machine executes to request cross-link data, the prolog machine processing mechanism (Oracle processor) in the node subscribes to the Oracle event log. And after the transaction write-in chain is called by the service contract, an Oracle event is thrown out, and after the event is received by the prediction machine processing mechanism, the cross-chain request is processed according to the request cross-chain data type in Oracle and the corresponding data request method and parameter. The witness node executes corresponding logic for different types of talker requests, constructs corresponding requests and sends the requests to the destination chain. When the request result is received, the cross-chain request result is obtained.
It can be understood that, after the witness node acquires the cross-link data, according to the requestID of the cross-link request, the responseooracle method of the language predictive contract is called, and the cross-link result is written into the language predictive contract. Wherein, the responseOracle method parameter input is a call code for writing the cross-chain data into the service contract. This parameter is optional, providing both an active and passive way of writing business contracts across linked results. If the input is empty and the passive mode is adopted, the cross-chain request data is written into the prompter contract only; if the input is not null, the prediction machine contract calls a service contract in an active mode, and actively writes the cross-link result data into the service contract. The method provides a more flexible data acquisition mode for the service contract.
Further, the calling the preset method of the predictive machine contract to write the cross-chain request result into the predictive machine contract comprises:
when the witness node execution module calls the predictive machine contract return data and adopts an active result writing mode, calling a preset acquisition method in the service contract according to a request identifier of a service request to obtain destination chain information;
and when the witness node execution module calls the language predictive contract to return data in a passive writing result mode, calling a preset acquisition method in the language predictive contract according to the request ID returned by the cross-chain request module to acquire destination chain information corresponding to the request ID stored in the language predictive contract.
It should be noted that, after the result is actively written, the call when the user uses the data includes three methods: a request method in a service contract, a response return method in a service contract, and a get acquisition method in a service contract (a preset acquisition method in a service contract).
Similarly, after the result is passively written, the call when the user uses the data includes three methods: the method comprises a request method in a built-in president contract, a response return method in the built-in president contract and a get acquisition method in the built-in president contract (a preset acquisition method in the president contract). And acquiring a service request result by a preset acquisition method in the contract of the language prediction machine, and acquiring destination chain information of the original chain request in a data structure field of the returned service request result in the language prediction machine.
Step S30: when a user calls the service contract, the data calling module acquires corresponding target chain information in the service contract according to the request identifier requestID returned by the cross-chain request module, if the target chain information does not exist in the service contract, the data calling module calls the prediction machine contract, acquires the target chain information corresponding to the request identifier requestID stored in the prediction machine contract according to the requestID, and if the acquisition is successful, the uplink success of the cross-chain contract transaction is determined.
It should be noted that, here, destination chain information corresponding to the request ID stored in the language predictive machine contract (i.e., witness node execution module stores the language predictive machine contract) is obtained according to the request ID (i.e., request identifier) returned by the cross-chain request module.
It can be understood that the uniquely identified requestID is automatically generated in the prediction machine, so as to request the destination chain data; when data is returned from the destination chain, the requestID is used as a unique identifier, so that the witness node execution module can store destination chain information corresponding to the requestID into the prompter contract.
As shown in fig. 3, (1) (2) triggering a requestOracle logical process in a president contract for a user through a business contract; (3) (4) subscribing an Oracle event log in a prediction machine for an Oracle processor, and monitoring an Oracle event process by a witness node; (5) (6) a process of sending an offline data request to a destination chain related node by the witness node to obtain and return a result; (7) calling responseOracle logic in a speaker-phone contract after acquiring data for the witness node; (8) (9) acquiring destination chain information and performing a cross-chain contract operation process by calling get methods in a service contract and a forecast machine contract; the in (r) is the process of actively calling the business contract by the predict machine contract responseoacle logic to return cross-chain data.
As can be seen from fig. 3, the method for setting the pre-senter contract in the embodiment is easy to implement, and can greatly reduce the development period and the cost. The link network is internally provided with the preplan, so that the link network has the advantage of semi-decentralization, and the reliability is ensured to a certain extent compared with the processing mode of the centralized preplan. The cross-chain information is acquired through the prediction machine contract, and the calling record is stored, so that the authenticity and the safety of data can be guaranteed to a certain extent. The method for returning the foresight contract to the cross-chain data provides a more flexible data acquisition mode for the user.
In particular implementations, a user invokes a contract for a service contract that has been deployed across chains or a process that invokes a contract across chains. Similar to the acquisition of the destination chain information, if a contract is deployed in a cross-chain manner, a transaction hash (i.e., a deployed transaction hash value) deployed by the contract on the destination chain is acquired from a corresponding data structure returned in the president contract; similarly, if the contract is called across chains, the transaction hash (i.e. the transaction hash value) of the contract called on the destination chain is obtained in the corresponding data structure returned in the prediction machine contract. In addition, after the contract transaction is deployed or the contract calling transaction is completed, the contract information deployed on the destination chain can be further acquired in a cross-chain mode according to the transaction hash deployed by the contract or the contract calling transaction hash, and if a return result exists, the successful uplink of the cross-chain contract transaction is confirmed.
In this embodiment, the cross-chain request module acquires service contract information after a user writes a service contract for completing a cross-chain purpose and inputs a built-in predictive engine contract address to complete a service contract deployment, and determines cross-chain data type information according to a service cross-chain requirement, so that the service contract calls a predictive engine contract according to the cross-chain data type information to request for calling the cross-chain information; when the foresight machine contract executes request cross-chain data according to the cross-chain data type information, the witness node execution module constructs a target chain cross-chain request according to the foresight machine contract request, sends the target chain cross-chain request to a target chain, and writes a cross-chain request result into the foresight machine contract according to the target chain cross-chain request; when a user calls the service contract, the data calling module acquires corresponding target chain information in the service contract according to the request identification requestID returned by the cross-chain request module, if the service contract does not have the target chain information, the predictive machine contract is called, the target chain information corresponding to the request identification requestID stored in the predictive machine contract is acquired according to the requestID, and if the acquisition is successful, the uplink success of the cross-chain contract transaction is determined. The invention meets the cross-chain data requirements of different service contracts by calling the built-in preplan contracts and triggering the witness nodes to execute corresponding processing logics, so that cross-chain data requests, processing and calling operations are all built in the request chains, and cross-chain information interaction and contract operations are easier to realize.
It should be understood that the above is only an example, and the technical solution of the present invention is not limited in any way, and in a specific application, a person skilled in the art may set the technical solution as needed, and the present invention is not limited in this respect.
It should be noted that the above-described work flows are only exemplary, and do not limit the scope of the present invention, and in practical applications, a person skilled in the art may select some or all of them to achieve the purpose of the solution of the embodiment according to actual needs, and the present invention is not limited herein.
In addition, the technical details that are not elaborated in this embodiment may refer to the chain crossing method based on the built-in preplan contract provided in any embodiment of the present invention, and are not described herein again.
Further, it is to be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or system comprising the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g. a Read Only Memory (ROM)/RAM, magnetic disk, optical disk), and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A built-in predictive engine contract-based cross-chain system, comprising: the system comprises a cross-chain request module, a witness node execution module and a data calling module; the cross-chain request module, the witness node execution module and the data calling module are all built in the request chain;
the cross-link request module is used for acquiring service contract information after a user writes a service contract for completing a cross-link purpose and inputs a built-in president contract address to complete service contract deployment, determining cross-link data type information according to service cross-link requirements, so that the service contract calls the president contract according to the cross-link data type information and requests to call the cross-link information;
the witness node execution module is used for constructing a target chain cross-link request according to the preplan contract request, sending the target chain cross-link request to a target chain and writing a cross-link request result into the preplan contract according to the target chain cross-link request when the preplan contract executes the requested cross-link data according to the cross-link data type information;
the data calling module is used for acquiring corresponding target chain information in a service contract according to a request identifier requestID returned by the cross-chain request module when a user calls the service contract, calling the predictive contract if the target chain information does not exist in the service contract, acquiring the target chain information corresponding to the request identifier requestID stored in the predictive contract according to the requestID, and if the acquisition is successful, determining that the uplink of the cross-chain contract transaction is successful.
2. The system of claim 1, wherein the cross-link request module is further configured to, after a user writes a service contract for completing a cross-link purpose and inputs a built-in predictive contract address to complete a service contract for deployment, obtain a service contract code and a predictive contract address input by the user, determine a target service contract code according to the service contract code, determine a type of the service contract request cross-link data and a corresponding invoking method and method parameter according to the target service contract code, and invoke a predictive contract corresponding to the predictive contract address according to the type of the service contract request cross-link data, the corresponding invoking method and method parameter.
3. The system of claim 1, wherein the witness node execution module is further configured to, when the predictive-machine contract execution request requests cross-link data, construct a destination-chain cross-link request according to a predictive-machine contract request generated by the predictive-machine contract, and send the destination-chain cross-link request to a destination chain, so that the destination chain feeds back a cross-link request result, and call a preset method of the predictive-machine contract to write the cross-link request result into the predictive-machine contract.
4. The system of claim 3, wherein the witness execution module is further configured to, when the predictive engine contract is invoked to return data in a manner of actively writing a result, invoke a preset acquisition method in the service contract according to a request identifier of a service request to obtain destination chain information;
the witness node execution module is further configured to, when the language predictive machine contract is called to return data in a passive writing result manner, call a preset obtaining method in the language predictive machine contract according to the request ID returned by the cross-chain request module to obtain destination chain information corresponding to the request ID stored in the language predictive machine contract.
5. A built-in predictive machine contract-based cross-chain method, which is applied to the built-in predictive machine contract-based cross-chain system according to any one of claims 1 to 4, and which comprises: the system comprises a cross-chain request module, a witness node execution module and a data calling module; the cross-chain request module, the witness node execution module and the data calling module are all built in the request chain;
the method comprises the following steps:
the cross-chain request module acquires service contract information after a user writes a service contract for completing a cross-chain and inputs a built-in president contract address to complete service contract deployment, determines cross-chain data type information according to service cross-chain requirements, so that the service contract calls the president contract according to the cross-chain data type information and requests to call the cross-chain information;
when the foresight machine contract executes request cross-chain data according to the cross-chain data type information, the witness node execution module constructs a target chain cross-chain request according to the foresight machine contract request, sends the target chain cross-chain request to a target chain, and writes a cross-chain request result into the foresight machine contract according to the target chain cross-chain request;
when a user calls the service contract, the data calling module acquires corresponding target chain information in the service contract according to the request identifier requestID returned by the cross-chain request module, if the service contract does not have the target chain information, the predictive machine contract is called, the target chain information corresponding to the request identifier requestID stored in the predictive machine contract is acquired according to the requestID, and if the acquisition is successful, the uplink success of the cross-chain contract transaction is determined.
6. The method of claim 5, wherein the cross-link request module obtains service contract information after a user writes a service contract for completing a cross-link destination and inputs a built-in predictive machine contract address to complete a service contract deployment, and determines cross-link data type information according to the service contract information, so that the service contract calls a predictive machine contract according to the cross-link data type information, and the method comprises:
the cross-chain request module acquires a service contract code and a preset contract address of a presupposition machine input by a user after the user writes a service contract for completing cross-chain and inputs the preset contract address of the presupposition machine to complete the arrangement of the service contract, determines a target service contract code according to the service contract code, determines the type of cross-chain data requested by the service contract and a corresponding calling method and method parameter according to the target service contract code, and calls the presupposition machine contract corresponding to the contract address of the presupposition machine according to the type of the cross-chain data requested by the service contract, the corresponding calling method and method parameter.
7. The method as claimed in claim 5, wherein the witness node execution module constructs a destination chain cross-chain request according to a foresight machine contract request when the foresight machine contract executes the request cross-chain data according to the cross-chain data type information, sends the destination chain cross-chain request to a destination chain, and writes a cross-chain request result into the foresight machine contract according to the destination chain cross-chain request, including:
when the foresight machine contract execution request cross-chain data is obtained, the witness node execution module constructs a target chain cross-chain request according to the foresight machine contract request generated by the foresight machine contract, sends the target chain cross-chain request to a target chain, enables the target chain to feed back a cross-chain request result, and calls a preset method of the foresight machine contract to write the cross-chain request result into the foresight machine contract.
8. The method of claim 7, wherein said invoking the preset method of the predictive-machine contract to write the cross-chain request result to the predictive-machine contract comprises:
when the witness execution module calls the prompter contract to return data and adopts a mode of actively writing a result, calling a preset acquisition method in the service contract according to a request identifier of a service request to obtain destination chain information;
and when the witness node execution module calls the language predictive contract to return data in a passive writing result mode, calling a preset acquisition method in the language predictive contract according to the request ID returned by the cross-chain request module to acquire destination chain information corresponding to the request ID stored in the language predictive contract.
CN202211418408.1A 2022-11-14 2022-11-14 Chain-crossing system and method based on built-in preplan contract Active CN115567321B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211418408.1A CN115567321B (en) 2022-11-14 2022-11-14 Chain-crossing system and method based on built-in preplan contract

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211418408.1A CN115567321B (en) 2022-11-14 2022-11-14 Chain-crossing system and method based on built-in preplan contract

Publications (2)

Publication Number Publication Date
CN115567321A CN115567321A (en) 2023-01-03
CN115567321B true CN115567321B (en) 2023-03-03

Family

ID=84770675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211418408.1A Active CN115567321B (en) 2022-11-14 2022-11-14 Chain-crossing system and method based on built-in preplan contract

Country Status (1)

Country Link
CN (1) CN115567321B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115774728B (en) * 2023-02-15 2023-04-14 湖南大学 President machine-based alliance chain cross-chain operation method, apparatus, device and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113301163A (en) * 2021-06-02 2021-08-24 网易(杭州)网络有限公司 Service processing method, system, electronic device and storage medium
CN113407640A (en) * 2021-07-21 2021-09-17 杭州链网科技有限公司 Multi-chain NFT (network File transfer) based chain crossing method and system
CN114202425A (en) * 2021-12-31 2022-03-18 杭州复杂美科技有限公司 Method, device and storage medium for predicting multi-main-chain interlinkage of language machine
WO2022062782A1 (en) * 2020-09-23 2022-03-31 上海万向区块链股份公司 Settlement method and system based on oracle machine lock group

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111145023A (en) * 2019-12-17 2020-05-12 上海交通大学 Cross-chain exchange method, system and medium based on trusted prediction machine
CN112819616A (en) * 2020-06-24 2021-05-18 支付宝(杭州)信息技术有限公司 Block chain-based original work transaction method and device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022062782A1 (en) * 2020-09-23 2022-03-31 上海万向区块链股份公司 Settlement method and system based on oracle machine lock group
CN113301163A (en) * 2021-06-02 2021-08-24 网易(杭州)网络有限公司 Service processing method, system, electronic device and storage medium
CN113407640A (en) * 2021-07-21 2021-09-17 杭州链网科技有限公司 Multi-chain NFT (network File transfer) based chain crossing method and system
CN114202425A (en) * 2021-12-31 2022-03-18 杭州复杂美科技有限公司 Method, device and storage medium for predicting multi-main-chain interlinkage of language machine

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
BitXHub:基于侧链中继的异构区块链互操作平台;叶少杰等;《计算机科学》;20200615(第06期);全文 *
智能合约和预言机初探;范锦锋;《信息通信技术与政策》;20180715(第07期);全文 *

Also Published As

Publication number Publication date
CN115567321A (en) 2023-01-03

Similar Documents

Publication Publication Date Title
CN111163129B (en) Resource processing method and device based on cross-link network
CN111159307B (en) Cross-link data subscription method and device
CN111461723A (en) Data processing system, method and device based on block chain
US10467576B2 (en) Distributed software process tracking
CN115567321B (en) Chain-crossing system and method based on built-in preplan contract
CN112817995B (en) Data processing method and device, electronic equipment and storage medium
CN111861481A (en) Block chain account checking method and system
CN110908812A (en) Business data processing method and device, readable storage medium and computer equipment
CN113220717A (en) Block chain-based data verification method and device and electronic equipment
US11093309B1 (en) Communication hub for information technology (IT) services
CN111062057B (en) Neutral data application method, device and system
CN113469815A (en) Data management method and device
US11120513B2 (en) Capital chain information traceability method, system, server and readable storage medium
CN113643030B (en) Transaction processing method, device and equipment
CN113254467B (en) Method and blockchain node for performing transactions in blockchain system
CN113987035A (en) Block chain external data access method, device, system, equipment and medium
CN113077241A (en) Approval processing method, device, equipment and storage medium
CN109067611B (en) Method, device, storage medium and processor for detecting communication state between systems
CN113051008A (en) Interface request processing method and device, computer equipment and storage medium
CN114884673B (en) Management method and device for block chain and electronic equipment
CN113177080B (en) Block chain consensus engine system and block chain consensus processing flow method
CN117993911B (en) Block chain-based offline payment method, system and computer equipment
CN117354321A (en) Service data mirroring method and device, storage medium and electronic device
CN118474191A (en) Service capability calling method, device, equipment, storage medium and program product
CN117472617A (en) Message processing method and device, electronic equipment and readable 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