Saturday, February 24, 2018

Cardano - New Smart Contract Platform

Another promising Smart Contract Platform - Cardano.

This is similar to Ethereum, Cardano is a smart contract platform however, Cardano offers scalability and security through layered architecture.

Cardano was conceptualized by Charles Hoskinson one of the co-founders of Ethereum.
While Ethereum is good as a smart contract platform, according to Hoskinson it is a second generation blockchain (I.e. It still needs evolution in terms of Scalability, Interoperability, & Sustainability).

Cardano is unique in asense that it is built on scientific philosophy and peer-reviewed academic research. All the engineering that goes into it has the ultimate goal of being “High Assurance Code”. 

You can read Cardano principles directly from the Cardano website.
https://www.cardanohub.org/en/philosophy/
 

More details to be added .. soon...

Keep Blogging..

Arun Manglick

Sunday, February 18, 2018

Ethereum Blockchain

Overview:

Ethereum.. in easy words - It is an open-source, decentralized network that allows smart contracts to be deployed on a blockchain with the use of ether. It’s a blockchain app (Dapp) platform that uses gas to run – in short. The network was created by Vitalik Buterin in 2015 although the white paper came into existence two years earlier.

Ethereum Blockchan.. in easy words -It is a distributed database that is constantly growing and therefore adding a new block to the chain every 17 seconds on average. Each new block contains records such as transactions and contracts.

More Detailed....

Ethereum is an open source Blockchain Platform that lets anyone to build/use decentralized applications that run on blockchain technology. It is easy to create new applications on the Ethereum platform, and with the Homestead release, it is now safe for anyone to use those applications.

Like Bitcoin, no one controls or owns Ethereum – it is an open-source project built by many people around the world. But unlike the Bitcoin protocol, Ethereum was designed to be adaptable and flexible. 

Ethereum is a Programmable Blockchain. Rather than give users a set of pre-defined operations (e.g. bitcoin transactions), Ethereum allows users to create their own operations of any complexity they wish. In this way, it serves as a platform for many different types of decentralized blockchain applications, including but not just limited to crypto-currencies.

Ethereum in the narrow sense refers to a suite of protocols that define a platform for decentralized applications. Like any blockchain, Ethereum also includes a peer-to-peer network protocol.

At the heart of it is the Ethereum Virtual Machine (“EVM”), which can execute code of arbitrary algorithmic complexity. The Ethereum blockchain database is maintained and updated by many nodes connected to the network. Each and every node of the network runs the EVM (Ethereum Virtual Machine) and executes the same instructions.   

Developers can create applications that run on the EVM using friendly programming languages modelled on existing languages like JavaScript and Python.

Ethereum Blockchain
  • Ethereum is distributed Cloud-based platform
  • Ethereum Blockchain can be used for:
    • Personal Finance
    • Self Executing Contracts
    • Gambling Sites
  • Ether is the underlying crypto-currency which powers Ethereum Network
  • For every code run, you need to pay Ether

How Etherum Works

Operational Details:
Whereas the Bitcoin blockchain was purely a list of transactions, Ethereum’s basic unit is the account. The Ethereum blockchain tracks the state of every account, and all state transitions on the Ethereum blockchain are transfers of value and information between accounts.
  • Accounts play central role in 'Ethereum'
  • Accounts can be created using Mist or Command Line
  • Each account is defined by pair of keys - Private/Public Key-Pair
  • Type of accounts:
    • EOA - Externally Owned Account
      • Controlled By Private Key
      • Has Ether Balance
      • Can Send Transaction
      • Has No Code but Can Trigger Contract Code
    • Contract Account
      • Has Ether Balance
      • Has Code - Code Exectuion is triggered by Transaction or Messages recieved from other Contracts
      • Controlled by their Contract code and can only be “activated” by an EOA
      • Note: The popular term “smart contracts” refers to code in a Contract Account – programs that execute when a transaction is sent to that account. Users can create new contracts by deploying code to the blockchain.
So human users control EOAs - because they can control the private keys which give control over an EOA, which in-turn control Contract accounts (governed by their internal code).

Contract accounts only perform an operation when instructed to do so by an EOA. So it is not possible for a Contract account to be performing native operations like random number generation or API calls – it can do these things only if prompted by an EOA. This is because Ethereum requires nodes to be able to agree on the outcome of computation, which requires a guarantee of strictly deterministic execution.

Payment:
Like in Bitcoin, users must pay small transaction fees to the network. This protects the Ethereum blockchain from malicious computational tasks. The sender of a transaction must pay for each step of the “program” they activated, including computation and memory storage. These fees are paid in amounts of Ethereum’s native value-token, Ether.

Mining Blocks: Proof of Work
These transaction fees are collected by the nodes that validate the network. These “miners” are nodes in the Ethereum network that receive, propagate, verify, and execute transactions. The miners then group the transactions – which include many updates to the “state” of accounts in the Ethereum blockchain – into what are called “blocks”, and miners then compete with one another for their block to be the next one to be added to the blockchain. Miners are rewarded with Ether for each successful block they mine. This provides the economic incentive for people to dedicate hardware and electricity to the Ethereum network.

