Bitcoin (CRYPTO: BTC) mining stocks have seen a huge rally this year, largely on the strength of Bitcoin's market-topping performance in the crypto market. Bitcoin is now up 60% year to date, and Bitcoin mining stocks are up even more. Riot Platforms (RIOT 0.25%), for example, is up about 215% for the year.

The big question for investors, of course, is whether this rally has legs. Even after Riot Platforms reported better-than-expected numbers in May, its stock price still fell by 13%. Much of that has to do with Bitcoin's recent inability to break through the $30,000 price level, which has investors concerned that the crypto's sizzling performance to start the year may be coming to an end.

Riot and the price of Bitcoin

Long story short, Bitcoin mining stocks tend to move up and down with Bitcoin. This makes perfect sense because the core business activity of any Bitcoin miner is, well, mining Bitcoin. The more Bitcoin a company mines, the more money it makes. And the higher the price of Bitcoin goes, the more valuable each Bitcoin it mines becomes. It's not rocket science.

Bitcoin hit by lightning and splitting in half.

Image source: Getty Images.

If you're a long-term buy-and-hold investor, though, this well-known correlation makes investing in Bitcoin mining stocks very problematic. It means that you will be tempted to sell during low points of the Bitcoin market and buy during high points of the Bitcoin market. This is exactly the opposite of a buy-low, sell-high strategy, and highlights the perils of trying to time markets. 

Impact of the Bitcoin halving

Investors are keeping a close eye on the next Bitcoin halving, now scheduled for April 2024. Halvings take place only once every four years and are one of the most anticipated events in the Bitcoin community, primarily due to a past history of significant price gains that have accompanied every halving event since 2012. 

In a halving, the reward for mining a new block of Bitcoin falls by half. Thus, in April 2024, the reward for mining new coins will drop from 6.25 Bitcoins to 3.125 Bitcoins. On the surface, this would seem to be a negative development for Bitcoin miners. It means they will be expending the same amount of energy but getting a smaller reward, right?

However, if you take into account the price appreciation in Bitcoin that can occur both before and after a halving, then this effect is largely negated. There have now been three past Bitcoin halvings (in 2012, 2016, and 2020), and each one has seen monster price appreciation for Bitcoin. In 2020, for example, the price of Bitcoin exploded by 688% after the halving. 

Although there is some debate about whether this historical cycle will repeat in 2024, there are plenty of analysts and investors who think it will, so it could become a self-fulfilling prophecy. By some estimates, the price of Bitcoin could blow through its all-time high of $68,790 and move toward $100,000 -- if not higher. And that would be tremendous news for Riot. Even though the company will be earning less Bitcoin next year, each new Bitcoin might become much more valuable. 

Is Riot a good long-term investment?

In the short run, then, Riot would seem to be an attractive investment target. But what about in the long run? From my perspective, there are two variables to consider here. 

The first variable is whether Riot Platforms can remain a best-in-class Bitcoin miner. Based on what we know about Riot's current mining capacity and willingness to take on new Bitcoin mining infrastructure, this looks very favorable. Dating back to the start of 2022, Riot has mined the second-highest number of Bitcoins in the industry. And it has done so with a lower cost basis than its rivals.

The other variable is whether Riot can diversify its core business so that it is not so cyclical. Riot is never going to be a stock you can buy and forget about until it is more diversified. There's good news on this front. In January, the company changed its name from Riot Blockchain to Riot Platforms as a way to signal to the market that the company has future plans to diversify. Some have suggested that Riot could find other uses for its high-performance computer facilities, including artificial intelligence and cybersecurity. 

Until this happens, the decision of whether to invest in Riot is still just a decision of where you think the market for Bitcoin is headed. Personally, I think the market for Bitcoin is headed higher in 2023 and early 2024, primarily due to the upcoming halving event. From my perspective, that makes Riot a screaming buy for the next 12 months.