Thursday 10 May 2018

Blockchain Technology : Smart Contracts

Origin of Smart Contract

Smart contract concept was developed by "Nick Szabo" in 1994 with the goal of bringing practices of contract law and practice to  design the electronic protocols between strangers on the Internet. Bitcoin emerged the use of contracts/blocks on a blockchain. Ethereum has made smart contracts operational along with the facility of ready made templates for various purposes. Smart contracts in general can be used to form any type of agreement that consists of specific & precise conditions and outcomes.

What is Smart Contract ?

  • Smart Contract is a set of rules in the form of programming  code that adds layers of information onto digital transactions being executed on a blockchain. 
  • Smart contracts are digital programs or contracts which may be executable or kick starter. They execute the instructions given to them automatically.
  • To process a Smart Contract a blockchain is required and Contracts can be encoded on any blockchain.
  • Blockchain is a virtual machine and it runs a smart contract.
  • Smart contract is the basic unit of programming a blockchain for business purposes.
  • Smart contract creates assets or tokenize existing assets on a blockchain.
  • A smart contract enforces terms of the agreement through programming crypto-graphically.
  • Smart contracts ensures a specific set of results. 
  • Smart Contracts are formed with the combined work of two parties "Software Developer" and "Lawyer". So a need for litigation is not required for that.
  • Smart Contract is an agreement between all bodies involved in a transaction that holds everyone involved responsible for their role. 
  • Smart contracts facilitate to perform required transactions without any involvement of 3rd party.
  • All the transactions performed by a smart contract are track-able this enables to maintain transaction history for records. Such transaction can not be reversed. 
  • Instead of simply exchanging digital tokens for a service or a product, smart contracts facilitate with more complex transactions through them. 
  • Benefits of using smart contracts instead of traditional contracts are increased speed, efficiency & trust among the parties.  

 

How Smart Contract Works ?

Smart contract is formed with the consultation of lawyer on legal terms and with the help of a programmer who code those terms and write set of rules in the form of program. 
That set of rules i.e. smart contract is then placed in a block of a blockchain. 
This contract is spread and copied multiple times between the nodes of a blockchain. Now whenever a smart contract get triggers by a request on blockchain then the programs of smart contract gets executed and perform actions as per written terms and conditions. The program verifies implementation of the rules by itself.

Smart Contract Example

Payment settlement after a job is complete. 
Assuming that their are two parties in which a payment has to made based on a job. In this case a smart contract plays an automatic and trustworthy role. A legal contract is made between a client and vendor based on various terms and conditions. Payment is made based on these terms. On start of the contract full payment is made by the client and it goes to an intermediate wallet. This payment will be release to vendor on completion of the job and only when both of the parties agrees. If any of the party disagrees and terms of the contract are not full filled the wallet payment goes back to client automatically.

 

Anatomy of a Smart Contract

Elements of a contract are mutual consent, consideration, capacity, and legality. 

Formation of Smart contracts depends on the information of
- Various parties involved,
- Their obligations,
- Time, 
- Terms and Conditions,
- Host that will execute contract code,
- Contract Outcomes

Three main stages during the formation of a smart contract -
First : Translating the terms of the contract into code. 
2nd : Ensuring the mutual consent from all parties for the correctness & outcomes of the code written for contract.
3rd : Execution of the code in impartial way so that results are always trustworthy and precise.

Coding Structure of a Smart Contract
A contract is similar to a class. A contract code is consist of state variables, functions, function modifiers, events, structures, and enums. It supports inheritance and polymorphism concepts of Object oriented programming. 


Example : Structure of Smart Contract Program


.
Code for a contract of simple Cryptocurrency








Solidity is a contract-oriented programming language for writing smart contracts. It is used for implementing smart contracts[2] on various blockchain platforms. It was developed by Gavin Wood, Christian Reitwiessner, Alex Beregszaszi, Liana Husikyan, Yoichi Hirai and several former Ethereum core contributors to enable writing smart contracts on blockchain platforms such as Ethereum.







Thursday 3 May 2018

Block Chain Technology : Advantages and Disadvantages


Block-chain. What is Block Chain Technology ?
The concept was brought in to existence within the context of a  crypto currency Bitcoin in 2009. But innovative engineers have envisioned many other ways for distributed ledger technology to benefit the world. 

It will have some very profound applications for society over the years to come. Companies like Microsoft Azure has already announced Coco Framework for enterprise block-chain networks and Ethereum has launched it block chain app platform years ago. Amazon, Microsoft Azure and IBM Bluemix rolling out Blockchain-as-a-Service (Baas) from the cloud.
https://blog.antheminfotech.com/2018/04/block-chain-technology-introduction.html

The block chain technology cannot be said exactly a revolution. But it can be compared to the nature of a tsunami which slowly advances and gradually envelops everything along its way by the force of its progression.
The world is preoccupied with dissecting, analyzing and prognosticating on the block chain's future. Technologists, entrepreneurs are in dilemma if it is to be considered panacea or poison. Lets look at few pros and cons of this technology below that may help to make up their decision.


