iServeU | Banking as a Service | Banking Infrastructure Provider

iServeU is certified under NPCI Partner Program for eKYC Setu, RuPay, UPI, IMPS & partners as Bharat Connect TSP for NBBL 's COU, BOU, & UPMS .

Synthesizing Atomicity and Resilience for the Core Wallet Stack

We started this series with a simple question, “When a ₹100 transfer happens, how do you guarantee it never half-happens”?

In our first blog, we explored how Two-Phase Commit (2PC) gave us atomicity but at the cost of freezing systems under failure. In the second, we turned to the Saga Pattern which improved resilience but introduced a window where consistency could break. Neither was enough. So in this final series, we’ll show you what we built instead: a hybrid architecture that combines the strengths of both.

The Unacceptable Trade-Off: Revisiting 2PC's Failure

The mandate for a financial ledger is clear: Atomicity. Our initial analysis focused on Two-Phase Commit (2PC) as the means to achieve Strong Consistency. However, as operational scale increased, the inherent flaw of 2PC became a critical system risk: the Indefinite Blocking Issue.

 

Recall that 2PC requires services to acquire and hold global locks on critical resources for the transaction’s full duration.

 

Technical Correlation: If the central Transaction Coordinator failed after services entered the Prepared state (Phase 1), those resources remained locked indefinitely. This failure mode demonstrated that 2PC’s fundamental reliance on global resource locking was incompatible with the requirement  for system availability and resilience. We needed a solution that could guarantee the integrity of the commitment without holding the ingress layer hostage to downstream failures.

A Two-Stage, Hybrid Commitment Pipeline: The Synthesis

Our hybrid pipeline is built as a two-stage system. The first stage captures and validates the transaction request with minimal system load. The second stage commits it only after every participant is ready while ensuring the final commitment is atomic and safe.The ingress point borrows the resilience principles of the Saga Pattern. Decoupled, failure-tolerant, and highly available. The ledger commit layer applies the atomic finality of 2PC ensuring zero duplicity when money actually moves. 

 

Think of it like a payment in motion.

 

In the first stage, a user initiates a ₹100 transfer. The system quickly accepts the request, validates basic details, and acknowledges. In the second stage, the system performs the 2 Phase Commit by first ensuring the critical checks, ensuring sufficient balance, coordinating between services, and finalising the debit and credit.
This is the high-commitment step where everything is validated before money actually moves.

The Validator Operator acts as the synchronous transaction ingress point, designed explicitly on the principles of the Saga Pattern to ensure high availability and non-blocking performance.

The Validator Operator and the Saga Foundation

The Saga Principle: This stage utilises the Saga foundation by executing a rapid, non-blocking Local Transaction (L-T). By not holding resources, we eliminate the 2PC Indefinite Blocking Issue for the high-volume service layer. If the downstream ledger fails, the front-end remains fully operational.

The Ledger Operator consumes the validated, ordered messages and is designated  to perform the definitive, non-duplicate commitment using a highly controlled instance of the 2PC protocol.

The Ledger Operator and the Localized 2PC Foundation 1

The Hybrid Advantage: We harness the atomicity  power of 2PC—the feature that led us to it in the first place—while effectively insulating its availability risk. The integrity of the core ledger is maintained via the two-phase commit, but the potential for global blocking is mitigated because the 2PC operation is decoupled, asynchronous, and executed far away from the synchronous ingress layer.

Conclusion: A New Standard for Financial Integrity

The challenge of engineering a core wallet stack—simultaneously demanding resilience, zero duplicity, and absolute correctness—cannot be solved by relying on a single , established commitment patterns.

Our hybrid solution successfully   these requirements: leveraging the non-blocking availability principles of the Saga Pattern at the transaction ingress, and confining the definitive atomic integrity of the 2PC protocol to a controlled, asynchronous ledger environment. This architectural approach establishes a higher standard for resilience and financial certainty in high-scale distributed systems 

Author
1cb6f153 1c30 49be b4c1 02d0d091b497

Sovit Acharya, Principle Engineer

Leading at the intersection of finance and technology, I build the mission-critical systems behind modern digital transactions. I specialize in engineering secure, high-performance fintech architectures that are resilient and fast at scale. I leverage a powerful, multi-stack approach to solve complex distributed systems challenges.

Leave a Comment

Your email address will not be published. Required fields are marked *

Partner With Us

Important ! : If You are from MENA,ASEAN and Other Region(Not India) Fill This Form. Otherwise Fill the Quick Contact Form.


This will close in 0 seconds

Scroll to Top