Protocol documentation.

How Templar Lend works: who lends, who borrows, the contract that holds the collateral and what it costs.

AlphaTest network only

Chapters

01 — The idea

In short.

Templar is a market for loans between people on the Liquid network. The collateral sits in a contract the network enforces, and nobody holds anyone else's funds.

The idea in five lines

  1. The lender writes a proposal with their rate and puts it in Templar's orderbook.
  2. The borrower picks a proposal, accepts the rate and puts up collateral, usually bitcoin.
  3. Each side signs its own part of the same transaction. Templar joins the signatures and sends it to the Liquid network.
  4. The collateral goes into a covenant, a script that accepts only the transactions written at opening.
  5. The borrower pays and gets the collateral back. If they don't pay, after the deadline the collateral goes to the lender.

The example on this page

Every chapter uses the same numbers.

ItemIn the example
The lender (maker)Bob, who has 40,000 USDt and wants to put them to work.
The borrower (taker)Alice, who has 1 L‑BTC, that is bitcoin on the Liquid network, and needs dollars for 30 days without selling.
Loan40,000 USDt.
Collateral1 L‑BTC, worth 80,000 USDt in the example: 200% of the loan.
Rate2.5% for the whole term: 1,000 USDt of interest.
Term43,200 blocks, about 30 days. Liquid adds about one block a minute.
Installments4, one every 10,800 blocks (about 7.5 days): 10,400, 10,300, 10,200 and 10,100 USDt, 41,000 in all.
If Alice doesn't payAfter the deadline Bob takes the collateral. Had Alice paid some installments, Bob would take only the part that covers the debt.

The ground rules

  • No custodian: the collateral sits in a covenant on Liquid and leaves only as the contract says.
  • No oracle: the price doesn't close the loan. The deadline and the installments do.
  • Collateral from 150% up: at least 150% of the loan, with no maximum. With no oracle, that margin is what protects the lender.
  • Deadline in blocks: 43,200 blocks are about 30 days, with an installment every 10,800.
  • Fixed rate: the proposal sets it, and it doesn't change with the days.

Alpha. This page describes the full protocol. Today's alpha runs on the test network only and uses a simpler contract: the chapter Today's alpha explains it.

02 — The idea

The flow, step by step.

Three roles, one proposal, two signatures and a single transaction that opens the contract.

  1. Maker

    1Proposal

    Amount, rate, term in blocks, collateral, installments, fees.→ to the orderbook · not signed
    Templar

    Orderbook

    The open proposals, sorted by rate.
  2. Taker

    2Accepts

    Picks Bob's proposal and accepts the rate.← to Templar
  3. Templar

    3Prepares the contract

    Inputs: Bob's USDt, Alice's L‑BTC. Outputs: USDt to Alice, L‑BTC into the covenant, fees.← PSET to Bob and to Alice →
  4. Maker

    4Signs his part

    His 40,000 USDt.→ to Templar
    Taker

    4Signs her part

    Her 1 L‑BTC.← to Templar
  5. Templar

    5Joins and sends

    Joins the PSETs, hides amounts and assets, adds the network fee and keeps its own.↓ to the Liquid network
  6. Liquid network

    6The contract is open

    One transaction: the USDt reach Alice as the L‑BTC goes into the covenant. About a minute, one block.
  7. Covenant

    7The life of the contract

    Installments or a single repayment. The deadline is a block height: 43,200 blocks after opening.
  8. Covenant

    8The close

    • RepaidThe collateral goes back to Alice.
    • Not repaidAfter the deadline the collateral goes to Bob.
    • By agreementAny outcome both of them sign.
The flow of one loan: Bob lends 40,000 USDt, Alice puts up 1 L‑BTC, Templar prepares and joins.

Who does what

RoleWhoWhat they do
MakerThe lender (Bob)Writes the proposal: what they lend and how much, the rate, the term in blocks, the collateral they ask for, the installments and the fees.
TakerThe borrower (Alice)Picks a proposal in the orderbook, accepts the rate and puts up the collateral.
TemplarThe protocolKeeps the orderbook, prepares the transactions, joins the signatures, sends and follows the contract until it closes. It holds nothing.
Liquid networkThe federation's signersPut transactions into blocks, about one a minute, and collect the network fees.

In the alpha the borrower can also publish a proposal, and then the borrower is the maker. This page follows the main case: the maker lends.