Just as in the Bitcoin network, miners are tasked with solving a complex mathematical problem in order to successfully “mine” a block. This is known as a “Proof of Work”.

Any computational problem that requires orders of magnitude more resources to solve algorithmically than it takes to verify the solution is a good candidate for proof of work. In order to discourage centralization due to the use of specialized hardware (e.g. ASICs) used for mining (used in the Bitcoin network), Ethereum chose a Memory-Hard Computational Problem.

If the problem requires memory as well as CPU, the ideal hardware is in fact the general computer. This makes Ethereum’s Proof of Work ASIC-resistant, allowing a more decentralized distribution of security than blockchains whose mining is dominated by specialized hardware, like Bitcoin.

Ethereum Ecosystem:
  • Meta-Mask
  • Infura
  • Mist
  • Blockchain Nodes
  • Solidity
  • Remix
  • Web3.js
  • Truffle
  • Geth (Go-Ethereum)
  • Webpack, Browserify, NPM
  • Angular, Vue.js

Smart Contracts:
  • Helps in transforming something of values in secured way. E.g. Property, Shares, Insurance etc.
  • Provide Speed and avoid Middle man.
  • Ethereum Smart Contracts
    • Are Code that can send data, send value/money, interact with other smart contracts etc.
    • Having Smart Contracts (Programs) to Blockchain enables - Logic & Currency running in the same system. 
    • Thus enable lot of opportunities to  utilize - Escrow, Insurance, Crowd-Funding, Real-Estate etc.
  • E.g. Selling-Purchasing a Home/Property Transaction
    • Handling thru Blockchain and paying thru Bitcoin
    • All receipts will be stored in Virtual Smart Contracts
    • These transactions are witnessed by many nodes.
Advantages
  • Autonomy: I.e. Cannot be manipulated by 3rd Party/Middleware (e.g. Lawyer)
  • Trust: Smart Contracts are encrypted and stored in Shared Ledger (Blockchain)
  • Backup: Smart Contracts are backed-up and thus safe.
  • Safety: Smart Contracts are secure thru Crypto-graphy
  • Speed: Due no 3rd party involved, it speeds ups
  • Saves Money: No payments for 3rd party (Lawyer)
  • Accuracy: Code driven thus accurate
Code: Simple Smart Contract
pragma solidity ^0.4.0;
contract SimpleStorage {
uint storedData;

function set(uint x) public {
storedData = x;
}

function get() public constant returns (uint) {
return storedData;
}
}

Inheritance & Abstraction:
  • Allows Multiple Inheritance
  • Even if contracts inherit from multipe other contracts, only a single contract is created on Blockchain
  • Forward Kill - Two classes/contract having similar function
  • Forward Kill with Super - Resolve Forward Kill Issue with Super
Using Libraries 
  • This is similar to contracts
  • Deloyed once at an 'Address' and they are reused using 'DELEGATECALL'
  • As the compiler, cannot know where the library will be deployed these adddresses have to be filled into final 'Byte-Code' by a 'Linker'
Special Variables
  • block.coinbase(address)
  • block.number(unit)
  • msg.sender(address)
Code Debugger
  • Mix
  • Browser-Solidity
  • Solidity Studio

