Level 3 · How it worksThe village#225

What is a dApp? A rule in the notebook and a shop window in front of it

A dApp is two things glued together: a smart contract that runs on the blockchain and a website that helps you talk to it. The contract is hard to change. The website is an ordinary website, and it can be taken down, altered or hijacked while the contract keeps running.

In the village notebook, some pages hold rules that run by themselves. "Anyone who writes two sacks of flour here gets one sack of sugar back." Every house keeps the rule, and every house runs it the same way.

But Grandma Rosa doesn't read rules in the notebook. She goes to a shop window on the square, where a friendly sign explains the swap and a clerk fills in the form for her. She signs at the bottom.

The rule in the notebook can't be changed by the shopkeeper. The shop window can. Whoever controls the window controls what Rosa is asked to sign. That, in one picture, is a dApp.

What it is

A dApp, short for decentralised application, is a program whose core logic lives on a blockchain. ethereum.org defines it as an application "that combines a smart contract and a frontend user interface" (ethereum.org).

The contract is the rule in the notebook: public, run by every node, usually impossible to edit quietly. The front-end is the website or app you click on. It reads the notebook, shows you buttons, and prepares the transaction your wallet asks you to sign.

ethereum.org notes that a front-end can be hosted on decentralised storage. It also lists the weak spot: some services "serve a frontend using a centralized server" (ethereum.org).

How it works

You open the website. You connect your wallet. You press "Swap". Behind that button, four things happen:

  1. The website reads the chain. It asks a node for prices and balances and shows them to you.
  2. The website writes a transaction. It fills in the contract address, the function to call and the amounts.
  3. Your wallet shows it to you. You see a summary: which address, which token, how much, what permission.
  4. You sign, and the network runs the contract. From here on, the website is irrelevant. Every node runs the same rule and gets the same answer.

Notice where trust sits. Steps 1 to 3 are done by an ordinary website. If it lies, the contract never knows. It only sees a valid signature.

When the shop window was swapped

On 14 December 2023, someone published poisoned versions of Ledger Connect Kit, a small piece of code that dApp websites loaded to connect wallets. Ledger's own report, dated 20 December 2023, gives the timeline (Ledger):

  1. That morning: a former employee was phished. Their access to the public code library NPM "was not properly revoked".
  2. 08:49, 09:44 and 10:37 UTC: three malicious versions, 1.1.5, 1.1.6 and 1.1.7, were published (the report gives 09:49, 10:44 and 11:37 CET).
  3. The effect: websites that loaded the library began "tricking EVM DApp users into signing transactions that drain their" wallets, asking for approval, permit or fake claim signatures.
  4. 12:45 UTC: Ledger learned of the attack. A genuine fix went out within 40 minutes.
  5. Afterwards: Ledger put the window in which funds were actively drained at "less than two hours in total", and about 5 hours from compromise to full resolution, because cached copies stayed online.

Ledger also wrote that the attacker never had access "to DApps themselves". The contracts behind those websites did exactly what they always did. The poison was entirely in the shop window.

Why it matters

  • The contract can be right while the website is wrong. An audit of the contract says nothing about the code your browser runs on a given morning.
  • Websites can disappear. A company can take its front-end down, block countries or change it. The contract keeps running, and anyone who knows its address can still reach it another way.
  • Who pays. When a front-end is hijacked, the losses land first on the users who signed. The contract can't tell a tricked signature from a willing one.
  • Who gains. The stranger at the gate. He doesn't need to break any contract. He only needs to stand in the shop window for an hour.

Where people get it wrong

  • "It's decentralised, so nobody can tamper with it." The contract, perhaps. The website is as centralised as any other.
  • "I've used this site a hundred times." The site you used yesterday is not proof of the site you load today.
  • "My wallet would warn me." It shows you what you are signing. It can't know what you meant to sign.
  • "Approvals are harmless, nothing moved." An approval lets a contract move your tokens later. That is how drainers work. "Token approvals: the permission you forgot you gave" has the details.

Check the address, not the window

Before you sign anything on a dApp, look at the address your wallet says you are interacting with. Compare it with the contract address the project publishes in its documentation, and check it on a block explorer: is it a verified contract, with the name you expect?

If the wallet asks for an approval you didn't expect, or for "unlimited" spending on a token you weren't using, stop. Close the tab. Come back later through a bookmark you saved yourself.

Anna does this every time. It takes her thirty seconds. The stranger at the gate has redecorated the shop window three times since, and she still hasn't signed anything he wrote.

Frequently asked questions

What is a dApp in simple terms?

A dApp is an application whose core rules run as a smart contract on a blockchain, with a website or app in front of it. The contract does the work; the website helps you build and sign the transactions.

Is a dApp's website decentralised?

Usually not. ethereum.org notes that front-ends can be hosted on decentralised storage, but many are served from ordinary servers. That means they can be changed, taken down or hijacked like any other website.

Can a dApp still work if its website goes offline?

Yes. The smart contract stays on the blockchain and keeps running. Anyone who knows its address can still interact with it through another interface or a block explorer.

How do front-end attacks steal crypto?

The attacker changes the code a dApp's website serves, so it asks users to sign approvals or transfers that send tokens to the attacker. The contracts are untouched. In December 2023, a poisoned code library loaded by dApp websites did exactly this for under two hours, according to Ledger's own report.

How can I check I'm using the real contract?

Compare the contract address shown in your wallet with the address published in the project's documentation, and look it up on a block explorer. Be wary of any request for an approval you didn't expect.

Sources

  1. ethereum.org, Introduction to dapps
  2. Ledger, Security Incident Report (20 December 2023)

Read next.