The orderbook

It is the list of open proposals, sorted by rate. It lives on Templar's site, off the network: a proposal is not signed and moves nothing. Signing comes only after someone has accepted it.

What the proposal says

  • The asset lent and the amount: 40,000 USDt.
  • The rate, fixed for the whole term: 2.5%.
  • The term in blocks: 43,200.
  • The collateral asked for, with asset and quantity: 1 L‑BTC. It must be worth at least 150% of the loan.
  • The installments: how many, and what happens if one is missed (see Installments).
  • The opening fee for the lender, which can be zero.
  • Templar's fee: how much it is and who pays it.

Whoever accepts reads all of it before signing, and afterwards nothing changes.

Each side signs its own part

Templar prepares the transaction that opens the contract and sends it to both as a PSET, Liquid's format for transactions waiting to be signed. Bob signs his USDt, Alice her L‑BTC.

In the design each side signs its own input with SIGHASH_ALL|ANYONECANPAY. That signature covers all the outputs, so nobody can change amounts or recipients, and among the inputs it covers only the signer's own. So Templar can join the two halves without Bob and Alice showing each other their coins.

In the alpha both sign, with SIGHASH_ALL, the complete PSET that Templar prepared; Templar then combines the signatures and sends. Either way, Templar does the joining.

Templar joins and sends

Templar joins the signed PSETs, hides amounts and assets with confidential transactions, adds the network fee and sends the transaction to Liquid. It keeps its fee in that same transaction.

A single transaction opens the contract: the USDt reach Alice at the same moment the L‑BTC goes into the covenant. Neither side has to trust the other to make its move afterwards.

Until the close

Templar follows the contract to the end: the installments or the single repayment, the deadline, the close. There are three possible outcomes.

  • Repaid: all the collateral goes back to the borrower, in the same transaction as the last payment.
  • Not repaid: after the deadline the lender takes the collateral, or only the part that covers the debt if some installments were paid.
  • By agreement: any outcome, if both sign it.

03 — The contract

The collateral.

It is what the borrower puts at the lender's disposal. During the loan it sits in nobody's wallet.

Usually it is L‑BTC, that is bitcoin on the Liquid network, 1:1 with BTC through the peg. It can also be another asset issued on Liquid: the chapter Assets and tokenization covers that.

For the whole term of the loan it sits in the covenant. It never passes through a Templar wallet, nor through the lender's.

No oracle, no liquidation

The price is not part of the contract: if it drops, the loan goes on and only the deadline and the installments count. The design Templar starts from leaves the oracle out on purpose, so as not to add one more party to trust.

The loan is non-recourse: if at the deadline the collateral is worth less than the debt, the lender takes the collateral and can't ask for more.

From 150% up

The collateral is worth at least 150% of the loan, and there is no maximum: the proposal asks for as much as it likes, and the borrower chooses whether to accept it. With no oracle and no liquidation, this margin is what protects the lender: at 150% the price can fall by a third before the collateral is worth less than the loan. In the example it is worth twice as much, 200%: 1 L‑BTC at 80,000 USDt for 40,000 lent.

Who loses if the price crashes

The loan carries on, because there is no oracle. Bob only loses if the collateral ends up worth less than the debt and Alice doesn't pay. Alice can still pay and get her collateral back, or not pay and leave it to Bob.

How it ends

OutcomeWhat happens to the collateral
Repaid in fullAll of it goes back to the borrower, in the same transaction as the payment.
Deadline passed, not repaidThe lender takes it.
Some installments paid, then nothingThe lender takes the part that covers the remaining debt plus the penalty. The rest goes back to the borrower.
A unique asset, quantity 1It can't be split: if the loan is not repaid, all of it goes to the lender.
Closed by agreementAny outcome both sign.

The deadline is a block height and there is no extension: from the first block after it, the lender can take the collateral.

Halfway through

Collateral can't be added or withdrawn while the loan is open. To change it, the two sides close the contract by agreement and open a new one.

04 — The contract

The covenant.

A script on the Liquid network that accepts only the transactions written in the contract.

Think of a safe with the list of its only possible exits written inside: “installment paid, a new safe with less debt”, “all paid, the collateral goes back to Alice”, “deadline passed, the collateral goes to Bob”. The network rejects any other transaction. Liquid's nodes check the rules, not Templar.