Meta-Mask: (Ethereum Browser Extension)
  • Install - 
    • Install plug-in and Set Password, you'll be given 'Seed'  to manage/restore your account vault in other browsers using Meta-Mask.
    • Your account vault is encrypted and stored locally in your browser. I.e No information touches Ethereum Servers
    • Meta-Mask suggest to use Ethereum enabled website to interact with Ethereum Blockchain 
  • Usage:
    • Choose Blockchain Nodes (either below)
      • Main Ethereum N/w
      • Ropsten Test Framework
      • Kovan Test Framework
      • RinkBy Test Framework (Preferred)
    • Create New Multiple Account
      • Send Ether b/w accounts
      • Switch between Accounts
      • Exort Private Key
      • Import JSON
  • Extension injects the Ethereum Web3 API into every website's javascript context, so that dapps can read from the blockchain.
  • Lets  user create and manage their own identities, so when a Dapp wants to perform a transaction and write to the blockchain, the user gets a secure interface to review the transaction, before approving or rejecting it.
  • Because it adds functionality to the normal browser context, MetaMask requires the permission to read and write to any webpage.
  • Implementation:
    • Go to (https://remix.ethereum.org)
    • Create New  Simple Contract and Submit to an account in Meta-Mask
    • Using Meta-Mask (which internally uses Infura) interact with Blockchain Nodes (e.g. RinkBy) to send Ether from one a/c to another
    • In case you need your own Blockchain Nodes, then download Geth/Parity/Mist
    • With Geth (Go-Ethereum): You can have your own Blockchain Nodes in Local Computer
    • With Mist - You can have your own Blockchain Nodes in Browser

RinkBy Test Framework (Preferred)
  • To work with this, you need to get test Ether
    • Go to https://www.rinkeby.io/#stats
    • In left pane, select 'Crypto-Faucet' for instructions
    • Copy Test Ether
    • Publish on Facebook/Twitter
    • Copy Publish link and paster here to request Ether

Mist: (Ethereum Wallet) (https://github.com/ethereum/mist)
  • Full Browser - Mist browser is the tool of choice to browse and use Ðapps.
  • With Mist - You can have your own Blockchain Nodes in Browser
  • One of the 'Ethereum Wallet' (Others are: MyEther Wallet, Hardware Wallet, Brain Wallet, EtherWall etc.)
  • Ethereum Wallet allows:
    • Manage your accounts
    • Send Funds
    • Check Last Transactions
  • Check this for the full guide - https://github.com/ethereum/mist

Blockchain Nodes
  • Are like My-SQL Clusters
  • Are like Geth/Parity/CPP-Ethereum
  • Runs at client side
  • All nodes implement Ethereum Protocol
  • Replicate all blocks from Blockchain locally

Solidity:
  • High Level Programming Language (like Javascript)
  • Needs Compilation 
  • Code Compiles to EVM assembly I.e. Byte-Code
  • Transaction send 'Byte-Code' (I.e. Data) to Blockchain
  • Mining Node - Adds 'Byte-Code' to the Block and assigns a new Address

Remix: (https://remix.ethereum.org)
  • Web-based Solidity IDE in the cloud
  • Compiles Solidity Code in Browser
  • Has Integrated debugger
  • Integrated Blockchain Simulator, where you can create
    • Distributed Applications
    • Solidity Contracts
    • Smart Contracts
  • File extension (.sol)
  • IDE has Left/Main/Right Tab
  • Right Tab comes with - Compile, Run, Settings, Debugger, Analysis, Support Menu Options

Web3.js & Eth.js
  • These are framework libraries
  • Interact with Blockchain from Browser
  • Used to communicate between Website and Contracts
  • Javascript Library to interact with local Blockchain Nodes (Javascript & HTTP-RPC)
  • Web3 works with:
    • RPC Calls:
      • Provide access to Ethereum Blockchain
      • Have Geth or CPP-Ethereum running
      • Have Ethereum-Test RPC (Local Blockchain)
      • In HTML/JS
    • HTML/Javascript
      • Use Web3.js
      • Connect to HTTP RPC - web3.setProvider(httpURL)
      • E.g. Commands
        • var coinbase - web3.eth.coinbase  (Get coinbase address)
        • var balance - web3.eth.getbalance(coinbase)
    • Interface
      • ABI: Application Binary Interface
        • var mycontract = web3.eth.contract(objarray)
        • var contractInstance = mycontract.at([address])
      • ABI Sample: Tells Web3.js how to interact with binary code on Blockchain

[
{
name:send,
const:false,
input: [{name:to, type:address}],
output:[]
}
]

Truffle & Embark 
  • Both are framework for Solidity & Blockchain Development
  • Truffle - 
    • Makes Ethereum Developer Life Easy
    • Has Development Environment
    • Has Contract Management
    • Has Integrated Testing Framework
    • Allows
      • Built-in Smart Contracts, Compilation, Linking, Deployment and Binary Management
      • Automated Contracts Testing with Mocha/Chai
      • Interactive Console for Direct Contract Negotiation
  • Truffle Boxes - Comes with Pre-Configured Web-Dev Environment (e.g. Truffle-React, Truffle-Webpack etc.)
  • Is a Asset Pipeline for Ethereum
  • It is as good as 'Ethereum Studio', except that code run on local Blockchain
  • Can be installed with Ethereum Studio
  • While development with Truffle, you also need 'Ethereum Client' which connects to Blockchain
    • Recomended Ethereum Client is 'Ethereum JS Test RPC' - Complete In-Memory Blockchain
  • Installation:
Angular, Vue.js, React or Redux

  • No Relation to do with Truffle or Solidity or Blockchain Development
  • Instead use Web3 JS Library to connect with Blockchain

Webpack, Browserify, NPM
  • Webpack - Bundler for JS. Packs many modules in few bundles
  • Browserify - Let us require modules in browser, by bundling up all dependency
  • NPM - Allows Package Download

Basic Ethereum:
  • Ethereum Blockchain is another Blockchain almost like Bitcoin Blockchain
  • Has Ether (Bitcoin BC has Bitcoin)
  • Has Miner (So as Bitcoin)
  • Currently 'Proof of Work' (Bitcoin currently has 'Proof of State')
  • Can Host Code/Logic and Run Applications directly on Blockchain (Bitcoin cannot)
  • I.e. Programs are executed by every participating Blockchain Nodes
  • Thus powerful and shared Infrastructure
  • Blockchain is accessed
    • Via Ethereum Nodes over Ethereum Protocol 
    • Also with Javascript JSON RPC (Over HTTP) to interact with Ethereum Nodes

  • Ether is the currency used in Ethereum
  • Ether is used to pay computation within EVM
  • Ethereum has a metric system of 'Denominations' used as units of Ether
  • There are three ways to get Ether
    • Ethereum Mining
    • Trade other currencies for Ether (like Livecoin, Gatecoin, BlueTrader etc)
    • Use 'Mist Ethereum GUI Wallet' having the ability to purchase ether using 'ShapeShift API'
    • Free Way: Read above bullet - RinkBy Test Framework (Preferred)
      • Go to https://www.rinkeby.io/#stats
      • In left pane, select 'Crypto-Faucet'
      • Copy Test Ether
      • Publish on Facebook/Twitter
      • Copy Publish link and paste here to request Ether
  • Ether Units

Geth - Go Ethereum Client
  • Geth is the the command line interface for running a full Ethereum Node implemented in 'Go'. 
  • It is the main deliverable of the Frontier Release
  • To install locally:
  • By installing and running geth, you can take part in the ethereum frontier live network and
    • Mine Real Ether - Using Javascript Console
    • Transfer Funds Between Addresses
    • Create Contracts And Send Transactions
    • Explore Block History
    • And Much Much More
  • To run Geth
    • Open Command Prompt
      • geth : This will start server
      • geth console
      • geth attach
    • Account creation
      • personal.newaccount("Myaccount")
      • personal.listaccounts
  • E.g. Send Ether between accounts
    • List Account - personal.listaccounts
    • Check Balance - eth.getbalance(eth.accounts[0])
    • Unlock account - personal.unlokcaccount(eth.accounts[0])
    • Transfer - eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1]}, value:web3.toWei(1,"ether")});
    • Above command retruns 'Transaction ID'
    • To check it's status 
    • To check transaction process, connect to MIST on Ethereum Wallet
