A smart contract on-chain identity authentication permission authentication method and system

By combining Paillier homomorphic encryption and hierarchical Merkle trees, the privacy leakage problem in cross-chain identity authentication is solved, and the secure transmission and anonymous verification of encrypted identity attributes are achieved, thereby improving the security and usability of cross-chain authentication.

CN121283645BActive Publication Date: 2026-03-27YANCHENG SHURONGZHISHENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing cross-chain identity authentication mechanisms pose serious privacy leakage risks, with user identity attributes being repeatedly exposed across multiple blockchain networks. The lack of effective privacy protection mechanisms hinders user privacy and security and the promotion of cross-chain applications.

Method used

The Paillier homomorphic encryption algorithm is used to generate ciphertext attributes and zero-knowledge proof commitment values. A hierarchical Merkle tree storage structure is constructed, a cross-chain authentication process based on ring signature is executed, and secure transmission and privacy protection of encrypted identity attributes between chains are achieved through a two-way commitment privacy transmission channel and a differential privacy authentication log mechanism.

Benefits of technology

It reduces the risk of plaintext information leakage, supports anonymous on-chain verification, improves the security and availability of cross-chain authentication, enhances user privacy protection, reduces data redundancy, improves retrieval and proof efficiency, and ensures cross-chain interoperability and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121283645B_ABST
    Figure CN121283645B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of blockchains, in particular to a smart contract chain on-line identity authentication permission authentication method and system. The method comprises the following steps: generating a private certificate that can be directly verified in a cipher domain by adopting Paillier homomorphic encryption and zero-knowledge proof technology; structurally storing the private certificate by adopting a hierarchical Merkle tree, and taking a root hash as an efficient on-line identity identifier; realizing cross-chain anonymous authentication by adopting ring signature, guaranteeing the privacy of interaction; after authentication, constructing a channel based on a two-way commitment and a time lock, and ensuring that the encryption attribute is safely and atomically exchanged between chains; and introducing a differential privacy mechanism, adding noise to an authentication log, and generating privacy protection data that can be used for safe auditing. The application scheme constructs a decentralized identity authentication system that has strong privacy protection, high security and cross-chain interoperability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of blockchains, in particular to a smart contract on-chain identity authentication permission authentication method and system. BACKGROUND

[0002] The existing cross-chain identity authentication mechanism faces a serious privacy leakage risk problem in actual application. In the traditional cross-chain identity authentication process, the user needs to directly provide identity attribute information in plaintext form to the target chain, including sensitive data such as identity identifier, permission certificate, and historical transaction record. These identity information exists in the form of plaintext or simple encryption in the cross-chain transmission and verification process, and is easy to be intercepted and analyzed by malicious nodes. At the same time, the open and transparent nature of the blockchain makes the authentication records and transaction information on the chain queryable and traceable by anyone, and attackers can infer the real identity, behavior pattern and privacy information of the user through correlation analysis of authentication events on different chains.

[0003] In addition, the existing cross-chain authentication system lacks effective privacy protection mechanisms and cannot prevent sensitive information leakage while ensuring the accuracy of identity verification. The identity attributes of the user are repeatedly exposed in multiple blockchain networks, increasing the risk of privacy leakage. Detailed information contained in the authentication log and audit record can also be used for user profiling and behavior analysis, further threatening the privacy security of the user. This privacy leakage risk seriously restricts the promotion and user acceptance of cross-chain applications and becomes an important obstacle to the development of blockchain interoperability.

[0004] In view of this, the application provides a smart contract on-chain identity authentication permission authentication method and system. SUMMARY

[0005] To achieve the above-mentioned purpose, the application provides a smart contract on-chain identity authentication permission authentication method and system, and the specific technical solutions are as follows:

[0006] A smart contract on-chain identity authentication permission authentication method, comprising:

[0007] The identity attributes of the user are processed using the Paillier homomorphic encryption algorithm to generate a set of ciphertext attributes and corresponding zero-knowledge proof commitment values, and the ciphertext attributes are subjected to verification calculation operations in the ciphertext domain to constitute the original identity certificate of the user;

[0008] A hierarchical Merkle tree storage structure is constructed, the generated ciphertext attributes are taken as leaf nodes, the ciphertext certificates are distributed to different tree level nodes according to a preset privacy level, the link relationship between levels is established through a hash pointer, and a root hash value is calculated and obtained, and the root hash value is taken as an identity identifier and written into the main chain smart contract;

[0009] Perform cross-chain authentication based on ring signature, authentication requester extracts the required ciphertext attributes from the Merkle tree, constructs a signature ring containing multiple candidate identities, forwards the authentication request to the target chain through the relay chain, and the target chain verifies the validity of the ring signature and authenticates the identity of the authentication requester;

[0010] After authentication, a two-way commitment privacy transmission channel is established, and the source chain and the target chain each generate a commitment containing a hash value and a time lock, including: the source chain generates a first time-locked hash commitment, the target chain generates a second time-locked hash commitment, and the secure transmission of encrypted identity attributes between chains is completed by exchanging commitment values and corresponding pre-image sequences;

[0011] Construct a differential privacy authentication log mechanism, add random noise subject to Laplace distribution to the recorded cross-chain authentication events, and generate log data that meets the differential privacy condition for auditing and tracing.

[0012] Preferably, the user identity attribute set is preprocessed and standardized, and the user identity attribute data is converted into a fixed-length binary sequence;

[0013] Generate a public-private key pair of Paillier encryption, perform encryption operation on each identity attribute to generate corresponding ciphertext, and introduce a randomly selected blinding factor in the encryption process;

[0014] Synchronously generate zero-knowledge proof commitment values and range proofs to prove that the encrypted attribute values are within the predetermined range; use homomorphic properties to perform addition and scalar multiplication operations in the ciphertext domain to verify the relationship constraints between attributes;

[0015] Build an attribute association verification mechanism, define a logical relationship function between identity attributes and calculate the verification result in the ciphertext domain;

[0016] Integrate the verified ciphertext attribute set, zero-knowledge proof commitment value set, and range proof set into the user's original identity credential, and attach a timestamp, version number, and user signature.

[0017] Preferably, the ciphertext attribute set is evaluated and classified according to privacy level, and a privacy level function is defined according to the sensitivity, access frequency, and permission requirements of the attribute;

[0018] Initialize the Merkle tree structure, set the depth and maximum number of leaf nodes of the tree, combine the ciphertext attributes and corresponding zero-knowledge proof commitment values to form attribute tuples as leaf nodes, and arrange and fill them in the bottom layer of the Merkle tree in order from low to high privacy level value;

[0019] Calculate the hash value of the intermediate node layer by layer upwards, by connecting the hash values of the left and right child nodes and performing a hash operation;

