Bitcoin mania is in full swing in 2017.

The cryptocurrency is no longer that quirky, risky, cyber gizmo that only tech geeks, Millennials and people on the Dark Web obsess over. No, it's starting to become - dare we say - mainstream, where investors are now actively looking at bitcoin and other cryptocurrencies as key additions to a diversified portfolio. Even the most risk-averse investor is having a tough time ignoring the sector's humongous returns.

Bitcoin has been on a monster run this year, with its value surging three-fold to a high of $3,018.54 in June from $968.23 at the end of 2016, according to Coindesk. Although it's pulled back since then, recently changing hands at $2,060.88, it's still up about 210% year-to-date.

Its younger competitor, Ethereum, has been on an even bigger blockbuster ride, with its value soaring 50-fold to a high of $415.31 in June from $7.31 at the end of 2016. It too has fallen from its high, recently trading at $171, but is still up more than 2300% this year.

So, why and how did bitcoin enter the mainstream psyche?

Maybe it was the surge in "ransomware" attacks, where even Granny was asked to pay up in bitcoins to unlock her computer from malicious malware. Or maybe it was the decision by countries, such as Japan and Australia, to recognize bitcoin as legal tender. Or maybe it was a growing number of investors choosing bitcoin over gold to offset the weak dollar. Any and all of these issues helped boost demand - and therefore, its value.

"It's the herd mentality that occurs when you have rising markets and the fear of missing out," said Charlie Hayter, chief executive of CryptoCompare, a research site that tracks the industry. "You have people acting in a mania-like fashion - jumping on the bandwagon because it has gone up and hope it's going to go up more."

The really "smart money" got in a year ago, said Hayter. But, for now, it's still largely "the more adventurous in the financial world" who are putting it into their portfolios, he said.

Many experts believe Bitcoin is here to stay, and its run-up will continue, although not without setbacks and volatility along the way.

For example, many experts expect considerable volatility in August and September related to software upgrades to the Bitcoin technology aimed at increasing transaction capacity. Some bitcoin miners oppose the changes. And if developers and miners can't agree on the format, there could be a split that could result in two separate currencies, which could turn the bitcoin market upside down. "It's unknown right now and hard to predict what's going to happen," said Conrad Barski, a software developer and co-author of the book Bitcoin For The Befuddled.

The rise in initial coin offerings, where new digital currencies are introduced, are also pressuring prices.

Then there's technical issues. A surge in trading could lead to bottlenecks and even flash crashes on the exchanges that could cause cryptocurrencies to plummet. In a flash crash last month, one exchange reported the price of ether plunging to a low of 10 cents from more than $300 a few minutes earlier, before recovering.

Still, Thomas Lee, strategist and managing partner at Fundstrat Global Advisors LLC, is bullish on bitcoin's long-term outlook. In a report earlier this month, he predicted Bitcoin could be worth between $20,000 and $55,000 a unit by 2022.

"The technology for bitcoin and ethereum is extremely promising and I think it will fundamentally be a part of society in five or ten years," said Barski, who owns both bitcoins and ethereum.

The growing mainstream popularity of bitcoin is a far cry from the "Silk Road" days of 2011, when bitcoin was viewed as a shady tool used by drug-dealers and other sketchy characters on the Dark Web to buy and sell illicit products and services anonymously. (The Silk Road site was shut down in 2013 amid an FBI probe, and its young founder, Ross Ulbricht, was sentenced to life in prison in 2015).

Bitcoin's image has since taken a 180-degree turn. How far into mainstream America has it gone? Well, when Fed Chairwoman Janet Yellen was testifying before Congress this week, two grinning bitcoin fans sat behind her, holding up a yellow legal pad with the words "buy bitcoin" written on it. Their photobombing prank made headlines across the country.

For those interested in purchasing bitcoins and other cryptocurrencies, here's a rundown on how and where to buy them directly as well as alternative ways to cash in on the bitcoin craze.

1.Buying bitcoins through cryptocurrency exchanges.