Practical - Hands-On
  • Create, Compile, Test, Deploy and Interact with Deloyed Contracts
  • Create/Compile/Test:
    • Write Contract in IDE (e.g. Ethereum Studio, Notepad)
    • Unit Test - Manual (In Browser-Solidity), Mocha, Truffle
    • Verify - Test-Net
  • Deploy
    • Contract Deployment on Live-Chain
    • Link HTML/JS to Contract Address
    • Deploy HTML on Server
    • Easy 4 steps:
      • Browser - Executes/Render HTML/JS
      • HTML/JS - Using Meta-Mask, connects to Geth/CPP-Ethereum Node 
      • Geth/CPP-Ethereum Node - Using HTTP-RPC, connect/access to 'Ethereum Blockchain'
      • Ethereum Blockchain - Then connect/access deployed Contracts
  • Interact
    • Create contract using Solidity
    • Deloy (Copy-Paste) using 'Ethereum Wallet'
    • Interact with deployed contract using 'Ethereum Wallet'

Setup Blockchain in Private Network:
  • Goto Go-Ethereum - https://github.com/ethereum/go-ethereum/wiki/geth
  • Download Go-Ethereum client
  • Download Genesis Block JSON File
  • Create New Dir and start 'Geth'
  • Use 'init' command to create your own 'Block' (Custom Genesis Block) in a chain
    • geth -datadir <somelocation> init genesis.json 
    • Here somelocation refers to local path to downloaded Blockchain) 
    • Output - Create multiple folder (e.g. Chaindata, dapp, nodes etc) and add Block to local location
  • To check this private n/w transaction - Run local 'EthereumWallet.exe')
Keep Blogging...

Arun Manglick

Sunday, January 21, 2018

Crypto-Currency Overview

Please find top 10 Crypto-Currency - Video











































































































































































Hope this helps..

Arun Manglick

Blockchain & Trade Finance

Here we'll cover how Blockchain can help existing Trade Finance and it's underlying problems.

Trade Finance
  • Problem:
    • Trade finance today is a core business for all global, tier-one banks. Yet its 10 years behind modern technology.
    • However there are multiple issues:
      • Highly-Decentralized, Paper-Contract, Payment-Based Market
      • Manual and Document Intensive - Breaks in business cycles inhibit visibility and amplify challenges such as financial crime. 
      • DOUBLE SPEND Fraud - Trade finance FRAUD COSTS businesses an estimated $14 billion a year.
  • Solution:
    • Blockchain is uniquely positioned to rethink this "Highly-Decentralized, Paper-Contract, Payment-Based Market".
    • Blockchain will ensure address such challenges and operations using "Distributed Ledgers, Smart Contracts and Digital Payments" in Trade-Life Cycle.
    • BlockChain can Digitize Entire Workflow as well as providing a common workflow for all participants – Banks, Suppliers and Buyers.
    • I.e. Provide a common platform for businesses to Consolidate Workflows and Generate Smart Contracts and Digital Payments.
    • BlockChain will eliminate possibility of 'SUPPLIER FRAUD' in Trade Finance while participating in a private credit, transaction and payment network. 
    • BlockChain brings power of 
      • Blockchain-based Network Validation
      • Creating Digital Versions Of Transactions, 
      • Generating Smart Contracts, 
      • Centralizing underlying collateral information on a DISTRIBUTED LEDGER across a private network to increase efficiency, 
      • Eliminate “DOUBLE SPEND” Fraud
        • Blockchain enables participating banks to audit & access underlying collateral in a secure,distributed database, which reduces supplier fraud.
        • Enhance Data Quality and Reduce Settlement Time. 
          • Note: Double Spend: In trade finance, suppliers find a way to obtain financing from multiple institutions on the same transaction.
      • Reduced Costs and Fees - Payments transfers using digital currencies dramatically reduce third-party fees, saving billions dollars.
      • Digital currency to make the TRADE-FINANCE CYCLE more efficient
  • Implementation: Ethereum
    • Privately hosted Ethereum network will be best in building a custom trade finance blockchain.
      • Private Permissioned Ethereum - Enable CONTRACT VERIFICATION from other participants without compromising sensitive client identities. 
      • I.e Restricted to parties concerned, permissioned so that only authorized participating banks, rating agency, and suppliers have access).
      • Smart Contracts - 
        • Automatically check Contract Terms-and-Conditions, which include triggering of payments through a low-cost private digital payment system.
        • Manages TRADE-FINANCE WORKFLOW of Approvals & Automatically Transfers Payment once all terms-conditions have been met and digital signatures are collected.

