Ember Protocol: Architecture

Trustless bitcoin backed loans, borrow any stablecoin, on any chain

Bitcoin-backed loans have traditionally been difficult to implement because Bitcoin does not support programmability like Ethereum or Solana. One common workaround has been the use of wrapped bitcoin on smart contract–enabled blockchains such as Ethereum. However, these wrapped versions are often custodial and centralized. Some networks, like Stacks and Rootstock, offer decentralized, 1:1-pegged wrapped bitcoin, but any tokens borrowed against this collateral are issued on those specific networks—which may not always be ideal. Additionally, bridging assets across chains can be challenging due to low liquidity.

Ember Protocol is a decentralized, non-custodial solution that allows users to borrow stablecoins they want on any chain, using native Bitcoin as collateral.

Ember has a lot of components. A user can access Ember though the client, which is embedded in the website/app. Ember leverages atomic swaps using HTLC (Hash Time Locked Contracts) in Bitcoin. This means, if a user pays some bitcoin as collateral, it is cryptographically proven they’ll receive the loan amount, and once they repay their loan, it is cryptographically proven their bitcoin collateral is returned back to them. A client and operators work together to prepare setup for an atomic swap. Once the client verifies that the setup is legit, the user can send their bitcoin collateral to a Bitcoin DLC (Discreet Log Contract). A DLC is a bitcoin native contract, more on it later. This DLC can either return funds back to the user once loan is repaid, or liquidated funds only if LTV (loan to value) ratio becomes risky. These are the only two outcomes possible. Once bitcoin is sent to this DLC, a secret becomes public, which client can use to release funds (loan amount) from Ethereum Smart Contracts.

Once a Loan Transaction completes, bitcoin collateral is securely locked in a Bitcoin Contract on L1, with deterministic outputs, and loan amount is released to the user. Users aren't required to pay any monthly interest, they can pay the lump sum interest with the principal amount when closing the loan. Currently, we don’t have any loan durations, users can return when they please, but all loans have to close within a year, which means users can keep the borrowed amount for a maximum of 1 year. Users will also have option to borrow funds on different chains, powered by Chainlink CCIP.

The overview of Ember Architecture

When a user wishes to close the loan and return funds, they can interact with a client (website/app) which sends a request with funds to smart contracts. Funds get locked in an intermediary ethereum smart contract which automatically releases the funds to the original sender after 24 hours if there is no activity. From here, operators can withdraw the funds by revealing a secret, which the client can use to unlock funds from the bitcoin DLC. There are a bunch of smart contracts deployed on the Ethereum L1 DLCs on bitcoin L1 which handle all the on chain logic. Bitcoin cannot be stolen from these contracts, it is cryptographically impossible, hence we call this self-custodial, i.e no one but you will have custody of the bitcoin collateral, no third party can steal your funds. However, we do need a set of operators which can manage the loan initiation on the lending side. We leverage Eigen Layer for this, operators can restake their eth and participate in the Ember Network. We require the total amount of restaked eth to be greater than the lending pool, at least 50% more, to keep the system secure. These operators create new DLCs on the bitcoin L1 and conditions for loan release.

Even though Ember requires operators, these operators cannot steal any of your funds, by any means. Because all collateral is locked in a bitcoin native contract, even if 100% operators collude, they cannot steal bitcoin collateral.

An aggregator is selected amongst the operators using Chainlink VRF (verifiable random function) every day. This aggregator is responsible for creating new DLCs on the Bitcoin L1 and adding new loan transactions to the Ethereum Smart Contracts. Other operators are required to approve a transaction before a loan can be initiated. Once a supermajority of operators approve the transaction, a loan can be initiated. Once a user sends the bitcoin collateral to the contract, the loan is marked active. Finally, when the user returns the loan + interest, the loan is marked completed.

LoanTransaction Lifecycle

To avoid LTV (loan to value) ratio to fall below threshold, a track of btc/usd price is kept using chainlink pricefeed. Chainlink automation is used to set up a job which triggers every hour. The job checks the btc/usd price, and if any loan’s LTV is below the threshold, the loan is liquidated (more on this later).

Anyone can lend funds to the protocol. These funds are used to issue loans to borrowers. A retail investor can send some USDC to Ember, for which they can earn a fixed APY. With no slashing risks (like in staking) or impermant loss risk (like in LP for AMMs), this is a very lucrative investing opportunity,

Lenders are provided with a Ember Liqudity Token against the tokens they lend, so lenders stay liquid, and there can be an open market for lending positions.

Last updated