In which country do you have to pay taxes on BTC profits if you move?

BitcoinBitcoin
$20,166.07
5.26%
1M Ago
self.Bitcoin
So let's say you have been living in the US for over a decade and you accumulated some BTC. Now you decide to move to Spain and obviously, you take your cold wallet with you. After a few months of living in Spain, you decide to sell your BTC in profits. So essentially: You bought the crypto in the US but you sold it in Spain. Question: In which country do you pay taxes? Thanks and sorry if it's an obvious one.