How it works

  1. Every possible transaction is worked out. Before opening, a template is prepared for each state of the contract. The outputs of each template are hashed with SHA‑256, and the hashes go into the script.
  2. The spender splits the outputs in two. In the spending data (the witness) they put the fixed part, which must match that hash, and a free part: the network fee and possibly an address chosen at the time.
  3. OP_CAT rebuilds the message. The script checks the hash of the fixed part, then joins it to the free part and rebuilds the message that a transaction's signature covers.
  4. One signature, two checks. OP_CHECKSIGFROMSTACKVERIFY checks a signature on that rebuilt message. Then the same signature goes to OP_CHECKSIG, which checks it against the real transaction. If it passes both times, the real transaction is exactly the template. The key used is public: here the signature authorizes nobody, it only serves to compare.
  5. OP_CHECKLOCKTIMEVERIFY counts the blocks. It opens the lender's path only after a given block height, that is after the deadline.

Two paths

The contract moves in two directions, one for each side.

  • The borrower moves it sideways: pays an installment and the covenant opens a new one with less debt, or repays everything early. The borrower does it alone.
  • The lender moves it down: when a period ends without an installment, the lender takes the contract to the “late” state, where the next installment costs more. At the end the lender can take the collateral.

When a period ends, the network can't cancel the old state by itself. That's why the lender makes the late step, and a timelock stops the lender from making it early.

The network fee is chosen at sending

The network fee sits in the free part of the outputs, so it is set when the transaction goes out. Nobody has to guess it weeks ahead, and the sender can raise it if the network is busy.

Control assets: transferable positions

At opening each side receives a control asset: a unique asset, quantity 1, needed to move its side of the contract. Whoever holds it controls that side.

A position can therefore be sold without touching the collateral. That is the basis for a secondary market in loans, which for now remains an idea for the future.

Tested before signing

Every transaction of the contract can be tested in advance, even offline. Anyone who wants to can check every state before signing.

The limits

  • Little room: each script element can hold at most 520 bytes, so a covenant can hide only a few outputs.
  • Pinning: if a contract transaction goes out with too low a fee, someone can stop it from being raised and keep it stuck waiting.
  • A shared key: for the hashes to match with amounts hidden, the two sides share a key that the masking of amounts comes from. Sometimes a small extra transaction is needed before paying an installment.
  • No price: the covenant doesn't watch the market. The lender has no margin call to protect them and chooses how much collateral to ask for, from 150% of the loan up.

In the alpha. Today's contract is a 2‑of‑2, with a branch that opens the lender's path after the deadline (OP_CHECKLOCKTIMEVERIFY). Repaying also needs the lender's signature. The covenant described here is in progress.

Source: Asset-Based Lending smart contract for Liquid Network, Rugged Bytes, 2020Read the article

05 — The contract

Installments.

The covenant is programmable, so repayment can be split into parts. Each part lowers the debt.

Each installment paid is a transaction that closes the covenant and opens a new one with less debt. The borrower pays it alone: the covenant accepts an installment only if it goes to the lender.

The parameters

The lender writes them in the proposal, except the last two, which change as the contract goes on.

SymbolWhat it means
PThe loan: 40,000 USDt in the example.
CThe collateral: 1 L‑BTC.
NHow many installments: 4.
MHow many installments missed in a row make the borrower lose the collateral.
RDThe rate of each installment, on the debt still open.
REThe surcharge for repaying everything early.
RCThe penalty on the collateral, if the loan is not repaid.
RL(1) … RL(M−1)The surcharges for lateness: the first with one missed installment, the second with two in a row, and so on.
BThe debt still open.
mThe installments missed in a row right now.

The formulas

FormulaWhat it computes
FP = P ÷ NThe principal part of each installment.
D = min(FP · (m + 1), B)The principal due now: one part, plus the missed ones.
L = min(FP · m, B)The principal that is late.
Areg = D + B · RD + L · RL(m)The installment: the principal due, the interest on the debt, the surcharge on what is late.
Aearly = B + B · RD + (B − D) · RE + L · RL(m)The early repayment of the whole debt.
Apenalty = max(B, Areg) · (1 + RC)What the debt is worth if the loan is not repaid, penalty included.
Cforfeit = max(Cuncond, min(C, C · Apenalty ÷ P))The part of the collateral that goes to the lender. The rest goes back to the borrower.