[0020] The Merkle tree is divided into multiple logical hierarchical areas of public layer, restricted layer, private layer and core layer, and an independent access control policy is set for each hierarchical area.

[0021] Preferably, a hash pointer is set at each hierarchical boundary, which contains a memory address or storage location identifier pointing to the target node and a hash value of the target node.

[0022] An aggregation node is set at each hierarchical area to store the aggregation information of all attributes in this hierarchical layer; the root hash value of the Merkle tree is iteratively calculated from the leaf node to the upper layer;

[0023] The root hash value is used as the user's identity identifier, written to the main chain through the smart contract interface, and the identity identifier is stored in the state variable mapping of the contract after the identity registration function defined in the smart contract verifies the validity of the user's signature;

[0024] A Merkle proof verification function is constructed in the smart contract, which reconstructs the root hash value by providing the hash values of all sibling nodes on the path from the leaf node to the root node, and compares it with the value stored on the chain to verify the user's identity.

[0025] Preferably, the authentication request party extracts the corresponding ciphertext attribute subset from the Merkle tree, and obtains the verification path from the required leaf node to the root node through the Merkle path proof;

[0026] Select a candidate identity set containing real identity and obfuscated identity, and obtain the public key corresponding to each candidate identity from the blockchain;

[0027] Generate a ring signature using its own private key and the public key set of all candidates, calculate the connection function, initial commitment and ring equation, and randomly generate a response value and an intermediate commitment value for non-real identity ring members, and calculate the corresponding response value by solving the ring equation at the real identity position;

[0028] Submit the authentication data packet containing the ring signature, ciphertext attribute and Merkle proof to the relay contract of the source chain, and generate a cross-chain message identifier after the relay contract verifies the correctness of the data packet.

[0029] Preferably, the relay chain adopts a threshold signature mechanism to ensure the trusted delivery of cross-chain messages, and the relay node set independently verifies the cross-chain message, each node uses its private key fragment to generate a partial signature, and collects a preset number of valid partial signatures to generate a complete relay signature through a signature aggregation algorithm;

[0030] After receiving the authentication request forwarded by the relay chain, the target chain verifies the mathematical validity of the ring signature by reconstructing the ring equation, and reconstructs the root hash value using the provided Merkle proof and compares it with the identity identifier stored on the chain;

[0031] The permission verification calculation is performed in the ciphertext domain, and the plaintext value corresponding to the ciphertext attribute is verified to meet the access threshold of the target chain through a zero-knowledge proof protocol; and after verification, an authentication credential containing a session identifier, a root hash value, an authentication timestamp, a validity period and a target chain signature is generated.

[0032] Preferably, the source chain generates a random number as a source chain secret value and calculates a corresponding hash commitment, sets a first time lock parameter, and constructs a first time-locked hash commitment containing the hash commitment, the time lock, the target chain address and the encrypted identity attribute data packet to be transmitted;

[0033] The target chain generates its own random number as a target chain secret value and calculates a hash commitment, sets a second time lock parameter that meets the time constraint condition, and constructs a second time-locked hash commitment;

[0034] Both parties exchange their respective hash commitment values through a secure channel, and deploy the commitments to the smart contract of their respective chains, and the contract contains conditional judgment logic to realize the conditional release mechanism;

[0035] The target chain generates a pre-image sequence obtained by iterative hash calculation, and discloses it to the source chain in reverse order; after the source chain verifies the correctness of the pre-image sequence, the encrypted identity attribute is divided into multiple data segments, each of which is sent to the target chain after being obfuscated.

[0036] Preferably, the target chain uses the corresponding pre-image and random number to restore the original data segment, and maintains a receiving buffer to sort and integrity check the data segments according to the sequence number.

[0037] The target chain discloses its complete pre-image to trigger the release condition in the smart contract, and the source chain verifies and then discloses its own pre-image to complete the confirmation;

[0038] Blind factors are introduced in the commitment exchange process to calculate blind commitments, preventing third parties from inferring the transmission content by monitoring the transactions on the chain.

[0039] Preferably, an authentication log data structure is defined, which includes an authentication timestamp, a source chain identifier, a target chain identifier, an authentication result status, an access frequency count and an attribute category marker;

[0040] A global privacy budget parameter is set to control the balance between privacy protection and data availability; Laplace mechanism is used to add noise to the access frequency statistics to generate random noise subject to Laplace distribution;

[0041] Time generalization processing is implemented on the authentication timestamp, which maps the original timestamp to a pre-defined time interval; and an exponential mechanism is used to select the output result for the attribute category distribution statistics;

[0042] A two-dimensional aggregation tree is constructed according to a time dimension and a chain identifier dimension, noise is independently added to each layer of statistical values, a sliding window mechanism is used to manage a history log, an incremental sensitivity is calculated, and corresponding noise is added;

[0043] An audit report processed by differential privacy is generated.

[0044] An intelligent contract chain identity authentication permission authentication system is used to implement the intelligent contract chain identity authentication permission authentication method, and includes an identity certificate generation module, a hierarchical identity storage module, a cross-chain anonymous authentication module, a privacy channel establishment module, and a differential audit log module.

[0045] The identity certificate generation module processes user identity attributes by using a Paillier homomorphic encryption algorithm, generates a group of ciphertext attributes and corresponding zero-knowledge proof commitment values, performs verification calculation operations on the ciphertext attributes in a ciphertext domain, and forms original identity certificates of the user.

[0046] The hierarchical identity storage module constructs a hierarchical Merkle tree storage structure, takes the generated ciphertext attributes as leaf nodes, distributes the ciphertext certificates to different tree level nodes according to a preset privacy level, establishes a link relationship between levels by a hash pointer, and calculates a root hash value, and writes the root hash value as an identity identifier into a main chain smart contract.

[0047] The cross-chain anonymous authentication module performs a cross-chain authentication process based on a ring signature, extracts required ciphertext attributes from the Merkle tree to construct a signature ring containing multiple candidate identities, forwards an authentication request to a target chain through a relay chain, and performs identity authentication on the authentication request party by verifying the validity of the ring signature.

[0048] The privacy channel establishment module establishes a bidirectional commitment privacy transmission channel after authentication, and generates a commitment containing a hash value and a time lock for each of the source chain and the target chain, including generating a first time-locked hash commitment by the source chain, generating a second time-locked hash commitment by the target chain, and completing the secure transmission of encrypted identity attributes between chains by exchanging commitment values and corresponding pre-image sequences.

[0049] The differential audit log module constructs a differential privacy authentication log mechanism, adds random noise subject to a Laplace distribution to a cross-chain authentication event record, generates log data meeting a differential privacy condition, and is used for auditing and tracing.

[0050] The application has the beneficial effects that the application combines Paillier homomorphic encryption and zero-knowledge commitment, completes verification calculation in a ciphertext domain without revealing original identity attributes, forms computable encrypted certificates, reduces the risk of plaintext exposure, supports subsequent anonymous verification on a chain, and balances security and usability.

