The present application claims priority of chinese patent application entitled "blockchain standard application model and method for applying same" filed by chinese patent office on 28/8/2018 with application number 201810986825.3, the entire contents of which are incorporated herein by reference.
Disclosure of Invention
The application provides a public chain-based transaction method and a blockchain system, which are used for solving the problems that the traditional transaction method does not support cross-chain transaction and the application of the blockchain-based transaction method is limited.
In one aspect, the present application provides a public-link-based transaction method, including:
the transaction initiating chain initiates an inquiry transaction containing the service type information to the public chain;
the public link inquires a transaction target link accessed to a public link network according to the service type information in the inquiry transaction;
the public link returns transaction target link information which accords with the service type information to the transaction initiating link, and the transaction target link information comprises a target link address, a transaction mode and a transaction condition;
the transaction initiating chain initiates service transaction to the public chain according to the transaction mode and the transaction condition;
the public link transmits the service transaction to a transaction target chain;
the transaction target chain verifies the transaction conditions and returns service content to the public chain according to the received service transaction after the transaction conditions are verified to be qualified;
the public link delivers the service content to the transaction initiation chain.
Optionally, the step of initiating, by the transaction initiation chain, the query transaction containing the service type information to the public chain includes:
a transaction node in a transaction initiating chain generates a transaction request according to actual transaction information;
the transaction node broadcasts the transaction request in a transaction initiation chain to form a blockchain accounting conforming to the transaction initiation chain;
the checkout node verifies the transaction request and packages the transaction request into block data;
and the accounting node broadcasts the block data to other nodes and initiates a query transaction to a maintenance node in the public chain, and the intelligent contract provided by the public chain comprises the intelligent contract created by the public chain and the public intelligent contract.
Optionally, before the step of initiating the inquiry transaction containing the service type information to the public link by the transaction initiation chain, the method further includes:
the public link initiates contract verification information to the block chain network of the accessed public link network, and verifies whether the accessed block chain network supports the intelligent contract provided by the public link;
the public link sets a contract judgment label for the accessed block chain network according to the verification result of whether the public link supports the intelligent contract, and the method comprises the following steps: setting contract judgment labels for interface nodes corresponding to the accessed block chain network; or, setting a contract judgment label for the accessed block chain network address.
Optionally, after the step of returning the transaction target chain information meeting the service type information from the public chain to the transaction initiation chain, if both the transaction initiation chain and the transaction target chain support the interface specification agreed by the public chain, the method may further return the service content to the transaction initiation chain through the following steps:
the transaction initiating chain directly initiates service transaction to a transaction target chain according to the transaction mode and the transaction condition;
the transaction target chain verifies the transaction conditions and returns service content to the transaction initiating chain according to the received service transaction after the transaction conditions are verified to be qualified;
and after the transaction initiating chain and the transaction target chain complete the transaction, the transaction summary is synchronized to the public chain.
Optionally, the step of initiating a query transaction containing the service type information to the public link at the transaction initiation chain further includes:
the public link judges whether the transaction initiating link supports the intelligent contract or not;
if the transaction initiation chain does not support the intelligent contract, establishing the intelligent contract for the transaction initiation chain through the public chain, or configuring the public intelligent contract for the transaction initiation chain;
and the public chain determines the addresses corresponding to the transaction initiating chain and the transaction target chain according to the intelligent contract or the public intelligent contract.
Optionally, the transaction condition includes a transaction amount specified by the transaction target chain, and the step of initiating the service transaction to the public chain by the transaction initiation chain according to the transaction condition further includes:
judging whether the amount of the certificates owned by the transaction initiating chain meets the amount of the transaction certificates appointed by the transaction target chain;
if the amount of the certificates owned by the transaction initiating chain meets the amount of the transaction certificates appointed by the transaction target chain, allowing the transaction initiating chain to initiate service transaction to the public chain;
and if the amount of the certificates owned by the transaction initiating chain does not meet the amount of the transaction certificates appointed by the transaction target chain, sending prompt information to the transaction initiating chain, and continuously inquiring other transaction target chains accessed to the public chain network according to the service type.
Optionally, the step of initiating the service transaction to the public link by the transaction initiation link according to the transaction condition includes: the transaction initiation chain creates a transfer transaction on the public chain to trigger contract execution, the transfer transaction including a specified transaction amount of vouching to pay the transaction destination chain.
Optionally, the step of public link delivery service transaction to transaction target chain includes:
locking the transfer transaction by the public chain, and initiating a request transaction to a transaction target chain according to the transfer transaction;
the transaction target chain provides a return transaction result to the public chain according to the transaction request;
the public link verifies the returned transaction result, and if the returned transaction is consistent with the transfer transaction, the locking state of the transfer transaction is released;
the public chain transfers the evidence of the transaction initiation chain payment to the transaction target chain, and transfers the service content to the transaction initiation chain.
Optionally, after querying a transaction target chain accessing the public link network, the method further includes:
the public link judges whether a transaction initiating link and a transaction target link support transaction directly through the certificate of the public link;
if the transaction initiating chain and/or the transaction target chain do not support direct transaction through the certificate of the public chain, the certificate is converted in the parallel chain corresponding to the transaction initiating chain and/or the transaction target chain;
and initiating service transaction to the public chain by the parallel chain corresponding to the transaction initiation chain, and returning service content to the public chain by the parallel chain corresponding to the transaction target chain.
In another aspect, the present application further provides a block chain system based on a public chain, including: a transaction initiation chain, a public chain and a transaction target chain; the transaction initiating chain establishes network connection with a transaction target chain through a public chain;
the transaction initiation chain is configured to: initiating a query transaction containing service type information to the public link; and initiating a service transaction to the public chain according to the transaction condition of the transaction target chain;
the male chain is configured to: inquiring a transaction target chain accessed to a public chain network according to the service type in the inquiry transaction; returning transaction target chain information which accords with the service type information to a transaction initiating chain, wherein the transaction target chain information comprises a target chain address, a transaction mode and a transaction condition; and, delivering the service transaction to a transaction destination chain, and delivering the service content to a transaction origination chain;
the chain of transaction targets is configured to: and verifying the transaction condition, and returning service content to the public chain according to the received service transaction after the transaction condition is verified to be qualified.
According to the technical scheme, in practical application, the method firstly initiates an inquiry transaction to a public link through a transaction initiation chain, and then inquires a transaction target chain accessed to a public link network through the public link according to service type information in the inquiry transaction; so that the public link returns transaction target link information which accords with the service type information to the transaction initiating link; the transaction initiating chain initiates service transaction to the public chain according to the transaction mode and the transaction condition required by the transaction target chain; the public chain transmits the service transaction to a transaction target chain; and returning service content to the public chain according to the received service transaction after the transaction target chain verifies that the transaction condition is qualified; and finally, the public chain transmits the service content to the transaction initiating chain to complete the cross-chain transaction. The method queries and transmits the service transaction through the public link network, so that the transaction initiating link can obtain the service content of the transaction target link, the cross-link transaction is completed among different link networks, and the application range of the block link-based transaction method is expanded.
Detailed Description
Reference will now be made in detail to embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following examples do not represent all embodiments consistent with the present application. But merely as exemplifications of systems and methods consistent with certain aspects of the application, as recited in the claims.
In the technical solution provided by the present application, the blockchain network refers to a peer-to-peer (P2P) network with decentralized application architecture, and the blockchain network can perform distributed storage, public consensus, digital encryption, transaction accounting, and verification. I.e., a transaction platform that encompasses distributed technology, cryptography, P2P network architecture, and various consensus algorithms that may be applied. The block chain or block chain information refers to accounting information generated according to transaction information when transactions occur in the block chain network, namely, a plurality of specific transactions form a block, and a plurality of blocks form an ordered block chain. The blockchain network comprises nodes which establish point-to-point network connection with each other, and each node is configured with a corresponding consensus mechanism, such as an intelligent contract, and has enough computing power to perform transaction verification and accounting procedures. The nodes also have interface specifications that conform to some uniform standard to enable access to more nodes or other types of blockchain networks through the interface specifications.
In the present application, the public chain, the transaction initiation chain, the transaction destination chain and the parallel chain are all referred to different blockchain networks conforming to the blockchain technology. In the present application, unless otherwise stated, the public link, the transaction initiation link, the transaction target link, and the parallel link all refer to corresponding networks, that is, a public link network, a transaction initiation link network, a transaction target link network, and a parallel link network. In the technical scheme provided by the application, a public link network is used as a basic platform arranged in the whole network, and node interfaces of the public link network are accessed into a plurality of block link networks, such as an industry chain, a alliance chain and a private chain which are built based on public link interface specifications. Each blockchain network can be used as a development platform and provides corresponding services for the inside of the network. The public link definition and specification has standard interfaces and modes so as to facilitate network interfacing of other block links, such as a transaction initiation link and a transaction target link. The public chain in the application has the capability of supporting cross-chain intermediary and also has decentralized application and intelligent contractual capability.
The transaction initiation chain and the transaction target chain refer to block chains accessed into a public chain network, namely in the application, the public chain provides a basic platform, and the transaction initiation chain and the transaction target chain are used as the accessed network and have respective functions and services. The transaction initiation chain and the transaction target chain can be block chain networks built based on public chain network standards and interface specifications, namely the transaction initiation chain and the transaction target chain can be directly communicated with the public chain network and service docking is carried out. The transaction initiation chain and the transaction target chain may also be independent networks, such as existing block chain network bitcoin, ether house, etc., or industry chains and alliance chains developed by some industries, even private chains built for achieving a certain service requirement. These existing blockchains, industry chains, federation chains, and private chains generally cannot directly trade with each other or even with a public-link network, and thus, in the present application, the public chain can be connected to other networks through parallel chains.
The parallel chain can be composed of partial nodes in a public chain network, and the public chain and other networks which cannot directly trade can be bridged through the parallel chain. In the application, for networks which cannot directly transact, each block chain network corresponds to a parallel chain, the parallel chains are set to have the complete function of the corresponding block chain network, and can synchronously convert transactions in the block chain network and transmit the transactions to a public chain network. Therefore, in the technical solution provided in the present application, the parallel chain may be determined as a mirror image of the corresponding blockchain network, and for convenience of description, the corresponding blockchain network becomes a parent chain. In the present application, the parallel chain is composed of partial nodes in the public chain network, and the nodes are also nodes in the mother chain to carry out the transmission of the transaction information.
Based on the components, the public chain can provide cross-chain relay in practical application, and work such as transaction verification, data certification, asset transfer, intelligent contract execution and the like is completed. The public link unifies external interface specifications, so that other block link networks can be rapidly accessed into the public link network. The public link also provides basic blockchain platform capability, namely, rapidly completing scheme deployment and verification and completing distributed storage and billing programs in the public link network. In addition, as a basic platform, the public chain can also provide a public development function, so that the cooperative development and deployment of a plurality of parallel chain intelligent contracts can be completed at one time.
The public link can be used for storing the information summary of the corresponding cross-link transaction, namely the transaction summary, besides recording the block chain information of the public link. Related content of cross-chain transaction is recorded through the formatted transaction data. Meanwhile, in order to reduce the occupation of the distributed storage space on the public link, when the public link records certain information, the third-party blockchain information can be recorded through a specific compression algorithm. Illustratively, the chunk data formed and stored in the public chain may include the following: block id (e.g., sequence number, timestamp, block hash value, and previous block hash value), block attribution (i.e., block generator), block other information (e.g., random value, difficulty value, and additional information), block weight, message digest (e.g., transaction tree, status tree, receipt tree, and data tree), transaction cost, reward, size, etc.
In order to implement cross-chain transaction, the present application provides a public chain-based transaction method, as shown in fig. 1, the transaction method includes the following steps:
s1: the transaction initiation chain initiates a query transaction containing service type information to the public chain.
In the technical scheme provided by the application, the transaction initiating chain determines the service type required on the transaction initiating chain according to the service requirement of the transaction initiating chain, and sends the service type to the public chain network in a transaction inquiring mode. Since the transaction initiation chain is also a blockchain network accessing the public chain in the present application, the initiation of the query transaction described herein may be initiated by a certain node in the transaction initiation chain. After the transaction node initiates the query transaction, the transaction initiation chain network firstly judges the service transaction so as to determine whether the service transaction can be completed in the transaction initiation chain network.
If the current service transaction can be completed in the transaction initiation chain, an inquiry transaction does not need to be initiated to the public chain network, that is, the transaction node completes the transaction between the transaction initiation chain and another node capable of providing the corresponding service type, and this transaction process can form blockchain information in the transaction initiation chain and perform procedures such as distributed storage, verification and the like in the transaction initiation chain. If the current service transaction can not be completed in the transaction initiation chain, a corresponding query transaction can be generated through an intelligent contract in the transaction initiation chain, and the query transaction is initiated to a public chain. Obviously, the type of service required in the service transaction must be included in the initiated query transaction. In addition, for a third party block chain which cannot directly transact with the public chain, the query transaction can be transmitted to the public chain through the parallel chain to initiate the query transaction.
For example, there are 5 blockchain networks accessing the public link network P, which are blockchain networks a to E, wherein the network B includes 100 nodes, which are respectively denoted as B00 to B99. In practical application, node B25 in network B needs to use 100 certificates Tb, exchange certificates Ta of equal value, and then node B25 is used as a transaction node, which creates query transactions and forms block data as needed, where the service types included in the query transactions are: in exchange for certificate, node B25 may broadcast the query transaction now in network B, i.e., to other nodes, such as B24 and B26, where the other nodes in network B may, on the one hand, perform distributed storage of the block data of the query transaction to complete accounting, and on the other hand, may determine whether other nodes in network B that can satisfy the transaction request of node B25, i.e., whether other nodes can exchange certificate Ta with node B25.
If the other nodes in network B are unable to complete the Certification exchange, the query transaction needs to be broadcast to the nodes in the public-link network P so that the nodes in the public-link network P determine from the query transaction whether the network A, C, D, E is able to exchange the Certification exchange Ta to node B25.
Further, as shown in fig. 2, the initiating of the query transaction containing the service type information from the transaction initiation chain to the public chain may further include the following steps:
s101: the transaction node in the transaction initiating chain generates transaction information according to actual transaction;
s102: the transaction node broadcasts the transaction information in a transaction initiation chain to form a blockchain accounting conforming to the transaction initiation chain;
s103: the accounting node verifies the transaction and adds block data;
s104: the accounting node broadcasts the block data to other nodes of the transaction initiation chain, meanwhile, an inquiry transaction is initiated to a maintenance node in the public chain, and the intelligent contract provided by the public chain comprises an intelligent contract and a public intelligent contract created by the public chain.
As can be seen from the above steps, after the transaction node generates a transaction, the transaction information may be broadcast in the transaction initiation chain, and the transaction initiation chain writes the transaction information into the block data according to the accounting rule thereof for distributed storage, so as to form block chain accounting data conforming to the transaction initiation chain. The block data records actual transaction information initiated by the transaction node, such as: service type, transaction amount, transaction initiator, transaction target, hash value, etc. After broadcasting in the transaction initiation chain, the transaction node also adds intelligent contract and service type information to the block data.
Still taking the service of the certificate exchange as an example, after initiating the inquiry transaction, the transaction node B25 generates block data including the certificate exchange service, and broadcasts the transaction information of the inquiry transaction in the network B, where the specific broadcast form may be determined according to the broadcast form requirement in the network B, for example, the transaction node B25 may broadcast the block data to the neighboring nodes B24 and B26, and the neighboring nodes B24 and B26 verify the transaction, determine whether the transaction is legal, and store the block data to form a block chain. And then broadcast to their respective neighboring nodes by neighboring nodes B24 and B26, so that all nodes in network B can verify and store the block data to form complete block chain data that conforms to the accounting specification in network B.
In this embodiment, the intelligent contracts provided by the public chain include intelligent contracts created by the public chain and public intelligent contracts, and the intelligent contract information is used for realizing that transactions can be performed with the public chain so as to initiate query transactions and subsequent service transactions; the service type information contains the necessary service description information, or service code information stored in the public link network, which can be used to initiate the query transaction. And broadcasting the block data added with the intelligent contract and the service type information to a maintenance node in the public chain, thereby realizing the initiation of query transaction. The maintenance node in the public link network may be a node for providing an interface for the transaction initiation chain, or may be a designated other node. In order to facilitate the initiation of the query transaction, the computing power can be used to satisfy the condition, and the node which is closer to the transaction initiation chain is used as a maintenance node to increase the broadcasting speed of the block data.
It should be noted that, in the technical solution provided in the present application, the service transaction includes specific transaction contents, which may be a virtual currency conversion transaction, for example, a voucher in a transaction target chain is converted into a voucher through a voucher (token) equivalent value in a transaction initiation chain; it may also be a purchase of some service through virtual currency, such as a web-oriented query service, a reporting service, etc. The inquiry transaction is a special transaction, the transaction form of which is the same as the common transaction form, but a special appointed specific transaction mode is required, for example, the transaction with the intelligent contract information of the inquiry transaction or the transaction with the evidence amount of the appointed transfer being 0.
In some embodiments of the present application, before the step of initiating the inquiry transaction by the transaction initiation chain, the intelligent contract verification may be performed on the transaction initiation chain through the public chain, so as to determine whether the transaction initiation chain supports the intelligent contract provided by the public chain. Namely, the public link initiates contract verification information to the accessed blockchain network of the public link network, and whether the accessed blockchain network supports the intelligent contract provided by the public link is verified. In practical applications, each blockchain network accessing the public chain may be used as a transaction initiation chain, so in this embodiment, after a blockchain network accesses the public chain, it may be verified by an intelligent contract.
After the intelligent contract verification is carried out, the public link can set a contract judgment label for the accessed block link network according to the verification result of whether the intelligent contract is supported or not. The method specifically comprises the following steps: setting a contract judgment label for the corresponding interface node of the accessed block chain network; or, setting a contract judgment label for the accessed block chain network address. The mode of setting a contract judgment label for an interface node corresponding to an accessed blockchain network can be used for extracting the judgment label set for the interface node when the corresponding blockchain network is used as a transaction initiating chain, so that whether the current transaction initiating chain supports an intelligent contract or not is determined; and the mode of setting a contract judgment label for the accessed block chain network address can determine whether the corresponding transaction initiating chain supports the intelligent contract or not by extracting the address of the transaction initiating chain.
In the embodiment, for the transaction initiation chain supporting the intelligent contract, the inquiry transaction can be initiated to the public chain directly through the intelligent contract without participation of a parallel chain; and for the transaction initiation chain which does not support the intelligent contract, the intelligent contract can be configured for the transaction initiation chain through the public chain, or the inquiry transaction is transmitted from the transaction node to the public chain in a parallel chain bridging mode, wherein the intelligent contract is configured in the parallel chain. Therefore, as shown in fig. 3, before the transaction initiation chain initiates the query transaction to the public chain, the transaction method may further include:
s105: the public chain judges whether the transaction initiating chain supports intelligent contracts or not;
s106: if the transaction initiation chain does not support the intelligent contract, establishing an intelligent contract for the transaction initiation chain through the public chain, or configuring a public intelligent contract for the transaction initiation chain;
s107: and the public chain determines the addresses corresponding to the transaction initiation chain and the transaction target chain according to the intelligent contract or the public intelligent contract.
In this embodiment, the public link may determine whether the transaction initiation chain supports the intelligent contract by extracting a contract determination tag on the transaction initiation chain through the public link, that is, determine whether the transaction initiation chain supports the intelligent contract by analyzing the contract determination tag, initiate a contract determination transaction in a specific format to the transaction initiation chain through the intelligent contract on the public link, and analyze a contract determination result returned by the transaction initiation chain. If the transaction initiation chain can return the content meeting the intelligent contract specification, determining that the transaction initiation chain supports the intelligent contract; if the transaction initiation chain cannot return content meeting the intelligent contract specification or does not respond, determining that the transaction initiation chain does not support the intelligent contract.
For a transaction initiation chain supporting a smart contract, a subsequent transaction step may be performed, i.e. the transaction initiation chain initiates a query transaction to the public chain via the smart contract. And aiming at the transaction initiation chain which does not support the intelligent contract, the intelligent contract can be configured for the transaction initiation chain through the public chain, or a public contract is selected for the transaction initiation chain through the public chain, and the selected public contract is configured for the transaction initiation chain. In this embodiment, the common contract may be a contract used by a blockchain network with a higher application degree, or a contract specification agreed in the current industry field. After the intelligent contract or the public intelligent contract is configured for the transaction initiation chain, the public chain can also determine the address information of the transaction initiation chain and the transaction target chain, namely the transaction initiation chain and the transaction target chain are determined, so that subsequent transactions can be implemented.
S2: and the public link inquires a transaction target link accessed to a public link network according to the service type information in the inquiry transaction.
According to the technical scheme, after a public link receives an inquiry transaction initiated by a transaction initiation link, service type information in the inquiry transaction is extracted, inquiry is carried out in a public link network according to the service type information, and a block link network capable of providing a service corresponding to the service type information is found and used as a transaction target link. Similarly, the network as the transaction target chain also includes a plurality of nodes, that is, a plurality of nodes form the transaction target chain. Thus, the services that can be provided in the chain of transaction targets may be one or a portion of the nodes. Therefore, in the technical scheme provided by the application, the result queried by the public chain can be a transaction target chain or a node capable of providing a service in the transaction target chain. In the technical scheme provided by the application, a mode that the result of the public link query is the transaction target chain is preferably selected, so that the transaction target chain is rapidly determined, and the situation that the transaction target chain does not support the public link query is avoided.
In this embodiment, the public link queries the transaction target chain in the public link network, and the query may be completed by an intelligent contract configured in the public link or by decentralized application in the public link network. The specific query process may be a query in the information of the access block chain network stored in the public chain network. In such an inquiry method, when the public link is accessed by the blockchain network, the public link needs to communicate through the access node to acquire information registered by the accessed blockchain network, and the registered information may include: the type of service that can be provided, the type of evidence that can be redeemed, and the manner in which the transaction is conducted, the conditions of the transaction, etc. The program in the public link stores the registration information and the corresponding network address in a corresponding manner, and broadcasts the registration information and the corresponding network address in the whole network.
The inquiry process may also be accomplished by the public link broadcasting a transaction for service provision over the network once after receiving the inquiry transaction. After receiving the transaction provided by the service, the blockchain network accessing the public chain may reply to the transaction, and the reply information may include a transaction condition and a transaction mode. The public link selects the block chain network which returns the earliest time as a transaction target chain, or determines the most suitable (if the number of the required certificates is the least, or the transaction certificate has the best traffic) transaction target chain according to the transaction condition.
Further, in order to facilitate the settlement of the transaction and to complete the accounting procedure, as shown in fig. 4, after querying the transaction object chain accessing the public chain network, the method further comprises:
s201: the public link judges whether the transaction initiating link and the transaction target link support transaction directly through the certificate of the public link;
s202: if the transaction initiating chain and/or the transaction target chain do not support the transaction directly through the certificate of the public chain, the certificate is converted in the parallel chain corresponding to the transaction initiating chain and/or the transaction target chain;
s203: and initiating service transaction to the public chain by the parallel chain corresponding to the transaction initiation chain, and returning service content to the public chain by the parallel chain corresponding to the transaction target chain.
In this embodiment, after the public link queries the transaction target chain, it may be determined whether the transaction initiation chain and the transaction target chain support direct transaction through the public link certificate according to information stored in the public link, and if the transaction initiation chain and the transaction target chain may directly perform transaction through the public link certificate, the public link may perform an accounting procedure and check transaction settlement. If the transaction initiating chain and/or the transaction target chain do not support transaction directly through the certificate of the public chain, the certificate can be converted in the transaction initiating chain and/or the parallel chain corresponding to the transaction target chain, namely the certificate paid by the transaction initiating chain is converted into the public chain certificate with equal value according to the conversion ratio between the public chain certificate and the transaction initiating chain and the transaction target chain, and then the public chain certificate is transmitted to the transaction target chain through the public chain. And in subsequent transaction procedures, service transactions are completed by the parallel chain.
S3: and the public link returns transaction target link information which accords with the service type information to the transaction initiating link, wherein the transaction target link information comprises a target link address, a transaction mode and a transaction condition.
After the public link inquires the transaction target chain, the address information of the transaction target chain, the transaction mode, the transaction condition and other information can be obtained. Obviously, the public link may obtain the information from the registration information stored in the public link, or the information may be provided by the party of the transaction target link by forwarding the inquiry transaction to the transaction target link. In order to increase the query efficiency, the present application preferably acquires the above information by means of the public chain stored registration information. After the public chain acquires the transaction target chain information, the public chain can send the acquired target chain information to the transaction initiating chain, so that the transaction initiating chain can determine whether to perform transaction with the public chain according to the transaction target chain information.
In the technical scheme provided by the application, the destination link address is a registered address of the transaction destination link in a public link network, or a node address of an interface is provided when the transaction destination link accesses the public link. The transaction mode is transaction time set by a transaction target chain, a block chain information format (template), a certificate type supporting transaction and the like. The transaction conditions may include not only a specified amount of vouchers that need to be charged for providing the service, but also qualification requirements for the transaction initiation chain, such as an owned voucher amount requirement, a reputation score for the transaction initiation chain, and the like.
Further, in order to obtain a more appropriate transaction target chain, some additional information may be attached to the query transaction, for example, the type of the transaction certificate that can be provided, the required service specification, the service provision qualification of the transaction target chain, the transaction certificate limit, and the like.
For example, when there is no node capable of providing the credential redemption service in the network B, the query transaction issued by the transaction node B25 may be broadcast to the maintenance nodes P01-P99 in the public link network P through the connection node BP (or interface node) between the network B and the public link network P, and the maintenance nodes in the public link also need to verify and store the query transaction in a distributed manner, and determine whether the credential redemption service can be provided by other blockchain networks A, C, D, E accessed on the public link network P according to the query transaction. If the network A which can meet the certificate clearing and exchanging service is inquired in other blockchain networks, the address information of the network A in the public chain network P, such as the IP address of the connecting node AP, and the transaction conditions registered in the public chain network P by the network A, namely the transaction conditions required when the certificate Tb is performed to clear the certificate Ta, such as the exchanging rate of the certificate Tb and the certificate Ta, the exchanging quality required by a transaction opponent by the network A, and the like are obtained. The service node in the public link P creates a query result with the address of network a and the transaction conditions of network a and returns the query result to the transaction node B25.
S4: and the transaction initiating chain initiates service transaction to the public chain according to the transaction mode and the transaction condition.
According to the technical scheme, after the transaction initiation chain receives the transaction target chain information returned by the public chain, the transaction initiation chain can analyze the transaction target chain information and extract the transaction mode and the transaction conditions in the transaction target chain information. Aiming at the transaction mode, the transaction initiating chain can determine whether the transaction mode provided by the transaction target chain is supported or not; and for the transaction condition, whether the transaction condition proposed by the transaction target chain can be accepted or not can be judged automatically or manually. If the transaction condition can be accepted and the corresponding transaction mode is supported, the transaction initiation chain can initiate the service transaction meeting the transaction condition to the public chain according to the specified transaction mode.
The step that the transaction initiating chain initiates service transaction to the public chain according to the transaction condition comprises the following steps: the transaction initiation chain creates a transfer transaction on the public chain to trigger contract execution, the transfer transaction including a specified transaction amount of evidence paid to the transaction destination chain.
Illustratively, after the maintenance node in the public link network P returns the query result to the transaction node B25, the transaction node B25 verifies the transaction conditions and transaction manner in the returned query result, on the one hand, to determine whether the transaction is satisfactory, i.e., whether the certificate redemption service request of B25 can be satisfied, and on the other hand, to determine whether the transaction conditions, e.g., the certificate redemption rate required by the transaction destination link a, can be accepted. The verification process may be automatically determined by the node B25 or may be an active choice of whether to accept the transaction conditions. In addition, the verification of the returned query result may also include whether the transaction node B25 is able to transact in the manner specified by the transaction destination chain a.
If the transaction node B25 accepts the transaction terms and is able to transact in the manner specified by the transaction destination chain A, then the transaction node B25 initiates the formal service transaction, i.e., the transfer of 100 passes Tb to the public chain network P. It should be noted that, since the maintenance node in the public link network performs the corresponding query and storage operations in the cross-link transaction, and also performs other operations such as delivery, value conversion, accounting, and the like in the subsequent transaction process, when the transaction node B25 initiates a formal service transaction to the public link, a certain amount of public link certificates are also transferred to the public link network as the reward of the maintenance node in the public link.
Further, as shown in fig. 5, the transaction condition includes a transaction amount specified by the transaction target chain, and the step of the transaction initiation chain initiating the service transaction to the public chain according to the transaction condition further includes:
s401: judging whether the amount of the certificates owned by the transaction initiating chain meets the amount of the transaction certificates appointed by the transaction target chain;
s402: if the amount of the certificate of the transaction initiating chain meets the amount of the transaction certificate appointed by the transaction target chain, allowing the transaction initiating chain to initiate service transaction to the public chain;
s403: and if the amount of the evidence of the transaction initiating chain does not meet the amount of the transaction evidence specified by the transaction target chain, sending prompt information to the transaction initiating chain, and continuously inquiring other transaction target chains accessed to a public chain network according to the service type.
In this embodiment, if the transaction condition is the transaction voucher amount specified by the transaction target chain, the public chain may determine the specified voucher balance owned by the transaction initiation chain, so as to determine whether the transaction initiation chain can meet the transaction condition requirement specified by the transaction target chain. For the condition that the transaction condition can be met, allowing the transaction initiation chain to initiate service transaction to the public chain; and for the condition that the transaction condition cannot be met, sending prompt information to the transaction initiating chain to inform the transaction initiating chain, continuously inquiring other transaction target chains accessed to the public chain network according to the service type, and repeating the process until the condition that the transaction condition is met is inquired.
For example, the transaction condition required by the transaction destination chain a is that the number of the certificates Tb owned by the transaction node as the transaction initiator is not less than 100, so before the formal service transaction is initiated, the number of the certificates Tb owned by the transaction node can be judged through the public link network, if the number of the certificates Tb owned by the transaction node is 53, it is determined that the transaction condition is not satisfied, at this time, the public link network sends a prompt message to the transaction node B25, such as "if the balance of the certificates Tb owned by you is not sufficient, the transaction cannot be completed", "the transaction requires that the number of the certificates Tb is not less than 100, and you still need 47 to complete the transaction".
S5: the public link communicates the service transaction to the transaction target chain.
In the technical scheme provided by the application, the service transaction sent to the public link by the transaction initiating link can be transmitted to the transaction target link only by the public link network without any processing in the public link. The public link can extract address information of a transaction target link in the service transaction, acquire the position of the transaction target link, and then send the service transaction to the transaction target link according to the address of the transaction target link.
For example, after receiving a service transaction initiated by the transaction node B25, a maintenance node in the public link network P verifies 100 certificates Tb transferred by the transaction node, forms block data conforming to the public link transaction form for the service transaction, broadcasts the formed block data in the public link network, and transfers the 100 certificates Tb to a Tb account corresponding to the network a.
Since the service transaction is delivered by relying on the public link, in order to achieve the anti-repudiation transaction effect, the public link needs to perform distributed storage in the public link network when delivering the service transaction, that is, accounting in the public link network. And thus is also a transaction that occurs in the public link network when the public link carries the service transaction. In practical application, the types of the certificates which are circulated are different for different blockchain networks, and different types of certificates cannot be directly traded. Therefore, in the technical scheme provided by the application, in the process of transmitting the service transaction to the transaction target chain by the public chain, the certificate of the transaction initiation chain payment can be locked, and then the public chain certificate of equivalent value is transferred to the transaction target chain so as to trigger the transaction target chain to return the service content.
That is, in some embodiments of the present application, as shown in fig. 6, the step of the public chain transferring the service transaction to the transaction target chain includes:
s501: the public chain locks the transfer transaction, and initiates a request transaction to the transaction target chain according to the transfer transaction;
s502: the transaction target chain provides a returned transaction result to the public chain according to the transaction request;
s503: the public chain verifies the returned transaction result, and if the returned transaction result is consistent with the transfer transaction, the locking state of the transfer transaction is released;
s504: and the public chain transfers the evidence of the payment of the transaction initiation chain to the transaction target chain and transfers the service content to the transaction initiation chain.
In this embodiment, the public link locks the posting transaction, that is, temporarily locks the evidence of the transaction initiation chain payment, and then initiates a request transaction to the transaction target chain according to the posting transaction, where the request transaction is used to trigger the transaction target chain to return the transaction, and the public link verifies the content of the return transaction, and if the return transaction is consistent with the posting transaction, the locking state of the posting transaction is released, so that the public link transfers the evidence of the transaction initiation chain payment to the transaction target chain, and transfers the service content to the transaction initiation chain. The posting transaction is locked through the public link, the transaction content can be verified in the public link network, whether the transaction content really meets the transaction specification is determined, and the transaction rights and interests of both transaction parties are guaranteed.
S6: and the transaction target chain verifies the transaction condition, and returns service content to the public chain according to the received service transaction after the transaction condition is verified to be qualified.
According to the technical scheme, after the service transaction transmitted by the public link is received by the transaction target chain, the transaction condition is verified, and whether the service transaction meets the transaction condition is determined. For example, whether the amount of the voucher paid by the service transaction conforms to the amount of the voucher required by the transaction destination chain, whether the transaction initiation chain has the transaction qualification required by the transaction destination chain, and the like. If the transaction target chain verifies that the transaction conditions are qualified, corresponding service content is returned according to the received service transaction, namely corresponding service is provided for the transaction initiating chain.
The service content may be a return transaction that includes specific service content, such as a data retrieval report, or another specified number of certificates redeemed, etc. For service contents which need to be maintained for a long time, the returned service contents may include corresponding network access information, a verification code, an account number, and the like. For service contents which need to be maintained for a long time, the public chain does not need to directly participate in the subsequent data transmission process, only when the service contents are returned, the corresponding information such as network access information, verification codes, account numbers and the like is transmitted to the transaction initiating chain, and the returned service contents are stored in a distributed mode in the public chain, so that an accounting program is completed.
S7: the public link delivers the service content to the transaction initiation link.
And after receiving the service content returned by the transaction target chain, the public chain transfers the service content to the transaction initiating chain in a relay mode. After the public chain forwards the service content to the transaction initiation chain, the transaction is completed. For example, after the public link network P transfers 100 certifications Tb to Tb accounts corresponding to the network a, after the verification of the transaction target chain is passed, the public link network extracts the certifications Ta with equal value from Ta accounts corresponding to the network a, and if the exchange ratio is 2:1, extracts 50 certifications Ta and transfers the extracted certifications Ta to accounts corresponding to the network B, thereby completing the final service transaction.
In some embodiments of the present application, as shown in fig. 7, after the step of returning the transaction target chain information meeting the service type information to the transaction initiation chain by the public chain, if both the transaction initiation chain and the transaction target chain support the interface specification agreed by the public chain, the method may further return service content to the transaction initiation chain by:
s8: the transaction initiating chain directly initiates service transaction to the transaction target chain according to the transaction mode and the transaction condition;
s9: and the transaction target chain verifies the transaction condition, and returns service content to the transaction initiating chain according to the received service transaction after the transaction condition is verified to be qualified.
In a part of the blockchain network system, since the whole network is a point-to-point network, theoretically, a network connection can be established between any two nodes. Therefore, communication can be directly carried out between different blockchain networks accessing the public chain, and the blockchain networks support the interface specification agreed by the public chain. That is, if the transaction initiation chain and the transaction target chain both support the interface specification agreed by the public chain, after the public chain returns the transaction target chain information conforming to the service type information to the transaction initiation chain, the transaction initiation chain can directly extract the transaction target chain address in the transaction target chain information, and directly initiate the service transaction to the transaction target chain according to the address.
The transaction target chain verifies the transaction condition after receiving the service transaction initiated by the transaction initiation chain, and the specific verification content is consistent with that of the embodiment. And after the transaction condition is verified to be qualified, the transaction target chain directly returns transaction content to the transaction initiating chain according to the received service transaction, and the final transaction is completed.
For the above situation, in order to ensure the transaction accounting program between the transaction initiation chain and the transaction destination chain, when the transaction initiation chain initiates a service transaction, distributed accounting may be performed once inside the transaction initiation chain, and the stored block data or the digest of the block data is sent to the public chain network for distributed storage; and when the transaction target chain returns the service content, distributed accounting is carried out once in the transaction target chain, and the stored block data or the abstract of the block data is sent to the public chain network for distributed storage. And after the transaction target chain sends the stored blockchain data or the data summary to the public chain, the public chain can also compare the consistency of the blockchain data sent by the transaction initiating chain and the transaction target chain according to the address information in the blockchain, and determine the validity of the transaction and the like.
The difference between the embodiment and the above embodiment is that the public link network is only responsible for corresponding query transaction, that is, after the query transaction is initiated by the transaction initiation chain, the public link network queries the transaction target chain according to the query transaction, and then returns the address information of the transaction target chain to the transaction node B25, the transaction node B25 directly initiates service transaction to the transaction target chain a according to the target chain address information, that is, 100 certificates Tb are transferred to the transaction target chain a, and after the service node in the transaction target chain a receives 100 certificates Tb, 50 certificates Ta are transferred to the transaction node B25, thereby directly completing the transaction. Obviously, in order to avoid transaction errors, when the transaction node B25 transfers 100 certificates Tb to the transaction destination chain a, the block data formed is not only broadcasted in the network B, but also broadcasted in the public chain network, and similarly, when the service node of the transaction destination chain a transfers 50 certificates Ta to the transaction node B25, it is also necessary to synchronously or asynchronously broadcast in the transaction destination chain network a and the public chain network P.
It should be noted that, in the technical solution provided in the present application, for convenience of description, the transaction node B25 transfers 100 certificates Tb to the transaction destination chain a, and the service node of the transaction destination chain a transfers 50 certificates Ta to the transaction node B25, which is a circulation direction of certificates or transaction results, and does not really transfer the certificates from one chain to another chain. In practical application, both transaction parties can have corresponding account numbers in two networks, and the transfer transaction only transfers the certificate to the corresponding account numbers, namely 100 Tb are exchanged in B network, 50 Ta are exchanged in A network, and only transaction information, accounting data and the like transmitted through public links describe the contents of cross-link transaction.
Based on the above transaction method, the present application further provides a block chain system based on public chain, as shown in fig. 8, the system includes: a transaction initiation chain, a public chain and a transaction target chain; the transaction initiating chain establishes network connection with the transaction target chain through the public chain; the transaction initiation chain refers to a blockchain network as a transaction initiator, and the transaction target chain refers to a blockchain network as a transaction target.
To complete a cross-chain transaction, the transaction initiation chain is configured to perform the following procedural steps: and initiating a query transaction containing the service type information to the public link. That is, at the beginning of the cross-link transaction, the transaction initiation chain initiates a query transaction to the public link, so that the public link queries the transaction target chain in the public link network. And initiating service transaction to the public chain according to the transaction condition of the transaction target chain. Namely, after the public link returns the transaction target link information which accords with the service type information, service transaction is initiated to the public link.
The male chain is configured to: inquiring a transaction target chain accessed to a public chain network according to the service type in the inquiry transaction; returning transaction target chain information which accords with the service type information to the transaction initiating chain, wherein the transaction target chain information comprises a target chain address, a transaction mode and a transaction condition; and, delivering the service transaction to the transaction target chain and delivering the service content to the transaction initiation chain;
the chain of transaction targets is configured to: and verifying the transaction condition, and returning service content to a public chain according to the received service transaction after the transaction condition is verified to be qualified. In addition, the transaction target chain can also provide the address information, the transaction mode and the transaction condition of the public chain after the public chain inquires the transaction target chain.
In the technical scheme provided by the application, the transaction initiation chain and the transaction target chain refer to a part of a plurality of block chain networks accessed to a public chain network, so that any one of the plurality of block chain networks accessed to the public chain network can be used as the transaction initiation chain as long as the transaction initiation chain has enough number of certificates for triggering transactions. Similarly, each blockchain network can also be used as a transaction target chain as long as it supports external transaction and can provide specific service content. That is, in the technical solution provided in the present application, the transaction initiation chain and the transaction target chain are only for convenience of description, and do not limit the blockchain network.
It should be noted that, in the embodiment of the present application, the service content exchanged by the certificate authority is taken as an example, and a description of a scheme is performed, it is obvious that for different forms of service content, a transaction process of the service content is the same as a transaction process of the certificate authority exchange, and only when a transaction node initiates a service transaction, after the transaction node transfers a specified number of certificate authorities to a public chain (or a transaction target chain), the transaction target chain returns specific transaction content according to the service transaction, for example, returns a query result of performance of a communication device of a certain model.
According to the technical scheme, the application provides a public link-based transaction method and a block link network. In practical application, firstly, a transaction initiating chain initiates an inquiry transaction to a public chain, and then the public chain queries a transaction target chain accessed to a public chain network according to service type information in the inquiry transaction; so that the public link returns transaction target link information which accords with the service type information to the transaction initiating link; the transaction initiating chain initiates service transaction to the public chain according to the transaction mode and the transaction condition required by the transaction target chain; the public chain transmits the service transaction to a transaction target chain; and returning service content to the public chain according to the received service transaction after the transaction target chain verifies that the transaction condition is qualified; and finally, the public chain transmits the service content to the transaction initiating chain to complete the cross-chain transaction. The method queries and transmits the service transaction through the public link network, so that the transaction initiating link can obtain the service content of the transaction target link, the cross-link transaction is completed among different link networks, and the application range of the block link-based transaction method is expanded.
The embodiments provided in the present application are only a few examples of the general concept of the present application, and do not limit the scope of the present application. Any other embodiments extended according to the scheme of the present application without inventive efforts will be within the scope of protection of the present application for a person skilled in the art.