Cuncond is the part of the collateral that, if the contract provides for it, goes to the lender in any case when the loan is not repaid. Computed amounts are rounded down.

The example: 40,000 USDt in 4 installments

With N = M = 4 and RD at 1% per period. The proposal's 2.5% is the total cost of the loan, 1,000 USDt: split over four installments, it comes to 1% of the debt still open in each period.

InstallmentBy blockPrincipalInterestTo payDebt after
Installment 110,80010,00040010,40030,000
Installment 221,60010,00030010,30020,000
Installment 332,40010,00020010,20010,000
Installment 443,20010,00010010,1000
In all 40,0001,00041,000 

Amounts in USDt. With the last installment the L‑BTC goes back to Alice.

If an installment is missed

At the end of the period the lender moves the contract to the late state, and the next installment costs more.

Say Alice pays the first installment and misses the second. At the third she owes two parts of principal, 20,000 USDt, plus 1% of the 30,000 still open, plus the surcharge RL(1) on the 10,000 that are late. The lender chooses the value of RL(1) in the proposal.

After M installments missed in a row, or at the end of the contract, the lender takes the part of the collateral that covers the remaining debt plus the penalty. The rest goes back to the borrower.

Paying early

The borrower can repay everything before the deadline. They pay the debt still open, the interest for the period and the surcharge RE on the principal not yet due. Merging two nearby installments doesn't save interest.

In the alpha. Templar records the installments in its database, and only the last one unlocks the collateral. A missed installment is flagged by hand. Installments enforced by the covenant are in progress.

Source: Asset-Based Lending smart contract for Liquid Network, Rugged Bytes, 2020, the variant with partial repaymentsRead the article

06 — Money and data

Fees and revenue.

Every cost is written in the proposal: whoever accepts reads it before signing, and afterwards it doesn't change.

ItemWho pays, who receivesWhen
InterestThe borrower to the lender, in USDt.At each installment, or at repayment.
Opening feeThe borrower to the lender, in the collateral asset (L‑BTC).At opening.
Templar's feeThe proposal says who pays it. Templar receives it.At opening, when Templar joins the signatures.
Network feeThe borrower, or the lender if they take the collateral. Liquid's signers receive it.At every transaction.

Interest

The lender sets the rate, and it is fixed for the whole term: it is not an annual rate and doesn't grow with the days. In the example, 40,000 USDt at 2.5% for 30 days comes to 1,000 USDt. With installments it is paid on the debt still open.

Opening fee

It goes to the lender in the same transaction that opens the loan, outside the contract, and stays with them even if repayment comes the next day. Whoever publishes the proposal sets it, and it can be zero.

Templar's fee

Templar takes it in the transaction that opens the contract, when it joins the signatures. The proposal states how much it is and who pays it, and whoever accepts reads both before signing. Templar takes nothing more on installments or repayment.

The percentage has not been set yet.

In the alpha. Today Templar's fee is a share of the interest, paid at repayment and set to zero. Moving it to the opening is in progress.

Network fees

They cost a few cents in L‑BTC. The borrower pays them at opening and at each installment, and the lender if they take the collateral. They are chosen when the transaction is sent.

How Templar earns

Templar earns a fee on each contract it matches and joins. It lends none of its own money and never holds the funds, so an unpaid loan costs it nothing and earns it nothing. Its revenue grows with the number of contracts.

In return for the fee, Templar:

  • keeps the orderbook, where supply and demand meet;
  • prepares the transactions to sign for each state of the contract;
  • joins the signatures and sends the transactions to the network;
  • follows the contract until it closes.

The lender earns the interest. The borrower gets dollars without selling.

07 — Money and data

Privacy.

On Liquid, anyone watching the network sees neither the amounts nor which asset is moving.

Liquid uses confidential transactions: amounts and assets stay hidden from anyone without the keys to see them. The contract can still be enforced, because the two sides hide the amounts in a predictable way, with a shared key, and the covenant's hashes still match.

Who sees what

WhoWhat they see
Anyone watching the networkThat a transaction happened. Not the amounts, not the assets.
The lender and the borrowerTheir contract, in full.
TemplarAmounts and assets, because it prepares and joins the transactions.
Anyone using the siteThe open proposals in the orderbook.

Documents

Today the app asks for no documents, and there is no account to open.