[0051] The application organizes the ciphertext attributes according to the privacy level based on the hierarchical Merkle tree, writes the root hash into the main chain as a unified identifier, realizes lightweight indexing and verifiable storage. Hierarchical and hash pointers reduce data redundancy on the chain, improve retrieval and proof efficiency, and facilitate cross-chain reference and audit.

[0052] The cross-chain authentication based on ring signature in the application completes the validity verification without exposing the specific identity, hides the real requestor by using the candidate set, and resists association analysis. The transmission through the relay chain reduces the inter-chain coupling degree, enhances the scalability and interoperability, and guarantees the anonymity and security.

[0053] The application provides atomicity and anti-fraud protection by constructing a two-way commitment and time lock mechanism, and both parties need to disclose the pre-image within the time limit to complete the exchange, avoiding one-sided imbalance. The commitment value transmission minimizes information leakage, realizes the secure transmission and traceable delivery of encrypted identity attributes between chains.

[0054] The application injects Laplace noise into cross-chain authentication events by creating a differential privacy log, which suppresses individual information leakage while meeting differential privacy constraints. It retains the availability of statistical analysis and audit, while mitigating the risk of replay and correlation attacks, balancing compliance audit and privacy protection. BRIEF DESCRIPTION OF DRAWINGS

[0055] Figure 1 A smart contract on-chain identity authentication permission authentication method flowchart is provided for the application;

[0056] Figure 2 A hierarchical Merkle tree construction and on-chain storage flowchart is provided for the application;

[0057] Figure 3 A cross-chain authentication flowchart based on ring signature is provided for the application;

[0058] Figure 4 A two-way commitment privacy transmission channel establishment flowchart is provided for the application;

[0059] Figure 5 A smart contract on-chain identity authentication permission authentication system structure diagram is provided for the application. DETAILED DESCRIPTION

[0060] In order to make the above-mentioned purposes, features and advantages of the application more obvious and easy to understand, the specific embodiments of the application will be described in detail below with reference to the accompanying drawings.

[0061] In the following description, numerous specific details are set forth to provide a thorough understanding of the present application. However, it will be apparent to one skilled in the art that the present application can be practiced without the specific details set forth in this description. In other instances, well-known methods have not been described in detail in order to avoid obscuring the present application.

[0062] Secondly, the "one embodiment" or "an embodiment" referred to herein means a specific feature, structure, or characteristic under discussion that can be included in at least one implementation of the present application. The appearances of "in one embodiment" or "in an embodiment" at different places in this specification do not necessarily refer to the same embodiment, nor do they necessarily refer to one independent or alternative embodiment, unless otherwise indicated.

[0063] Embodiment 1

[0064] Reference Figures 1 to 4 For the first embodiment of the present application, as shown in the accompanying drawings, a smart contract chain identity authentication permission authentication method is provided. Figure 1

[0065] Step 1: Use Paillier homomorphic encryption algorithm to process user identity attributes, generate a set of ciphertext attributes and corresponding zero-knowledge proof commitment values, and perform verification calculation operations in the ciphertext domain to constitute the user's original identity certificate.

[0066] The user identity attribute set is preprocessed and standardized, and the user identity attributes include but are not limited to identity identification number, biological feature hash value, permission level identification, organization affiliation code, and time effectiveness certificate, and other multi-dimensional information. Format the original attribute data into a fixed-length binary sequence to ensure the consistency of subsequent encryption operations.

[0067] For the formatted identity attributes, Paillier homomorphic encryption algorithm is used for encryption processing, first generate a Paillier encryption algorithm public and private key pair, select two large prime numbers p and q, calculate N = p x q, λ = lcm(p-1, q-1), where lcm(·) represents the least common multiple; select a generator g θ , such that and satisfy where L(u) = (u-1) / N, gcd(·) represents the greatest common divisor. The public key is set to (N, g θ ), and the private key is set to λ, is the unit group modulo N 2 .

[0068] For each identity attribute m i of the user, perform Paillier encryption operation to generate corresponding ciphertext c i , i represents the i-th attribute, and the encryption process is:​ Where r i From The blinding factor is randomly selected in the middle. It is a unit group modulo N, ensuring that the same plaintext produces different ciphertexts in different encryption processes, thus enhancing semantic security. In this way, the user's original identity attributes are converted into ciphertext form, supporting subsequent homomorphic operations without exposing plaintext information.

[0069] To ensure the verifiability of ciphertext attributes, zero-knowledge proof commitment values ​​are generated synchronously for each ciphertext attribute c. i Constructing the Pedersen commitment Where g θ and h θ It is a pre-selected generator, r′ i It commits to random numbers, where p′ is a large prime number. Zero-knowledge proof commitments allow verifiers to verify the validity and completeness of attributes without knowing the specific attribute values; it also generates range proofs π. i Prove the encrypted attribute value m i Within the legal range [a i ,b i Within ], the legal scope [a i ,b i ] is predefined to prevent malicious users from submitting attribute values ​​that are outside the predefined range.

[0070] Within the ciphertext field, verification computation operations are performed to ensure the legitimacy of the identity credential. Utilizing the homomorphic property of Paillier encryption, addition operations are performed within the ciphertext field: E(m1)×E(m2)=E(m1+m2), and scalar multiplication operations: E(m). k =E(k×m), where E represents the encryption function. Verification computation can verify the constraints between attributes without decryption, such as verifying the correspondence between a user's age and permission level, or checking whether the cumulative sum of multiple attribute values ​​meets threshold requirements.

[0071] Construct an attribute association verification mechanism and define a logical relationship function F(c1,c2,...,c) between attributes. n This function calculates and outputs the verification result within the encrypted domain. For example, if it is necessary to verify the user's age attribute m... age Calculate F if it is greater than 18 and less than 65. age =E(m) age -18)×E(65-m age F is verified using a zero-knowledge proof protocol. age The corresponding plaintext value is positive, thus confirming that the age attribute meets the requirements. This verification method can protect the user's specific age information from being leaked.

[0072] After all the verification calculations are completed, the set of verified ciphertext attributes {c1, c2,..., c n} and its corresponding set of zero-knowledge proof commitment values {Com1, Com2,..., Com n}, the set of range proofs {π1, π2,..., π n} are integrated into the user's original identity credential. This credential contains a timestamp t create , a version number v id , and a signature σ user = Sign(SK user , H(c1||c2||...||c n ||t create ||v id )), where SK user is the user's private key, H is a hash function, and || represents the string concatenation operation.

