Skip to main content

Type a word from a question or an article title.

1 · Basics

dApps and DeFi - decentralised applications and finance without middlemen

What dApps and DeFi are, how decentralised exchanges (AMM) and lending work, what collateral and liquidation are, and the risks of decentralised finance.

3 min readUpdated:
In this article

An ordinary application is an interface with someone's server behind it. A dApp (decentralised application) is built differently: the interface stays an ordinary website, but the "brain" is smart contracts on a blockchain. Our service is exactly such an application: money and rules sit in the contract, and the website merely shows them and helps you sign actions.

What a dApp consists of

  1. Smart contracts - the logic and the money. Their code is public and they work the same for everyone.
  2. An interface - a website or app that reads data from the blockchain and builds transactions.
  3. The user's wallet - the "pass" and the signature (how it works).
  4. External nodes (RPC) - a "window" into the blockchain for the website.

The main consequence: the interface can be replaced, while the contract and your money stay put. If the website is down, the contract still works and actions can be performed through a block explorer.

DeFi: finance without middlemen

DeFi (decentralised finance) is a set of financial services where smart contracts play the role of bank, exchange and broker. The main directions:

  • Swaps - decentralised exchanges.
  • Lending - loans against collateral.
  • Stablecoins - tokens pegged to the dollar (article).
  • Escrow and deals - like our service (what it is).

They all "assemble" from one another like a construction kit: one contract can call another. This is called composability.

A decentralised exchange and the x·y = k formula

A classic exchange matches buyers' and sellers' orders. A decentralised exchange (AMM, automated market maker) works differently: a pool of two tokens is put into a contract, and the price is set by a formula.

Example. The pool holds 100 ETH and 200,000 USDC. The product x · y = k equals 20,000,000 and must be preserved.

  • The current price: 200,000 / 100 = 2,000 USDC per ETH.
  • You want to buy 1 ETH. After the purchase the pool will hold 99 ETH, so USDC must become 20,000,000 / 99 ≈ 202,020.20.
  • You pay the difference: ≈ 2,020.20 USDC for 1 ETH, not 2,000.

The extra ≈ 20 USDC is slippage: the larger the trade relative to the pool, the worse the price. The pool is topped up by liquidity providers, who in return receive a share of fees. Different exchanges add their own improvements, but the principle is the same.

Lending and collateral

DeFi lending has no application form and no bank check, so loans are issued against collateral with a margin.

Example. You deposit 10 ETH of collateral worth 20,000 USD. The protocol allows borrowing up to 75% of the value, that is up to 15,000 USDC. If ETH falls and the collateral stops covering the debt with a margin, the contract automatically sells part of the collateral to repay the debt. This is called liquidation, and it happens without your consent and without a call from a manager.

This is how the protocol protects those who lent money without knowing you personally.

Advantages and risks

Advantages:

  • works around the clock, without days off or middlemen;
  • the rules are visible in code;
  • open to anyone with a wallet;
  • services plug into one another.

Risks:

  • Contract bugs. A bug can cost all the funds. That is why audits and testing are needed.
  • Price manipulation. If a contract takes a price from an unreliable source, it can be distorted (the oracle problem).
  • Liquidation when the collateral's price falls.
  • Anonymity. If you mistyped an address or signed a malicious permission, nobody can return the money (phishing).
  • Centralised links. Many "decentralised" services depend on a stablecoin with an issuer or on one company's website.

Where escrow fits

Most DeFi services work between programs: a contract swaps tokens by a formula. But real deals between people - with goods, work, delivery - need human judgement in a dispute. Escrow with a guarantor adds an arbiter to programmable money where a formula is not enough.

See how escrow is used in life: escrow use cases. And for safe behaviour in the dApp world, the wallet protection checklist.

Mentioned in

Ready to try it?

Create your first deal in a couple of minutes. The money is locked in a smart contract and paid out by rules you can see in advance.