Based on my research, the answer is both. You would pay taxes on the bitcoin you mine as income, and then capital gains tax when you sell them for a profit (or capital loss if you lose value on the sale).
You can write off a portion of your electricity bill and hardware purchased for the use of mining as a business expense, but it's recommended that you consult a tax professional for determining the proper amount that is eligible for a deduction.
New Bitcoin are being issued by the system roughly every 10 minutes by
a process called mining. In mining, computers running the Bitcoin
software around the world attempt to solve math problems and the first
computer to come up with the solution adds the most recent
transactions to the ledger of all Bitcoin transactions, plus receives
the new bitcoins created by the system, called the block reward.
If you are a miner and win the block reward, you must record the fair
market value of Bitcoin that day and mark that as an addition to your
personal or business income. Also note the date and timestamp at which
your coins were mined. Later, when you dispose of those Bitcoin, you
will subtract the date of acquisition from the date of disposal, and
you will be taxed a long-term capital gains rate on any Bitcoin you
held for more than a year, and a short-term capital gains rate on any
Bitcoin you held for a year or less. (The timestamp isn’t absolutely
necessary, but is helpful to validate the order of multiple
acquisitions or disposals within a day.)
The amount you pay in taxes on a long-term capital gain will depend on
your income-tax bracket, while short-term capital gains are taxed the
same as ordinary income.
Another clarification in the IRS's March notice was how mining should
be treated. Mining is income, on the day of receipt of any coins and
at the fair value of those coins. This means that if you mined any
Bitcoins or alt-coins either solo, as part of a pool, or through a
cloud provider, you need to report any coins you received as income.
Where it is less clear, is what that dollar value might be, since the
fair value is not always as easy to determine.
Dogecoins, are all examples of where there is a direct USD market and
so you can easily find out their value of any given day. However, a
newly created alt-coin that was mined in its early days has no direct
market and so how do you determine its value? Or for any alt-coin,
e.g. ABC coin, that has no direct USD market but does have a BTC
market. Does it have a value? Do you have to make a conversion from
ABC to BTC to USD?
Since there is no clarification yet from the IRS on
this issue you should discuss how to proceed with your own tax
professional. BitcoinTaxes has taken a prudent approach and calculates
value where a fiat or BTC market exists, converting an alt-coin to BTC
to USD as necessary.
And from Bitcoin magazine:
The IRS also stated mined bitcoins are treated as immediate income at
the market value of those mined coins on their date of mining.
“Most don’t know they can write off any losses they have,” said Libra
founder Jake Benson. “The IRS allows you to offset income by up to
$3,000 per year on capital losses. If you have losses and you aren’t
writing them off, then it’s like throwing money away. Nobody likes
doing taxes, but if you can owe less or increase your return, then
doing your Bitcoin taxes often results in a benefit. In fact, the
majority of our users are filing a capital loss, which means they’ve
actually saved money by using our tool.”
Benson also gives insight for miners.
“Mining is considered income, so know the price of Bitcoin at the time
you mined it,” he said. “If you make money on Bitcoin trading, the IRS
requires that you report gains with line level detail.” The
appropriate form for that is 8949, a sub-form of schedule D. Gains and
losses, as outlined above, are treated like every other capital asset.