Bitcoin has been on a wild ride.

Already over the past year, Craig Wright stepped forward as Satoshi Nakamoto, bitcoin’s anonymous founder, but later backed away from those claims; a civil war raged at the upper echelons of the bitcoin community over changes to the network’s code; a renowned bitcoin developer wrote a eulogy for the cryptocurrency; and another virtual currency, ethereum, exploded in popularity.

Against this backdrop, the price of bitcoin has nearly tripled.

It’s nearly impossible to say why bitcoin has done so well. But as an asset not directly tied to a single economy, it tends to attract investors when there’s a lot of volatility. There’s certainly been no shortage of that.

Now, a looming event expected around July 9th, known as “the halving,” could rattle the entire bitcoin system—its price, its stability, and its future.

What’s going on?

Before we get started, we should go over how bitcoin works. Bitcoin is a digital currency that lets two people enter into a financial transaction without any middlemen. While simple to use, the technology is loaded with checks and balances to eliminate fraud.

One of the keys to preventing fraud is the process of mining. Bitcoin transactions are stored on something called a “block.” If the bitcoin network is essentially a massive accounting book, then the blocks are its pages. Each block can store 1 megabyte of data, and it’s the miners’ job to confirm the authenticity of the transactions contained in the block. The miners do that by taking each transaction’s corresponding data and using it to complete a math problem. The solution is known as a “hash”—a shorter unique string of digits that has all the important transaction information within the block. Once completed, the hash ties back to the last block, which is how bitcoin creates a permanent, unalterable transaction record. (Changing one hash would require changing everyone else’s ledger in the bitcoin system.) Importantly, as more computing power is added to the system, the problems become more complex.

Miners don’t do this for fun, of course—every time a miner completes a block, it earns bitcoins as a reward. Right now, miners earn 25 bitcoins per block, which is about $16,000. Completing a block is the only way for new bitcoin to come into circulation.

That’s a lot of money. Sounds like a decent gig.

Yes, miners can make a good amount of money. Some, like this one in China, gross $1.5 million a month, according to Motherboard. Overall, ARK Invest estimates that miners have a 40% profit margin. Dealing with the complexity of the problems requires a lot of computing power and electricity, which account for the bulk of miners’ expenses. Becoming more efficient is crucial, which is why some miners have focused on making better chips and others have tried things like submerging their mining rigs in super cold liquids to get rid of heat more efficiently.

As long as mining for bitcoin remains profitable, miners will keep mining. But that’s about to become more difficult.

What’s changing?

Remember that reward miners get for confirming blocks? It’s going to be cut in half to 12.5 bitcoins in the coming weeks.

Why?

Part of what makes bitcoin valuable is the fact that there is a finite supply of 21 million bitcoin. No more will ever be created. This was done to make bitcoin similar to a natural resource like gold. When bitcoin’s creator built the system, he (or she, or they) knew that if bitcoin took off and there was an abundance of miners, that cap would be reached quickly. Currently, there are almost 16 million bitcoin in circulation and about 3,600 bitcoins are created each day.

So, to slow things down, Nakamoto did two things. First, in the bitcoin code, Satoshi made miners compete with one another to win the block reward. As more people are attracted to mine bitcoin, it gets progressively more difficult for any single miner to win the reward. As competition increases, miners load up on processing power, turning bitcoin mining from a bedroom hobbyist activity to one that requires the computing power of entire data centers today.

The second change? After every 210,000 blocks, the mining reward is cut in half. This is known in the bitcoin industry as a halving event. As of now, it looks like the 420,000th block will be mined on July 9th, at approximately 11:23 UTC.

So, this happened before?

Yes, approximately every four years, like the Olympics. Last time, it happened on November 28, 2012. At the time, the biggest concern was whether the computer code would actually cut the reward in half. But it did, which was a huge reassurance to the market that the technology was fully functional. On the day of the halving event, the price of bitcoin was $12.25. A little over a year later, it reached its all-time high, around $1,000. Bitcoin was also bought and sold more frequently, making it an all around better asset.

How will the miners adjust to being paid less for more difficult work?

Miners will hope to stay profitable by cutting costs and finding new revenue streams, like charging small transaction fees, for starters. A research paper by ARK Invest bitcoin analyst Chris Burinske found that miners have been over-investing in state-of-the-art mining equipment ahead of the halving, which means that the fixed cost of upgrading their equipment will be lower in the foreseeable future.

Miners will also benefit if the price rises, and some market watchers believe it will. Vinny Lingham, an avid bitcoin follower who has accurately predicted the price of bitcoin before, wrote in May that the halving event could push the price of bitcoin north of $1,000 by the end of the year. In an interview with Quartz, he reaffirmed that estimate, though he predicts there could be major volatility over the next few months at around $700, which he says it closer to the “true all time high” for bitcoin (read more about that here).

So, while miners are getting shortchanged by the halving event, most of them will be able to offset the short-term loss of revenue. But not all miners will survive.

Who won’t survive?

The miners running older equipment will be the ones that suffer. Lingham and other industry experts estimate that 25% of computers will probably be unprofitable thanks to the halving event. If they’re taken offline, the hashrate—a metric that quantifies the processing power of the bitcoin network—would fall, and the bitcoin network could be less secure. Last time, it fell almost 20%, according to Coindesk.

That’s a big problem, right?

Theoretically, but probably not. There’s a hypothetical scenario called a “51% attack” where a miner takes over 51% of the processing power in the bitcoin network. Since the miner controls the majority of the network, it can make fraudulent transactions and confirm them on its own, or spend bitcoins that have already been spent. It would create a chain effect that would probably bring down the whole bitcoin network. But bitcoin’s been around for so long that it’ll take a lot of money and resources to take over the network. ARK Invest estimated it would cost up to $400 million to carry out such an attack. And one of the key properties of blockchain, the technology underpinning bitcoin, is transparency—if any bad actor tries to take over 51% of the network, they’ll probably be spotted quickly, ARK Invest said.

What can we expect on the day of the event itself and after?

In general, we can expect a lot of volatility. On the day of the last halving, nothing really happened. Bitcoin was four years old and its market cap was only around $129 million.

With bitcoin’s market cap closer to $10 billion today, things won’t be as calm this time. Volume could be heavy and the price could fluctuate a lot, but the real metric to keep an eye on is the hashrate. If miners decide it no longer makes sense to keep older equipment online, the hashrate could fall, like it did last time. However, if the computing power in the bitcoin network falls below a certain point, it suddenly becomes profitable to add those older mining rigs back into a miner’s system (the less computing power, the easier and cheaper it is to solve for blocks). Then, if miners turn back on a lot of their older hardware, the hashrate jumps back up again. All this back and forth can cause a ripple effect throughout the bitcoin ecosystem.

Mid-July will be a tense time for the bitcoin community, especially miners. Mining will be tougher and less lucrative. And while things like transaction fees may change the way we think about bitcoin, making it less of an anarchist’s financial dream and more of a digital version of our existing financial system, a successful halving event will prove that bitcoin has a future, even if we don’t know exactly what it will be.