In the alpha. With the test wallet held by the site, the loan terms end up readable on the network. With Templar Wallet they don't.

08 — Money and data

Assets and tokenization.

The contract works with any pair of assets issued on Liquid: one is lent, another goes in as collateral.

Today the app uses L‑BTC as collateral and USDt as the loan, both on the test network.

What tokenizing means

On Liquid anyone can issue an asset: a stablecoin, a bond, units or shares of a company. An issued asset moves like L‑BTC, so it can sit in a covenant as collateral. For example, tokenized shares instead of L‑BTC.

KindExampleAs collateral
BitcoinL‑BTCToday's case.
Digital dollarsUSDtUsually the asset that is lent.
Tokenized securitiesShares, bondsPossible in the design, with the caveats below.
Unique itemsAn asset with quantity 1It can't be split: if the loan is not repaid, all of it goes to the lender.

Caveats

  • Many regulated securities on Liquid can move only with their issuer's permission. Whether a covenant can hold them still has to be checked.
  • Tokenized shares and bonds are financial instruments and follow their own rules, different from those for crypto.
  • The covenant doesn't watch the price: with an asset that swings a lot, the lender has to ask for more collateral, well above 150%.
  • The alpha's engine already accepts other assets; the interface doesn't yet.

Here tokenization is something the protocol makes possible. Templar does not issue securities and does not offer any.

09 — Context

Four ways to borrow against bitcoin.

If you hold bitcoin and want dollars without selling it, today you can leave it in the custody of a bank or a lender, turn it into a token on another blockchain, or lock it in a multisig where the platform also holds a key. In all three cases, if the price drops, the collateral can be sold. With Templar it sits in a covenant on the Liquid network, and the price does not close the loan.

The four ways

WayHow it works
TemplarA contract between two people, on the Liquid network.
Multisig oraclesA multisig on the Bitcoin network, with the price supplied by the platform.
Other blockchainsBitcoin turned into a token, inside a lending pool.
BanksBanks and lenders, with the collateral in custody.

The comparison is by category: within each one, platforms differ in the details.

In one table

QuestionTemplarMultisig oraclesOther blockchainsBanks
Bitcoinwhich bitcoin, and where the collateral sitsL‑BTC, in a covenantReal BTC, in a multisigA token instead of BTCIn the lender's custody
Stablecoinwhat the loan is paid inUSDt on LiquidStablecoins on several networks, or eurosA stablecoin on the same chainDollars or euros in the account
Trustwho you have to trustNo custodian, no oracleThe platform and its oracleCustodian, oracle and governanceThe lender and its custodian
Privacywho can see the loanAmounts hidden on the networkPublic addressAll publicVerified identity
Termhow long it runs, and what ends itFixed in blocks, no margin callFixed, with margin callsOpen-ended, variable rateBy contract, with margin calls

The Templar column describes the full protocol. Today's alpha uses a 2‑of‑2 contract: Today's alpha explains it.

Bitcoin: which bitcoin, and where the collateral sits

WayThe detail
TemplarBitcoin on the Liquid network, 1:1 with the BTC held by the Liquid federation. It leaves the covenant only through the transactions written at opening: the borrower by paying, the lender after the deadline. Never Templar.
Multisig oraclesOn the Bitcoin network, one address per loan. Moving it takes several signatures, and one of the keys always belongs to the platform.
Other blockchainsA custodian or a group of signers holds the real BTC. The token stays in the lending contract as long as the price holds.
BanksThe lender holds it, or a custodian does on its behalf, and sometimes uses it in turn as collateral with whoever funds the lender.

Stablecoin: what the loan is paid in

WayThe detail
TemplarUSDt digital dollars, on the Liquid network. The contract works with any asset issued on Liquid.
Multisig oraclesUSDt and USDC on various blockchains, Liquid included. Some platforms also pay in euros or dollars by bank transfer.
Other blockchainsThe loan is a stablecoin taken from the pool, USDC for example, on the same blockchain as the token.
BanksThe loan lands in a bank account. Some crypto lenders also pay in stablecoins.

Trust: who you have to trust

WayThe detail
TemplarWhat remains is trust in the Liquid federation, which holds the BTC and signs the blocks, in the stablecoin's issuer and in the covenant's code, which the nodes check. Templar keeps the orderbook and joins the signatures, but has no path of its own to move the collateral.
Multisig oraclesThe platform supplies the price, from an average of exchanges. Below a threshold it liquidates the collateral with its key and a second signature.
Other blockchainsThe token's custodian, the price oracle, the pool's code and whoever can change its parameters.
BanksTheir soundness, and what they do with the collateral. In 2022 several crypto lenders went bankrupt holding their clients' funds.

