  Cryptocurrency networks such as Bitcoin have emerged as a distributed
alternative to traditional centralized financial transaction networks. However,
there are major challenges in scaling up the throughput of such networks.
Lightning network and Spider network are alternates that build bidirectional
payment channels on top of cryptocurrency networks using smart contracts, to
enable fast transactions that bypass the Blockchain. In this paper, we study
the problem of routing transactions in such a payment processing network. We
first propose a Stochastic model to study such a system, as opposed to a fluid
model that is studied in the literature. Each link in such a model is a
two-sided queue, and unlike classical queues, such queues are not stable unless
there is an external control. We propose a notion of stability for the payment
processing network consisting of such two-sided queues using the notion of
on-chain rebalancing. We then characterize the capacity region and propose a
throughput optimal algorithm that stabilizes the system under any load within
the capacity region. The stochastic model enables us to study closed loop
policies, which typically have better queuing/delay performance than the open
loop policies (or static split rules) studied in the literature. We investigate
this through simulations.
