Using the Bitcoin network for e-commerce and online transactions

Whether you are interested in Bitcoin as an open source software project, peer-to-peer network, or decentralized virtual currency, insight into its many facets will help you make sounder decisions about implementing it. In this article (one of three parts) Dirk Merkel gives an overview of Bitcoin, discussing its characteristics as a peer-to-peer network and decentralized currency. He also explores motivations for contributing to the project or implementing it in online transaction systems, as well as some of the pitfalls of doing so.

Since its inception in 2007, Bitcoin has captured the imagination of many people, including software developers, consumers, and economists. Numerous factors have contributed to the project's popularity and mystique, not least the fact that its creator used a pseudonym to remain anonymous and has publicly withdrawn from the project (see Resources). As an open source software project, peer-to-peer network, and decentralized virtual currency, Bitcoin is applicable to a range of private and commercial interests. Its social implications have also made it a matter of public interest, and widely discussed in mainstream media. And Bitcoin's maintainers have effectively used peer-to-peer networks and public-key cryptography to spread Bitcoin's message and proliferate the technology.

This three-part article attempts a well-rounded introduction to Bitcoin. In this first part we'll explore some of the motivations for creating and using Bitcoin, as well as discussing characteristics of a Bitcoin implementation. In Part 2 we'll dive into some of the theory and design of Bitcoin, including its elegant solutions to certain problems inherent in currencies and payment systems. Part 3 will be your chance to put some of what you've learned to practical use with BitCoinJ, a Java implementation of Bitcoin.

Motivations for developing and using Bitcoin

Several factors seem to have motivated Bitcoin's creator and the many enthusiasts who use and contribute to the project. So let's start by considering those motivations and how well they are reflected in Bitcoin as a whole system.

Voluntary transaction costs

First, Bitcoin aims to eliminate the need for a third-party (such as a credit card company or PayPal) to mediate online transactions. This is a cost motivation, since electronic transactions often involve fees. For credit cards, transaction fees are typically in the 1.5% to 2% range.

By enabling direct transfer of funds from one user to another, Bitcoin eliminates the need for an intermediary. Users like the fact that transaction costs are thus extremely low; in fact the transaction fee is at the discretion of the person making the payment! Any fee paid is viewed as an incentive for the Bitcoin network to confirm the transaction. The higher the fee included in a transaction, the faster and more likely it is that the transaction will be confirmed. As of the current version of the Bitcoin client application, the minimum transaction fee is 0.0005 BTC (BTC is the currency symbol for Bitcoins).

The absence of an intermediary also means that chargebacks are not possible, which can be a relief to people processing payments. A valid Bitcoin transfer is non-reversible. It is thus the user's responsibility to be sure that he or she is dealing with a reputable merchant who will actually deliver the purchased item or service.

Anonymity and regulation

Another interesting facet of the Bitcoin network is anonymity. Bitcoins are transferred between addresses, and each address is a randomized string of 25 to 34 characters. A transaction consists of the addresses of both the sender and the receiver and the number of Bitcoins exchanging hands. All transactions are broadcasted across the whole P2P network. As long as it is not possible to associate a user's identity with an address, the user will remain anonymous. Like the absence of chargebacks, this aspect of Bitcoin puts the burden of precaution on the user.

One effect of Bitcoin's anonymous infrastructure is that it has been used to pay for illegal goods and services, which has brought both media interest and the attention of the U.S. Attorney General. Bitcoin's anonymity also isn't perfect; maintaining it requires vigilance, and complete anonymity is not assured. (See Resources.)

Bitcoin's decentralized economy

Bitcoin transactions are bundled together in so-called blocks, which are then chained together to indicate the sequence of all transactions since the inception of the economy. This ever-growing block chain is one of the data structures at the core of the Bitcoin design. The Bitcoin client downloads the complete block chain and is thus able to validate new transactions. Actually confirming a new transaction means constructing the next block in the chain -- which is computing-intensive by design. The first client to discover a new block and broadcast it to the network is rewarded with an amount of newly minted Bitcoins. New currency is thus introduced into the Bitcoin economy at a controlled rate, as a reward for clients that construct new blocks.

Over time, the reward for creating a new block will decrease, and the flow of money into the economy will subside. Currently the reward is at 50 BTC per block with blocks getting created every 10 minutes on average. The reward will be halved roughly every four years, such that the total number of Bitoins does not exceed 21 million in the next two decades.

Decentralization

Another interesting attribute of the Bitcoin economy is that it completely eliminates the role of a central authority to manage the flow and creation of money. In the United States, the government via the Treasury Department and the Federal Reserve has various means of restricting or easing the money supply. In the Bitcoin economy, no single entity has that kind of power. On the one hand, some people like the idea of not being at the mercy of a central authority. On the other hand, the Bitcoin economy foregoes some of the benefits of that authority, such as mechanisms to curb inflation and fluctuations in the exchange rate relative to other currencies. Evidence of this is in the exchange rate of Bitcoin (BTC) to US Dollars (USD). Just during the writing of this article, the exchange rate between USD and BTC has fluctuated from a high of $11.54 to a low of $4.76 USC per 1 BTC.

The Bitcoin currency is still in its infancy and many believe that exchange rates will stabilize over time as more merchants join the economy and the value of Bitcoins becomes more closely tied to underlying value. Until then however, the Bitcoin economy is fertile ground for speculators and investors.

