WHAT IS BITCOIN?

//WHAT IS BITCOIN?

WHAT IS BITCOIN?

WHAT IS BITCOIN?

Bitcoin – so what it is really? We’ve been hearing a lot about bitcoin recently perhaps mostly because of the WannaCry ransomware rants. Bitcoin is a cryptocurrency not owned by any banks or any country.

Bitcoin was proposed by a software developer called Satoshi Nakamoto though the real identity of the developer is not yet known, Satoshi put forward an idea of an electronic payment system based on a mathematical proof. The goal was to produce a currency independent of any central authority, transferable electronically, almost instantly with very low transaction fees.

Well how can one use such a currency and even if it is possible how can we invest, buy or sell goods and services with bitcoin, these questions arise as soon as we decide to use bitcoin. To be on the safer side one must always observe the risks involved before any investment and understand underlying methodologies and procedures.

Bitcoin block is simply a file and it records Bitcoin transactions that haven’t yet entered any prior blocks. It is a permanent store of records unalterable or unremovable.

Bitcoin blockchain is sort of like a ledger but public and houses transactions that have ever been executed. As expected it is growing constantly after each completion of a block. It houses the history of all transactions that have happened since the Genesis block (First bitcoin transaction).

Bitcoin transaction is simply a process where one entity sends an amount to some other entity and thus a block is generated. It is a double hash of transaction bytes i.e. SHA256(SHA256(txbytes)) One can view transaction details in following link using transaction id:

http://btc.blockr.io/api/v1/tx/raw/{transaction_id}

This website Blockr.io provides developers an easy means to check transaction details. Transaction details can also be viewed using Blockchain.info.

Bitcoin address is a base58check (and yes not our usual base64) unique string which is a public entry point for sending coins for our use. Bitcoin address is made with the combination of public key hash encoded base58check and the Bitcoin network information.

Bitcoin networks basically are the platforms where one might be making a transaction. There are two types one being main net which houses real coins or Bitcoins with monetary value to them, other being the test net and as the name implies these are for testing purposes only. Even if we try to spend test net coins on main net that won’t work either as they have different Bitcoin network addresses and the test net coins don’t have monetary values associated with them.

Now we’ll check out more of the technical terms like keys why we use them and why they are needed.

Private key is the basic building block of a Bitcoin without it we virtually own nothing no value whatsoever. It is meant to be kept secret and just that we should know it is basse58check string also known as a WIF (Wallet Import Format). This key should be kept secret because without it we cannot spend any Bitcoin amount and if we lose it then we lose our money.

We can generate a Public key from our Private Key and then generate appropriate network based Bitcoin address from it.

Once we do get a public key we can get its hash and this aids in generation of a Bitcoin address also. We can generate a bitcoin address in any of the two ways i.e., by using either the public key or a public key hash.

Well then, what is a script pub key one might ask. It is a unique key which consists of flag strings containing information about bitcoin like comments or its signatures and the public key hashes in between them and likewise they can be generated from public key or a public key hash as well.

It is also a point worth noting that a script pub key determines a Bitcoin recipient and there is no such concept of a Bitcoin address in the block chain.

Below is a typical examples of the mentioned keys: –

Public Key: 02fc2e5ab52c89f3bfbbbd702254ab9fc7134173e5682b69bf740c3d0bf6bfc4ce
Hashed public key: 1b2da6ee52ac5cd5e96d2964f12a0241851f8d2a
Address: 13Uhw9BmdaXbnjDXiEd4HU4yesj7kKjxCo
ScriptPubKey from address: OP_DUP OP_HASH160 1b2da6ee52ac5cd5e96d2964f12a0241851f8d2a
OP_EQUALVERIFY OP_CHECKSIG
ScriptPubKey from hash: OP_DUP OP_HASH160 1b2da6ee52ac5cd5e96d2964f12a0241851f8d2a
OP_EQUALVERIFY OP_CHECKSIG

And the C# code to generate the above output (taken from Blockchain programming by Nicholas Dorrier):

Key key = new Key(); //generates a new private key.
 PubKey pubKey = key.PubKey; //gets the matching public key.
 Console.WriteLine("Public Key: {0}", pubKey);
 KeyId hash = pubKey.Hash; //gets a hash of the public key.
 Console.WriteLine("Hashed public key: {0}", hash);
 BitcoinPubKeyAddress address = pubKey.GetAddress(Network.Main); //retrieves the
 bitcoin address.
 Console.WriteLine("Address: {0}", address);
 Script scriptPubKeyFromAddress = address.ScriptPubKey;
 Console.WriteLine("ScriptPubKey from address: {0}", scriptPubKeyFromAddress);
 Script scriptPubKeyFromHash = hash.ScriptPubKey;
 Console.WriteLine("ScriptPubKey from hash: {0}", scriptPubKeyFromHash);

A bitcoin miner is an entity whose sole responsibility is to insert a transaction into blockchain once a miner manages to submit a valid block all transactions within that block are then confirmed. When a user performs a bitcoin transaction the amount that he might be sending is deducted from his balance as well as the mining fees. This fees determines how quickly the transaction is to be processed into the block chain.

We can synchronize the history of all blocks using a software know as wallet. What it does is to capture the history of all transactions since genesis block into our device and then we may send or receive coins and view transaction details. it comes in two flavors the main net and test net versions. (The link for downloading wallet software is provided in references section)

Nicholas Dorrier and Ádám Ficsór have come up with some great blogs on details regarding certain issues and features while using bitcoin and they can be looked up on code project. Nicholas has even written a book named as Blockchain programming in C# to facilitate programming bitcoins.

His work includes a bitcoin wallet indexer and a bitcoin server and client application which goes by the names of QBitNinja Server / Client and NBitcoin Indexer. The NBitcoin is a whole library of bitcoin redone in C# from C++ which aids in programming bitcoin apps with C# of course.

This is it for this blog I’ll be covering up more interesting topics in my upcoming blogs so please feel free to share your opinion and critiques for improvement.

Reference links:

https://programmingblockchain.gitbooks.io/programmingblockchain/content/

http://blockchainprogramming.azurewebsites.net/

https://blockchain.info/

http://www.investopedia.com/terms/b/block-bitcoin-block.asp

http://www.coindesk.com/information/what-is-bitcoin/

https://bitcoin.org/en/download

By |2018-10-25T08:02:44+00:00September 4th, 2018|Technology|0 Comments

About the Author:

Leave A Comment