[0073] The technical solution constructed in this step ensures that the user's sensitive identity information remains encrypted throughout the entire processing process, effectively preventing the risk of plaintext information leakage. The homomorphic encryption feature enables necessary verification operations to be performed in the ciphertext domain, protecting privacy while ensuring the verifiability of identity attributes. The zero-knowledge proof commitment mechanism further enhances security, ensuring that the verification process does not leak any additional information about the original attributes. Overall, this step lays a solid cryptographic foundation for subsequent on-chain storage and cross-chain authentication, achieving a balance between privacy protection and functionality.

[0074] Step 2: Construct a hierarchical Merkle tree storage structure, taking the generated ciphertext attributes as leaf nodes. According to the pre-set privacy level, distribute the ciphertext credentials to different tree level nodes, establish hierarchical link relationships through hash pointers, and calculate the root hash value. Write the root hash value as an identity identifier into the main chain smart contract. Figure 2 , the hierarchical Merkle tree construction and on-chain storage flowchart for this step.

[0075] In Step 2, the hierarchical Merkle tree storage structure is constructed to manage ciphertext attributes. The privacy level evaluation and classification are performed on the set of ciphertext attributes generated in Step 1.

[0076] According to the sensitivity, access frequency, and permission requirements of the ciphertext attributes, define the privacy level function PL i = α × S i + β × (1 / F i ) + γ × A i , where PL i represents the privacy level value of the i-th ciphertext attribute, S i represents the sensitivity coefficient, Fi denotes the expected access frequency, A i denotes the permission threshold, and α, β, γ are weight parameters and satisfy α + β + γ = 1. Each ciphertext attribute is assigned a corresponding privacy level identifier by the privacy level function.

[0077] Initialize the Merkel tree structure, set the depth of the tree to d, and the maximum number of leaf nodes to 2 d , and the corresponding zero-knowledge proof commitment value Com i of each ciphertext attribute c j Combine to form an attribute tuple (c i , Com i , PL i , index i ), where index i is the attribute index identifier. Arrange these attribute tuples as leaf nodes in order of privacy level value from low to high, and fill them into the bottom layer of the Merkel tree. For vacant leaf node positions, use the predefined null value hash H null to fill in to ensure the integrity of the tree structure.

[0078] After the leaf node layer is constructed, calculate the hash values of the intermediate nodes layer by layer upwards. For each non-leaf node N j,k (where j represents the level and k represents the node position in that level), its hash value is obtained by concatenating the hash values of its left and right child nodes and performing a hash operation: H j,k = Hash (H j+1,2k || H j+1,2k+1 ), where Hash is the SHA-256 hash function and || represents the string concatenation operation. This calculation method ensures that any modification of a leaf node will cause the root hash value to change, achieving a cryptographic guarantee of data integrity.

[0079] According to the privacy level, the Merkel tree is divided into multiple logical level areas of public layer, restricted layer, private layer and core layer. Specifically, attributes with privacy level values in the range [PL min , PL low ] are assigned to the public layer, [PL low , PL mid ] to the restricted layer, [PL mid , PL high ] to the private layer, and [PL high , PL max ] to the core layer; PL min denotes the theoretical lower bound of the privacy level, PL max denotes the theoretical upper bound of the privacy level, and PL lowPL represents the threshold of the boundary between the public layer and the restricted layer. mid PL represents the threshold of the boundary between the restricted layer and the private layer. high PL represents the threshold of the boundary between the private layer and the core layer. Each hierarchical region is managed by an independent access control policy, forming a multi-level privacy protection mechanism. The hierarchical design constructed makes different permission visitors can only obtain the attribute information within their permission range, effectively preventing unauthorized access.

[0080] To establish the link relationship between layers, a hash pointer is set at each hierarchical boundary; the hash pointer structure is defined as HP = (ptr, H target ), where ptr is the memory address or storage location identifier pointing to the target node, and H target is the hash value of the target node. Through the hash pointer, the upper layer node can quickly locate and verify the data of the lower layer node, while maintaining the logical isolation between layers. An aggregation node is set at each hierarchical region, which stores the aggregation information of all attributes in this hierarchical region where n j is the number of nodes in the jth hierarchical region.

[0081] After completing the construction of the tree structure, the root hash value H root of the Merkle tree is calculated; the calculation process of the root hash value starts from the leaf node, iterates layer by layer upwards, and finally obtains a single hash value located at the top of the tree. This root hash value has uniqueness and unforgeability, and can represent the digital fingerprint of the entire identity attribute set. For example, for a Merkle tree with a depth of 4, containing 16 leaf nodes, 15 hash operations are required to obtain the root hash value.

[0082] The calculated root hash value H root is used as the user's identity identifier, and is written to the main chain through the smart contract interface. In the smart contract, define the identity registration function: rgId(address user , H root , timestamp, signature), where address user is the user's blockchain address, timestamp is the registration timestamp, and signature is the user's digital signature of the registration information.

[0083] After receiving the registration request, the smart contract first verifies the validity of the signature, and then stores the identity identifier in the contract's state variable mapping mapping(address=>bytes32)identityRoots; the constructed on-chain storage method ensures the non-tamperability of the identity identifier while having public verifiability.

[0084] Constructing a Merkle proof verification function in the smart contract: vfMP(bytes32 proof, bytes32 leaf, bytes32 root), verifying whether a certain attribute of a user belongs to a specific identity tree, the verification process reconstructs the root hash value by providing the hash values of all sibling nodes on the path from the leaf node to the root node, and compares it with the value stored on the chain. The verification mechanism enables users to selectively disclose partial attributes without exposing complete identity information, achieving fine-grained privacy control.

[0085] The technical solution of this step successfully constructs an efficient and secure hierarchical Merkle tree storage structure, which not only realizes the ordered organization and hierarchical management of ciphertext attributes, but also ensures the integrity and non-repudiation of identity information through the on-chain storage of root hash values. The combination of hierarchical design and hash pointer mechanism provides flexible access control capabilities, enabling the provision of identity attribute proofs at different levels according to different authentication requirements. Overall, this step provides reliable data structure support for identity authentication in the smart contract environment, protecting user privacy while meeting the efficiency and security requirements of on-chain identity management.

[0086] Step 3: Perform cross-chain authentication based on ring signature, the authentication requester extracts the required ciphertext attributes from the Merkle tree to construct a signature ring containing multiple candidate identities, forwards the authentication request to the target chain through the relay chain, and the target chain verifies the validity of the ring signature to authenticate the identity of the authentication requester. Refer to Figure 3 , the flowchart of the cross-chain authentication based on ring signature for this step.

[0087] In step 3, the cross-chain authentication based on ring signature is performed, the authentication requester first extracts the corresponding subset of ciphertext attributes from the Merkle tree constructed in step 2 according to the authentication requirements of the target chain, the extraction process is realized through the Merkle path proof, the authentication requester calculates the verification path from the required leaf node to the root node, and obtains the necessary hash value set {h1, h2,...,hk} on the path. k} where k is the path length. These hash values and the extracted ciphertext attributes {c i1 ,c i2 ,...,c m} together constitute the attribute proof package, ensuring the authenticity and integrity of the extracted attributes.