Bitcoins can be purchased directly through cryptocurrency exchanges, such as Coinbase, GDAX, Kraken, and Gemini. (Gemini was founded by the Winklevoss twins). People sign up for an account online and then buy the bitcoins through a bank account transfer, credit card, wire transfer, or, in come cases, even a PayPal account. (Some don't accept credit cards because the transaction can be reversed with a call to a credit card company). On Coinbase, a person can withdraw money by transferring cash to a bank account or PayPal account. Trading and withdrawal fees vary from exchange to exchange, so it's best to shop around. Keys to the bitcoins are stored in a digital wallet.

Ether can be purchased on such exchanges as Coinbase and GDAX.

  1. Buying bitcoins at an ATM.

People can buy bitcoins through special ATM machines. Bitcoin Depot, for example, offers ATM machines in six states - Georgia, Florida, Tennessee, Texas, Massachusetts and Alabama. The investor signs up for an account with Airbitz bitcoin wallet, deposits cash into the ATM, scans a QR code with a special scanner attached to the ATM, and voila - the bitcoins will be in the Airbitz account. However, the ATM method often comes with hefty fees - sometimes in excess of 20%. "If you're a serious investor, that's too much of a cut in fees to make it viable," said Barski.

  1. Buying and selling from local sellers directly.

For investors who prefer anonymity or don't want to provide banking information, they can purchase bitcoins directly from a local seller - face-to-face. You can find such sellers through LocalBitcoins.com, where transactions are arranged, prices negotiated and an escrow service provides protection for both parties. For those choosing this method, it's best to meet in public places. There are also bitcoin groups that meet through meetup.com for local buyers and sellers.

  1. Investing through a brokerage firm.

For investors wanting to avoid the risks and hassle of setting up digital wallets, they can invest in bitcoin indirectly through Bitcoin Investment Trust (GBTC) in the OTC market. GBTC is a bitcoin-based fund that acts like an ETF, whose shares can be bought and sold through traditional brokerage firms. Each share represents about one-tenth of a bitcoin. But the convenience comes at a steep price: The fund has been wildly popular, which has caused shares to soar to the point where a share is now priced about 73% higher than the value of the underlying bitcoin. (GBTC recently traded at $357, which values a single bitcoin at about $3,570. But Bitcoin recently traded at $2,060.88). Also, GBTC charges a 2% management fee on top of that.

The frothy premium may not be an immediate concern for shareholders, since GBTC is the only bitcoin ETF available. However, if the Winklevoss Brothers, famous for their controversial lawsuit over their role in Facebook's start, ever get their Winklevoss Bitcoin ETF approved, it could be a different ballgame, and GBTC values could plunge. (The SEC turned down the Winklevoss ETF earlier this year over lack of regulation, but agreed to reconsider it later). "As soon as there's more products, more liquidity and more choice, the premium will disappear," said Hayter.

  1. Investing indirectly in Bitcoin.

Investors can also cash in on the bitcoin craze indirectly by purchasing shares in companies that either invest in bitcoin or provide part of the underlying blockchain technology. The risk is that many are penny stocks. Examples include:

-First Bitcoin Capital Corp. (BITCF) develops digital cryptocurrencies and blockchain technologies. It also owns and operates various digital assets, such as cryptocurrency exchange CoinQX.com and bitcoin news site, iCoiNEWS.com.

-Connexus Corp. (CNXS) operates bitcoin ATMs.

-BTCS Inc. (BTCS) hosts an ecommerce marketplace, where people can buy merchandise using digital currencies, like Bitcoin and litecoin.

-Bitcoin Services (BTSC) , which offers both bitcoin escrow services, where it acts as a third party between a buyer and seller when doing business online, and bitcoin mining services, where it validates bitcoin transactions. It also develops and sells blockchain software.

- Nvidia Corp. (NVDA - Get Report) and Advanced Micro Devices Inc. (AMD), which trade on Nasdaq, provide graphics processing chips to cryptocurrency miners.

  1. Guarding your bitcoins.

For investors who buy bitcoins, it's critical they take steps to safeguard them. Bitcoins in exchange accounts are not FDIC or SIPC protected. Leaving bitcoins in a digital account on an exchange could be risky if the site crashed, went bankrupt or got hacked.

In 2014, Mt. Gox bitcoin exchange filed for bankruptcy after claiming it had been hacked and that thieves made off with hundreds of thousands of bitcoins. A trial began in Tokyo this week against the former head of Mt. Gox, Mark Karpeles, who faces charges of embezzlement and creating unauthorized records.

"Never keep a large dollar amount at a bitcoin/ethereum exchange," said Barski. "There are still high risks for hacks."

So, experts recommend investors move the bitcoin keys to a digital wallet on their computers, which involves installing a cryptocurrency wallet on their computer and making sure the computer is protected by anti-malware protection.

To be even safer, the investor could purchase "hardware wallets," such as Trezor wallet or Ledger Nano wallet, which are USB-sized devices that safeguard the bitcoin private keys offline. "If you follow these steps, you can sleep comfortably," said Barski, "Knowing that if an exchange is hacked or goes bankrupt, your funds will remain safe."