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
Bitcoin · tranche 0 HTLC
worked example, MaxyLock 5.2 · reveal window 7 days
- 01 The borrower calls
repayTranche, orrepayin the SDK. The tranche readsEscrowedand the reveal window starts. - 02 The lender calls
revealSecret. The contract checks the secret, pays the lender and publishes the secret. - 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
What the pot owes the borrower
25,000,000 × 10,500 / 10,000
= 26,250,000 sats
worked example, MaxyLock 11.8 · ghostPayoutBps 10500 · no price read
| What happens | Result | Who bears it |
|---|---|---|
| The borrower does not repay | The tranche defaults. The borrower keeps the principal; the lender sweeps the Bitcoin after the time lock | Borrower |
| The lender does not reveal | Anyone calls triggerGhostLiquidation. The lender's slice and the escrow buy the borrower Bitcoin at a premium: 105% in live vaults | Lender |
| The borrower never funds | Funding is finalized; the lender recovers both deposits | Nobody |
| The BTC is sent but not proven | Finalized unfunded. By Maxy's policy, not a contract rule, Maxy discloses the secret so the BTC comes back | Time |
| The lender does not prove | The borrower or a third party proves; a third party after the deadline earns a bounty from the lender's collateral | Lender |
| No filler takes a pot | The pot is reclaimed and reopened until one does | Borrower, in time |
| A filler commits and does not deliver | The filler is slashed | Filler |
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.