[0088] Constructing a ring signature structure to achieve identity concealment of the authentication requester, the ring signature mechanism requires the authentication requester to select a set of candidate identities , which contains the real identity ID real of the authentication requester and n r -1 obfuscated identities. For each candidate identity ID jObtain its corresponding public key PK from the blockchain j . The authentication requester generates a ring signature using its own private key SK real and the public key set of all candidates. The generation process of the ring signature includes calculating the connection function , where E s is a symmetric encryption function, s is a session key, y j is the response value of the jth ring member, represents the XOR operation.

[0089] The specific steps of the authentication requester calculating the ring signature are as follows: first, generate a random number α and calculate the initial commitment c1 = H(m||α||PK1||PK2||...||PK n ), where m is the authentication request message to be signed, and H is a hash function. Then, for non-real identity ring members, randomly generate response values r j and intermediate commitment values c j . For real identity positions π, calculate the corresponding response value r π by solving the ring equation , where g is the group generator and R is the ring signature public parameter. The final ring signature is σ ring = (c1, r1, r2,..., r n , R). The construction of the ring signature makes it impossible for the verifier to determine the specific identity of the signer, achieving complete anonymity of the signer in the candidate set.

[0090] The forwarding of cross-chain authentication requests is implemented through a relay chain, which deploys a special cross-chain communication contract that maintains the connection status of the source chain and the target chain and the message queue.

[0091] The authentication requester submits an authentication data packet Packet = {msg auth , σ ring , {c i1 ,..., c im}, proof merkle , nonce} containing the ring signature, ciphertext attributes, and Merkle proof to the relay contract of the source chain, where msg auth is the authentication request message, and nonce is a random number for anti-replay attack.

[0092] After verifying the correctness of the data packet, the relay contract generates a cross-chain message identifier TxID = H(Packet||timestamp||chain source ||chain target ), where chain source and chain target are the identifiers of the source chain and the target chain, respectively.

[0093] The relay chain adopts a threshold signature mechanism to ensure the trusted delivery of cross-chain messages, and the relay node set {N1, N2,..., N t} independently verifies the cross-chain messages, and each node N i uses its private key fragment sk i to generate a partial signature σ i = Sign(sk i , TxID). When at least valid partial signatures are collected, a complete relay signature ∑ relay = Aggregate(σ1, σ2,..., σ k ) is generated through a signature aggregation algorithm, where k is the number of nodes participating in the signature. The threshold signature mechanism prevents single point failures and attacks by malicious nodes, enhancing the security of cross-chain communication.

[0094] After receiving the authentication request forwarded by the relay chain, the target chain performs a ring signature verification process. The verification contract of the target chain first checks the mathematical validity of the ring signature, and verifies and so on until to form a complete ring; therefore, if the ring equation holds, it can be confirmed that the signature comes from a certain member in the candidate set, but it cannot be determined which one.

[0095] The target chain further verifies the validity of the ciphertext attribute and the matching of the permission, and the verification contract reconstructs the root hash value using the provided Merkle proof and compares it with the identity identifier stored on the chain. For the ciphertext attribute, the contract performs a permission verification calculation in the ciphertext domain, where w j is the permission weight of the jth attribute, and N is the modulus of the Paillier algorithm encryption. Through a zero-knowledge proof protocol, it is verified that the corresponding plaintext value V perm satisfies the access threshold T access of the target chain. For example, if the target chain requires that the access permission value be no less than 100, it is verified that Dec(V perm ) ≥ 100 without exposing the specific permission value.

[0096] After verification, the target chain generates an authentication credential:

[0097] Cert auth = {ID session , H root , timestamp auth , validity period , σ target},

[0098] where ID session is a session identifier, timestamp auth is an authentication timestamp, validity preiod is a validity period of the credential, and σ target is a signature of the target chain on the credential. The credential is written into the authentication log contract of the target chain, and the authentication requester is notified through the event mechanism. The generation of the authentication credential marks the successful completion of cross-chain identity authentication, and the authentication requester obtains the authorization to perform corresponding operations on the target chain.

[0099] The technical scheme of this step realizes a privacy protection cross-chain authentication mechanism based on ring signature. The ring signature technology ensures that the authentication requester proves that it belongs to the set of legal users while maintaining anonymity, effectively balancing the identity verification demand and privacy protection requirement. The introduction of the relay chain solves the communication barrier between heterogeneous blockchains, and the threshold signature mechanism ensures the trusted delivery of cross-chain messages. The multi-layer verification mechanism of the target chain, including ring signature verification, Merkle proof verification and ciphertext property permission verification, builds a complete trust chain. Overall, this step realizes a secure, private and efficient cross-chain identity authentication, providing reliable technical support for identity management and permission control in a distributed environment.

[0100] Step 4: After authentication, a two-way commitment privacy transmission channel is established, and the source chain and the target chain each generate a commitment containing a hash value and a time lock, including: the source chain generates a first time-locked hash commitment, the target chain generates a second time-locked hash commitment, and the secure transmission of encrypted identity attributes between chains is completed by exchanging commitment values and corresponding pre-image sequences. Referring to Figure 4 , a flowchart for establishing the two-way commitment privacy transmission channel of this step.

[0101] After authentication, a two-way commitment privacy transmission channel is established to realize the secure transmission of encrypted identity attributes between the source chain and the target chain. The source chain first initializes the transmission channel parameters, generates a random number x s as the source chain secret value, and calculates the corresponding hash commitment h s = H(x s ), where H is the SHA-256 hash function. The source chain sets the first time lock parameter t1, which defines the effective time window of the commitment. The source chain constructs the first time-locked hash commitment HTLC s = (h s , t1, addr t , data e ), where addr t is the target chain receiving address, and data e is the encrypted identity attribute data packet to be transmitted.

[0102] After the target link receives the commitment request from the source link, it generates its own random number x t As the target chain's secret value, calculate the hash commitment h t = H(x t ). The target chain sets the second time lock parameter t2, satisfying the constraint condition of t2 < t1, ensuring that the commitment of the target chain expires before the commitment of the source chain. The target chain constructs the second time-locked hash commitment HTLC t = (h t , t2, addr s , ack e ), where addr s is the source chain address, and ack e is the encrypted confirmation information.

[0103] The source chain and the target chain implement the commitment exchange protocol, and the source chain and the target chain exchange their respective hash commitment values through a secure channel; the source chain deploys HTLC s into the smart contract of the source chain, and the contract code contains conditional judgment logic: if the correct preimage x s is provided before time t1 such that H(x s ) = h s , then release the encrypted identity attribute data e to the target chain; otherwise, return the locked resources to the source chain after timeout. Similarly, the target chain deploys HTLC t into the smart contract of the target chain to implement a symmetric conditional release mechanism.