Privacy: who can see the loan

WayThe detail
TemplarWith confidential transactions, anyone watching the network sees neither amounts nor assets. Templar, which prepares the transactions, does see them. Today the app asks for no documents.
Multisig oraclesThe multisig is visible on the Bitcoin network, amount included. Documents depend on the platform: some ask for none, others do.
Other blockchainsCollateral, debt and liquidation threshold are visible on the chain. The contract asks for no documents; the exchange you go through usually does.
BanksThe lender asks for documents and personal data, and keeps them.

Term: how long it runs, and what ends it

WayThe detail
TemplarFor example 43,200 blocks, about 30 days, installments too, at a fixed rate. The deadline and missed installments end it, not the price. Early repayment is possible, on the contract's terms.
Multisig oraclesUsually one to 24 months. If the price drops, warnings arrive, and at a threshold the collateral goes to the lender.
Other blockchainsNo deadline, and the rate follows the pool. If the price falls below a threshold, anyone can liquidate the collateral and the borrower pays a penalty.
BanksFor example 12 months. If the price drops, the lender asks for more collateral, then sells it.

To read alongside the table

  • L‑BTC is not BTC on the Bitcoin network: it depends on the Liquid federation, a point of trust that a multisig on Bitcoin doesn't have.
  • Some multisig platforms also pay out in USDt on Liquid. The difference is where the collateral stays.
  • Hidden amounts apply to anyone watching the network. Templar, which prepares the transactions, sees them.
  • Repaying early can cost a surcharge, if the proposal sets one.
  • Today, in the alpha, repaying also needs the lender's signature.

Sources: the public documentation of platforms in each category, read on 27 September 2026. The comparison names no one.

10 — Context

Who controls what.

Who can move the collateral, what the site sees, how signing works, what happens if the site shuts down and which risks remain.

Who can move the collateral

Only as the contract says: the borrower by paying, the lender after the deadline. The collateral sits in a covenant on the Liquid network, which accepts only the transactions written at opening: the installments and the repayment, which the borrower pays alone, and after the deadline the lender's path. Templar has no path of its own, and Liquid's nodes check the rules.

Today's alpha uses a simpler 2‑of‑2 contract: Today's alpha explains it.

What the site sees

Templar prepares every transaction and, once all the signatures are in, joins them and sends it to the network. With Templar Wallet connected the site never gets the seed (the recovery words) or any other secret key: it cannot sign for anyone.

The wallet shares

  • A read-only copy of the wallet (the “watch‑only descriptor”): the site sees addresses, balances and transactions.
  • The public key for contracts: Templar uses it to write each contract, and nothing can be spent with it.

Never shares

  • The seed or the private keys.
  • The wallet's password or PIN.

Two ways to sign

The app accepts Templar Wallet and, for trying things out, a test wallet. What changes is who holds the keys.

ItemTemplar WalletTest wallet
KeysOn your computer. The site gets a read-only copy.The site holds them: you bring the 12 or 24 words of a test wallet, or the app creates one.
SigningThe request arrives as a templar:// link or as a QR code. The wallet checks amounts and addresses again, then you sign.The site signs for you.
NetworkThe test network today. It is the wallet meant for real use.Test network only, with coins that have no value.
WheremacOS, Windows and Linux. Signing on Android comes later.In the browser, nothing to install.

A signing request stays valid for 15 minutes: if it expires, nothing moves. With the test wallet the loan terms end up readable on the network.

How to connect Templar Wallet is in the wallet documentation.

If the site shuts down

The covenant lives on the Liquid network, outside Templar's servers, and the planned transactions are written at opening: the borrower can still pay, and after the deadline the lender can still take the collateral.

In today's alpha, though, the site prepares those transactions. Every loan has a recovery file meant to do without it, and no wallet can read it yet.

The risks

  • The borrower can lose all the collateral by not repaying in time.
  • In the alpha the borrower can also lose it if the lender doesn't sign the repayment before the deadline.
  • The lender can end up with collateral worth less than the loan, because the price doesn't close the contract.
  • L‑BTC depends on the Liquid federation, and digital dollars on whoever issues them.
  • The software has not been audited and may contain bugs.