What is Smart Contract on BlockChain:
  • Smart Contract lives on the Distributed Ledger accessible to all parties to read, update and verify information.
  • Smart Contract is data and code
    • Data stores the current state of various counterparties and components of the workflow
    • Code is triggered when key events occur such as documentation completion, validation of shipping, shipment arrival etc.
  • Such elimination of manual steps greatly accelerates the time window from Order-to-Ship and Receipt-to-pay
  • Common ledger on the block-chain is a highly reliable source of truth making reconciliations easy and verifications quick.

Hope this helps!!

Arun Mannglick

Friday, December 22, 2017

BitCoin Mining

What is BitCoin Mining:
  • People send bitcoins to each other over the bitcoin network all the time, but unless someone (Data Miner's) keeps a record of all these transactions, no-one would be able to keep track of who had paid what. 
  • The bitcoin network deals with this by collecting all of the transactions made during a set period into a list, called a BLOCK. 
  • Now it’s data miners’ job to confirm those transactions, and write them into a general ledger (A long list of blocks, known as the 'BLOCKCHAIN).

  • Thus Bitcoin mining is the process of adding transaction records to Bitcoin's public ledger of past transactions or blockchain. 
  • OR Bitcoin mining is the process by which transactions are verified and added to the public ledger, known as the block chain.
  • Or Bitcoin mining process involves compiling recent transactions into blocks and trying to solve a computationally difficult puzzle.  

  • The participant who first solves the puzzle gets to place the next block on the block chain and claim the rewards.  
  • The rewards, which incentivize mining, are both the transaction fees associated with the transactions compiled in the block as well as newly released bitcoin.
  • Anyone with access to the internet and suitable software & hardware (if you are not using pool) can participate in mining.  
    • Software - 
      • Standard Bitcoin Client - This enables to connect your computer to the network and enables it to interact with the bitcoin clients. (https://bitcoin.org/en/download)
      • Bitcoin Mining Software  - This is what instructs the hardware to do the hard work, passing through transaction blocks for it to solve.
    • Hardware - Bitcoin Mining Hardware (Three Categries)
      • CPU/GPU Bitcoin Mining
      • FPGA Bitcoin Mining
      • ASIC Bitcoin Miners

What is BitCoin Mining Process: 
  • As discussed above:
    • People send bitcoins to each other over the bitcoin network all the time.
    • The bitcoin network deals with this by collecting all of the transactions made during a set period into a list, called a BLOCK. 
    • These transactions/blocks are then confirmed and written to a general ledger.
    • This general ledger (used to explore any transaction made between any bitcoin addresses) is a long list of blocks, known as the 'blockchain'. 
    • Whenever a new block of transactions is created, it is added to the blockchain, creating an increasingly lengthy list of all the transactions.
    • A constantly updated copy of the block is shared with everyone who participates, so that they know what is going on.
  • But this general ledger has to be trusted and ensure that blockchain stays intact, and is never tampered with... This is where the MINERS come in picture.
    • Check this - Link
    • It’s Miners job to record & confirm those transactions (otherwise no-one would be able to keep track of who had paid what), and write them into a general ledger (A long list of blocks, known as the 'BLOCKCHAIN).
    • Process:
      • When a block of transactions is created, miners put it through a process. 
      • They take the information in the block, and apply a mathematical formula to it, turning it into something else. 
      • That something else is a far shorter, seemingly random sequence of letters and numbers known as a HASH. 
      • This hash is stored along with the block, at the end of the blockchain at that point in time.
    • Note: 
      • Miners don’t just use the transactions in a block to generate a hash. Some other pieces of data are used too. 
      • One of these pieces of data is the hash of the last block stored in the blockchain.
    • Because each block’s hash is produced using the hash of the block before it, it becomes a digital version of a wax seal. It confirms that this block – and every block after it – is legitimate.
    • I.e. Because each block’s hash is used to help produce the hash of the next block in the chain, tampering with a block would also make the subsequent block’s hash wrong too. 
    • That would continue all the way down the chain, throwing everything out of whack.

BitCoin Mining Competetion:
  • As discussed above: Miners 'seal off’ a block by recording/creating transation and creating hash/attaching block to BlockChain (General Ledger)
  • Well in this process - 
    • Multiple Miners compete with each other to do this, using software written specifically to mine blocks. 
    • Every time someone successfully creates a hash, they get a reward of 25 bitcoins, the blockchain is updated, and everyone on the network hears about it. 
    • That’s the incentive to keep mining, and keep the transactions working.
  • This hashing process is the competing factor here. Whosoever creates fast, wins the incentive.
  • Proof of Work - 
    • The bitcoin protocol deliberately makes  hashing process more difficult, by introducing something called ‘proof of work’.
    • The bitcoin protocol won’t just accept any old hash. It demands that a block’s hash has to look a certain way; it must have a certain number of zeroes at the start. 
  • Nonce:
    • Miners aren’t supposed to meddle with the transaction data in a block, but they must change the data they’re using to create a different hash. 
    • They do this using another, random piece of data called a ‘nonce’. This is used with the transaction data to create a hash. 
    • If the hash doesn’t fit the required format, the nonce is changed, and the whole thing is hashed again. 
    • It can take many attempts to find a nonce that works, and all the miners in the network are trying to do it at the same time. 
    • That’s how miners earn their bitcoins.

Mining Hardware - Bitcoin Mining Hardware (Three Categries)
  • By this stage, you will understand how bitcoin works, and what mining means. 
  • Now you need to set up a bitcoin mining hardware and start generating some digital cash.
  • There are two main things to think about h/w when choosing it:
    • Hashing Rate - MHash/sec, GHash/sec, and THash/sec - Higher your hash rate,  more likely you are to solve a transaction block.
    • Energy Consumption
  • Three main hardware categories
    • CPU/GPU Bitcoin Mining
      • CPU - Least powerful category of bitcoin mining hardware is your computer.
      • GPU - Enhance Bitcoin Hash Rate.  You can buy from two main vendors: ATI and Nvidia
    • FPGA Bitcoin Mining (Field Programmable Gate Array)
      • Is an integrated circuit designed to be configured after being built. 
      • This enables a mining hardware manufacturer to buy the chips in volume, and then customize them for bitcoin mining before putting them into their own equipment.
      • Range: 750 Megahashes/sec
    • ASIC Bitcoin Miners (Application Specific Integrated Circuits)
    • This is where the action’s really at. 
    • They are specifically designed to do just one thing: mine bitcoins at mind-crushing speeds, with relatively low power consumption.
    • Range 5-500 GHash/sec

Mining Software
  • Depending on which equipment you choose, you will need to run software to make use of it. 
  • Typically when using GPUs and FPGAs, you will need a host computer running two things: 
    • Standard Bitcoin Client - This enables to connect your computer to the network and enables it to interact with the bitcoin clients. (https://bitcoin.org/en/download)
    • Bitcoin Mining Software  - This is what instructs the hardware to do the hard work, passing through transaction blocks for it to solve.

Bitcoin Mining Pools
  • Important ques.. anyone interested in mining cryptocurrencies faces is whether to mine SOLO or join a 'POOL'. 
  • There are a multitude of reasons both for and against mining pools. 
  • Pool is always good for high hash rate distribution but you have to share the benefit.
  • Going solo means you won’t have to share the reward, but your odds of getting a reward are significantly decreased.
  • List of Mining Pools: https://www.litecoinpool.org/pools

Ref: 
Ref: Mining Profitability Calculator
Hope this helps.

Arun Manglick

Wednesday, August 16, 2017

What is Bitcoin ?

What is Bitcoin:
  • Bitcoin is a form of digital currency (Peer-to-Peer Currency or Crypto-Currency), created and held electronically. 
  • No one controls it. Bitcoins aren’t printed, like dollars or euros – they’re produced by people, and increasingly businesses, running computers all around the world, using software that solves mathematical problems. (Data Mining)
  • Bitcoin can be used to buy things electronically. In that sense, it’s like conventional dollars, euros, or yen, which are also traded digitally.
  • However, major difference to conventional money, is that it is decentralized. No single institution controls the bitcoin network.
  • There are an estimated 700 Bitcoin-like crypto-currencies 
  • E.g. Bitcoin, Ethereum, Ripple, Litecoin, Monero, Dash, Augur, NEM, Waves etc
  • Bitcoin uses Blockchain Technology and is just one implementation of Blockchain
  • Bitcoin has been called “digital gold,” and for a good reason

Who Prints/Generates it?
  • No one. This currency isn’t physically printed in the shadows by a central bank.
  • It's not like conventional currency based on gold or silver. Bitcoin isn’t based on gold; it’s based on mathematics (Bitcoin Mining). I.e. Bitcoin is created digitally (Thru Bitcoin Mining), by a community of people that anyone can join. Bitcoins are ‘mined’, using computing power in a distributed network. 
Well you can certainly buy bitcoins on the open market, but you can also mine your own if you have enough computing power. After covering your initial investment in equipment and electricity, mining bitcoins is simply a case of leaving the machine switched on, and the software running and making bitcoins.
  • Around the world, people are using software programs that follow a mathematical formula to produce bitcoins. The mathematical formula is freely available, so that anyone can check it.
  • The software is also open source, meaning that anyone can look at it to make sure that it does what it is supposed to.
The bitcoin protocol – the rules that make bitcoin work – say that only 21 million bitcoins can ever be created by miners.

Bitcoin Characteristics?
  1. Decentralized :The bitcoin network isn’t controlled by one central authority. Every machine that mines bitcoin and processes transactions makes up a part of the network, and the machines work together. That means that, in theory, one central authority can’t tinker with monetary policy and cause a meltdown
  2. Easy Set-up: Unlike conventional banks which takes enough time to simply open a bank account. Setting up a bitcoin address in seconds, no questions asked, and with no fees payable.
  3. Anonymous: Well, kind of. Users can hold multiple bitcoin addresses, and they aren’t linked to names, addresses, or other personally identifying information. However…
  4. Transparent:  Bitcoin stores details of every single transaction that ever happened in the network in a huge version of a general ledger, called the blockchain. The blockchain tells all. If you have a publicly used bitcoin address, anyone can tell how many bitcoins are stored at that address. They just don’t know that it’s yours.
  5. No/Minimal Charges: Your bank may charge you a £10 fee for international transfers. Bitcoin doesn’t.
  6. Very Fast: You can send money anywhere and it will arrive minutes later, as soon as the bitcoin network processes the payment.
  7. No Chargebacks/Fraud: Once bitcoins have been sent, they’re gone, no way of reversing the transaction. A person who has sent bitcoins cannot try to retrieve them without the recipient’s consent. This avoid frauds with credit cards, in which people make a purchase and then contact the credit card company to make a chargeback, effectively reversing the transaction.
  8. Safe & Secure: Bitcoin is a relatively private currency. In conventional transactions, you know where transactions came from, and where they’re sent. However here, no one knows who holds a particular bitcoin address. Also Bitcoin transactions, don’t require you to give up any secret information. Instead, they use two keys: a public key, and a private one. Anyone can see the public key (which is actually your bitcoin address), but your private key is secret.
  9. Not Inflationary: The problem with regular fiat currency is that governments can print as much of it as they like frequently (e.g to pay-off debt), and take newly created money and inject it into the economy, via a much-publicized process known as Quantitative Easing. This causes the value of a currency to decrease. I.e. If you suddenly double the number of dollars in circulation, then that means there are two dollars where before there was only one. Someone who had been selling/buyinh a chocolate bar for a dollar will have to double the price to make it worth the same as it was before, because a dollar suddenly has only half its value. This is called Inflation, and it causes the price of goods and services to increase and can decrease people’s buying power. Bitcoin was designed to have a maximum number of coins. Only 21 million will ever be created under the original specification. This means that after that, the number of bitcoins won’t grow, so inflation won’t be a problem. In fact, deflation – where the price of goods and services falls – is more likely in the bitcoin world.
Buying Bitcoin:
  • You can buy bitcoins from either exchanges, or directly from other people via marketplaces.
  • You can pay for them in a variety of ways, ranging from
    • Hard cash 
    • Credit/Debit cards
    • Wire transfers, or
    • With other cryptocurrencies
  • Credit Cards: In the US, Coinbase, and Circle offer purchases with credit cards.
  • Face-to-face, or 'Over-the-counter' (OTC): If you live in a city, prefer anonymity or don't want bank hassles, the easiest option to acquire bitcoin is to make a face-to-face trade with a local seller.
  • Bitcoin ATMs: Though a relatively new concept, bitcoin ATMs are growing in number. Different vendors including BitAccess, CoinOutlet, Genesis Coin, Lamassu and Robocoin.
Bitcoin Wallets:
  • After buying, you will need a place to store your new bitcoins. In the bitcoin world, they're called a 'wallet' but it might be best to think of them as a kind of bank account.
  • Depending on the security levels you want, different wallets will provide different levels of security. The main options are: 
    • Software wallet stored on the hard drive of your computer, 
    • Online, web-based service or
    • 'Vault' service that keeps your bitcoins protected


Who accept Bitcoins as Payment:

Bitcoins are taking over the crypto-currency marketplace. They’re the largest and most well-known digital currency. Many large companies are accepting bitcoins as a legitimate source of funds. They allow their online products to be bought with bitcoins. Here is the list of companies accepting BitCoin as payment. Below is snapshot of buying thru BitCoin at Expedia:




Hope this helps!!

Arun Manglick

Tuesday, August 15, 2017

What is BlockChain

What is Blockchain?

Blockchain is a software protocol (underlying internet transportation layer) that guides internet to how to send money or asset over internet (same as SMTP is a software protocol for sending/receiving emails over the internet). The way we need an email address to know (whether gmail/yahoo etc) to send emails, same is in Blockchain you need  digital wallet address to send Bitcoin or other Crypto Currency.

The blockchain concept originally was developed as an efficient and secure way to manage and register transactions made with crypto-currencies (for example, Bitcoin). Until now, it has mostly been of interest to individuals and financial institutions. With its Distributed-Ledger Technology (DLT) and Smart contracts, blockchain has great potential to benefit all companies across the global supply chain—not just banks. 

Blockchain is a public ledger of all Bitcoin transaction occurred.

A Blockchain is a distributed computing architecture where every network node executes and records the same transactions, which are grouped into blocks. Only one block can be added at a time, and every block contains a mathematical proof that verifies that it follows in sequence from the previous block. In this way, the blockchain’s “distributed database” is kept in consensus across the whole network. Individual user interactions with the ledger (transactions) are secured by strong cryptography. Nodes that maintain and verify the network are incentivized by mathematically enforced economic incentives coded into the protocol.

Bitcoin is just an application (uses Blockchain Technology) and is just one implementation of Blockchain like another crypto-currency applications.

Blockchain resolved the problem of 'Double Spent', where after Bitcoin is received in your wallet, it cannot be copied to make multiple copies. This is done using a 'Distributed Ledger' system (like a big giant Google Spreadsheet accessible to all).

More Technically:
  • Decentralized/Distributed DB and a Peer-to-Peer Network - that stores a registry of transactions.   
  • Offer Peer-To-Peer Transaction. I.e. No Third Party/Middle-Man is Involved
  • A type of distributed ledger. Well not all BC ledgers are distributed
  • Incorruptible digital ledger of economic transactions and can be programmed to record not just financial transactions but virtually of any value.
  • Information held on a blockchain exists as a shared — and continually reconciled — database. 
  • The blockchain database isn’t stored in any single location, meaning the records it keeps are truly public and easily verifiable. 
  • No centralized version of this information exists for a hacker to corrupt. 
  • Hosted by millions of computers simultaneously, its data is accessible to anyone on the internet.
  • Has no single point of failure.

Simple Example:
  • Google Docs/Sheets
    • Picture a spreadsheet duplicated thousands of times across a network of computers and this network is designed to regularly update this spreadsheet.
    • With Google Docs (or Google Sheets), both parties have access to the same document at the same time, and the single version of that document is always visible to both of them. It is like a shared ledger, but it is a shared document. 
  • Wallet:
    • BC potentially cuts out the middleman for these types of transactions.  
    • Personal computing became accessible to the general public with the invention of the GUI, which took the form of a “desktop”. 
    • Most common GUI devised for the blockchain are the so-called “wallet” applications, which people use to buy things with Bitcoin, and store it along with other crypto-currencies.

Peer-2-Peer Network:
  • A network of so-called computing “nodes” make up the blockchain.
  • Computer connected to the blockchain network using a client (e.g. Slack) performs the task of validating and relaying transactions.
  • Each client gets a copy of the blockchain, which gets downloaded automatically upon joining the blockchain network. 
  • Every node is an “administrator” of the blockchain, and joins the network voluntarily. However, each one has an incentive for participating in the network: the chance of winning Bitcoins.)

Typical BlockChain Transaction:
  • Request: Someone request a transactions
  • Broadcast: This transactions is broadcast to a P2P network, consisting of computers, called as 'Nodes'
  • Validation: This network of nodes, validates the transactions and user status using known algorithms.
  • (Note: A verified transaction can involve 'Crypto-Currency', contract, records and other information)
  • Combine (To form new block of data): Once verified, this transaction is combined with other transactions to create new block of data for the ledger
  • Add to Existing BlockChain - This new block of data is then added to existing BlockChain, and becomes permanent and unalterable
  • Complete - Transaction is marked complete




















Type of Blockchain:
  • Public Blockchain - 
    • Fully De-centralized
    • Anyone can read & download transaction
    • Ethereum and Bitcoin uses Public BC
  • Consortium Blockchain
    • Partially De-centralized
    • Controlled by pre-selected set of nodes
  • Private Blockchain
    • Centralized
    • Banks prefer Private Blockchain

Cryptocurrency /Crytographic Wallet:

Reference - Link 
A Cryptocurrency wallet is a secure digital wallet used to store, send, and receive digital currency like Bitcoin. Most coins have an official wallet or a few officially recommended third party wallets. In order to use any Cryptocurrency you will need to use a Cryptocurrency wallet.

Here you can compare Bitcoin, Ethereum & other Cryptocurrency Wallets - Link

Cryptocurrency itself is not actually “stored” in a wallet. Instead, a private key (secure digital code known only to you and your wallet) is stored that shows ownership of a public key (a public digital code connected to a certain amount of currency). There are various digital wallet in app-store. So your wallet stores your private and public keys, allows you to send and receive coins, and also acts as a personal ledger of transactions. Public key (32 bit) is individual's bitcoin address used to transfer bitcoin to another individual.

Below is a screenshot of Bitcoin Wallet.























We typically suggest using an official (or officially endorsed) wallet for any given coin. So, for Bitcoin we would suggest using the Bitcoin Wallet, and for Litecoin we would suggest Litecoin-QT.

There are a number of different types of wallets. Each “type” refers to what type of medium the wallet is stored on and whether or not the data is stored online. Some wallets offer more than one method of accessing the wallet – for instance, Bitcoin Wallet is a desktop application and a mobile app.

  • Desktop Wallet: The most common type of wallet. Typically an app that connects directly to a coin’s client.
  • Mobile Wallet: A wallet that is run from a smartphone app.
  • Online Wallet: An online wallet is literally a web-based wallet. You don’t download an app, but rather data is hosted on a real or virtual server
  • Hardware Wallet: Dedicated hardware that is specifically built to hold cryptocurrency and keep it secure. This includes USB devices. These devices can go online to make transactions and get data and then can be taken offline for transportation and security.
  • Paper Wallet: You can actually print out a QR code for both a public and private key. This allows you to both spend and receive digital currency using a paper wallet. With this option, you can completely avoid storing digital data about your currency by using a paper wallet.



Hope this helps!!!

Arun Manglick