[0104] The source chain and the target chain execute the preimage sequence exchange process. The target chain first generates the preimage sequence {p1, p2,..., p k}, where each preimage p i is obtained through iterative hash calculation: p i = H (k-i) (x t ), and H (j) represents the execution of j hash operations. The target chain keeps the last element p k = x t confidential and gradually discloses the remaining preimages to the source chain in reverse order. After the source chain receives the preimage p i , it verifies whether the relationship of H(p i ) = p i-1 holds to confirm the correctness of the preimage sequence. The created progressive disclosure mechanism allows both parties to maintain equal information advantages during the transmission process.

[0105] After the source chain verifies some preimages of the target chain, it starts to transmit the shard data of the encrypted identity attribute. The complete encrypted identity attribute data e is divided into n data segments {d1, d2,..., dn}, each segment is appended with a sequence number and a checksum. The source chain sends the segments to the target chain through a predefined transmission channel according to a pre-defined transmission strategy. Each data segment is obfuscated, where denotes the XOR operation, nonce i is a random number for the i-th segment. The obfuscated data segments are sent to the target chain one by one through the inter-chain message channel.

[0106] After receiving the data segments, the target chain performs verification and recombination operations. For each received obfuscated segment T(i), the target chain uses the corresponding pre-image p i and the random number nonce i to recover the original data: The target chain maintains a receiving buffer to sort the data segments according to the sequence numbers and perform integrity checks. After receiving all n segments, the target chain calculates the hash value H verify of the recombined data: n and compares it with the original data hash provided by the source chain to confirm the integrity and correctness of the data transmission.

[0107] After the data transmission is completed, both parties perform a commitment release process. The target chain first discloses its complete pre-image x t , triggering the release condition in the target chain smart contract and sending the confirmation information ack e to the source chain. After verifying that H(x t ) = h t , the source chain confirms that the target chain has correctly received the data, and then discloses its own pre-image x s , completing the final confirmation of the entire transmission process. The smart contract automatically performs state updates, recording the timestamp and transaction hash of the completed transmission.

[0108] An exception handling mechanism is constructed to address potential issues during transmission. If the target chain fails to provide a valid pre-image within the time window [0, t2], the source chain stops data transmission and triggers a rollback mechanism. If the source chain fails to complete data transmission within the time window [t2, t1], the target chain can apply for compensation through an arbitration contract. The arbitration contract automatically executes dispute resolution logic based on the transmission progress recorded on the chain and the evidence provided by both parties. For example, if the source chain has transmitted 60% of the total data but is interrupted due to network failure, the arbitration contract can rule that the transmission is partially completed and adjust the rights and interests of both parties accordingly.

[0109] To enhance the privacy protection capabilities of the transmission channel, a blinding factor is introduced during the commitment exchange process. The source chain generates a blinding factor b s , calculates the blinded commitment h' s = H(xs ||b s ). The target chain can only verify the validity of the commitment after obtaining the blinding factor, and the blinding mechanism involved prevents third parties from inferring the transmission content by monitoring on-chain transactions. Meanwhile, the onion routing technology is used to encrypt the inter-chain message in multiple layers, and each relay node can only decrypt one layer to obtain the next hop address, and cannot obtain the complete transmission path and content.

[0110] The technical scheme of this step establishes a secure and reliable two-way commitment privacy transmission channel, and the time-locking hash commitment mechanism ensures the atomicity of the transmission process, either completely successful or completely failed, avoiding inconsistent state caused by partial transmission; the progressive exchange of pre-image sequences realizes fairness guarantee, preventing any party from gaining an unequal advantage in the transmission process; data fragmentation and obfuscation enhance the privacy of transmission, even if part of the data is intercepted, the complete information cannot be restored. Overall, this step realizes the trusted transmission of encrypted identity attributes between heterogeneous blockchains, provides a secure and efficient data exchange capability for cross-chain identity authentication system, and ensures that user privacy is fully protected in cross-chain scenarios.

[0111] Step 5: Build a differential privacy authentication log mechanism, add random noise subject to Laplace distribution to the recorded cross-chain authentication events, generate log data that meets the ε-differential privacy condition, for auditing and tracing.

[0112] Deploy the differential privacy authentication log mechanism to protect the privacy information of cross-chain authentication events, first define the data structure of the authentication log, including authentication timestamp, source chain identifier, target chain identifier, authentication result status, access frequency count, and attribute category label fields. When a cross-chain authentication event occurs, these raw data are automatically captured and stored in a temporary buffer for subsequent differential privacy processing.

[0113] Set the global privacy budget parameter ε, which controls the balance between privacy protection and data availability. According to the differential privacy theory, it is necessary to ensure that for any two adjacent data sets D and D' (only one record is different), and any output result set S, the probability constraint is met: Pr[M(D) ∈ S] ≤ e ε × Pr[M(D') ∈ S], where M represents the query mechanism after adding noise, Pr represents the probability, and e is the base of natural logarithm. The smaller the value of privacy budget ε, the higher the privacy protection level, but the accuracy of the data will decrease accordingly.

[0114] For access frequency statistics of authentication events, add noise using the Laplace mechanism, set the original access frequency as f, and calculate the sensitivity of this query as Δf = max D,D′|f(D)-f(D′)|, where D and D' are adjacent data sets. For count queries, the sensitivity is typically 1. Generate random noise Lap(λ) that follows a Laplace distribution, where the scale parameter λ = Δf / ε. The probability density function of the Laplace distribution is where x is the noise value. The access frequency after adding noise is The processing method of adding noise prevents the inference of individual authentication behavior through frequency analysis while ensuring statistical properties.

[0115] Time generalization processing is performed on the authentication timestamp information. The original timestamp is mapped to a predefined time interval, and the processing is performed by the time granularity function , where t is the original timestamp, w is the time window size, Δt is the time query sensitivity, and ε t is the privacy budget allocated to the timestamp. The total privacy budget ε is allocated to different data fields according to a predetermined proportion: ε = ε t + ε f + ε a , where ε f is used for frequency statistics, and ε a is used for attribute categories, ensuring reasonable use of the overall privacy budget.

[0116] For statistical queries of attribute category distribution, an exponential mechanism is implemented to select the output result. Define the utility function u(D, r) to represent the utility value of outputting result r on data set D, which is proportional to the probability of selecting output r, where Δu is the sensitivity of the utility function. For attribute category histogram queries, the real count of each category is calculated, and then the final output category distribution is selected according to the probability distribution of the exponential mechanism. Preventing the inference of specific user attribute information through category distribution.

