Back to blog
Specific Practical Guides

How to Document DeFi Transactions for the Spanish Tax Authority: A Practical Guide to Tax Evidence

Complete guide to documenting your decentralized finance activity for the Spanish Tax Authority. Learn what evidence the AEAT expects, how to extract on-chain data, value transactions in euros, and build a robust tax documentation system.

E

Cleriontax Team

Crypto Tax and Data Analysis Experts

14 min read
DeFi DocumentationTax EvidenceTraceabilityAEATTax AuthoritySmart ContractsOn-ChainBlockchain ExplorerEtherscanDEX SwapsStakingYield FarmingDeFi LendingIncome Tax ReturnForm 100
Cómo documentar transacciones DeFi para Hacienda - Guía práctica de pruebas fiscales para declarar operaciones de finanzas descentralizadas ante la AEAT
9 de febrero de 2026
14 min de lectura
Guías Prácticas Específicas
DeFi DocumentationTax EvidenceTraceabilityAEATTax AuthoritySmart ContractsOn-ChainBlockchain ExplorerEtherscanDEX SwapsStakingYield FarmingDeFi LendingIncome Tax ReturnForm 100

Decentralized finance has transformed the way millions of people interact with their digital assets. Protocols such as Uniswap, Aave, Curve, or Lido make it possible to operate without intermediaries, without forms, and without annual certificates. That operational freedom, however, does not exempt you from tax obligations. And this is where a problem many investors discover too late arises: documenting DeFi transactions for the Spanish Tax Authority is the taxpayer’s sole responsibility.

Unlike a bank or a centralized exchange that issues statements and tax certificates, decentralized protocols do not generate documentation for the Tax Agency. Every swap, every deposit into a liquidity pool, every staking reward, and every lending transaction is recorded on the blockchain, but turning that raw data into valid tax evidence requires methodology, tools, and above all consistency.

This practical guide explains step by step how to build a solid DeFi documentation system, what the Tax Authority expects from taxpayers who operate in decentralized finance, and how to avoid mistakes that can turn a routine review into a serious issue.

Why DeFi documentation is a different challenge

When you trade on a centralized exchange like Binance or Kraken, the platform keeps a complete record of all your activity. You can export your history in CSV format, download annual reports, and even request position certificates as of December 31. The exchange acts, to some extent, as an intermediary that facilitates tax documentation.

In DeFi, that intermediary does not exist. When you perform a swap on Uniswap, provide liquidity on Curve, or deposit ETH on Lido, you are interacting directly with smart contracts deployed on a public blockchain. There is no company behind it that will send you an annual summary, and no protocol is required—for now—to report your activity to the AEAT.

This does not mean those transactions are invisible. All on-chain activity is public and permanent. The Tax Authority can—and in fact increasingly does—trace wallets and cross-check information with the data that centralized exchanges do report. With the implementation of the DAC8 directive, the tax administration’s tracing capabilities will increase exponentially.

The fundamental difference is that while an exchange makes documentation easier, in DeFi you must build it yourself. And if the Tax Authority requests proof of your transactions and you cannot provide orderly documentation, the burden of proof falls on you. Without clear evidence, the AEAT may impute estimated income or apply penalties for lack of cooperation.

What the Spanish Tax Authority expects from a taxpayer with DeFi activity

To date, the AEAT does not have a specific guide on how to document DeFi transactions. However, the general Spanish Personal Income Tax rules (IRPF) and binding tax rulings on cryptocurrencies clearly establish what information the taxpayer must provide in the event of a tax review.

For each transaction that generates a taxable event, the Tax Authority expects to be able to verify:

  • Exact date and time of the transaction. It is not enough to say “sometime in March 2025.” Each on-chain transaction has a precise timestamp that must be recorded.
  • Nature of the transaction: whether it is a swap, a liquidity provision, a reward claim, a lending deposit, a liquidation, or any other type of transaction with tax relevance. The correct classification of each transaction is essential because it determines the applicable tax treatment.
  • Assets involved and exact amounts: which tokens you sent, how many you received, on which blockchain network the transaction was executed, and what fees (gas fees) you paid.
  • Valuation in euros at the time of the transaction. This is perhaps the most critical point. The AEAT works in euros, and every gain, loss, or yield must be expressed in the national currency using recognized reference sources.
  • Transaction hash, your strongest piece of evidence. A blockchain hash is irrefutable proof that the transaction existed, when it was executed, and what fund movements it involved. It is the digital equivalent of a certified bank statement, publicly verifiable by any party.
  • Traceability of the origin and destination of funds: where the cryptocurrencies used in the DeFi transaction came from and where they went afterward.

