Bitcoin is just another currency. Bitcoin refers to the entire currency system and BitCOINS are basic units (just like Dollar or Pound)
Like other currencies, you can save/ spend Bitcoins, or exchange with other currencies.
What is Digital currency?
Digital currency can be easily stored and used on a computer.
Dollar can be considered digital currency as such, we can use it to shop online.
However, dollar supply is controlled by a centralized bank.
What is Decentralized?
Gold coins are decentralized, means, there is no central authority controls the supply of gold.
Anyone can dig for gold and distribute gold, but it is not easy to exchange with exact change.
Also not possible to transfer over internet.
Bitcoin is the world’s first currency that is both Digital and Decentralized, somewhat like digital gold.
Bitcoins is a stateless currency, not associated with any nation, but it is not a private currency.
Private currencies are issued by person or company/organization, may collapse due to bankruptcy or other failure of the person or company.
Bitcoin is not a company, nor controlled by a person/organization, so there is no single point of failure. Nobody can inflate the supply or create hyperinflation.
Now-a-days people can send digital cash back and forth via a central mediator (like, Paypal).
These central mediator can track payments and record the money transfer in a privately held account ledger.
Let’s indulge the thought that if we can trust such central mediator, or if we can send cash without being tracked.
The challenge with decentralized money is, how two strangers can trust each other and accomplish a financial transaction? [Aka, Byzantine Generals’ problem]
Learning from history
Between 1921 and 1924, the value of the German mark fell by a factor of more than 10 trillion due to overprinting by the government.
In 2008, the government of Zimbabwe printed so much of its currency that in a single year, a loaf of bread increased from $1 to $100 billion.
In both cases, any savings that people had in the form of national currency were completely destroyed.
In 2008, Satoshi Nakamoto, described an elegant solution of Byzantine Generals’ problem and the invention of Bitcoin in a paper, Bitcoin: A Peer-to-Peer Electronic Cash System.
First version of the software that demonstrated the concept was written by Satoshi, but now open source.
In January 2009, first bitcoins were distributed using the software.
Slowly but surely the use of Bitcoin increased and what began as an experiment, now a multibillion dollar economy and process hundreds of thousands transaction per day.
Benefits of Bitcoin
- International currency, anyone can send bitcoins to anyone else, almost instantly.
- Travel the world without exchanging to local currency.
- No middle man involved, so the transaction fees are negligible.
- No need to provide personal information like credit cards.
- No risk of losing savings or runaway inflation, it is designed to have fixed supply.
- Fundamentally impossible to counterfeit.
- Merchants can accept bitcoins without any paperwork.
- No governments can seize your money.
Why understanding bitcoin is complex
At times, it was not comfortable for people to use pieces of paper instead of precious metals (gold/ silver).
Additionally it uses modern cryptography, digital signatures, public/private key pairs and secure hashing.
To resist abusers to destroy the system, Bitcoin’s design uses game theory to align incentives to maintain network and who act in for selfish interest.
How Bitcoin works
As a decentralized currency, without any central authority, everyone cooperates to keep track of everyone else’s money.
Imagine only $21 million exists in the world and there is a list of all people who possess the money and in what amount and EVERYONE has a copy of this list.
When you give $2 to your friend, you must subtract $2 from your entry and add $2 to her entry. After informing her about the transaction, she updates her list as well.
Now everyone needs to update the list, otherwise their list would be inaccurate. So in addition to notify your friend, you need to publicly announce that you are updating the list.
Now if you try to cheat and send your friend $1000, that you do not possess, your cheating attempt would be easy to catch, cause everyone knows you don’t have $1000.
Imagine the whole transactions are carried out on computers, automated and through internet and replace
$ with bitcoins.
- How the unit should be valued? Should a haircut be worth of 5000 bitcoins or 0.005 bitcoins?
- How do you obtain the copy of the list?
- How bitcoins initially distributed?
We will come to these points later.
Total currency is capped at 21 million, but the smallest unit is a hundred millionth of a bitcoin (0.00000001 bitcoins), called satoshi, in honor of Satoshi Nakamoto.
Goods can be priced very precisely with exact change. Like a gallon of milk is 0.00152374 bitcoins or 152,374 satoshis.
Merchants uses short form BTC or XBT for bitcoins.
1 bitcoin = 1 BTC or 1 XBT 1 BTC = 1,000 mBTC 1 mBTC = 1,000 µBTC 1 µBTC = 100 satoshis
Standard of currency code (ISO 4217) wise, since Bitcoin is a nongovernmental currency, the name should start with X, as is the case with gold (XAU) or silver (XAG).
Bitcoin uses a public ledger that indicates the number of bitcoins and their owner. Instead of owner name, they use Bitcoin address to associate with a owner.
A sample Bitcoin address:
Pretty much like a bank account number, usually starts with 1.
To send someone bitcoin you need to know their Bitcoin address. Similarly, when you share your address, others can send you bitcoins.
People uses QR (Quick Response) code to represent their address. You can print your address or QR code in business card/ website/ storefront.
You need an internet connection to send bitcoins, but you don’t need to be connected to receive. So you can pass out your address and collect bitcoins while you sleep.
Other than QR code, you can use first bits scheme to send out first few characters of the address. Or, you can use address-shortening service (like URL shortening). From version 0.9+ Bitcoin supports human readable address (like, website address rather than IP)
Bitcoins ledger copies are distributed across millions of computers, so there is no central point of failure and impossible to erase records.
But Bitcoin ledger are public information, so how do you maintain privacy? Although there is no personal information in ledger but as you share your address, people will know your Bitcoin balance.
To maintain privacy you can use many Bitcoin address, but publicly share one or some of them.
In general, maintaining complete privacy while doing online transaction is very difficult with or without Bitcoin. Although Bitcoin provides far better protection than Credit card, however other privacy-protecting tool (TOR) might need to be used as well.
To unlock (move or send) bitcoins, there is a private key associated with each Bitcoin address.
If Bitcoin address is similar to bank account number, then private key is like PIN.
When a transaction is broadcast, computer check whether the transaction has been digitally signed using a private key that can only be created by someone possessing the private key.
Similar to PIN, private key should be kept secret. If someone obtains your private key, he will be able to spend your bitcoins.
Private key can be used to produce digital signature, but the reverse is not possible, means, you can not obtain the private key using digital signature. A digital signature can not be reused.
This is fundamentally different from online payment with credit card. You provide your card number to someone to authorize the transaction and that number can be reused (maliciously)
Unlike PIN, only you know the private key, not any bank/others. But if you lose the private key the bitcoins will remain locked in that address forever.
Every private key is associated with a single Bitcoin address, but the reverse is not true. A Bitcoin address can require multiple private keys to unlock.
Most people use multiple Bitcoin address, each with it’s own private key and store them in a digital wallet.
A Bitcoin wallet is a collection of address and corresponding private keys owned by one person. It helps to organize money and maintain privacy.
Bitcoin wallet program is a tool for common Bitcoin tasks, like, creating new Bitcoin address, sending bitcoins, backing up private keys etc.
Several other Bitcoin wallet program can be found here
There are some sites that are giving away small amounts of free Bitcoin, mostly for the newbies to try out. Here are two of these, TryBTC.com and Bitcoin Street Faucet. [No guarantee that they are still providing free coins when you stumble this blog post.]
Some wallet (for example, Electrum) ask for a seed, consists of 12 random words from you to generate Bitcoin address and private key. In case you lost your private key, it can be regained using the seed.
Bitcoin ledger is called Blockchain. Transactions are added in pool and about every 10 minutes, the pool transactions are bundled into a block and added to the blockchain.
transaction ID: 10110 address 1bl35lndlkas32l33 -2.0 BTC address 18scklshl13nnlk33 +2.0 BTC transaction ID: 10232 ....
The thousands of computer that collects transactions and add them to blockchain are called miners. Anybody can be a miner by running open source Bitcoin-mining software.
Why would anyone update the blockchain? You might not want to send/receive bitcoins for months, then why bother update?
For the Bitcoin system it is required to keep the blockchain up-to-date. Otherwise, if only person had the latest copy then she could manipulate the records.
If you add a blockchain you will be rewarded with all the transaction fees of that block.
Based on some probability a miner is chosen to add a block to blockchain. What is the purpose of using a lottery system to run Bitcoin?
When we engage in a transaction in $, we put our trust on a bank to confirm the transaction. The banker’s job is to announce that both party can trust each other and to update the ledger correctly.
In Bitcoin anyone can be a banker (miner) and then he announces to the network that the transaction is valid. Picking a person randomly helps to accomplish this.
There is a small chance that miner knows a person involved in a the transaction. To avoid this personal conflict interest, each miner also needs to confirm the previous transaction along with her’s.
To eligible for the next lottery, a miner needs the latest copy of the blockchain. It motivates then to add as many blocks to blockchain and update the blockchain.
The process is done automatically by Bitcoin-mining software, run by the community; no central authority exists to choose a winner. Thousands of miners constantly helping the transaction process.
Lottery system works as expected most of the time. Occasionally two miner finds a block at the same time and blockchain become forked, resulting two different branches.
For example, A and B both miners add a block to blockchain. The contents are identical but added by different miners.
Now in next 10 minutes, whichever these two branches take the next block would be the winning branch and other branch will be discarded, called orphaned.
The process is automatic and most of the users do not notice this forking, ignoring orphaned blocks and thus no negative impact on the use of Bitcoin.
The transaction that not yet added to blockchain has a depth 0, newly added block transactions have depth 1, immediate previous transactions have depth 2.
For low-value transactions it’s enough to forgo the transaction of depth 1. Merchants require higher depth confirmation before selling high-priced item. But how this confirms if the transaction is valid?
Suppose a super-villain try to double spend his bitcoins. He simultaneously sends same bitcoins to receiver address and another address owned by him.
This is called Double-Spending problem. To know more details follow the post.
When miners detect two transactions that spent same bitcoins, but sent to different address, they accept the first one they received and ignore the second.
It is impossible to add both transaction to the blockchain as one contradicts to the other.
The super-villain intent is for the merchant to delivery the product but transaction to be ignored and the other transaction to be added to blockchain.
This devious scheme is usually unsuccessful because many merchants use special monitoring software that can recognize two conflicting Bitcoin transactions.
Even simpler for the merchant to wait for 10 minutes until the transaction is added to blockchain. However, what if the super-villain has truly extra ordinary resources (many millions of $ of hardware) and orphaned the block!
To cope with this remote possibility, merchants who sell high value products typically wait until a transaction has depth 2 before delivering the product.
Total supply of bitcoin is capped at 21 million and it reached slowly over time. Miner reward is included small sum of newly minted bitcoins that increased the total supply.
Miners must find a certain winning number by generating numbers at random repeatedly to win (thus getting newly minted bitcoin). It creates incentive for the miners to use power computers.
Today, mining requires significant capital, expertise, inexpensive electricity. Similar to gold mining, at one time unearthing gold could be done by a person, now this is performed by large companies with expensive drills.
There are two parts of mining reward.
- First part is transaction fee. Transaction fees are typically few cents, but as each block contains hundreds or thousands of transactions, the reward is the sum of all transactions fees.
- Second part is newly minted bitcoins.
The second part is decreasing gradually over time.
- The first 210,000 blocks – on a 10 mins spanning – took 4 years to mine. It provided every miner 50 newly minted bitcoins per block + transaction fees.
- The next 210,000 blocks – (210,001 to 420,000) – reward miners 25 newly minted bitcoins per block.
- Thereafter, the reward drops to 12.5, 6.725 and so on.
This mining process is only source of new bitcoins. It is the reason no more than 21 million bitcoins will ever be in circulation.
Every 4 years the newly minted bitcoins rewarded per block halves.
Question: How can you ensure that only 210,000 blocks will be added every 4 years, it could be more (or less) based on the number of transactions and users?
Answer: Blocks are constrained by time, not transactions. A block can have any number of transactions, but one block will be added at every 10 mins. Due to increasing number of transactions in each block it requires a performant machine to process.
Transaction fees will grow as the Bitcoin user base grows. Eventually, transaction fees will be greater than newly minted bitcoin value.
At that point, Bitcoin network will be sustained entirely through transaction fees.
Don’t do this
Bitcoin wallet is pretty foolproof. However don’t do this,
- You created your first bitcoin wallet.
- You wrote down your address and private key.
- Well, what if you computer gets a virus that steal all your money?
- You thought that let’s DELETE the wallet, as you have written down private key.
- You money will go into back hole!!
What went wrong?
- A Bitcoin wallet is not just ONE address, instead it’s a LIST of Bitcoin addresses.
- When you send money from one address, all the money is used up of that address.
- Don’t worry yet!! your money is safe. Listen to the rest of the process.
- After sending, rest of the money moved to another address of the same wallet.
- But you won’t be able to recover the new address if you only have the private key of the old address.
Think in terms of ENTIRE Bitcoin Wallet, not individual Bitcoin address.
Some wallet apps have a feature called, Import private key – only experts should rely on this risky feature.
Storing Bitcoin safely
Storing Bitcoin safely means storing your private key(s) safely. Nothing can be protected with 100 percent certainty. Bitcoins can be stored extremely securely or loosely (due to technical failures)
Your bitcoins are stored in blockchain. Millions of copies of blockchain are distributed all over the world and no disaster can erase every copies, so you don’t need to worry about your Bitcoin address.
To access the bitcoins you require private key. And you need to store your private key with serious precautions. Bitcoin allows you to be your own bank. It comes with great responsibility.
Hot storage vs Cold storage
Hot storage refers to private keys are stored on a online device. Cold storage refers the storage not accessible via internet.
You can share your Bitcoin address with everyone, but storing the private key in cold storage provides better security. Remember, a hot storage can not become cold by going offline.
If a wallet company claims they store your private in cold storage but the fund can be moved to hot storage conveniently, it is a red flag. May be they are not using cold storage at all. Cold storage requires a person to access an offline computer physically.
Personal vs Hosted wallets
With a personal wallet, only you know the private keys.
With a hosted wallet, a third party knows your private keys and they do operations (send, receive, store) on your behalf, (unlike traditional bank who stores your cash in vault and won’t give you keys to open it)
With online personal wallet, they host the wallet software on their server but not the private keys.
The liability can be distributed using two private keys, one will be used by customer and other by online service. Both keys will be required for unlocking one address.
Safety, Security and Convenience
These 3 major factors are sometimes conflict with each other.
- Safety (preventing accidental loss of bitcoins)
- Security (preventing the theft of bitcoins)
- Convenience (ability to easily unlock bitcoins)
Most people use two storage methods: one for storing small amounts conveniently but less securely, another for large amounts less conveniently but very securely. Just like carrying small cash in pocket but most of the cash in bank account.
Storing small amounts
The following methods are for small amount that are convenient, easy to use and reasonably safe.
A sophisticated attacker can hack your traditional bank account. As remedy banks implement daily withdrawal limits and other measures.
Online hosted wallet services
Similar to online banking, no software installation is required. They manage all your transfers on your behalf.
But you do not have access to your private keys and you may loose your bitcoins if the service provider goes bankrupt.
You can access the service using username/password (so can a thief!). Make sure your provide require two-factor authentication.
Remember that, provider knows who you are, how much bitcoins you have and all transactions.
Online personal wallet services
Similar to Online hosted wallet services, but once the website loads locally on your device, no communication occur to server.
You can make transactions by using your private keys that never leave your device.
If the company goes bankrupt you will have a little bit of inconvenience but never loose your bitcoins.
Typically it’s a greater responsibility. If you loose your password to their service, they can not rescue it for you. Write down your password in a secure place.
Online personal wallet services provide better security but they may track usage patterns and other data other than private keys.
Personal hot wallet
Install the wallet software (open source) in your device and full responsibility is yours. It provides greater security but you are to protect your device from malware, viruses.
- Do not keep large amount in your hot wallet.
- Keep in mind that you computer can be stolen, destroyed, lost.
- Avoid cloud storage to store your private keys.
Storing large amounts
Disclaimer: If you are storing a large Bitcoin fortune, consider having a security expert audit your storage method.
To try out the following methods you can use open source Bitcoin wallet generator, Bitaddress. You can download the entire website and run it on offline computer.
To use this website you need to cursor over a box of letters and numbers to provide a random seed to generate Bitcoin address. It’s a challenge of CS to generate truly random numbers.
This is simplest and most popular cold storage method. Generate address and private in an offline computer and write down the keys in a paper and locked it away.
When you need to unlock, use import private key feature of any bitcoin wallet. Then immediately transfer the rest of the amount in another address and store the private key same way.
Paper wallets are one time use only. For each transaction you will create a new address and store a new private key.
Do not scan, take photo or any duplication method other than handwriting. Some photocopiers maintain records of every document they scan/copy.
Encrypted paper wallets
You write down an encrypted version of your private key in a paper. Most common encryption method used is BIP38 encryption.
To create BIP38 encrypted paper wallet, go to bitaddress site and shake your mouse until you generate enough random data for encryption.
Remember for encryption uses passphrases, not password. If you forget your passphrases you’ll permanently lose access of your bitcoins.
Store your paper wallet (written down encrypted private key) and passphrases into separate safe locations.
Offline transaction signing
In this process, you need two computers, one is online and other one is offline. Steps are follows
- Create an unsigned transaction from online computer.
- Copy the unsigned transaction to offline computer.
- Digitally sign the transaction in offline computer.
- Copy the signed transaction to online computer.
- Send signed transaction to the Bitcoin network.
To help out this process you can try a highly recommended wallet called Armony Bitcoin Client, which is open source and designed with maximum security in mind.
Fragmented private keys
A cryptographic trick named secret sharing, a Bitcoin private key can be divided into many fragments.
This is called m of n private key, where,
m = necessary fragments
n = available fragments.
For example, 3 of 5 private key means, a private key is split into 5 fragments and any 3 of them can be used to reconstruct it.
Several different cryptographic protocols are used for secret sharing, most popular is Shamir’s Secret Sharing method and several open source implementations of this method can be found on the Web.
This method uses multiple private keys rather fragments of single private key.
For example, 3 private keys are required to unlock an address, Or, any 2 of the 3 private keys can be used to unlock an address.
Multiple persons are required, not even CEO or President can solely able to unlock an address.
The Bitcoin hardware wallet
This is a small device that store your private keys in a way that no one can extract them from the device.
It works as a cold storage. Downside is, you need to purchase it and you may lose it.
Trezor received a lot of attention,
Trezor is like a paranoid chef who will never reveal his secret but cook for you anytime. You can use to any computers (good for traveler).
The bitcoin brain wallet
This method is recommended only for experts. Memorize your private key as passphrase. Then use the passphrase in an offline computer to retrieve your private key and address.
To be continued