[0117] A hierarchical log aggregation mechanism is constructed to improve query efficiency. The authentication log is constructed into a two-dimensional aggregation tree according to the time dimension and the chain identifier dimension. Each node stores the aggregation statistical information of its child nodes. In the node aggregation process, Laplace noise is independently added to the statistical value of each layer: where A i,j is the aggregation value of the i-th layer and the j-th node, and ε level is the privacy budget allocated to this layer.

[0118] An audit report meeting the condition of epsilon-differential privacy is generated, and the report contains statistical indicators such as authentication success rate, average response time, and inter-chain traffic distribution, each of which is processed by differential privacy. For continuous value indicators, Laplace noise is added; for discrete classification indicators, an exponential mechanism is applied. The audit report provides query services through an intelligent contract interface, and the contract code verifies the authority and remaining budget of the query request to ensure that the privacy budget is not exceeded.

[0119] The technical scheme of this step constructs an authentication log mechanism that meets the differential privacy requirement. The application of the Laplace mechanism ensures that the statistical query result does not leak individual authentication information, and the reasonable allocation of the privacy budget achieves a balance of multi-dimensional data protection. Hierarchical aggregation improves query efficiency. Overall, this step constructs a complete privacy protection audit system, providing reliable technical support for compliance operation and security supervision of cross-chain authentication, and realizing the organic unification of privacy protection, data availability, and audit demand.

[0120] Embodiment 2

[0121] Reference Figure 5 For the second embodiment of the present application, an intelligent contract on-chain identity authentication permission authentication system is provided.

[0122] The system includes an identity credential generation module, a hierarchical identity storage module, a cross-chain anonymous authentication module, a privacy channel establishment module, and a differential audit log module.

[0123] The identity credential generation module processes user identity attributes using the Paillier homomorphic encryption algorithm, generates a set of ciphertext attributes and corresponding zero-knowledge proof commitment values, and performs verification calculation operations on the ciphertext attributes in the ciphertext domain to form the user's original identity credential.

[0124] The hierarchical identity storage module constructs a hierarchical Merkle tree storage structure, takes the generated ciphertext attributes as leaf nodes, distributes the ciphertext credentials to different tree level nodes according to the preset privacy level, establishes a hierarchical link relationship through a hash pointer, and calculates the root hash value, which is written into the main chain smart contract as an identity identifier.

[0125] The cross-chain anonymous authentication module performs cross-chain authentication based on ring signature, and the authentication requester extracts the required ciphertext attributes from the Merkle tree to construct a signature ring containing multiple candidate identities, forwards the authentication request to the target chain through the relay chain, and the target chain verifies the validity of the ring signature to authenticate the authentication requester.

[0126] The privacy channel establishment module establishes a two-way commitment privacy transmission channel after authentication, and the source chain and the target chain each generate a commitment containing a hash value and a time lock, including that the source chain generates a first time-locked hash commitment, the target chain generates a second time-locked hash commitment, and the secure transmission of encrypted identity attributes between chains is completed by exchanging commitment values and corresponding pre-image sequences.

[0127] The differential audit log module constructs a differential privacy authentication log mechanism, adds random noise subject to Laplace distribution to the recorded cross-chain authentication event, generates log data meeting the differential privacy condition, and is used for auditing and tracing.

[0128] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, and for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interfaces, devices or units, which can be electrical, mechanical or other forms.

[0129] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above specific embodiments, and the above specific embodiments are only illustrative, not restrictive. Those skilled in the art can make changes, modifications, replacements and variations to the above embodiments without departing from the scope of the present application, which is within the scope of protection of the present application.

Claims

1. A method for on-chain identity authentication and authorization authentication in smart contracts, characterized in that, include: The Paillier homomorphic encryption algorithm is used to process user identity attributes, generating a set of ciphertext attributes and corresponding zero-knowledge proof commitment values. The ciphertext attributes are verified and calculated within the ciphertext domain to form the user's original identity credentials. A hierarchical Merkle tree storage structure is constructed, and each generated ciphertext attribute is used as a leaf node. The ciphertext certificate is allocated to nodes at different tree levels according to the preset privacy level. The link relationship between levels is established through hash pointers, and the root hash value is calculated and written into the main chain smart contract as an identity identifier. The cross-chain authentication process based on ring signature is executed. The authentication requester extracts the required ciphertext attributes from the Merkle tree to construct a signature ring containing multiple candidate identities. The authentication request is forwarded to the target chain through the relay chain. The target chain verifies the validity of the ring signature to authenticate the identity of the authentication requester. After authentication, a two-way commitment privacy transmission channel is established. The source chain and the target chain each generate a commitment containing a hash value and a time lock, including: the source chain generates a first time lock hash commitment, and the target chain generates a second time lock hash commitment. By exchanging commitment values ​​and corresponding preimage sequences, the secure transmission of encrypted identity attributes between chains is completed. The preimage is obtained by iterative hash calculation of random numbers. A differential privacy authentication log mechanism is constructed, which adds random noise following a Laplace distribution to the records of cross-chain authentication events to generate log data that meets the differential privacy conditions for auditing and traceability.

2. The smart contract blockchain identity authentication and authorization method according to claim 1, characterized in that, The user identity attribute set is preprocessed and standardized, and the user identity attribute data is converted into a fixed-length binary sequence; Generate a public-private key pair for Paillier encryption, perform encryption operations on each identity attribute to generate corresponding ciphertext, and introduce a randomly selected blinding factor during the encryption process; Simultaneously generate zero-knowledge proof commitment values ​​and range proofs to prove that the encrypted attribute values ​​are within a predetermined range; utilize homomorphic properties to perform addition and scalar multiplication operations within the ciphertext domain to verify the constraints between attributes; Construct an attribute association verification mechanism, define logical relationship functions between identity attributes, and calculate the verification result in the ciphertext domain; The verified set of encrypted attributes, the set of zero-knowledge proof commitment values, and the set of range proofs are integrated into the user's original identity credentials, and a timestamp, version number, and user signature are attached.

3. The smart contract blockchain identity authentication and authorization method according to claim 2, characterized in that, The privacy level of the encrypted attribute set is assessed and classified, and a privacy level function is defined based on the sensitivity, access frequency and permission requirements of the attributes. Initialize the Merkle tree structure, set the depth of the tree and the maximum number of leaf nodes, combine the ciphertext attributes and the corresponding zero-knowledge proof commitment values ​​to form attribute tuples as leaf nodes, and fill them to the bottom layer of the Merkle tree in order of privacy level values ​​from low to high. The hash value of the intermediate node is calculated layer by layer upwards, and obtained by connecting the hash values ​​of the left and right child nodes and performing a hash operation. The Merkle tree is divided into multiple logical hierarchical regions: public, restricted, private, and core. Each hierarchical region is configured with an independent access control policy.