Anatomy of DeFi tax evidence

Understanding what constitutes valid tax evidence in the DeFi context is essential before you start documenting. It is not simply about saving screenshots or jotting transactions down in a notebook. Solid DeFi tax evidence combines verifiable on-chain data with a justified economic valuation.

The transaction hash as the atomic unit of evidence

Every operation on a blockchain generates a unique transaction hash (transaction hash or tx hash). This hexadecimal identifier is the core of your documentation because it can be verified by anyone at any time through a block explorer such as Etherscan, BscScan, or Arbiscan.

A transaction hash contains—or allows access to—all relevant information: the block it was included in (and therefore the exact date and time), the source and destination addresses, the tokens transferred, the amounts, the gas consumed, and the transaction status (successful or failed). It is immutable and publicly auditable information.

If you performed a swap of 1 ETH for 3,500 USDC on Uniswap V3, the hash of that transaction allows any inspector to verify that this amount was indeed exchanged, at what time, through which pool, and how much gas was paid. There is no possibility of manipulation, which makes the hash the most robust evidence available.

The per-transaction documentation sheet

For each DeFi transaction with tax relevance, your record should include at least the following fields:

FieldDescriptionExample
Date and timeUTC timestamp of the transaction2025-08-15 14:23:47 UTC
NetworkBlockchain where it was executedEthereum Mainnet
Tx HashUnique identifier of the transaction0xabc...def
Transaction typeTax classificationSwap (crypto-to-crypto exchange)
Token sentAsset and amount1.0000 ETH
Token receivedAsset and amount3,500.0000 USDC
EUR value (sent)Market price × amount€3,285.00
EUR value (received)Market price × amount€3,182.00
Gas feeNetwork fee in EUR€12.50
ProtocolName of the protocol usedUniswap V3
NotesAdditional contextSwap to obtain stablecoins

This sheet may seem excessive for a single transaction, but when you accumulate hundreds of transactions over a tax year, having this information structured makes the difference between a solid return and a documentation nightmare.

Price sources and euro valuation

Euro valuation is where many taxpayers make mistakes. There is no official AEAT standard on which price source to use, but professional practice recommends recognized and consistent sources such as CoinMarketCap, CoinGecko, or the protocol’s own data where the transaction was executed. The key is to apply the same criterion throughout the tax year and document which source was used.

For low-liquidity tokens or tokens not listed on well-known price aggregators, you can rely on the implicit value of the transaction itself. If you swapped an unknown token for 500 USDC, the tax value of that token at the time of the swap is equivalent to the value of the 500 USDC received, converted to euros at the exchange rate of the day.

For dollar-denominated stablecoins, always remember to convert to euros using the EUR/USD exchange rate on the day of the transaction. As we explain in our article on stablecoin taxation, ignoring this conversion is one of the most frequent mistakes and can generate significant discrepancies in portfolios with large stablecoin positions.

How to document swaps on decentralized exchanges

Swaps on DEXes such as Uniswap, PancakeSwap, Curve, or 1inch are the most common DeFi operation and also the most frequent source of taxable events. Each swap is treated for tax purposes as a crypto-to-crypto exchange, which generates a capital gain or loss that must be reported in the Model 100.

Information to capture for each swap

To properly document a swap you need to record:

  • The token you send and the token you receive, with exact amounts (including full decimals)
  • The euro value of both assets at the time of the swap
  • The gas cost in the native currency and its euro equivalent
  • The transaction hash, which allows you to verify all this data later

It is important to distinguish between simple swaps (one token directly for another) and routed swaps (where the DEX may pass through several intermediate pools to achieve the best price). Even if routing is complex internally, for tax purposes what matters is the net outcome: what you sent and what you received. The final transaction hash reflects exactly that.

Tax treatment of gas

Gas fees paid in a transaction have their own tax treatment. When you pay gas in ETH to execute a swap, you are using—and therefore disposing of—an amount of ETH whose acquisition cost you must know. That disposal of ETH in turn generates a micro capital gain or micro capital loss.