The code

Templar Wallet's code, including its side of the link with the site, is open source under the MIT licence: it's on GitHub. The protocol and site code is not public yet.

11 — Context

Today's alpha.

This documentation describes the full protocol. Here is what the alpha already does, and what is missing.

Alpha. Templar runs on the test network only, with coins that have no value. Anyone who uses it does so at their own risk.

What works today

  • Proposals in the orderbook, with a rate fixed for the term. Both lenders and borrowers can publish.
  • A 2‑of‑2 contract with the deadline in blocks: after the deadline the lender can take the collateral.
  • Templar joins the signatures, hides amounts and assets and sends the transaction.
  • Test L‑BTC and USDt.
  • Signing with Templar Wallet on a computer, or with a test wallet held by the site.

Design and alpha, piece by piece

PieceThe designThe alpha today
NetworkLiquid.Test network only (testnet and regtest). The main network is not supported.
Contract on the collateralA covenant with OP_CHECKSIGFROMSTACK and OP_CAT.2‑of‑2, plus the lender's path after the deadline.
RepaymentThe borrower pays alone, and the covenant forces the payment to the lender.It also needs the lender's signature.
InstallmentsEnforced by the covenant.Recorded in Templar's database. Only the last one unlocks the collateral, and a missed installment is flagged by hand.
Minimum collateralAt least 150% of the loan, no maximum.Not checked yet: what counts is what the proposal says, and whoever accepts checks it themselves.
Who publishesThe lender.Both: a loan offer or a loan request.
RateIn the proposal.Yes, fixed for the term.
Joining signatures and sendingTemplar.Yes.
PrivacyAmounts and assets hidden.Yes, Templar hides the amounts. With the test wallet the loan terms can be read on the network.
Templar's feeAt opening.A share of the interest at repayment, zero today.
AssetsAny Liquid asset.The engine, yes. The interface, only test L‑BTC and USDt.
Transferable positionsWith control assets.The tokens are issued, but they can't be transferred and aren't tied to the script.
SigningThe user's own wallet.Templar Wallet on a computer, or a test wallet held by the site.

In progress

  • The covenant (OP_CHECKSIGFROMSTACK and OP_CAT) in place of the 2‑of‑2.
  • Installments enforced by the covenant.
  • The check on the minimum collateral, 150% of the loan.
  • Other Liquid assets as collateral.
  • Templar's fee at opening.
  • Transferable positions with control assets.

12 — Help

Glossary.

The words on this page, briefly explained.

The network and the coins

WordWhat it means
LiquidA network built alongside Bitcoin, with a block about every minute, issued assets and confidential transactions.
FederationThe group of signers that holds the pegged BTC and signs Liquid's blocks.
PegThe 1:1 exchange between BTC and L‑BTC. You enter and leave Liquid through the peg or through a swap service.
L‑BTCBitcoin on the Liquid network, 1:1 with the BTC held by the federation.
StablecoinA digital coin that tracks the value of a currency, usually the dollar.
USDtDigital dollars, Tether's stablecoin, here on the Liquid network.
AssetAnything issued on Liquid: L‑BTC, a stablecoin, a security, a unique item.
TokenizationIssuing an asset on a network that stands for something else, a share or a bond for example.
BlockA group of transactions the network records together. Liquid adds one about every minute: 43,200 blocks are about 30 days.
Confidential transactionsTransactions where anyone watching the network sees neither amounts nor assets.
Network feeThe cost of a transaction, a few cents in L‑BTC, paid to Liquid's signers.
Test networkA copy of the network with coins that have no value, for trying things out (testnet, regtest).

The contract