4. The smart contract blockchain identity authentication and authorization method according to claim 3, characterized in that, A hash pointer is set at each level boundary, and the hash pointer contains a memory address or storage location identifier pointing to the target node and the hash value of the target node; Set up an aggregation node in each level area to store the aggregate information of all attributes in this level; The root hash value of the Merkle tree is calculated iteratively upwards, starting from the leaf nodes; The root hash value is used as the user's identity identifier and written to the main chain through the smart contract interface. After the identity registration function is defined in the smart contract and the validity of the user's signature is verified, the identity identifier is stored in the contract's state variable mapping. In the smart contract, a Merkel proof verification function is constructed. By providing the hash values ​​of all sibling nodes on the path from the leaf node to the root node, the root hash value is reconstructed and calculated, and then compared with the value stored on the chain to verify the user's identity.

5. The smart contract blockchain identity authentication and authorization method according to claim 4, characterized in that, The authentication requester extracts the corresponding subset of ciphertext attributes from the Merkle tree and obtains the verification path from the required leaf node to the root node through Merkle path proof. Select a set of candidate identities that includes real and obfuscated identities, and obtain the public key corresponding to each candidate identity from the blockchain; Generate a ring signature using your private key and the public key set of all candidates, calculate the connection function, initial commitment and ring equation, randomly generate response values ​​and intermediate commitment values ​​for ring members with non-real identities, and solve the ring equation to calculate the corresponding response value for the real identity position. The authentication data packet, which includes the ring signature, ciphertext attributes, and Merkel proof, is submitted to the relay contract of the source chain. After verifying the correctness of the data packet format, the relay contract generates a cross-chain message identifier.

6. The smart contract on-chain identity authentication and authorization method according to claim 5, characterized in that, The relay chain uses a threshold signature mechanism to ensure the trusted transmission of cross-chain messages. The relay node set independently verifies cross-chain messages. Each node uses its private key fragment to generate a partial signature. After collecting a preset number of valid partial signatures, a signature aggregation algorithm is used to generate a complete relay signature. After the target link receives the authentication request forwarded by the relay chain, it verifies the mathematical validity of the ring signature by reconstructing the ring equation, and uses the provided Merkle proof to reconstruct the root hash value and compare it with the identity identifier stored on the chain. Perform permission verification calculations within the ciphertext domain, and verify that the plaintext value corresponding to the ciphertext attribute meets the access threshold of the target chain through a zero-knowledge proof protocol; Once verified, an authentication credential containing a session identifier, root hash value, authentication timestamp, validity period, and target chain signature is generated.

7. The smart contract blockchain identity authentication and authorization method according to claim 6, characterized in that, The source chain generates a random number as its secret value and calculates the corresponding hash promise. It then sets the first-time lock parameters and constructs a structure containing the hash promise. The first-time locking hash commitment for the time lock, the target link receiving address, and the encrypted identity attribute data packet to be transmitted; The target chain generates its own random number as the target chain secret value and calculates the hash commitment. It sets the second time lock parameters that meet the time constraints and constructs the second time lock hash commitment. Both parties exchange their respective hash commitment values ​​through a secure channel and deploy the commitments into smart contracts on their respective chains. The contracts contain condition judgment logic to implement the condition release mechanism. The target chain generates a pre-image sequence calculated through iterative hashing and discloses it to the source chain in reverse order. After verifying the correctness of the pre-image sequence, the source chain divides the encrypted identity attributes into multiple data fragments, obfuscates each fragment, and sends them to the target chain one by one.

8. The smart contract on-chain identity authentication and authorization method according to claim 7, characterized in that, The target chain uses the corresponding preimage and random number to recover the original data segment, and maintains the receive buffer to sort and verify the integrity of the data segments according to their sequence numbers. The target chain publicly discloses its complete preimage to trigger the release conditions in the smart contract, and the source chain, after verification, publicly discloses its own preimage to complete the confirmation. A blinding factor is introduced during the commitment exchange process to calculate blinded commitments, preventing third parties from inferring the content of the transmission by listening to on-chain transactions.

9. The smart contract blockchain identity authentication and authorization method according to claim 8, characterized in that, Define an authentication log data structure that includes authentication timestamp, source chain identifier, target chain identifier, authentication result status, access frequency count, and attribute category tag; Set global privacy budget parameters to control the balance between privacy protection and data availability; The access frequency statistics are noise-added using the Laplace mechanism to generate random noise that follows a Laplace distribution; Time generalization processing is applied to the authentication timestamp, mapping the original timestamp to a predefined time interval; An index mechanism is used to select output results for the statistical analysis of attribute category distribution. Construct a two-dimensional aggregation tree based on the time dimension and the chain identifier dimension, and add noise independently to the statistical values ​​of each level; A sliding window mechanism is used to manage historical logs, and incremental sensitivity is calculated with corresponding noise added. Generate an audit report with differential privacy processing.

10. A smart contract blockchain identity authentication and authorization system, used to implement the smart contract blockchain identity authentication and authorization method according to any one of claims 1 to 9, characterized in that, include: The module includes an identity credential generation module, a hierarchical identity storage module, a cross-chain anonymity authentication module, a privacy channel establishment module, and a differential audit log module. The identity credential generation module uses the Paillier homomorphic encryption algorithm to process the user's identity attributes, generating a set of ciphertext attributes and corresponding zero-knowledge proof commitment values. The ciphertext attributes are verified and calculated within the ciphertext domain to form the user's original identity credential. The hierarchical identity storage module constructs a hierarchical Merkle tree storage structure, uses each generated ciphertext attribute as a leaf node, distributes the ciphertext certificate to different tree level nodes according to the preset privacy level, establishes inter-level link relationships through hash pointers, calculates and obtains the root hash value, and writes the root hash value as an identity identifier into the main chain smart contract. The cross-chain anonymous authentication module executes a cross-chain authentication process based on ring signatures. The authentication requester extracts the required ciphertext attributes from the Merkle tree to construct a signature ring containing multiple candidate identities. The authentication request is then forwarded to the target chain via a relay chain. The target chain verifies the validity of the ring signature to authenticate the identity of the authentication requester. The privacy channel establishment module establishes a two-way commitment privacy transmission channel after authentication is successful. The source chain and the target chain each generate a commitment containing a hash value and a time lock, including: the source chain generates a first time lock hash commitment, and the target chain generates a second time lock hash commitment. By exchanging commitment values ​​and corresponding preimage sequences, the secure transmission of encrypted identity attributes between chains is completed. The preimage is obtained by iterative hash calculation of random numbers. The differential audit log module constructs a differential privacy authentication log mechanism, adding random noise following a Laplace distribution to the records of cross-chain authentication events to generate log data that meets the differential privacy conditions for auditing and tracing.

Citation Information

Patent Citations

  • Method and system for generating recoverable linkable ring signature with post-quantum security

    CN118316622A

  • Supply chain financial digital identity zero-knowledge authentication and identity management method and device based on block chain

    CN118505250A