In addition, gas can be considered an additional cost of the transaction for purposes of calculating the net gain. The taxation of DEX protocols has nuances worth understanding so you do not understate or overstate the real tax impact of your activity.

Multi-chain swaps and bridges

If you operate on multiple blockchains (Ethereum, Polygon, Arbitrum, BNB Chain, Optimism, etc.), you need to consolidate documentation across all networks. Each network has its own block explorer and its own gas fees. A swap on Arbitrum may be much cheaper in gas than one on Ethereum mainnet, but both have exactly the same tax relevance.

Bridges add another layer of documentation complexity. When you use a bridge to move tokens from one chain to another, that movement may or may not create a taxable event depending on how it is technically executed. What it always creates is the need to document the continuity of your funds from one chain to another so that your portfolio’s traceability is not broken.

Documenting liquidity and yield farming operations

Providing liquidity in protocols such as Uniswap, Curve, or Balancer involves a sequence of transactions that must be documented individually, as each can have different tax implications. As we analyze in our guide to liquidity pools and in the article on yield farming, these transactions are tax-complex, and rigorous documentation is the only way to report them correctly.

Entering the liquidity pool

When you deposit tokens into a liquidity pool (for example, ETH + USDC on Uniswap V3), you receive LP tokens that represent your position. This moment must be documented by recording:

  • Amount and euro value of each token deposited
  • Hash of the deposit transaction
  • Amount of LP tokens received
  • Protocol and specific pool used

This information is the starting point for calculating your gain or loss when you withdraw liquidity.

Rewards and incentives

While your liquidity is active, you may receive rewards in the form of pool fees, protocol incentive tokens, or both. Each reward claim is a taxable event that must be documented: date, assets received, exact amounts, and euro value at the time of receipt.

Yield farming returns are generally taxed as investment income if they come from pool fees, or as capital gains if they come from the appreciation of incentive tokens. The correct classification depends on the specific nature of each return, and poor documentation makes it practically impossible to apply the right criterion.

Exiting the pool and calculating impermanent loss

When you withdraw your liquidity, you return the LP tokens and receive back the underlying tokens, generally in different proportions than those you originally deposited. The difference between the value of what you deposited and the value of what you withdraw, net of rewards already reported, determines your capital gain or loss.

Document the hash of the withdrawal transaction, the exact amount of tokens received and their euro value, and compare it with the entry documentation you recorded previously. Impermanent loss is not a tax concept recognized directly by the AEAT, but its effect is reflected in the net gain or loss of the operation when you close the position.

Documenting lending, borrowing, and liquidations

Lending and borrowing operations in protocols such as Aave, Compound, or MakerDAO generate different types of taxable events that require specific and particularly careful documentation.

Lending: documenting generated interest

For lending operations, document the moment of deposit (with hash, deposited assets, and their euro value), and then each withdrawal or interest claim. Lending interest is taxed as investment income and must be valued in euros at the market price on the day it is received or realized.

If the protocol uses representative tokens (such as Aave’s aTokens or Compound’s cTokens), also document the receipt of those tokens and, crucially, the exchange rate at the time of each relevant transaction. The difference in exchange rate between deposit and withdrawal reflects the interest accrued.

Borrowing: documenting collateral and liquidations

Although taking out a loan does not generate direct taxation, document the collateral deposit with its original acquisition cost and its market value at the time of deposit. This information will be critical if a liquidation occurs, because the acquisition cost of the liquidated collateral determines the resulting capital gain or loss.

Liquidations are the most sensitive tax event in borrowing. When part of your collateral is liquidated, a forced disposal occurs that generates a capital gain or loss. For each liquidation, make sure you record:

  • Hash of the liquidation transaction
  • Exact amount of collateral liquidated
  • Acquisition cost of the collateral (applying FIFO)
  • Euro value at which the liquidation was executed
  • Amount of debt repaid by the liquidator

Without this documentation, correctly calculating the tax impact of a liquidation is virtually impossible.

Documenting staking and on-chain rewards

Staking cryptocurrencies—whether native (such as ETH staking on the Beacon Chain) or via liquid staking protocols (such as Lido or Rocket Pool)—generates returns that must be documented with the same rigor as any other DeFi transaction. The taxation of staking and DeFi yields requires full traceability from deposit to withdrawal.

Native staking

