  Layer-two blockchain protocols emerged to address scalability issues related
to fees, storage cost, and confirmation delay of on-chain transactions. They
aggregate off-chain transactions into a fewer on-chain ones, thus offering
immediate settlement and reduced transaction fees. To preserve security of the
underlying ledger, layer-two protocols often work in a collateralized model;
resources are committed on-chain to backup off-chain activities. A fundamental
challenge that arises in this setup is determining a policy for establishing,
committing, and replenishing the collateral in a way that maximizes the value
of settled transactions.
  In this paper, we study this problem under two settings that model
collateralized layer-two protocols. The first is a general model in which a
party has an on-chain collateral C with a policy to decide on whether to settle
or discard each incoming transaction. The policy also specifies when to
replenish C based on the remaining collateral value. The second model considers
a discrete setup in which C is divided among k wallets, each of which is of
size C/k, such that when a wallet is full, and so cannot settle any incoming
transactions, it will be replenished. We devise several online policies for
these models, and show how competitive they are compared to optimal (offline)
policies that have full knowledge of the incoming transaction stream. To the
best of our knowledge, we are the first to study and formulate online
competitive policies for collateral and wallet management in the blockchain
setting.
