Abstract

The present disclosure relates to a method and a system for synchronizing offline-generated Application Programming Interface (API) requests using Merkle roots between a client device and a server. The present disclosure suggests buffering one or more API requests in a persistent local storage queue responsive to unavailability of network connectivity. Thereafter, the present disclosure suggests generating, for each buffered API request, a cryptographic leaf hash based on a canonical representation of the corresponding API request. Upon generating the cryptographic leaf hash, the present disclosure suggests constructing, by the client device, a Merkle tree including the cryptographic leaf hashes as leaf nodes and generating a root hash corresponding to the buffered API requests. Subsequently, the present disclosure suggests transmitting the root hash to a server upon restoration of network connectivity and comparing the transmitted root hash with an expected root hash associated with previously synchronized API requests for the client device. In response to determining that the transmitted root hash differs from the expected root hash, the present disclosure suggests iteratively requesting and receiving hash values of child nodes of the Merkle tree from the client device to identify one or more divergent leaf nodes. Further, the present disclosure suggests transmitting only those API requests corresponding to the divergent leaf nodes to the server. As a result, the present disclosure provides efficient and cryptographically verified synchronization of offline API requests by transmitting only unmatched request data identified through Merkle-root comparison, thereby minimizing bandwidth usage and avoiding redundant retransmissions.

Creative Commons License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.

Share

COinS