Document the staking deposit with the corresponding hash, the staked amount, and its euro value. Staking rewards are taxed as investment income when they are received. In Ethereum’s case, rewards accrue automatically, so the tax accrual moment can be subject to interpretation.

The most prudent approach is to document rewards accrued as of December 31 of each tax year and report the corresponding returns for the period, or to document the withdrawal (unstaking + rewards) as the moment the return is realized. Regardless of the criterion you choose, apply it consistently and document the methodology followed.

Liquid staking

Liquid staking protocols add an extra layer of documentation complexity because you receive a derivative token (such as Lido’s stETH or Rocket Pool’s rETH) in exchange for your staked ETH. The exchange of ETH for stETH may be considered a crypto-to-crypto exchange for tax purposes, which would create a taxable event at the time of deposit.

Document both the initial deposit and any subsequent transactions involving liquid staking tokens:

  • ETH (or other asset) sent and its euro value
  • Liquid staking tokens received (stETH, rETH, etc.) and their value
  • Hash of the deposit transaction
  • Subsequent transactions with those tokens (use as collateral in Aave, sale, swap, etc.)

If you use stETH as collateral in a lending protocol, for example, that transaction must also be recorded with its corresponding documentation.

Tools and methods for extracting DeFi data

Building DeFi tax documentation from scratch by manually reviewing every transaction on Etherscan is not feasible for most investors with meaningful activity. Fortunately, there are specialized tools that automate much of the extraction and organization work.

Block explorers

Block explorers (Etherscan, BscScan, Arbiscan, Polygonscan, among others) are your primary source of verifiable data. They allow you to query any transaction by its hash, view a wallet’s complete history, and export transaction lists in CSV format. They are the source of truth on which all DeFi documentation is built.

For each network you operate on, identify the corresponding explorer and perform periodic exports of your transaction history. Save both the exported CSVs and screenshots of the most relevant transactions. These files constitute your primary evidence in the event of an audit.

Portfolio trackers and DeFi aggregators

Tools such as DeBank, Zerion, or Zapper can connect to your wallet and show a consolidated view of all your DeFi positions across multiple networks. Although they are not tax tools per se, they provide a unified overview that makes it much easier to identify which transactions need documentation and to detect positions you may have forgotten.

Specialized tax software

Platforms such as CoinTracking, Koinly, or Accointing offer specific functionality to track DeFi transactions and attempt to classify them for tax purposes. None is perfect—complex DeFi interactions often require manual review—but they provide a solid starting point that significantly reduces the work required.

The main limitation of these tools is that they may not correctly interpret all smart-contract interactions, especially in lesser-known protocols or in complex transactions such as recursive leverage farming. Always verify the results by comparing them to block explorer data before accepting the automated classification.

The spreadsheet as an essential complement

Regardless of the tools you use, maintaining your own spreadsheet with the master record of your transactions is highly recommended. This spreadsheet acts as your personal source of truth, where you consolidate information from all sources, add euro valuations, tax-classify each transaction, and keep contextual notes that no automated tool can provide.

A well-structured spreadsheet with columns for date, network, hash, transaction type, tokens, amounts, EUR values, gas, and notes becomes the central document of your DeFi taxation. It is the artifact you would hand to a tax advisor or present to the Tax Authority in the event of a request.

Building a sustainable documentation system

The biggest mistake DeFi investors make with their tax documentation is not technical, but disciplinary. Documenting all transactions at the end of the year, trying to reconstruct twelve months of on-chain activity, is painful, error-prone, and inevitably creates gaps. The solution is to create a sustainable system that integrates into your operating routine.

The monthly routine that can save you trouble

Set aside time each month to update your tax documentation. This discipline involves:

  • Exporting the month’s transactions from the relevant block explorers
  • Updating your master spreadsheet with new transactions
  • Recording euro valuations using historical price data
  • Identifying and classifying tax-relevant transactions
  • Taking screenshots of the status of your active DeFi positions

This monthly routine turns an overwhelming annual task into a manageable and far more accurate process. In addition, by documenting while transactions are fresh in your memory, you can add context that would be impossible to reconstruct months later. Why did you make that emergency swap in July? What was the reason for withdrawing liquidity from Curve in September? These contextual notes can be valuable if you need to explain your activity to the Tax Authority.

Recommended file structure