WordWhat it means
CovenantA script that accepts only certain transactions: the ones written in the contract.
PSETA Liquid transaction still waiting for signatures, passed from one person to another. It is the Liquid version of Bitcoin's PSBT.
SIGHASHThe part of a signature that says what it covers. With SIGHASH_ALL|ANYONECANPAY it covers all the outputs and, among the inputs, only the signer's own.
MultisigAn address that needs several signatures to spend, 2 of 2 for example.
CLTVOP_CHECKLOCKTIMEVERIFY: keeps a path closed until a given block height.
OP_CAT and OP_CHECKSIGFROMSTACKThe two script commands that make the covenant possible: the first joins two pieces of data, the second checks a signature on any message.
Control assetA unique asset, quantity 1, that controls one side of the contract. Whoever holds it can move that side.
OracleA service that brings outside data, such as a price, into a contract. Templar uses none.
CollateralWhat the borrower locks in the covenant to cover the loan, usually L‑BTC.
Over‑collateralizationCollateral worth more than the loan. In Templar at least 150%, with no maximum: with no oracle, the margin is what protects the lender.
Margin callA demand for more collateral when the price drops. Templar has none.
LiquidationThe forced sale of the collateral below a price threshold. Templar has none.
Non-recourseIf the loan is not repaid, the lender takes the collateral and can't ask for more. Templar's loans work this way.

The market and the wallet

WordWhat it means
OrderbookThe list of open proposals, sorted by rate.
ProposalThe terms of a loan written by whoever publishes it: amount, rate, term, collateral, installments, fees.
MakerWhoever publishes the proposal. On this page, the lender.
TakerWhoever accepts a proposal. On this page, the borrower.
SeedA wallet's 12 or 24 recovery words. You never give them to anyone.
Watch‑onlyA read-only copy of the wallet: it shows addresses and balances, and can't spend.
templar://The link the site uses to send Templar Wallet a signing request. It is valid for 15 minutes.
AlphaAn early, incomplete version, for trying out.

13 — Help

Frequently asked questions.

For people who want to use Templar and for people evaluating it.

Can I use it today?

Not with real money. The alpha runs on the test network only, and the app is coming soon. Templar Wallet, on the other hand, you can already install on your computer and try with test coins, without signing up: the wallet page.

What happens if the price crashes?

The loan carries on, because there is no oracle and nobody sells the collateral. The lender only loses if the collateral ends up worth less than the debt and the borrower doesn't pay. That's why the collateral is worth at least 150% of the loan.

How much collateral is needed?

At least 150% of the loan, and there is no maximum: the proposal asks for as much as it likes, and the borrower chooses whether to accept it. In the example Bob asks for 200%: 1 L‑BTC at 80,000 USDt for 40,000 lent. In the alpha the minimum isn't checked yet: see Today's alpha.

Can Templar take my collateral?

In the design, no: the covenant accepts only the transactions written at opening, and none of them sends the collateral to Templar. In the alpha the contract is a 2‑of‑2 between the borrower and the lender. If you use the test wallet, though, the site holds the keys.

Can I repay before the deadline?

Yes. You pay the debt still open, the interest for the period and, if the proposal sets one, a surcharge on the part not yet due. The calculation is in the chapter Installments.

What if I miss an installment?

The next one costs more: it includes the missed part and a surcharge for lateness. After the number of installments missed in a row that the proposal sets, the lender takes the part of the collateral that covers the debt plus the penalty, and the rest comes back to you.

Can I add collateral, or take some out?

No, not while the loan is open. To change it, you and the lender close the contract by agreement and open a new one.

Who sets the rate?

The lender, in the proposal. The orderbook sorts proposals by rate and the borrower picks the one that suits them. The rate is fixed for the whole term and is not annual: the 2.5% in the example covers the 30 days.

Is L‑BTC real bitcoin?

It is bitcoin on the Liquid network, 1:1 with BTC held by the Liquid federation. You go from BTC to L‑BTC and back through the peg or a swap service. Compared with BTC on the Bitcoin network there is one more point of trust: the federation.

Why Liquid?

Because it has what the contract needs: the commands for covenants (OP_CAT and OP_CHECKSIGFROMSTACK), issued assets like USDt and confidential transactions. And a block about every minute, so deadlines can be counted in blocks quite precisely.

What happens to the loans if Templar shuts down?

In the design the covenant stays on the Liquid network with its transactions already written: the borrower can pay, the lender can take the collateral after the deadline. In the alpha the site still prepares the transactions, and no wallet can read each loan's recovery file yet.

How does Templar earn, and how much?

With a fee at the opening of each contract it matches and joins. The proposal states how much it is and who pays it. The percentage has not been set yet. Templar lends none of its own money and doesn't hold the funds: the details are in How Templar earns.

Does it need a licence?

Which rules apply has not been settled yet. Until a lawyer clears it up, Templar stays on the test network. This page describes a protocol in development: it is not an offer of financial services or an invitation to invest.