Find something... ⌘K

Loans (MaxyLock) / How it works

Repaying and defaults

How a repayment gets the Bitcoin back, and what each side loses when a party misses its part.

Repaying

A repayment is not a transfer to the lender. It is a deposit into the loan contract, which the lender collects only by publishing the secret.

Host chain · loan contract

Borrower repays 15,000 USDC escrowed
revealSecret lender paid + slice back
Live Escrowed Settled

Bitcoin · tranche 0 HTLC

0.25 BTC locked HTLC · two exits
Borrower spends it with the secret
no payment without the release
secret published → opens the HTLC

worked example, MaxyLock 5.2 · reveal window 7 days

  1. 01 The borrower calls repayTranche, or repay in the SDK. The tranche reads Escrowed and the reveal window starts.
  2. 02 The lender calls revealSecret. The contract checks the secret, pays the lender and publishes the secret.
  3. 03 The borrower spends the Bitcoin with that secret.

In Maxy's loans, Maxy's service reveals, then broadcasts the return the borrower signed during funding, so the BTC arrives by itself. If it has not, reclaimCollateral spends the tranche with the published secret.

The amount to repay is exactly the tranche's principal share. Repay before lastSafeRepayTime, which getLoan returns: repay refuses after it. Tranches can be repaid in any order.

Every credit goes to a payout ledger, and each party withdraws with claimPayout. Balances do not expire.

With no gas to repay, requestGas sends a small amount, and you retry. The secret alone cannot reclaim the Bitcoin without the Bitcoin key, so back the key up.

If someone defaults

Reveal window over, no secret
Mega-Pot 15,000 slice + 15,000 repaid
Order on the settler owes 0.2625 BTC
Borrower paid pot Delivered

What the pot owes the borrower

25,000,000 × 10,500 / 10,000

= 26,250,000 sats

Open Delivered

worked example, MaxyLock 11.8 · ghostPayoutBps 10500 · no price read

What happensResultWho bears it
The borrower does not repayThe tranche defaults. The borrower keeps the principal; the lender sweeps the Bitcoin after the time lockBorrower
The lender does not revealAnyone calls triggerGhostLiquidation. The lender's slice and the escrow buy the borrower Bitcoin at a premium: 105% in live vaultsLender
The borrower never fundsFunding is finalized; the lender recovers both depositsNobody
The BTC is sent but not provenFinalized unfunded. By Maxy's policy, not a contract rule, Maxy discloses the secret so the BTC comes backTime
The lender does not proveThe borrower or a third party proves; a third party after the deadline earns a bounty from the lender's collateralLender
No filler takes a potThe pot is reclaimed and reopened until one doesBorrower, in time
A filler commits and does not deliverThe filler is slashedFiller

A default is confined to its tranche, and the liquidation claim never expires. Timing rule: every collateral lock opens after the end of the term plus the reveal window plus two days, so a borrower who repays always has time to act.

In the SDK, getLoan(...).status.revealMissed lists the tranche and startLiquidation starts it.