It's true. I had tax investigation myself. I am tax expat. I can confirm that if amounts are larger barely having tax certificate would not be enough. They will ask for lots of proof you really moved outside the country: airlines tickets, rental agreements, utility bills, residency certificate and all other proofs like (membership at clubs, newspaper memberships, doctor visits confirmations). I still had my apartment in my home country, so they asked neighbors if I was really not in the country etc. They do everything they can to prove I am still resident in my home country. Even though I have spent only 2 weeks a year on Holiday in my home country...Just moving to another country for 183 days, withdraw a profits which would be taxable in a Spain in case of not doing it, and comming back next year is considered by spanish tax authorities as abuse of law.
And you will be liable for income tax as well as all penalties and criminal prosecution in Spain.
Do not believe to people who are trying to sell you just a dream about moving to UAS for some time, cash out your cryptos and move back to Spain afterwords. This is not how it works. One day, when you will be crying in a jail for a tax fraud, they will just declare, everything is your responsibility.
To cash out a crypto, you need more sophisticated structure. It is not cheap nor easy, But is it still possible. Do not believe those who promise you easy and cheap solutions. Expecialy if you are resident of high tax western country, what Spain is. They are just trying to sell you their services and they do not care about you in real.
Just moving to Dubai for 6 months, botain tax residence certificate, cash out crypto and come back to Spain, will be conssidered by spanish tax authority as abuse of law and they will deny to accept your UAS tax residence certificate as result of abuse of law and you will be taxed from all income + penalties + late tax payment interest + criminal prosecution..
You really must have lots of substance in UAE to be a real tax resident there and not be tax resident in home country.