The animation in Figure 1 illustrates the potential impact of Bitcoin on e-commerce.

Figure 1. Bitcoin's impact on e-commerce (click to enlarge)

Bitcoin for clients and consumers

Now let's consider Bitcoin from a practical standpoint: How does it work? The first thing we'll need is a Bitcoin client application. Although the project has had several core developers, the official Bitcoin client is largely the work of "Satoshi Nakamoto" (a pseudonym). I use that client as proof of concept and reference implementation.

The official Bitcoin client is rather minimalist in its user interface. This is probably a good thing because it encapsulates some fairly complex functionality -- especially from an end-user perspective. Figure 2 shows the client application running on my OS X machine.

Figure 2. The official Bitcoin client's user interface

Note the Bitcoin address displayed at Point 1. As a participant in the Bitcoin marketplace, I can give this address to other users, who can then use it to send me Bitcoins. No single address is normally associated with all of a user's transactions and Bitcoin holding. In fact, the recommended practice is to generate a new address for each transaction. (The address on my screen is only displayed for convenience, I change it periodically.)

The Balance field at Point 2 shows my current Bitcoin holding, which is the sum of all the debit and credit transactions in my "wallet." Actual transactions are listed at the bottom of the main window, at Point 3. Optional tabs at the top let me narrow the view parameters so that I see only received, sent, or all transactions. The Send Coins button (Point 4) lets me send Bitcoins to any address by bringing up a dialog box to enter the amount and recipient address.

Those four features encompass everything required to send Bitcoins. The Address Book (Point 5) lets me store other user's addresses along with names. A status line at the bottom of the window (Point 6) displays some summary information about the Bitcoin network, economy, and my wallet. As you can see, my client has eight active connections to other peers on the network, the longest block chain contains 142614 blocks, and my wallet contains a single transaction for testing purposes.

Using Bitcoin, spending Bitcoins

As interesting as a virtual crypto-currency is, its relevance is ultimately determined by its usefulness. For Bitcoin to be more than an experiment in applied cryptography, networking, and economics, people have to be able to use it to buy merchandise or services. This leads to questions about how many merchants accept Bitcoins, what kind of merchandise or services Bitcoins can purchase, and how the consumer experience compares to traditional e-commerce.

The official Bitcoin Wiki maintains a listing of merchants accepting Bitcoins and their respective offerings. At the time of time of this writing, there were probably a couple hundred listings, ranging from tangible goods such as books, clothing, and electronics to services such advertising, legal, software development, hotel stays, and sport equipment rentals. I'm sure this listing isn't comprehensive, but it is clear that many of the listed services represent a still rather small Bitcoin network. The list seems to comprise mostly smaller businesses using the novelty of Bitcoins to promote their goods and services. Whether bigger firms join the list in the future will be a good indicator of the long-term success of Bitcoin.

In order to determine the functional usability of Bitcoin as a marketplace, I did an actual transaction using Bitcoins. My first challenge was to acquire some Bitcoin funds. As a currency, Bitcoin competes with payment processors and other currencies, but for now both are gateways to entering the Bitcoin economy. In other words, you must pay cash to acquire Bitcoins. Mt Gox is one of many currency exchanges where investors can exchange traditional currencies, such US Dollars (USD), Australian Dollars (AUD), and Euros (EUR), for Bitcoins. Mt Gox offers several ways of funding a trading account, but none of them are exactly convenient for someone with a checking account in USD.

I ended up opening an account on Dwolla, a cash-based payment network that offers a better US checking account integration than Mt Gox. After going through the Dwolla account verification process, I was able to initiate an ACH transfer from my checking account to Dwolla. From there I transferred the money to Mt Gox. It was then simply a matter of submitting an order to buy BTC for USD at an exchange rate that would enable it to get filled. Mt Gox provides tools for monitoring the exchange rate and the volume of the various buy and sell transactions. I was able to exchange $98.50 for 14.00 BTC at an exchange rate of roughly 7:1, minus a 0.60% transaction fee charged by Mt Gox.

For my Bitcoin experiment, I decided to buy a pair of Alpaca socks, famously featured in a Bitcoin introductory video. A quick crosscheck with the previously mentioned listing of merchants brought me to GrassHillAlpacas.com. After selecting a product and reading the site's payment instructions, I emailed the merchant and informed them that I would like to pay for my purchase with Bitcoins. (Contacting the merchant by email, by the way, is not the norm; it's more usual to see Bitcoins offered as a payment option integrated into a shopping cart.)

When I received a response with the merchant's Bitcoin address, I entered it into my Bitcoin client's Send Coins dialog box, as shown in Figure 3.

Figure 3. Bitcoin client: making a payment

Conclusion to Part 1

In this first part of my introduction to Bitcoin, I've discussed some of its characteristics as an online marketplace and decentralized currency. I've also walked through its user interface and a standard end-user interaction scenario. All of this is good foundation for Part 2, where we'll look at some of the underlying concepts of Bitcoin as software. That theoretical understanding will serve us well when we start writing code to work with Bitcoin, in Part 3.

Dirk Merkel is the CTO at VivanTech Inc. He has been developing software in a variety of languages for over 25 years and has been getting paid for it for over 15 years. In his spare time, he likes to learn about new technologies and ruin perfectly good open-source projects by submitting unsolicited patches. He also writes about technology, software development, and architecture. He lives in San Diego with his lovely wife and two wonderful daughters. Dirk can be reached at dmerkel@vivantech.com.