Disadvantages of Block Chain Technology

  • Being new its less Adaptive. Every new technology that is confusing, fast-moving and disruptive is going to be controversial. Its adaption will be met with resistance because it is an extreme change. This technology is not mature enough to be directly trusted.
  • Lack of regulations. Block chain startups are suffering from a crippling, archaic, and antiquated state regulatory system - and it's driving innovation abroad.
  • Low Performance. Performance issues due to its mechanisms of signature verification, consensus and redundancy. It makes block chain slow data processor than centralized database approach.
  • Higher Energy Consumption. Every node runs a consensus to ensure the zero downtime, fault tolerance and immutability of data on it. Every node repeats it, which is wasteful and requires money and energy. Mining is required to support the block chain network. It requires resources like costly machines and electricity. Due to lack of required electricity only 60% of mining is done in China.
  • Complexity and lesser resources. The block chain concept is complex to understand and there is a small community of developers at present. So it becomes difficult for inverters to trust the credibility of new developing party.
  • Lack of exposure. Being new and less exposed for everyone existing market finds it of limited use. Learning of new technology and its adaption takes extra time.
  • High development & setup cost. No doubt block-chain offers various time saving and cost effective mechanisms but initial development and setup cost of software developed over this technology is comparatively high. 
  • Upgrade requires funds. To update the existing technology investments are required.
  • 404 errors. Errors occurs when the block-chain network is not properly maintained. So incentives needs to be distributed to keep the flame lightened. 
  • Complexity in coding. Developing decentralized apps are not so easy and it is difficult to comprehend the written code. Smart contracts can't call external APIs. 
  • Memory Issues. Size of block with time gets so huge which takes lots of space on block chain network. In some cases i.e. bitcoin it took 100 gigabytes of space and on the other hand 200 Gigabytes space in Ether block chain. 

Advantages of Block Chain Technology

  • Disintermediation. It has made it possible for humanity to reach a consensus about a piece of data without having any authority to dictate it. It shifts in power from the centers to the edges of the networks.
    It offers disintermediation of 3rd party organizations to avoid reuse of the important information about users for other purposes. With the decentralization of trust, we will be able to exchange anything we own and challenge existing trusted authorities and custodians that typically held the keys to accessing our assets or verifying their authenticity.
  • Mutuality of database. An opportunity to mutuality of database infrastructure across entities within financial services. That  translates it into is an enormous cost-saving, risk-reducing, and capital-enhancing opportunity. 
  • Secure Identity. In block chain people can exchange data without knowing the identity of each other in a secure way. Trust, value distribution and security layer enables it to reach above goal.
  • Control shift. Most of the technologies tend to automate employees on the periphery doing menial tasks, but on the other hand block chain technology automates away the center. Example : Instead of putting a taxi driver out of a job, block chain puts Uber out of a job and lets the taxi drivers work with the customer directly.
  • Trust by proof. It replaces third-party trust with mathematical proof that something happened.
  • Data Ownership. A block chain based medical records system can safeguard patient data and allow for improved process between doctors and hospitals and it can also give patients more ownership over their own records.
  • Time saving through Disintermediation. It is going to change the way that our financial world operations. It takes 1-3 days to settle a payment due to involvement of 3rd party. The direct bank to user verification will cut the cost and time in the process. It reduces the post settlement duration from days to minutes. Transactions happens instantly , however it may take time to process and approve the transaction.
  • Proof of work and Hashing mechanisms makes a block chain immutable and secure. Data in the block chain can't be altered or deleted.
  • Block chain makes things transparent, democrat, secure and efficient.
  • The block chain technology allows users to use it where there's record keeping, everything where there's trust around record keeping and it allows us to make that digital, immutable, permanent, decentralized  and global.
  • It saves time, saves money and saves effort to manage a centralized database.
  • Block chain is held in the cloud by all the parties involved. It's cryptographically so strong that it can not be broken. Example : To take over the Bitcoin you would have to compromise its  entire network.
  • Block chain is an asset normalization platform that can enable a new liquidity in transactions creating large networks of usage and value effects with benefits in speed, cost, quality  or outcomes.
  • It offers permanent and a secure database for ages. To be noted,  Block chain is not a Database management system. 

With this i would like to summarize my post here. New technology bring along both new benefits and drawbacks. At least we should listen about it and give it a try. Humanity has always worked for making the things easy, useful and advance.

I will keep sharing about block-chain technology in upcoming posts. Keep reading, keep gaining. 

You may know more about Blockchain Technology through below articles
Blockchain Technology : Introduction
Blockchain Technology : Smart Contracts

Cheers for happiness !

How to get code from a published ASP.Net build where we don't have source code?

If you have ever lost or misplaced your source code for an ASP.Net web application, you might wonder if there is a way to recover it from th...