Introduction to Bitcoin

bitcoin

Bitcoin is a “digital currency” that’s received quite a bit of attention recently. Where does it come from and how is its value determined? Is it an acceptable way to make/recieve payments as Bitcoins ?

Bitcoin is an open-source, peer-to-peer virtual currency that exists purely in digital form. It is the first decentralized peer-to-peer payment network that is powered by its users with no central authority or middlemen.

Who Created it?

The concept of Bitcoin was introduced and developed by Satoshi Nakamoto. In November 2008, a paper was published into a mailing list titled “Bitcoin: A Peer-to-Peer Electronic Cash System”. This paper described methods of using a peer-to-peer network to generate what was described as “a system for electronic transactions without relying on trust”.

In January 2009, the Bitcoin network came into existence with the release of the first open source Bitcoin client. Satoshi left the project in late 2010 without revealing much about himself. The community has since grown exponentially, with many new developers working on Bitcoin protocol.

How Does Bitcoin Work?

Bitcoin is a system which allows for anonymous currency transactions. No one will ever know about the payment or about all other information regarding the payment, including who sent it, who received it, etc.

The Bitcoin network – a peer-to-peer network – is not controlled by a central authority, but rather by a network of contributors and freedom enthusiasts. Essentially, people can do money transactions and no authority or organization will know anthing about it.

Where Does It Come From?

For a currency to have any value, the number of coins must be limited. A new bitcoin is generated when a new set of solutions is found for Satoshi’s mathematical problem.

The process of finding new solutions to Satoshi’s mathematical problem, using computers, is commonly referred to as “Bitcoin mining”. New coins are slowly mined into existence by following a mutually agreed-upon set of rules. A user mining bitcoins is running a software program that searches tirelessly for a solution to a very difficult math problem whose difficulty is precisely known.

An interesting characteristic of the mathematical problem is that as each successive solution (Bitcoin) is found, the next solution becomes increasingly more difficult to find.

Advantages and Disadvantages

Advantages of Bitcoin over the conventional forms of currencies are :

  • Easy and Fast Payments: Bitcoin payments are generally easy and fast. The bitcoin user just needs the address to which he intends to transfer the coins. The transaction would be completed in a matter of seconds.

  • Secure: Since the Bitcoin protocol is using highly secure cryptography, it ensures that the transactions remains secure. The transactions can be authorized only from the wallet. However, the security of the wallet depends on the users and the steps they have undertaken to protect it.

  • Anonymous Transactions: The identity of Bitcoin users and Bitcoin wallets are private.
    The addresses created for bitcoin transactions are also private. However, Bitcoin transactions are public, traceable, and permanently stored on the Bitcoin network. IP addresses of users on the Bitcoin network are also logged. Therefore, it is advisible to use different IP address or hide your computer’s IP address for your transactions, if you want your identity to be kept anonymous.

  • Low or No Transaction Fees: Bitcoin transaction fees are usually a voluntary fee to enable faster confirmation of your transaction.

Bitcoin has its disadvantages, also:

  • Irreversible Payments: Transactions using Bitcoin are, generally, irreversible as there is no central authority which monitors these transactions for fraud and reversal. The only way to get a payment back is if the person who received the funds issues a refund.

  • Acceptance: Being a new form of currency, the acceptance of Bitcoin is limited. Not all (or even many) online merchants accept Bitcoin.

  • Learning Curve: Using Bitcoins for payments requires a user to acquire certain knowledge about using Bitcoin and especially about keeping the Bitcoin wallet secure. This includes knowing how to create a wallet, keeping the wallet secure, keeping the identity of the owner of the wallet private and secure, using different addresses for different transactions, and so on.

  • Experimental Currency: As Bitcoin is still under development no one can be sure about the its future. There could be technical flaws or vulnerabilities in the system that are not yet discovered.

  • Volatile: Since there isnt a central authority that can control the value of Bitcoin, its value can be highly volatile.

With the above advantages and disadvantages, it is the users who should decide whether they should be using Bitcoin or not. It would be wise to learn how to use it properly and how to stay safe and secure before playing around with it.

Bitcoin as a Payment Option in Ruby

The Bitcoin network can be accessed via the JSON-RPC. The following code, as given in the Bitcoin wiki), provides details on how to connect to the Bitcoin network and perform some basic requests.

require 'net/http'
require 'uri'
require 'json'

class BitcoinRPC
  def initialize(service_url)
    @uri = URI.parse(service_url)
  end

  def method_missing(name, *args)
    post_body = { 'method' => name, 'params' => args, 'id' => 'jsonrpc' }.to_json
    resp = JSON.parse( http_post_request(post_body) )
    raise JSONRPCError, resp['error'] if resp['error']
    resp['result']
  end

  def http_post_request(post_body)
    http    = Net::HTTP.new(@uri.host, @uri.port)
    request = Net::HTTP::Post.new(@uri.request_uri)
    request.basic_auth @uri.user, @uri.password
    request.content_type = 'application/json'
    request.body = post_body
    http.request(request).body
  end

  class JSONRPCError < RuntimeError; end
end

if $0 == __FILE__
  h = BitcoinRPC.new('http://user:password@127.0.0.1:8332')
  p h.getbalance
  p h.getinfo
  p h.getnewaddress
  p h.dumpprivkey( h.getnewaddress )
end

The full list of API calls is described here

Conclusion

There has been quite a lot of buzz around Bitcoin, with some countries imposing bans on using Bitcoin and hacking attempts being made on Bitcoin exchanges. At the same time, Bitcoin opens a wide range of possibilities to take over internet-based financial transactions, providing a lot of value and opportunity for both consumers and sellers.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • Neal Palmquist

    This article forgets to mention one very important fact:

    Every day is April Fool’s Day for people who buy Bitcoins!

  • fcduythien

    The article is great