Organize your DeFi tax documentation with a clear structure by tax year. Create a folder for each year and, within it, organize files by blockchain network or by document type:

  • CSV exports from each block explorer
  • Screenshots of relevant transactions and positions
  • Master spreadsheet with the consolidated record of transactions
  • Summary document with the tax conclusions for the period

Keep this documentation for at least four years (the general statute of limitations for taxes in Spain), although it is advisable to store it for six years as a precaution, especially if there are years with complex transactions or significant amounts.

Cross-chain consolidation

If you operate on multiple blockchains, you need a process to consolidate information from all networks into a single coherent record. Techniques for cleaning and normalizing datasets can help you harmonize data formats from different networks and exchanges, detect duplicates, and generate a unified dataset ready for tax analysis.

For portfolios with a high volume of multichain transactions, an ETL pipeline approach can automate much of the consolidation process, extracting data from multiple sources, transforming it into a standard tax format, and loading it into a unified master record.

Common mistakes that compromise your DeFi documentation

DeFi tax documentation has specific traps that are worth knowing to avoid. These mistakes may seem minor day to day, but in the context of a tax audit they can be the difference between a routine review and a penalty file. We detail them alongside other common mistakes when declaring cryptocurrencies in our dedicated article.

Not documenting failed transactions

Failed blockchain transactions consume gas but do not execute the intended operation. That consumed gas has a real cost that, depending on tax interpretation, could be relevant for calculating the net return of your activity. Not documenting these transactions leaves a gap in your record of ETH (or other gas token) consumption, which can create discrepancies when you try to reconcile amounts.

Ignoring airdrops and unsolicited tokens

If you received tokens via airdrop or as a protocol incentive, those tokens have a market value at the time of receipt that constitutes taxable income. Many investors ignore these events because they did not actively request them, but for tax purposes they create a documentation and reporting obligation that does not disappear simply because they were received passively.

Not maintaining acquisition cost history

To calculate the capital gain or loss of any transaction, you need to know the acquisition cost of the asset you dispose of. In DeFi, where a token can pass through multiple swaps, pools, and protocols before ultimately being sold or exchanged, tracking acquisition cost under FIFO requires meticulous documentation from the very first transaction. Without it, reconstructing the cost chain is extraordinarily difficult.

Relying exclusively on automated tools

Tracking tools are useful but not infallible. DeFi protocols evolve constantly, and software tools need time to adapt to new transaction types. Always verifying automated results against block explorer data is an essential practice that protects against classification errors that could lead to an incorrect tax return.

Not keeping evidence of position status as of December 31

For Model 721 and Model 714, you need to document the value of your DeFi positions as of December 31. If you do not capture that information at the precise moment, reconstructing it later can be difficult or imprecise, especially for liquidity positions whose composition and value change continuously with each pool transaction.

Conclusion

Documenting DeFi transactions for the Spanish Tax Authority is not optional—it is an increasingly urgent necessity. With the DAC8 directive applied to the DeFi ecosystem on the horizon and the AEAT’s growing ability to trace on-chain transactions, the era of fiscal opacity in decentralized finance is coming to an end. Taxpayers who have built a solid documentation system will be ready; those who have not will face costly and potentially incomplete retroactive reconstructions.

DeFi tax documentation requires a systematic approach that combines verifiable on-chain data, documented euro valuations, correct tax classification, and consistency in periodic record-keeping. It is not a one-off year-end exercise, but an ongoing process that is an integral part of operating responsibly in decentralized finance.

If your DeFi operations are complex or high-volume, professional help can make the difference. At Cleriontax, our team combines tax expertise with data engineering to analyze multichain DeFi portfolios and generate complete, defensible tax documentation for the AEAT. You can learn more about our portfolio analysis service for more details.

Request an analysis of your DeFi portfolio

Our experts will review your on-chain activity, identify the relevant taxable events, and produce a complete tax report, with all the supporting documentation you need to comply with the Spanish Tax Authority.

Legal notice: This article is for informational and educational purposes only. It does not constitute personalized tax advice or an investment recommendation. Tax regulations are subject to change and each personal situation is unique. Always consult a licensed professional tax advisor for your specific case.

Article updated periodically

Published by: Cleriontax Team - Experts in Cryptocurrency Taxation and Data Analysis

Did you find this article helpful?

Share it with other investors who might need it

Need help with your cryptocurrency tax return?

Our team of experts can analyze your case and prepare your complete tax return

Request free analysis