Maybe you can clear this up for me. Let's go back to the coffee analogy. Let's say one day I buy a bitcoin for $1. The next day I but a bitcoin for $2 because the worth has doubled. I now have 2 bitcoins worth $4, one has doubled in value but the other still has the same worth as what I bought it for. If I buy a coffee for $2 with one bitcoin, how do we know which bitcoin I used to buy the coffee? They are all in the same wallet. So essentially I have two bitcoins...one of them I would owe capital gains tax of $1 if I used it to buy the $2 coffee. The other bitcoin I would owe no capital gains tax on if I used that bitcoin. How is that determined? And I'm not being a dick...I really just don't understand how that would work.
Capital gains are based on the average cost. If you bought 1 bitcoin for $1, and 1 bitcoin for $2, you now have 2 bitcoins, that you bought for a total of $3 dollars. Therefore your average cost was $1.5 / bitcoin. So when you buy a coffee for $2 using 1 bitcoins, you should calculate that you only spent $1.5 to acquire that 1 bitcoin (on average), and therefore you made a $0.50 profit.
Most investors used the above method, called the "average cost basis method", in their accounting of capital gains for stocks and such.
You can also use the first in first out (FIFO) method. That means if you bought bitcoin for $1 first, and then later bought another bitcoin for $2, then later you bought something with 1 bitcoin, you would calculate your cost to acquire the bitcoin as $1 (since that was the first bitcoin into your wallet, it is the first bitcoin out of your wallet: hence "First in first out").
You can pick either the average cost basis method or the FIFO method in any given year, whichever is more tax advantageous for you.