Taxation under IRPF of certain interactions with DeFi protocols. Analysis of loans collateralised with bitcoin
Cases are increasingly common in which an individual locks bitcoin or ether as collateral to borrow stablecoins, deposits bitcoin in a lending protocol that pays interest, contributes assets to a liquidity pool and receives LP tokens in return, or engages in liquid staking and obtains a token representing the position. In each of those transactions the following questions, among others, must be resolved: whether the income obtained is investment income or a capital gain, and whether the very delivery of the assets to the protocol is already a disposal with immediate tax effect.
Although there is little tax material dealing with these transactions, the Directorate General for Taxes (DGT), in ruling V0648-24, analyses several of the most common ones in the ecosystem and lays down a criterion on the returns they generate. Its scope, however, is limited, since it leaves out central questions such as the obtaining and redemption of LP tokens or the tax effects of the liquidation of a loan collateralised with bitcoin.
Loans collateralised with bitcoin
Where a taxpayer locks bitcoin as collateral to obtain stablecoins or other borrowed assets, whether from a DeFi protocol or from another individual through a peer-to-peer platform, the question arises whether there is a genuine disposal, with a change in the taxpayer’s assets, or merely an earmarking of the asset as security, and how each event in the life cycle of a loan is taxed.
Ruling V0648-24 addresses this case in its section 5, but in one specific form: the platform contributes the collateral to its liquidity reserves, where it generates a return for the borrower while the loan lasts (the model of protocols such as Aave). The DGT classifies that return as investment income (Article 25.2 LIRPF), included in the IRPF savings base, and states that the interest and fees on the loan are not deductible. Of the delivery of the collateral it says only that it is returned to the taxpayer when the loan is repaid, without treating it as a disposal, and it says nothing about interest paid in crypto-assets or about liquidation.
On peer-to-peer platforms for bitcoin-collateralised loans (Hodl Hodl, Lendasat, Debifi or Firefish, among others) the structure is different. The borrower deposits their bitcoin in a multisignature escrow, in which the lender and the platform also hold keys, and there it stays locked without generating any return; the lender transfers stablecoins or, on some platforms, euros to the borrower. At maturity, the borrower repays principal and interest and recovers the bitcoin. If the price falls and the LTV (the ratio between debt and collateral) reaches the agreed threshold without the borrower adding more security, the collateral is liquidated: on Hodl Hodl, the lender receives in bitcoin the value of the principal and interest, the platform keeps a penalty and the remainder goes back to the borrower. There is no doctrine on this structure, so we propose applying the general IRPF rules to each stage of the loan to resolve it.
Posting the collateral does not, in our view, entail a change in the taxpayer’s assets. The borrower remains the owner of the locked bitcoin, which acts as security: the lender does not acquire ownership of it and cannot dispose of it except on default. Nor is the receipt of the borrowed stablecoins income, since the borrower acquires them under an obligation to return the same amount of the same kind (Article 1753 of the Civil Code), so their net assets do not change.
The position is different for the origination fee where, as on Hodl Hodl, it is paid in bitcoin: delivering bitcoin in payment for a service is a disposal that gives rise to a capital gain or loss, computed under the FIFO criterion the DGT applies to homogeneous cryptocurrencies (V0975-22 and V2520-22, cited in ruling V0648-24 itself). The same happens, with differences that are usually minimal, with the stablecoins delivered to pay the interest and repay the principal.
If the loan ends normally, repaying the principal and interest releases the collateral, and that release has no tax effect, since the bitcoin never left the borrower’s assets. The same applies where the borrower meets a margin call by adding more bitcoin collateral to the escrow.
Liquidation, by contrast, can indeed trigger taxable events. Although the borrower does not sell anything voluntarily, the bitcoin leaving the escrow is delivered to extinguish their debt and pay the penalty, which in legal terms amounts to a payment in kind (dación en pago) giving rise to a capital gain or loss, included in the IRPF savings base, measured as the difference between its market value on the date of liquidation and its acquisition value. Here the FIFO criterion can work against the liquidated borrower: if their portfolio holds other bitcoins acquired earlier and more cheaply than those now liquidated, the liquidated coins will be deemed to be the oldest, so that a liquidation triggered by a fall in price may also reveal a taxable gain for the borrower. The remainder returned to the borrower is not taxed.
For the lender, the interest received would qualify as investment income, on the terms explained in the next section, and the repayment of the principal would not give rise to income. If the loan is liquidated and the lender receives bitcoin instead of stablecoins, the part corresponding to interest still qualifies as investment income, albeit now in kind, and the part corresponding to the principal would involve exchanging their claim for bitcoin, with a gain or loss that is usually small. That market value will be the acquisition value of the bitcoin when it is disposed of. If the collateral did not cover the debt, the unpaid part could be recognised as a loss only once the claim becomes uncollectible (Article 14.2.k LIRPF), as we explain in the analysis of hacks.
Lending and yield: investment income
Where the income derives from the economic transfer of crypto-assets to a protocol or to third parties, the DGT classifies it as investment income, from the transfer of own capital to third parties under Article 25.2 of the IRPF Act, provided that the activity does not involve organising means of production and human resources on one’s own account (Article 27.1 LIRPF).
The DGT has confirmed this classification even for a taxpayer acting as a validator, finding that validation was carried out automatically and with minimal resources, without sufficient organisation to constitute an economic activity (V1766-22). What is decisive is not the existence of clients, but the degree of organisation of means. That ruling is the reference for staking, and V0648-24 applies the same criterion to the returns from more complex liquidity and lending structures.
Where that return is received in tokens or crypto-assets, it is measured at its market value in euros on the date of receipt. That same value will be their acquisition value when they are disposed of, at which point a capital gain or loss will arise on the difference.
Liquidity pools and LP tokens
Ruling V0648-24 also analyses the returns from liquidity pools and from yield-optimisation platforms, but expressly leaves aside the tax treatment of obtaining and redeeming LP tokens (the tokens the protocol gives the liquidity provider to represent its share in the pool). The most delicate question is thus left unresolved: whether the initial contribution of assets to the pool and the receipt of LP tokens is or is not a barter with tax effect.
On that point, as we know, two approaches coexist. Under the strict interpretation, there is an immediate barter of the assets contributed for distinct LP tokens. Under the flexible one, it is merely an economic representation of the same position, with no relevant change in the taxpayer’s assets until redemption.
Liquid staking
Liquid staking adds a layer of complexity, because the taxpayer not only receives a return but also receives a representative token (stETH, rETH or others) that can circulate, be sold or be used in new strategies.
Ruling V0612-26 settles the question: ETH and rETH are crypto-assets of a different type, so both receiving the representative token in exchange for ETH and later redeeming it qualify as barters. We analyse this in the article on staking.
Wrapping and bridging
In wrapping and bridging transactions the taxpayer usually keeps the same economic exposure to the underlying asset, even though they start operating with a technically different version of it, on another network or contract. From an economic perspective, there are arguments for neutrality in some 1:1 conversions. From a strictly legal perspective, it can also be argued that these are formally distinct assets and, therefore, a barter with tax implications.
There is not, to date, any binding ruling that expressly resolves the treatment of wrapping or bridging. V0648-24 describes bridges and wrapped tokens, but only to decline to rule on the fees the taxpayer paid for them, since it was not stated in which transactions they were used; it does not address whether wrapping itself is a barter. Both transactions are analysed in more detail in the analysis devoted to wrapping and bridging.
- V0648-24 — classifies as investment income (Article 25.2 LIRPF) the income obtained from the transfer of crypto-assets to liquidity pools, yield-optimisation platforms and lending, including the return on collateral that the platform contributes to its reserves; the interest and fees on the loan are not deductible. It does not rule on the delivery of the collateral, its liquidation or the obtaining and redemption of LP tokens.
- V1766-22 — reference for the classification as investment income of rewards from the transfer of own capital.
Applicable legislation: Articles 14.2.k), 25.2, 33.1, 34, 35, 37.1.h) and 43.1 LIRPF; Article 1753 of the Civil Code.