Tamper-proof method for group chat messages
By constructing a confirmer group based on the closeness of members and a hash chain verification mechanism, the problems of low efficiency in group chat message anti-tampering verification and collusion attacks are solved, achieving efficient and reliable decentralized verification and enhancing the security and adaptability of the system.
Patent Information
- Application Number
- CN202511589956.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-03
- Publication Date
- 2025-12-12
AI Technical Summary
Existing technologies for verifying the tamper-proof nature of group chat messages are inefficient, vulnerable to collusion attacks, and overly reliant on trusted third-party institutions, failing to ensure both verification speed and reliability of verification results.
A matrix of intimacy levels among group chat members is constructed. By dynamically calculating the frequency of message interactions between members, groups of confirmers with high and low intimacy levels are selected. Confirmation messages with digital signatures are generated and stored on the blockchain. Hash chains are used to ensure the integrity and traceability of message sequences.
It significantly improves the efficiency and reliability of group chat message anti-tampering verification, prevents node collusion attacks, realizes decentralized trusted verification, and enhances the security and adaptability of the system.
Smart Images

Figure CN121125121A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of blockchain and instant messaging technology, and in particular to a method for preventing tampering of group chat messages. Background Technology
[0002] With the widespread adoption of instant messaging technology, group chats have become an important way for people to communicate online. However, current mainstream group chat platforms typically employ a centralized architecture, with all chat history data centrally stored and managed by the platform. This makes it impossible for group chat participants to effectively verify whether the chat records provided by the platform have been tampered with; the reliability of the data depends entirely on the platform's reputation and security, resulting in single points of failure and trust dependency issues. To address this problem, existing technologies have proposed blockchain-based group chat message notarization schemes, utilizing the immutability of blockchain to notarize messages or their hash values on the chain. However, these schemes typically require confirmation from all members or a large number of randomly selected members when determining message validity, leading to significant message confirmation delays in active group chats with a large number of members, severely impacting the chat experience. Furthermore, fixed or random verification node selection mechanisms are insufficient to prevent collusion and cheating among nodes, failing to ensure both verification speed and reliability of verification results. Summary of the Invention
[0003] To address the problems of low verification efficiency, vulnerability to collusion attacks, and over-reliance on trusted third-party institutions in existing group chat message anti-tampering methods, this invention proposes a method for preventing group chat message tampering.
[0004] The specific technical solution is as follows: A method for preventing tampering of group chat messages, characterized by the following steps:
[0005] Construct a closeness matrix of group chat members, wherein the element values in the closeness matrix are dynamically calculated based on the message interaction frequency between the corresponding members;
[0006] For the message sequence to be verified, a confirmer group screening operation is performed based on the intimacy matrix. The screening operation includes a first screening based on the high intimacy between the member and the message sender, and a second screening based on the low intimacy between the member and the message sender.
[0007] The group of confirmers confirms the message sequence, generates a confirmation message with a digital signature, and submits it to the blockchain;
[0008] Based on the confirmation messages stored on the blockchain, the content and order of the message sequence are verified against tampering. A dynamically calculated affinity matrix is used to intelligently select verification nodes, avoiding the delays caused by full verification or random verification, significantly improving verification efficiency. Simultaneously, through dual screening of high and low affinity levels, verification reliability is enhanced while effectively preventing collusion among nodes, achieving decentralized and trustworthy verification.
[0009] Furthermore, constructing the intimacy matrix includes:
[0010] Set the message window threshold w;
[0011] When a new message arrives in the group chat, retrieve the w previous historical messages preceding the new message;
[0012] For each historical message, the affinity value between the sender of the new message and the sender of the historical message is updated according to the following formula, based on its distance from the new message in the sequence:
[0013] Q updated =Q prev +(w-Distance) / w;
[0014] Among them, Q prev The value represents the intimacy level before the update, and Distance is the distance between the two messages in the sequence. This ensures that the intimacy matrix reflects the latest interactions between members in real time, making trust assessment more accurate and adaptive, avoiding bias caused by outdated historical data, and thus improving the accuracy and real-time performance of verification.
[0015] Furthermore, the process of performing the confirmer group screening operation includes:
[0016] Traverse the message sequence to be verified. For each message in the sequence, find the other member with the highest intimacy with the current message sender from the intimacy matrix and add it to the candidate confirmer set.
[0017] Calculate the frequency of occurrence of each member in the candidate confirmation set;
[0018] Sort the members from high to low according to their frequency, and select the top N members to form the main confirmer subset;
[0019] From the intimacy matrix, find the M members with the lowest average intimacy with all senders in the message sequence to be verified, and form a subset of supervisory confirmers;
[0020] The confirmer group is composed of the primary confirmer subset and the supervisory confirmer subset. By using frequency statistics and subset combination, the composition of the confirmer group is optimized, ensuring both the confirmers' familiarity with the message sequence and introducing independent supervision, thereby enhancing the system's resistance to attacks while maintaining verification speed.
[0021] Furthermore, the number M of members in the subset of supervisors and confirmers is dynamically determined according to the following rules:
[0022] M = max(1, ceil(δ*N));
[0023] Where N is the number of members in the subset of primary confirmers, δ is the anti-cheating coefficient preset according to the trust level of the group chat, and ceil is the rounding function. This method achieves adaptive adjustment of the supervision intensity, flexibly configuring the anti-cheating strength according to the trust level of the group chat. It enhances security in low-trust environments and maintains efficiency in high-trust environments, improving the applicability and robustness of the method.
[0024] Furthermore, when multiple members have the same frequency after being sorted by frequency, members with higher overall affinity to the message sequence to be verified are preferentially selected for inclusion in the primary confirmer subset. Optimizing the overall affinity improves the representativeness of the confirmer group, ensuring a fairer and more reliable verification process and reducing decision-making uncertainty.
[0025] Furthermore, generating the confirmation message with a digital signature includes:
[0026] Obtain the first hash value corresponding to the previously successfully confirmed message sequence recorded in the blockchain;
[0027] Calculate the second hash value of the current sequence of messages to be confirmed;
[0028] The first hash value and the second hash value are concatenated, and the concatenation result is hashed to obtain a combined hash value.
[0029] The confirmation message is generated by digitally signing the combined hash value using the confirmer's own private key. The hash chain ensures the continuity and integrity of the message sequence, preventing intermediate tampering; the digital signature provides authentication and non-repudiation, further enhancing data security and traceability.
[0030] Furthermore, for the first batch of messages in the group chat, the first hash value is a preset initial value. This initial value is determined through negotiation among all founding members when the group chat is created and recorded in the genesis block or the first block of the blockchain. This provides a secure trust anchor for system startup, ensuring reliable storage and verification of the initial messages, avoiding vulnerabilities in the startup phase, and guaranteeing the integrity and consistency of the entire verification chain.
[0031] Furthermore, the verification based on the confirmation message stored on the blockchain includes:
[0032] Receive a verification request for a target message sequence and determine one or more confirmation message fragments corresponding to the target message sequence on the blockchain;
[0033] For each confirmation message segment, perform the following operations:
[0034] Retrieve a confirmation message from the blockchain that stores the fragment, the confirmation message containing a combined hash value signed by the confirmers group;
[0035] Based on the actual content of the target message sequence, the combined hash value is recalculated;
[0036] The recalculated combined hash value is compared with the combined hash value obtained from the blockchain;
[0037] If the comparison matches, the message segment is determined to be untampered. This achieves efficient message segment verification, supports partial verification and rapid detection, and reduces computational overhead. Simultaneously, hash comparison ensures the accuracy of the verification results, facilitating rapid identification of tampering.
[0038] Furthermore, it also includes a decay process for the intimacy matrix:
[0039] According to a preset decay period, all element values in the intimacy matrix are multiplied by a decay factor α, where 0 < α < 1. This prevents early interactions from excessively influencing the current trust assessment, allowing the intimacy matrix to dynamically reflect the latest relationships, avoiding assessment distortion caused by data stagnation, and improving the long-term stability of the system.
[0040] Furthermore, it also includes initialization during group chat creation, with initialization steps including:
[0041] Deploy a smart contract on the blockchain, the smart contract being used to receive, verify, and store the confirmation message;
[0042] Register the hash of each group chat member's digital identity certificate on the blockchain, and use a PKI-based identity authentication mechanism to verify the validity of the digital signature.
[0043] The above technical solution has the following advantages or technical effects:
[0044] 1. This invention significantly improves the efficiency and reliability of group chat message anti-tampering verification through a dynamically calculated intimacy matrix and a confirmer group screening mechanism; through dual screening of high and low intimacy levels and dynamic adjustment of anti-cheating coefficients, it effectively prevents node collusion attacks and enhances the security and adaptability of the system.
[0045] 2. This invention utilizes hash chains and blockchain for evidence storage, ensuring the integrity and traceability of message sequences and achieving decentralized trusted verification. Through attenuation processing and initialization settings of the intimacy matrix, the long-term stability and deployability of the system are improved, making it suitable for various group chat scenarios. Attached Figure Description
[0046] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0047] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0048] like Figure 1 As shown, a method for preventing tampering with group chat messages includes the following steps:
[0049] Construct a closeness matrix for group chat members. The element values in the closeness matrix are dynamically calculated based on the message interaction frequency between the corresponding members.
[0050] For the message sequence to be verified, a confirmer group screening operation is performed based on the intimacy matrix. The screening operation includes a first screening based on the high intimacy between the member and the message sender, and a second screening based on the low intimacy between the member and the message sender.
[0051] The message sequence is verified by a group of confirmers, who generate a digitally signed confirmation message and submit it to the blockchain.
[0052] Based on the confirmation messages stored on the blockchain, the content and order of the message sequence are verified to prevent tampering.
[0053] When a group chat is created, the system performs initialization steps, which include:
[0054] A smart contract is deployed on the blockchain to receive, verify, and store confirmation messages. The code of the smart contract is public and transparent, and all group chat members can review its logic.
[0055] Each group chat member registers the hash of their digital identity certificate on the blockchain for use in verifying the validity of digital signatures. Digital identity authentication is based on the standard X.509 certificate, using a PKI system to generate a digital certificate for each member to represent their identity. These digital certificates are issued by a trusted Certificate Authority (CA) or implemented through a decentralized identity solution. Meanwhile, the Membership Service Provider (MSP), responsible for certificate issuance, user authentication, and backend encryption mechanisms, utilizes the PKI system to issue data certificates. Combined with the MSP for identity authentication and authorization matching, this further ensures data trustworthiness.
[0056] The initial parameters for the group chat are set, including the message window threshold w, the confirmer group size N, the anti-cheating coefficient δ, and the decay factor α (0 < α < 1). The message window threshold w needs to be set to balance verification accuracy and computational cost, typically between 5 and 20 depending on the group chat's activity level. For highly active group chats, the w value can be increased to obtain a more accurate intimacy assessment, such as 15-20; for low-activity group chats, the w value can be decreased to reduce computational complexity, such as 5-10.
[0057] The system framework of this invention includes a data acquisition layer, a data processing layer, a data transmission layer, a data platform, and a blockchain service. The data acquisition layer is responsible for collecting group chat messages from group chat terminal devices (such as mobile phones and computers); the data processing layer preprocesses the collected data based on edge nodes; the data transmission layer uploads the data to the data platform and blockchain via relay stations; the data platform includes a group chat message management platform for data analysis and storage; and the blockchain service provides decentralized storage and smart contract execution. Users / organizations interact with the data platform through the application system and undergo identity verification. This system periodically verifies data integrity through an anomaly monitoring module.
[0058] The system preprocesses the collected group chat messages to construct and update the intimacy matrix. Preprocessing includes data cleaning, format conversion, and integration, abstracting messages into message data and extracting identifying information (such as hash values, timestamps, and data types). The intimacy matrix is a quantitative representation of the message interaction frequency among group chat members, and its element values are dynamically calculated based on the message interaction frequency between corresponding members.
[0059] The process of constructing the intimacy matrix includes the following steps:
[0060] Set the message window threshold w (e.g., w=5) to indicate the number of historical messages to consider;
[0061] When a new message arrives in the group chat, retrieve the w previous historical messages preceding the new message;
[0062] For each historical message, based on its distance from the new message in the sequence, update the affinity value between the sender of the new message and the sender of the historical message according to the following formula:
[0063] Q updated =Q prev +(w-Distance) / w;
[0064] Among them, Q prev The proximity value before the update is used, and Distance is the distance between the two messages in the sequence (e.g., the distance between adjacent messages is 1).
[0065] The intimacy matrix is stored in matrix form, with rows and columns representing members and element values indicating the intimacy level of the corresponding member pair. The intimacy value Q(User-m, User-m) between a member and itself is always set to 0 to avoid self-verification. By dynamically updating the intimacy matrix, the system can reflect the latest interactions between members in real time, making trust assessment more accurate and adaptive, avoiding bias caused by outdated historical data, and providing a reliable basis for the selection of confirmer groups.
[0066] Assume that in the current intimacy matrix, the intimacy between users U3 and U1 is Q(U3,U1)=3, and the intimacy between U3 and U2 is Q(U3,U2)=2. The new message sequence is: User1 sends message-1; User2 sends message-2; User1 sends message-3; User3 sends message-4. Then, for message-4, its distance from message-3 is 1, so update Q(U3,U1)=3 + (5-1)*1 / 5=3.8; its distance from message-2 is 2, so update Q(U3,U2)=2 + (5-2)*1 / 5=2.6; and its distance from message-1 is 3, so update Q(U3,U1)=3.8 + (5-3)*1 / 5=4.2.
[0067] For the message sequence to be verified, the system performs a confirmer group screening operation based on the intimacy matrix. This operation includes a first screening based on the high intimacy between the member and the message sender, and a second screening based on the low intimacy between the member and the message sender. The specific steps are as follows:
[0068] Traverse the message sequence to be verified. For each message in the sequence, find the other member with the highest affinity to the current message sender from the affinity matrix and add it to the candidate confirmer set.
[0069] Calculate the frequency of occurrence of each member in the candidate confirmation set;
[0070] Sort the members from highest to lowest frequency and select the top N members to form the main confirmer subset. N can be preset according to the size of the group chat, for example, N=3.
[0071] If multiple members have the same frequency after sorting by frequency, members with higher overall affinity to the message sequence to be verified are prioritized for inclusion in the primary confirmer subset. Overall affinity is calculated by taking the average affinity between a member and all senders in the sequence; it refers to the average affinity between that member and all senders in the message sequence.
[0072] To ensure the impartiality of the verification and prevent collusion, the system performs a second screening to construct a subset of supervisory confirmers;
[0073] Calculate the average intimacy level between each member in the intimacy matrix and all message senders in the message sequence to be verified;
[0074] Select the M members with the lowest average intimacy level from all members to form a subset of supervisor confirmers;
[0075] The number of members M is dynamically determined according to the following rule: M=max(1,ceil(δ*N)), where N is the number of members in the subset of main confirmers, δ is the anti-cheating coefficient preset according to the trust level of the group chat, and ceil is the round-up function;
[0076] The confirmer group is composed of a subset of primary confirmers and a subset of supervisory confirmers.
[0077] This dual screening mechanism optimizes the composition of verification nodes: the primary confirmer subset, due to its high degree of intimacy, can quickly and accurately understand and confirm the message sequence; the supervisor confirmer subset, due to its low degree of intimacy, has higher independence and can effectively supervise and constrain the primary confirmers, preventing group collusion and cheating. Thus, while ensuring verification efficiency, it significantly enhances the security and robustness of the system.
[0078] The confirmer group confirms the sequence of messages to be verified, generates a confirmation message with a digital signature, and submits it to the blockchain. The specific steps include:
[0079] Retrieve the first hash value corresponding to the previously successfully confirmed message sequence recorded in the blockchain. For the first batch of messages in a group chat, the first hash value is a preset initial value, which is determined by all founding members through negotiation when the group chat is created and recorded in the genesis block or the first block of the blockchain;
[0080] Calculate the second hash value of the current sequence of messages to be confirmed;
[0081] The first hash value is concatenated with the second hash value, and the concatenation result is hashed to obtain the combined hash value. The formula for generating the combined hash value is:
[0082] H combined =Hash(H prev ||H current );
[0083] Among them, H prev H is the first hash value. current The second hash value is represented by |, where | indicates a concatenation operation, and Hash is a hash function (such as SHA-256).
[0084] The confirmer uses their own private key to digitally sign the combined hash value, generating a confirmation message. The confirmation message consists of two structures: Verify Message and Confirm Message. Verify Message contains the fields: last block number, message sequence range, message hash value (i.e., combined hash value), and confirmer's signature. Confirm Message contains the fields: last block number, message sequence range, message hash value, and a list of confirmer signatures (signatures of all confirmers).
[0085] The confirmer submits the Verify Message to the blockchain smart contract, which ensures that the sequence numbers submitted by all confirmers are consistent. After all confirmers have submitted their confirmation messages, the contract automatically updates the message sequence hash value: hash(hash value of the current message sequence [m,n] + confirmer sign list). Upon receiving the final confirmation message, the confirmer checks the validity of the signature list and records the confirmation message locally.
[0086] The message confirmation process uses a hash chain to ensure the continuity and integrity of the message sequence and prevents tampering in the middle; digital signatures provide identity authentication and non-repudiation; smart contracts enable automated execution, improving efficiency and transparency.
[0087] Based on the confirmation messages stored on the blockchain, the content and order of the message sequence are verified against tampering. The specific steps include:
[0088] Receive verification requests for a target message sequence and determine one or more corresponding confirmation message segments on the blockchain. If the target sequence spans multiple confirmation message segments, it is split into corresponding sub-ranges and verified segment by segment.
[0089] For each confirmation message segment, perform the following operations:
[0090] Retrieve the confirmation message storing the fragment from the blockchain, and extract the list of confirmers' signatures and the combined hash value;
[0091] Based on the actual content of the target message sequence, recalculate the combined hash value (the calculation method is consistent with the message confirmation process).
[0092] The recalculated combined hash value is compared with the combined hash value obtained from the blockchain;
[0093] If the comparison matches, the message segment is determined to be unaltered; otherwise, it is determined to have been tampered with.
[0094] If verification fails, the system can retrieve the original message data from the blockchain for recovery and record an anomaly log for administrator analysis.
[0095] In the user authentication process, the system uses digital certificates based on the PKI system for user authentication, combined with MSP (Membership Service Provider) for identity authentication and permission matching, to ensure the authenticity and legitimacy of the user's identity.
[0096] To assess the overall security of the system, this embodiment evaluates the system's security status by monitoring the changing trends of the intimacy matrix and the verification consistency of the confirmer group.
[0097] The verification process supports local verification and rapid detection, reducing computational overhead; hash comparison ensures the accuracy of verification results, facilitating rapid identification of tampering; and combined with the immutability of blockchain, it achieves decentralized and trustworthy verification.
[0098] To maintain the timeliness of the intimacy matrix, the system multiplies all element values in the matrix by a decay factor α (0 < α < 1, e.g., α = 0.95) according to a preset decay period (e.g., daily). This ensures that early interactions do not excessively influence current trust assessments. The decay process prevents assessment distortion caused by data stagnation, allowing the intimacy matrix to dynamically reflect the latest relationships and improving the system's long-term stability and accuracy.
[0099] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for preventing tampering with group chat messages, characterized in that the steps include... include: Construct a closeness matrix of group chat members, wherein the element values in the closeness matrix are dynamically calculated based on the message interaction frequency between the corresponding members; For the message sequence to be verified, a confirmer group screening operation is performed based on the intimacy matrix. The screening operation includes a first screening based on the high intimacy between the member and the message sender, and a second screening based on the low intimacy between the member and the message sender. The group of confirmers confirms the message sequence, generates a confirmation message with a digital signature, and submits it to the blockchain; Based on the confirmation messages stored on the blockchain, the content and order of the message sequence are verified to prevent tampering.
2. The method for preventing tampering with group chat messages according to claim 1, characterized in that, Constructing the intimacy matrix includes: Set the message window threshold w; When a new message arrives in the group chat, retrieve the w previous historical messages preceding the new message; For each historical message, the affinity value between the sender of the new message and the sender of the historical message is updated according to the following formula, based on its distance from the new message in the sequence: Q updated =Q prev +(w-Distance) / w; Among them, Q prev The intimacy value before the update is given, and Distance is the distance between the two messages in the sequence.
3. The method for preventing tampering with group chat messages according to claim 1, characterized in that, The screening operation for the confirmer group includes: Traverse the message sequence to be verified. For each message in the sequence, find the other member with the highest intimacy with the current message sender from the intimacy matrix and add it to the candidate confirmer set. Calculate the frequency of occurrence of each member in the set of candidates for confirmation; Sort the members from high to low according to their frequency, and select the top N members to form the main confirmer subset; From the intimacy matrix, find the M members with the lowest average intimacy with all senders in the message sequence to be verified, and form a subset of supervisory confirmers; The confirmer group is composed of the primary confirmer subset and the supervisory confirmer subset.
4. The method for preventing tampering with group chat messages according to claim 3, characterized in that, The number M of members in the subset of supervisors and confirmers is dynamically determined according to the following rules: M = max(1, ceil(δ*N)); Where N is the number of members in the subset of primary confirmers, δ is the anti-cheating coefficient preset according to the trust level of the group chat, and ceil is the rounding up function.
5. The method for preventing tampering with group chat messages according to claim 3, characterized in that, It also includes the following: when multiple members have the same frequency after being sorted by frequency, members with higher overall affinity to the message sequence to be verified are preferentially selected to enter the primary confirmer subset.
6. The method for preventing tampering with group chat messages according to claim 1, characterized in that, The generation of the confirmation message with a digital signature includes: Obtain the first hash value corresponding to the previously successfully confirmed message sequence recorded in the blockchain; Calculate the second hash value of the current sequence of messages to be confirmed; The first hash value and the second hash value are concatenated, and the concatenation result is hashed to obtain a combined hash value. The confirmer uses their own private key to digitally sign the combined hash value, generating the confirmation message.
7. The method for preventing tampering with group chat messages according to claim 6, characterized in that, For the first batch of messages in a group chat, the first hash value is a preset initial value. The initial value is determined by all founding members through consultation when the group chat is created and is recorded in the genesis block or the first block of the blockchain.
8. The method for preventing tampering with group chat messages according to claim 1, characterized in that, The verification based on the confirmation message stored on the blockchain includes: Receive a verification request for a target message sequence and determine one or more confirmation message fragments corresponding to the target message sequence on the blockchain; For each confirmation message segment, perform the following operations: Retrieve a confirmation message from the blockchain that stores the fragment, the confirmation message containing a combined hash value signed by the confirmers group; Based on the actual content of the target message sequence, the combined hash value is recalculated; The recalculated combined hash value is compared with the combined hash value obtained from the blockchain; If the comparison matches, the message segment is determined to have not been tampered with.
9. The method for preventing tampering with group chat messages according to claim 1, characterized in that, It also includes attenuation processing of the intimacy matrix: According to a preset decay period, all element values in the intimacy matrix are multiplied by a decay factor α, where 0 < α < 1.
10. The method for preventing tampering with group chat messages according to claim 1, characterized in that, This also includes initialization during group chat creation, with the initialization steps including: Deploy a smart contract on the blockchain, the smart contract being used to receive, verify, and store the confirmation message; Register the hash of each group chat member's digital identity certificate on the blockchain, and use a PKI-based identity authentication mechanism to verify the validity of the digital signature.