Cross-chain method and device for electronic lading bill contract and storage medium
By using cross-chain bridge contracts and cross-chain relays, pledging and forwarding asset information of electronic bill of lading contracts in the blockchain network, the problem of low cross-chain transmission security in the existing technology is solved, and higher security and privacy protection is achieved.
Patent Information
- Application Number
- CN202411736336.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-25
AI Technical Summary
In the prior art, the cross-chain transmission security of electronic bill of lading contracts is low because all blockchain nodes can receive and view the contract.
By using a cross-chain bridge contract between the business chain and the target chain, the asset information in the electronic bill of lading contract is pledged, and cross-chain events are forwarded through cross-chain relay, the cross-chain process of the electronic bill of lading contract is realized.
Improve the cross-chain transmission security of electronic bill of lading contracts and prevent unauthorized nodes from contacting sensitive information.
Smart Images

Figure CN119693136A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to cross-chain methods, devices and storage media for electronic bill of lading contracts. Background Technology
[0002] Cross-chain refers to interoperability technologies across multiple blockchain ledgers or public blockchain ecosystems, including message exchange and on-chain asset exchange. Currently, in blockchain technology, the cross-chain transmission of electronic bills of lading contracts is achieved by broadcasting the electronic bill of lading contract within the blockchain, allowing other nodes in the blockchain to receive it. However, this method allows all nodes in the blockchain to receive and view the electronic bill of lading contract, resulting in low security for cross-chain transmission of electronic bills of lading contracts.
[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] This application provides a cross-chain method, device, and storage medium for electronic bill of lading contracts, aiming to solve the problem of low security in cross-chain transmission of electronic bill of lading contracts in related solutions.
[0005] To achieve the above objectives, this application provides a cross-chain method for electronic bill of lading contracts, applied to a business chain connected to a target chain. The cross-chain method for electronic bill of lading contracts includes the following steps:
[0006] Upon detecting a cross-chain request, at least one electronic bill of lading contract corresponding to the cross-chain request is determined;
[0007] Determine the asset information in the electronic bill of lading contract, and pledge the electronic bill of lading contract to the cross-chain bridge contract based on the asset information;
[0008] A cross-chain event is generated according to the cross-chain bridge contract, and the cross-chain event is forwarded to the target chain through the cross-chain relay. After receiving the cross-chain event, the target chain releases the asset information in the electronic bill of lading mapping contract according to the asset information in the cross-chain event, so as to complete the cross-chain process of the electronic bill of lading contract.
[0009] In one embodiment, after the steps of determining the asset information in the electronic bill of lading contract and pledging the asset information to the cross-chain bridge contract, the method further includes:
[0010] Create a cross-chain collection in the cross-chain bridge contract and obtain at least one of the electronic bill of lading contracts staked in the cross-chain bridge contract;
[0011] Insert at least one of the electronic bill of lading contracts into the cross-chain set and obtain the Merkel path generated by the cross-chain set;
[0012] The Merkel path is associated with the corresponding electronic bill of lading contract and stored in the cross-chain collection, wherein the Merkel path is used to unlock the cross-chain collection and retrieve the corresponding electronic bill of lading contract;
[0013] The cross-chain event is generated based on the cross-chain set, and the step of forwarding the cross-chain event to the target chain via a cross-chain relay is executed.
[0014] In one embodiment, before the step of obtaining the Merkel path generated by the cross-chain set, the method further includes:
[0015] When the electronic bill of lading contract is detected to be inserted into the cross-chain set, a first Merkel path is generated according to the structure of the Merkel tree.
[0016] When the cross-chain collection is locked, the locking structure of the current Merkle tree is obtained to generate a second Merkle path, and the second Merkle path is determined as the Merkle path of the electronic bill of lading contract.
[0017] In one embodiment, before the step of generating the cross-chain event based on the cross-chain set and forwarding the cross-chain event to the target chain via a cross-chain relay, the method further includes:
[0018] Determine the preset waiting time and preset number of transactions for the cross-chain set;
[0019] When the number of electronic bill of lading contracts inserted into the cross-chain set is equal to the preset number of transactions, the cross-chain set is locked to prevent electronic bill of lading contracts from being inserted into the cross-chain set.
[0020] When the waiting time of the cross-chain set is equal to the preset time, the cross-chain set is locked, and the cross-chain event is generated according to the cross-chain set. The cross-chain event is then forwarded to the target chain through the cross-chain relay.
[0021] In one embodiment, after the step of generating a cross-chain event based on the cross-chain bridge contract and forwarding the cross-chain event to the target chain via a cross-chain relay, the method further includes:
[0022] After the target link receives the cross-chain event, the electronic bill of lading contract in the cross-chain event is obtained;
[0023] Determine the format information and content parameters of the electronic bill of lading contract;
[0024] Determine whether the format information conforms to the specified format, and determine whether the content parameters match the preset description information;
[0025] When the format information conforms to the specified format and the content parameters match the preset description information, the step of releasing the asset information in the electronic bill of lading mapping contract based on the asset information in the cross-chain event is executed to complete the cross-chain process of the electronic bill of lading contract.
[0026] In one embodiment, after the steps of determining whether the format information conforms to a specified format and determining whether the content parameters match preset description information, the method further includes:
[0027] Calculate the corresponding hash value based on the electronic bill of lading contract;
[0028] Obtain the target hash value pre-stored on the chain, and determine whether the hash value matches the target hash value;
[0029] When the hash value matches the target hash value, the Merkel path is determined using the hash value;
[0030] The electronic bill of lading contract is unlocked according to the Merkel path to extract the asset information in the electronic bill of lading contract.
[0031] In one embodiment, the step of determining the asset information in the electronic bill of lading contract and pledging the electronic bill of lading contract to the cross-chain bridge contract based on the asset information includes:
[0032] Parse the electronic bill of lading contract and extract the asset information from the electronic bill of lading contract;
[0033] A staking request is generated based on the asset information, and the staking request is sent to the cross-chain bridge contract;
[0034] The cross-chain bridge contract verifies the pledge request according to the staking rules, and after successful verification, pledges the electronic bill of lading contract to the cross-chain bridge contract.
[0035] In one embodiment, after determining at least one electronic bill of lading contract corresponding to the cross-chain request upon detection of the cross-chain request, the method further includes:
[0036] Parse the cross-chain request to determine the corresponding identity information;
[0037] Based on the identity information, query the database to see if there is matching target information;
[0038] When a target information matching the identity information is found, the cross-chain request authentication is deemed successful.
[0039] In addition, to achieve the above objectives, this application also provides a cross-chain device for electronic bill of lading contracts, the cross-chain device for electronic bill of lading contracts comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the cross-chain method for electronic bill of lading contracts as described above.
[0040] In addition, to achieve the above objectives, this application also provides a storage medium, which is a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the steps of the cross-chain method for the electronic bill of lading contract as described above.
[0041] This application provides a cross-chain method, a cross-chain device, and a storage medium for electronic bills of lading (EB-B / L) contracts. Upon detecting a cross-chain request, at least one EB-B / L contract corresponding to the request is identified. Then, asset information within the EB-B / L contract is determined and pledged to a cross-chain bridge contract. A cross-chain event is generated based on the bridge contract and forwarded to the target chain via a cross-chain relay. Finally, upon receiving the cross-chain event, the target chain releases the asset information from the EB-B / L mapping contract based on the event information, thus completing the cross-chain process. The cross-chain bridge contract collects EB-B / L contracts requiring cross-chain transfer and forwards them to the target chain via a cross-chain relay, thereby improving the security of cross-chain transmission of EB-B / L contracts. Attached Figure Description
[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0043] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a flowchart illustrating the first embodiment of the cross-chain method for the electronic bill of lading contract in this application.
[0045] Figure 2 This is a schematic diagram of the cross-chain process involved in the embodiments of this application;
[0046] Figure 3 This is a flowchart illustrating the second embodiment of the cross-chain method for the electronic bill of lading contract in this application.
[0047] Figure 4This is a flowchart illustrating the cross-chain set insertion process involved in the embodiments of this application;
[0048] Figure 5 This is a flowchart illustrating the third embodiment of the cross-chain method for the electronic bill of lading contract in this application;
[0049] Figure 6 This is a schematic diagram of the hardware operating environment of the cross-chain device for the electronic bill of lading contract involved in the embodiments of this application.
[0050] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0051] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0052] To better understand the above technical solutions, exemplary embodiments of this application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.
[0053] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.
[0054] The main solution of this application is to determine at least one electronic bill of lading contract corresponding to the cross-chain request when a cross-chain request is detected.
[0055] Determine the asset information in the electronic bill of lading contract, and pledge the electronic bill of lading contract to the cross-chain bridge contract based on the asset information;
[0056] A cross-chain event is generated according to the cross-chain bridge contract, and the cross-chain event is forwarded to the target chain through the cross-chain relay. After receiving the cross-chain event, the target chain releases the asset information in the electronic bill of lading mapping contract according to the asset information in the cross-chain event, so as to complete the cross-chain process of the electronic bill of lading contract.
[0057] Currently, in blockchain technology, cross-chain transmission of electronic bills of lading contracts is achieved by broadcasting the electronic bill of lading contract within the blockchain, allowing other nodes in the blockchain to receive and thus enabling cross-chain transmission. However, this method allows all nodes in the blockchain to receive and view the electronic bill of lading contract, resulting in low security for cross-chain transmission of electronic bills of lading contracts.
[0058] This application, upon detecting a cross-chain request, identifies at least one electronic bill of lading (ELB) contract corresponding to the request, then determines the asset information within the ELB contract, pledges this asset information to a cross-chain bridge contract, generates a cross-chain event based on the bridge contract, and forwards the event to the target chain via a cross-chain relay. Finally, upon receiving the cross-chain event, the target chain releases the asset information from the ELB mapping contract based on the cross-chain event, thus completing the cross-chain process for the ELB contract. This application improves the security of cross-chain transmission of ELB contracts by collecting ELB contracts requiring cross-chain functionality through a bridge contract and then forwarding them to the target chain via a cross-chain relay.
[0059] Example 1
[0060] Please refer to Figure 1 In the first embodiment, the cross-chain method for the electronic bill of lading contract includes the following steps:
[0061] Step S10: When a cross-chain request is detected, determine at least one electronic bill of lading contract corresponding to the cross-chain request.
[0062] In this embodiment, the processing actions are performed by the business chain. The business chain can be a node in the entire blockchain or a separate business chain platform; no limitation is made here. The business chain establishes a communication connection with the target chain, where the business chain is the initiator of the cross-chain request for the electronic bill of lading (EBITDA) contract, and the target chain is the receiver of the cross-chain request. The cross-chain request is a request issued by the user based on the front end of the business chain platform. When the user has a cross-chain requirement for an EBITDA contract, they select the cross-chain EBITDA contract on the front end interface through a selection device, and trigger the corresponding component to send a cross-chain request back to the business chain backend. When the business chain backend detects the cross-chain request, it retrieves at least one EBITDA contract that needs to be cross-chained from the request.
[0063] Specifically, the process begins with detecting cross-chain requests. A detection tool can be set up within the business chain platform's system to monitor cross-chain interfaces or bridges, ensuring that any attempts at cross-chain communication are captured promptly. Upon detection, the system verifies whether the entity initiating the request possesses the necessary permissions and qualifications. This is done by verifying the identity information carried in the request and by verifying the signature generated from the user's key. Furthermore, the information carried in the cross-chain request can be inspected to determine its completeness, accuracy, and conformity to a predetermined format.
[0064] Optionally, in this embodiment, after step S10, the method further includes:
[0065] The cross-chain request is parsed to determine the corresponding identity information; based on the identity information, a query is performed in the database to see if there is matching target information; when there is target information that matches the identity information, the cross-chain request is deemed to have passed authentication.
[0066] Specifically, upon detecting a cross-chain request, the received request is parsed to extract key information. Data fields related to authentication are identified, such as identity information including public keys, usernames, or digital signatures. Then, identity information for authentication is extracted from the parsed request data. This extracted identity information undergoes specific formatting processes, such as encoding conversion and hash calculations, to ensure it is used in the correct format for subsequent comparison operations. Based on the extracted and formatted identity information, database query conditions are constructed, including conditions that accurately locate matching records in the database. Using these constructed query conditions, a query operation is executed in the database, returning all records matching the query conditions. Finally, the database query results are checked. If the query returns at least one record, it indicates the existence of target information matching the identity information. Based on the matching results, authentication is determined. If a matching record is found, the cross-chain request authentication is successful; otherwise, authentication fails. The authentication result is fed back to the service backend of the business chain platform. If the authentication is successful, the cross-chain request can continue to be processed; if the authentication fails, the cross-chain request is rejected and the user is required to resubmit valid identity information.
[0067] After verifying the cross-chain request, the electronic bill of lading information within it is parsed. This parsing includes information related to the electronic bill of lading, such as the bill of lading number, cargo description, shipper, and consignee. Based on this parsed information, the corresponding electronic bill of lading contract is then determined.
[0068] Specifically, this can be achieved by querying a blockchain database. Leveraging the distributed ledger characteristic of blockchain, the database stores electronic bill of lading (EBL) contract information. Then, the EBL information, such as the bill of lading number, is matched with the contracts in the blockchain database to find the corresponding EBL contract.
[0069] Step S20: Determine the asset information in the electronic bill of lading contract, and pledge the electronic bill of lading contract to the cross-chain bridge contract according to the asset information.
[0070] In this embodiment, to determine the asset information in the electronic bill of lading contract, the electronic bill of lading contract needs to be parsed to extract the asset information, which includes the description of the goods, quantity, value, and terms of transport. Then, a cross-chain bridge contract deployed in the business chain is determined, and the asset information from the electronic bill of lading contract is pledged to the cross-chain bridge contract to ensure that only the cross-chain bridge contract has the authority to operate on the assets of the electronic bill of lading contract.
[0071] Specifically, after parsing the electronic bill of lading contract, the extracted asset information needs to be verified to ensure its authenticity and accuracy. This can be achieved through the consensus mechanism of the blockchain and the verification function of smart contracts. Specifically, a hash function can be used to hash the asset information, and the hash value is stored on the blockchain to complete the verification. Before staking the asset information to the cross-chain bridge contract, a suitable cross-chain bridge contract needs to be selected according to the requirements of the business chain, and the cross-chain bridge contract needs to be deployed in the business chain platform. Then, the asset information is staked to the cross-chain bridge contract, where the cross-chain bridge contract records the staking status of the asset information, including staking time, staking party, staking period, staking rules, redemption conditions, and other information.
[0072] Furthermore, upon the expiration of the staking period or the fulfillment of redemption conditions, users can redeem their pledged assets through the cross-chain bridge contract. The redemption process follows pre-agreed rules and procedures to ensure the validity of the redemption operation. Simultaneously, an effective monitoring mechanism is needed. During the staking period, if any changes occur in asset information, such as a decrease in quantity or a change in value, the staking status needs to be updated and synchronized promptly to detect and address any anomalies or potential risks. This can be achieved by calling the smart contract's update function, transmitting new asset information, and receiving the returned results.
[0073] As an optional implementation, in this embodiment, step S20 includes:
[0074] The electronic bill of lading contract is parsed and the asset information in the electronic bill of lading contract is extracted; a pledge request is generated based on the asset information and the pledge request is sent to the cross-chain bridge contract; the cross-chain bridge contract verifies the pledge request according to the pledge rules, and after the verification is successful, the electronic bill of lading contract is pledged to the cross-chain bridge contract.
[0075] Specifically, a staking request is generated on the business chain. This request includes detailed information about the electronic bill of lading (ELB) contract to be staked, such as the contract address, hash value, asset information, and staking rules. The staking request is submitted to the cross-chain bridge contract and awaits verification and confirmation. The cross-chain bridge contract verifies the staking request, ensuring that the ELB contract is valid, has not been previously staked, and complies with the staking rules. If the staking request passes verification, the ELB contract information is recorded in the cross-chain bridge contract, and the staking status is updated. Finally, a confirmation message indicating successful staking is sent to the ELB holder's terminal.
[0076] Step S30: Generate a cross-chain event according to the cross-chain bridge contract, and forward the cross-chain event to the target chain through the cross-chain relay. After receiving the cross-chain event, the target chain releases the asset information in the electronic bill of lading mapping contract according to the asset information in the cross-chain event to complete the cross-chain process of the electronic bill of lading contract.
[0077] In this embodiment, the cross-chain event is generated by the cross-chain bridge contract. Within the business chain, the cross-chain bridge contract continuously detects preset trigger conditions, including transaction occurrences, asset transfers, and contract calls. Here, the trigger condition is asset staking. When the cross-chain bridge contract detects asset staking, it encapsulates the triggered staking event into a cross-chain message. This message contains detailed event information, such as event type, triggerer, and involved assets. The cross-chain event is then forwarded to the target chain via a cross-chain relay.
[0078] Specifically, to ensure the authenticity and integrity of cross-chain events, the cross-chain bridge contract signs the messages generated based on the cross-chain events. The signature can be generated using a private key and will be broadcast to the network along with the message content.
[0079] Cross-chain relay is a decentralized application that serves different blockchain networks, continuously detecting cross-chain events on the source chain. Once a cross-chain event is captured, the relay begins processing it and prepares to forward it to the target chain. When a cross-chain event is captured, the relay verifies it, verifying the signature of the cross-chain message and parsing the message content to ensure its authenticity and integrity. If verification fails, the relay discards the event; if verification succeeds, it continues processing the event and forwards the verified and parsed information to the target chain. To ensure state synchronization between the source and target chains, the cross-chain bridge contract and the relayer record detailed information about the cross-chain event, including event type, trigger time, and involved assets. Since the accounting rules and data formats may differ between different blockchains, the extracted asset information needs to be formatted and converted to meet the requirements of the target blockchain. This can involve renaming data fields, converting data types, and standardizing data units to format the asset information.
[0080] After receiving the cross-chain event sent by the cross-chain relay, the target chain parses and processes the cross-chain event to obtain the asset information within it. The target chain receives the cross-chain event sent by the cross-chain relay through the cross-chain interface and verifies the asset information within it to ensure the authenticity and completeness of the information.
[0081] After the asset information is verified, the eBill of Lading mapping contract on the target chain releases the asset information based on the cross-chain event. The eBill of Lading mapping contract releases the asset information corresponding to the cross-chain event on the target chain, completing the cross-chain transfer of the eBill of Lading and its asset information. Furthermore, after receiving the asset information, the target chain sends a confirmation message to the cross-chain relay, indicating that the cross-chain event has been successfully received and processed. The cross-chain relay feeds back the confirmation message to the business chain to notify the user that the asset information cross-chain transfer is complete. Finally, based on the cross-chain eBill of Lading asset type and specific metadata, the target chain's cross-chain bridge contract executes the release of the corresponding mapped eBill of Lading asset in the corresponding eBill of Lading mapping contract. The user can then use the mapped eBill of Lading asset in the target chain's eBill of Lading contract for other business transactions.
[0082] For example, such as Figure 2 As shown, Figure 2This is a schematic diagram of the cross-chain process involved in the embodiments of this application. Assume a foreign trade exporter user has created an electronic bill of lading (EFL) X on Chain A (logistics consortium blockchain), digitizing and structuring the EFL, and then submitting it as an on-chain asset X. The user pledges the EFL asset X from the EFL contract to the cross-chain bridge contract address on Chain A, allowing the corresponding cross-chain bridge contract to operate on the EFL asset. The submission result in the previous step generates a cross-chain event. After the cross-chain relay captures this event, it forwards it to the cross-chain bridge contract on Chain B (financial consortium blockchain). Based on the cross-chain EFL asset type and specific metadata, the cross-chain bridge contract on Chain B executes the corresponding mapping EFL asset for the user in the corresponding EFL mapping contract on Chain B. Subsequently, the user uses the mapped EFL asset in the EFL contract on Chain B for other business transactions, such as pledging the EFL asset to a bank on Chain B to obtain trade financing.
[0083] In the technical solution provided in this embodiment, when a cross-chain request is detected, at least one electronic bill of lading contract corresponding to the cross-chain request is determined. Then, the asset information in the electronic bill of lading contract is determined, and the asset information is pledged to the cross-chain bridge contract. A cross-chain event is then generated according to the cross-chain bridge contract, and the cross-chain event is forwarded to the target chain through a cross-chain relay. Finally, after receiving the cross-chain event, the target chain releases the asset information in the electronic bill of lading mapping contract according to the asset information in the cross-chain event to complete the cross-chain process of the electronic bill of lading contract. This embodiment solution collects electronic bill of lading contracts that need to be cross-chained through the cross-chain bridge contract, and then forwards them to the target chain according to the cross-chain relay to improve the security of cross-chain transmission of electronic bill of lading contracts.
[0084] Example 2
[0085] Please refer to Figure 3 In the second embodiment, after step S20, the method further includes:
[0086] Step S40: Create a cross-chain collection in the cross-chain bridge contract and obtain at least one of the electronic bill of lading contracts pledged to the cross-chain bridge contract.
[0087] In this embodiment, the cross-chain bridge contract is deployed in the business chain, and the cross-chain set is created based on a Merkle tree. First, one or more cross-chain sets are defined in the cross-chain bridge contract to store the anchoring information or hash values of the electronic bills of lading contracts to be crossed. Then, all electronic bills of lading contracts pledged to the cross-chain bridge contract in the previous steps are retrieved. These electronic bills of lading contracts are stored in the cross-chain bridge contract, and a retrieval command can be generated to retrieve the pre-stored electronic bills of lading contracts. Furthermore, it is also necessary to obtain the staking rules of the electronic bills of lading contracts pledged to the cross-chain bridge contract, including the pledge amount, pledge period, and type of collateral (such as the electronic bill of lading itself or other valuable assets).
[0088] Specifically, a Merkle tree, also known as a hash tree, is a hash-based data structure and a generalization of hash lists. A Merkle tree is a tree-like data structure where each leaf node stores the hash value of a data block, while non-leaf nodes store the hash value of the combination of the hash values of all their child nodes. This structure allows the root node of a Merkle tree to represent a unique identifier for the entire dataset.
[0089] As an alternative implementation for constructing a cross-chain set, the electronic bill of lading contracts to be stored are first divided into fixed-size data blocks, and a hash value is calculated for each data block. These hash values will serve as leaf nodes of the Merkle tree. Then, the hash values of two adjacent leaf nodes are concatenated, and a hash value is calculated again for this concatenated string. This hash value will serve as the parent node of these two leaf nodes. This process is repeated until only one node remains; this node is the root node of the Merkle tree, also known as the Merkle root. Finally, the generated Merkle tree is saved as a cross-chain set in the cross-chain bridge contract.
[0090] Step S50: Insert at least one of the electronic bill of lading contracts into the cross-chain set and obtain the Merkel path generated by the cross-chain set.
[0091] Step S60: Associate the Merkel path with the corresponding electronic bill of lading contract and store it in the cross-chain set, wherein the Merkel path is used to unlock the cross-chain set and retrieve the corresponding electronic bill of lading contract.
[0092] Step S70: Generate the cross-chain event based on the cross-chain set, and execute the step of forwarding the cross-chain event to the target chain through the cross-chain relay.
[0093] In this embodiment, the Merkle path refers to the set of all hash values from a leaf node (representing a specific data block) to the root node (representing the unique identifier of the entire dataset) in a Merkle tree, that is, the set of all hash values of a certain e-bill of lading contract in the cross-chain set, which is the unique identifier of the e-bill of lading contract. Figure 4 As shown, Figure 4 This is a flowchart illustrating the cross-chain set insertion process involved in the embodiments of this application. When the electronic bill of lading contract is inserted into the cross-chain set, a Merkel path is automatically generated. The Merkel path is then associated with and stored in the cross-chain set, whereby the Merkel path is used to unlock the cross-chain set and retrieve the corresponding electronic bill of lading contract. Finally, a cross-chain event is generated based on all electronic bill of lading contracts in the cross-chain set. This cross-chain event includes information about the electronic bill of lading contract and its corresponding Merkel path. The step of forwarding the cross-chain event to the target chain via a cross-chain relay is then executed.
[0094] It should be noted that, as Figure 4 As shown, the cross-chain event information storing the e-bill of lading contract during cross-chain transactions does not include the original text of the e-bill of lading contract, meaning the specific content of the e-bill of lading remains confidential. Users submit this information to the contract by revealing the e-bill of lading contract's private key (signature), original text, and Merkel path, thereby minting the corresponding e-bill of lading asset into the e-bill of lading mapping contract. Before the user uses it, this asset remains private on the target chain. Furthermore, by revealing the contract's unlocking private key (signature) and Merkel path, users transfer the address corresponding to this operation to other users within the cross-chain bridge contract. This completes the transfer of e-bill of lading ownership without disclosing the specific information on the chain; the counterparties can reveal the corresponding address privately through plaintext hash values, providing a higher level of privacy protection. This method is recorded in the contract, and the contract's Merkel path is transferred to the new public key Y. Subsequently, within this contract, the e-bill of lading contract can only be unlocked using the private key corresponding to Y.
[0095] Optionally, in this embodiment, before the step of obtaining the Merkel path generated by the cross-chain set, the method further includes:
[0096] When the electronic bill of lading contract is detected to be inserted into the cross-chain set, a first Merkle path is generated according to the structure of the Merkle tree; when the cross-chain set is locked, the current locking structure of the Merkle tree is obtained to generate a second Merkle path, and the second Merkle path is determined as the Merkle path of the electronic bill of lading contract.
[0097] Specifically, due to the characteristics of the Merkle tree, the corresponding Merkle path cannot be obtained immediately after the electronic bill of lading (EBL) is inserted. The Merkle path of the EBL contract in the cross-chain set will change with subsequent newly inserted EBL contracts. Therefore, when the insertion of the EBL contract into the cross-chain set is detected, a first Merkle path is generated according to the structure of the Merkle tree. At this time, the Merkle path of the EBL contract is the first Merkle path. Then, the action of inserting the EBL contract into the cross-chain set continues. When the cross-chain set is full or no new EBL contract is inserted within a preset time, the cross-chain set is locked. At this time, the structure of the Merkle tree no longer changes. The current locked structure of the Merkle tree is obtained to generate a second Merkle path, and the second Merkle path is determined as the Merkle path of the EBL contract.
[0098] Furthermore, in this embodiment, before the step of generating the cross-chain event based on the cross-chain set and forwarding the cross-chain event to the target chain via a cross-chain relay, the method further includes:
[0099] The preset waiting time and preset number of transactions of the cross-chain set are determined; when the number of electronic bills of lading contracts inserted into the cross-chain set is equal to the preset number of transactions, the cross-chain set is locked to prevent electronic bills of lading contracts from being inserted into the cross-chain set; when the waiting time of the cross-chain set is equal to the preset time, the cross-chain set is locked, and the cross-chain event is generated according to the cross-chain set, and the cross-chain event is forwarded to the target chain through the cross-chain relay.
[0100] Specifically, when a cross-chain collection is created, a preset waiting time and a preset number of transactions are set. The preset waiting time is the time during which the cross-chain collection waits for electronic bills of lading contracts to be inserted, and the preset number of transactions is the maximum number of transactions that the cross-chain collection can hold. When the number of electronic bills of lading contracts inserted into the cross-chain collection equals the preset number of transactions, and when the waiting time of the cross-chain collection equals the preset time, the cross-chain collection is locked, thereby preventing electronic bills of lading contracts from being inserted into the cross-chain collection.
[0101] For example, the cross-chain collection is equivalent to creating a bus on the original chain contract and then notifying users in the system that a bus has been created, and users who need to ride should board. The fare (cross-chain gas fee and transaction fee) is paid equally by everyone on the bus based on the number of users. This bus needs to commit to certain parameters, such as the minimum number of passengers (minimum number of transactions), the latest departure time (maximum waiting time for users to join in the batch cross-chain collection), etc. These parameters ensure the effective operation of the batch package. At the same time, users can clearly understand their expectations, knowing their maximum transaction fee and the maximum waiting time. Furthermore, during the cross-chain collection locking phase, the cross-chain relay can release the funds through transactions, returning any excess transaction fees to the users.
[0102] In the technical solution provided in this embodiment, a cross-chain set is created in the cross-chain bridge contract, and at least one electronic bill of lading (EBL) contract staked in the cross-chain bridge contract is obtained. Then, at least one EBL contract is inserted into the cross-chain set, and a Merkle path generated by the cross-chain set is obtained. The Merkle path is then associated with the corresponding EBL contract and stored in the cross-chain set. The Merkle path is used to unlock the cross-chain set and retrieve the corresponding EBL contract. Finally, a cross-chain event is generated based on the cross-chain set, and the step of forwarding the cross-chain event to the target chain via a cross-chain relay is executed. This embodiment creates a cross-chain set using a privacy Merkle tree and inserts the EBL contract into the cross-chain set for cross-chain steps, ensuring that the EBL business maintains business privacy after cross-chain operations, thereby improving the security of contract information.
[0103] Please refer to Figure 5 In the third embodiment, after step S30, the method further includes:
[0104] Step S80: After the target link receives the cross-chain event, obtain the electronic bill of lading contract in the cross-chain event.
[0105] Step S90: Determine the format information and content parameters of the electronic bill of lading contract.
[0106] Step S100: Determine whether the format information conforms to the specified format, and determine whether the content parameters match the preset description information.
[0107] Step S110: When the format information conforms to the specified format and the content parameters match the preset description information, execute the step of releasing the asset information in the electronic bill of lading mapping contract based on the asset information in the cross-chain event to complete the cross-chain process of the electronic bill of lading contract.
[0108] In this embodiment, the target chain performs the processing action. After receiving the cross-chain event, the target chain first obtains the electronic bill of lading contract in the cross-chain event. By parsing the electronic bill of lading contract and combining keyword matching, the format information and content parameters of the electronic bill of lading contract are determined. The format information includes encoding method, data structure, etc., and the content parameters include bill of lading number, cargo description, quantity, shipper, consignee, etc.
[0109] Then, the pre-stored prescribed format and preset description information in the target chain are obtained. The prescribed format is compared with the format information, and the preset description information is compared with the content parameters. When the format information conforms to the prescribed format and the content parameters match the preset description information, the verification of the electronic bill of lading contract is deemed successful. At this point, the steps of releasing the asset information in the electronic bill of lading mapping contract can continue to complete the cross-chain process of the electronic bill of lading contract.
[0110] Furthermore, in this embodiment, after the steps of determining whether the format information conforms to the specified format and whether the content parameters match the preset description information, the method further includes:
[0111] Based on the electronic bill of lading contract, calculate the corresponding hash value; obtain the target hash value pre-stored on the chain, and determine whether the hash value matches the target hash value; when the hash value matches the target hash value, determine the Merkel path through the hash value; unlock the electronic bill of lading contract according to the Merkel path to extract the asset information in the electronic bill of lading contract.
[0112] Specifically, a hash value is calculated for the complete content of the electronic bill of lading, and the hash value is verified to be consistent with the target hash value recorded on the blockchain. If the hash value is consistent with the target hash value, the verification is considered successful. Then, the Merkel path on the blockchain can be calculated using the hash value, and the electronic bill of lading contract is unlocked according to the Merkel path. This allows for the execution of the step of retrieving asset information from the electronic bill of lading contract, and subsequent business operations based on the asset information of the bill of lading.
[0113] In the technical solution provided in this embodiment, after the target link receives the cross-chain event, it obtains the electronic bill of lading contract in the cross-chain event, then determines the format information and content parameters of the electronic bill of lading contract, and judges whether the format information conforms to the prescribed format and whether the content parameters match the preset description information. When the format information conforms to the prescribed format and the content parameters match the preset description information, it executes the step of releasing the asset information in the electronic bill of lading mapping contract based on the asset information in the cross-chain event, thereby completing the cross-chain process of the electronic bill of lading contract. This embodiment improves the validity of the electronic bill of lading contract by verifying its format information and content parameters, thus preventing data loss during the cross-chain process.
[0114] Since the system described in the embodiments of this application is a system used to implement the methods of the embodiments of this application, those skilled in the art can understand the specific structure and variations of the system based on the methods described in the embodiments of this application, and therefore will not be described in detail here. All systems used in the methods of the embodiments of this application fall within the scope of protection of this application.
[0115] This application provides a cross-chain device for electronic bill of lading contracts. The cross-chain device for electronic bill of lading contracts includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the cross-chain method for electronic bill of lading contracts in the above embodiment 1.
[0116] The following is for reference. Figure 6 The diagram illustrates a structural schematic of a cross-chain device suitable for implementing the electronic bill of lading contract in the embodiments of this application. The cross-chain device for the electronic bill of lading contract in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The cross-chain device for the electronic bill of lading contract shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments in this application.
[0117] like Figure 6As shown, the cross-chain device for the electronic bill of lading contract may include a processing unit 1001 (e.g., a core processor, graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. RAM 1004 also stores various programs and data required for the operation of the cross-chain device for the electronic bill of lading contract. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard drives, etc.; and communication devices 1009. Communication device 1009 allows the cross-chain device of the electronic bill of lading contract to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows a cross-chain device of the electronic bill of lading contract with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented alternatively.
[0118] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0119] The cross-chain device for electronic bill of lading contracts provided in this application, employing the cross-chain method for electronic bill of lading contracts in the above embodiments, can solve the technical problem of low security in cross-chain transmission of electronic bill of lading contracts in related solutions. Compared with the prior art, the beneficial effects of the cross-chain device for electronic bill of lading contracts provided in this application are the same as those of the cross-chain method for electronic bill of lading contracts provided in the above embodiments, and other technical features in this cross-chain device for electronic bill of lading contracts are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0120] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0121] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0122] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the cross-chain method of the electronic bill of lading contract in the above embodiments.
[0123] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0124] The aforementioned computer-readable storage medium may be included in the cross-chain device of the electronic bill of lading contract; or it may exist independently and not be assembled into the cross-chain device of the electronic bill of lading contract.
[0125] The aforementioned computer-readable storage medium carries one or more programs that, when executed by the cross-chain device of the electronic bill of lading contract, cause the cross-chain device of the electronic bill of lading contract to: upon detecting a cross-chain request, determine at least one electronic bill of lading contract corresponding to the cross-chain request; determine asset information in the electronic bill of lading contract and pledge the electronic bill of lading contract to a cross-chain bridge contract based on the asset information; generate a cross-chain event based on the cross-chain bridge contract and forward the cross-chain event to the target chain via a cross-chain relay, wherein, upon receiving the cross-chain event, the target chain releases the asset information in the electronic bill of lading mapping contract based on the asset information in the cross-chain event to complete the cross-chain process of the electronic bill of lading contract.
[0126] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0127] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0128] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0129] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the cross-chain method of the aforementioned electronic bill of lading contract. This addresses the technical problem of low security in cross-chain transmission of electronic bill of lading contracts in related solutions. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the cross-chain method of the electronic bill of lading contract provided in the above embodiments, and will not be elaborated upon here.
[0130] This application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the cross-chain method for electronic bill of lading contracts as described above.
[0131] The computer program product provided in this application can solve the technical problem of low security in cross-chain transmission of electronic bill of lading contracts in related solutions. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the cross-chain method for electronic bill of lading contracts provided in the above embodiments, and will not be repeated here.
[0132] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent scope of this application.
Claims
1. A cross-chain method for electronic bill of lading contracts, characterized in that: Applied to a business chain, the business chain is connected to a target chain, and the cross-chain method of the electronic bill of lading contract comprises the following steps: When a cross-chain request is detected, determining at least one electronic bill of lading contract corresponding to the cross-chain request; Determine the asset information in the electronic bill of lading contract, and pledge the electronic bill of lading contract to the cross-chain bridge contract based on the asset information; A cross-chain event is generated according to the cross-chain bridge contract, and the cross-chain event is forwarded to the target chain through a cross-chain relay. After receiving the cross-chain event, the target chain releases the asset information in the electronic bill of lading mapping contract based on the asset information in the cross-chain event to complete the cross-chain process of the electronic bill of lading contract.
2. The method according to claim 1, characterized in that After the step of determining the asset information in the electronic bill of lading contract and pledging the asset information to the cross-chain bridge contract, the method further includes: Creating a cross-chain collection in the cross-chain bridge contract, and obtaining at least one of the electronic bill of lading contracts pledged to the cross-chain bridge contract; Inserting at least one of the electronic bill of lading contracts into the cross-chain set, and obtaining the Merkle path generated by the cross-chain set; The Merkle path is associated with the corresponding electronic bill of lading contract and saved in the cross-chain set, wherein the Merkle path is used to unlock the cross-chain set and extract the corresponding electronic bill of lading contract; Generate the cross-chain event according to the cross-chain set, and execute the step of forwarding the cross-chain event to the target chain through the cross-chain relay.
3. The method according to claim 2, characterized in that Before the step of obtaining the Merkle path generated by the cross-chain set, the method further includes: When it is detected that the electronic bill of lading contract is inserted into the cross-chain set, a first Merkle path is generated according to the structure of the Merkle tree; When the cross-chain set is locked, the locking structure of the current Merkle tree is obtained to generate a second Merkle path, and the second Merkle path is determined as the Merkle path of the electronic bill of lading contract.
4. The method according to claim 2, characterized in that Before the step of generating the cross-chain event according to the cross-chain set and forwarding the cross-chain event to the target chain through a cross-chain relay, the method further includes: Determine the preset waiting time and the preset number of transactions of the cross-chain set; When the number of the electronic bill of lading contracts inserted into the cross-chain set is equal to the preset transaction number, the cross-chain set is locked to prevent the electronic bill of lading contracts from being inserted into the cross-chain set; When the waiting time of the cross-chain set is equal to the preset time, the cross-chain set is locked, and the cross-chain event is generated according to the cross-chain set, and the cross-chain event is forwarded to the target chain through the cross-chain relay.
5. The method according to claim 1, characterized in that After the step of generating a cross-chain event according to the cross-chain bridge contract and forwarding the cross-chain event to the target chain through a cross-chain relay, the process further includes: After the target link receives the cross-chain event, obtaining the electronic bill of lading contract in the cross-chain event; Determining the format information and content parameters of the electronic bill of lading contract; Determining whether the format information complies with a specified format, and determining whether the content parameters match preset description information; When the format information conforms to the prescribed format and the content parameters match the preset description information, the steps of executing the asset information in the cross-chain event and releasing the asset information in the electronic bill of lading mapping contract are performed to complete the cross-chain process of the electronic bill of lading contract.
6. The method according to claim 5, characterized in that After the step of determining whether the format information conforms to the prescribed format and determining whether the content parameters match the preset description information, the method further includes: According to the electronic bill of lading contract, calculate the corresponding hash value; Obtain the target hash value pre-stored on the chain, and determine whether the hash value matches the target hash value; When the hash value matches the target hash value, determining a Merkle path by the hash value; The electronic bill of lading contract is unlocked according to the Merkle path to extract the asset information in the electronic bill of lading contract.
7. The method according to claim 1, characterized in that The step of determining the asset information in the electronic bill of lading contract and pledging the electronic bill of lading contract to the cross-chain bridge contract according to the asset information includes: Parsing the electronic bill of lading contract and extracting asset information in the electronic bill of lading contract; Generate a pledge request according to the asset information, and send the pledge request to the cross-chain bridge contract; The cross-chain bridge contract verifies the pledge request according to the pledge rules, and after the verification is passed, pledges the electronic bill of lading contract to the cross-chain bridge contract.
8. The method according to claim 1, characterized in that After the step of determining at least one electronic bill of lading contract corresponding to the cross-chain request when the cross-chain request is detected, the method further includes: Parsing the cross-chain request to determine the corresponding identity information; According to the identity information, query whether there is matching target information in the database; When there is target information matching the identity information, it is determined that the cross-chain request identity authentication is successful.
9. A cross-chain device for an electronic bill of lading contract, characterized in that: The cross-chain device of the electronic bill of lading contract includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the cross-chain method of the electronic bill of lading contract as described in any one of claims 1 to 8.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the cross-chain method for an electronic bill of lading contract as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Blockchain cross-chain transaction verification method based on multistage Merkel tree
CN112702400A
Information processing method and device based on multi-block chain, equipment and medium
CN116708463A
Cross-chain transaction method, system and apparatus, device, and storage medium
WO2022095244A1
Multi-blockchain-based asset transfer method and apparatus, and device, medium and product
WO2024082807A1