We're going to walk through how this simulator is made together.
Before we do though, maybe you don't know what Bitcoin is or something. Let's level set.
Let's level set - a birds' eye view of how Bitcoin mining works.
Skip this section if you've heard this before.
Bitcoin is a globally shared digital ledger that can keep track of amounts in an unforgeable way. If
Alice wants to
transfer 5 bitcoin to Bob, she will enter a transfer of "5 bitcoin" to Bob into the global ledger. Her
will decrease by 5 and his will increase by 5. There is no such thing as a "bitcoin" on its own apart
transfers on this ledger. Naturally, two questions arise - where do initial bitcoin amounts come from,
is this ledger protected from invalid transactions?
In Proof of Work cryptocurrencies (of which Bitcoin is the first), both questions are
resolved by a
lottery system called mining. Anyone running a computer can enter the lottery. A valid lottery
one that has a set of some valid transactions, refers to the previous valid lottery ticket, and solves a
cryptographic puzzle successfully. If a computer finds (or mines) the next block of
successfully according to the above rules, the rules then specify that its operator is awarded some
brand new, just minted
bitcoin. This is the agreed upon behavior by all Bitcoin software, and if one of these lottery tickets
play by the rules all of the other Bitcoin software plays by, the lottery ticket will be ignored. As you
imagine, the best strategy for maximizing Bitcoin mining rewards is to obtain the most valid lottery
The costliest step in creating a lottery ticket is the cryptographic puzzle, (this is called the
Proof of Work) and the rate at which these can
be attempted is called the hash rate. Dedicated Bitcoin mining computers are rated in terms of
terahashes per second, or how many trillion cryptographic puzzles can be attempted every
Because the system would fall apart if lottery tickets were being distributed trillions of times a
participants of the Bitcoin network all agree on a system that adjusts the expected number of attempts
to find a
valid lottery ticket (the difficulty) such that the network on average only has one successful
lottery ticket every 10 minutes. No matter how many lottery participants there are, there will only be
one winner every 10 minutes.
This is standard lottery probability - the value of a lottery ticket is equal to the probability of the
ticket winning times the reward if it wins minus the cost of obtaining it. The monetary value provided
by one exahash (one billion
billion lottery attempts) is equal to the percent of the total network one exahash represents times the
reward minus the cost of performing one exahash worth of attempts. As an aside, the Bitcoin network
is currently performing around 200 exahashes per second, so 1 exahash per second gives you 0.5% chance
of winning the lottery.
As a result, chances of winning the lottery, in expectation, are exactly equal to the percent
network hash rate you control. Miners are incentivized to maximize the percent of the network hashrate
control, as long as it is economically feasible to do so.
A note about asset classes in case you don't know: there are other cryptocurrencies besides Bitcoin!
Bitcoin is not the only cryptocurrency! It's only
Proof of Work cryptocurrencies that the above applies to. Many other cryptocurrencies use
alternate consensus mechanisms, such as Algorand, Avalanche, Cardano, Cosmos, Polkadot, Polygon, Solana,
Tezos, etc., and soon Ethereum, and these are not nearly as bad as Proof of Work. If you're interested
in investing in cryptocurrency, you'll be delighted to know that the whole market moves together
with high correlation (so far), and so you should feel just dandy about selling all of your
Proof of Work cryptocurrency and trading it for something else.
Okay, let's simulate a single Bitcoin miner
Below, we're going to calculate what you can expect to earn by running mining computers (your profit)
given your energy costs.
How does this work? Well first off, if you're on mobile, it might not, lol. The simulator probably
looks better on
desktop. I haven't been a web developer in 15 years. Can you imagine how much has changed in 15 years of
web development? I'm still shocked KHTML beat Trident and Gecko.
I tried to make this responsive, but maybe go get your computer.
Okay, but so how does this work?
This simulator simulates on regular intervals (the Sim step size). With
settings, each data point is one week of simulated time. For each simulator step:
- The simulator calculates the energy cost to you of your configured
hashrate, given your miner efficiency and the cost of energy. It then graphs cumulative cost. Note that
for large hashrates, this is the same as running multiple mining computers. Your mining operation
may have lots and lots of hardware!
- It calculates your expected revenue; this is your "expected earnings" (before costs)
mathematical sense. Your actual earnings are random and based on who wins the lottery, but in
expectation over long periods of time, your actual earnings will
match the expected earnings, so this is fine. It multiplies the simulator step's block rewards by your
chances of winning the Bitcoin mining lottery. This is also graphed cumulatively.
- It subtracts your costs from your earnings, and that's your profit. If your profit is
going up, great! If your profit is going down, you're
For this first simulator, we're going to assume you already have all the mining computers you could
possibly want lying around and freely obtainable. No capital expenditure yet!
Otherwise, the numbers are pulled from real life
right now (as I'm writing): the Bitcoin network is around 200 EH/s
when I looked, I looked up electricity prices, and so on.
Go ahead and play around with it - it's worth getting a feel for how quickly mining can turn from a good
thing to a bad thing. In particular, check out how poorly GPUs and CPUs do (the nVidia and Intel presets).