Blockchain Tutorial

Blockchain Tutorial History of Blockchain Blockchain Terminologies Working of Blockchain Blockchain vs DLT Blockchain Versions Smart Contracts Blockchain Applications Cryptography Role of Bitcoin Miners Blockchain Hash Function Bitcoin Basic Component Blockchain Block Hashing How to Block Hashes Work in Blockchain Blockchain Pow Coinbase Transaction Key Concepts in Bitcoin Key Areas of Blockchain Blockchain Cryptocurrency Blockchain DAO Blockchain Double Spending Blockchain Bitcoin Cash Bitcoin Forks and SegWit Blockchain Merkle Tree Difference between Blockchain and Database Bitcoin Mitigating Attacks Who sets the Bitcoin Price Getting Started with Bitcoin How to choose Bitcoin Wallet Sending and Receiving Bitcoin Converting Bitcoins to Fiat Currency Ethereum 2.0 Blockchain Data Management Steps to become a Blockchain developer Smart Contracts Advantages of Blockchain in healthcare Decentralized Voting System using Blockchain Demur-rage currencies in Blockchain How can Blockchain Technology help IoT to reach its full potential Project Ideas on Blockchain for Professionals Consensus Algorithms in Blockchain Top 10 Blockchain Project Concepts Uses of Blockchain Obtaining Free Test Ethers What does a Blockchain contain What does the IT industry mean by BaaS Top Blockchain Project Ideas for Beginners

Cryptography

Introduction and Features of Cryptography DNA cryptography ECB Mode in Cryptography Elliptic curve in cryptography Format String Vulnerabilities in Cryptography and Network Security Kerberos in Cryptography and Network Security Blowfish Algorithm in Cryptography Data Encryption Standards Feistel Cipher in Cryptography HMAC Algorithm in Cryptography IP Security in Cryptography ElGamal Algorithm ElGamal Cryptosystem What is IDEA Advantages of Cryptography Role of Bitcoin Miners Blockchain Hash Function Blockchain Merkle Tree Blockchain Pow Coinbase Transactions Consensus Algorithms in Blockchain Converting Bitcoins to Fiat Currency Decentralized Voting System using Blockchain Demur-rage currencies in Blockchain Difference between Blockchain and Database Difference between Symmetric and Asymmetric Encryption Ethereum 2.0 Getting Started With Bitcoin How can Blockchain Technology help IoT to reach its full potential? How does Digital Signature Work Advantages of Blockchain in healthcare Basic Component of Bitcoin Bitcoin Forks and SegWit Bitcoin Mitigating Attacks Blockchain Bitcoin Cash Blockchain Block Hashing Blockchain Cryptocurrency Blockchain DAO Blockchain Data Management Blockchain Double Spending What does Blockchain contain? What does the IT industry mean by BaaS (Blockchain as a Service)? Who sets the Bitcoin Price? Working of Block Hashes in Blockchain How to Choose Bitcoin Wallet? Key Areas of Blockchain Key Concepts in Bitcoin Obtaining Free Test Ethers for the Rinkeby Test Network on the Ethereum Blockchain Project Ideas on Blockchain for Professionals Sending and Receiving Bitcoin Top 10 Blockchain Project Concepts Uses of Blockchain What do you need to do to become a Blockchain Developer? Blockchain Technology-Introduction

Smart Contracts in Blockchain

A Smart Contract (also known as a cryptocontract) is a computer software that manages the transfer of digital assets among parties directly and automatically under specific conditions. A smart contract works in the same way as a traditional contract, but with the added benefit of automated enforcement. Smart contracts are computer programmes that function precisely how their creators intended them to (coded, planned). In the same manner that normal contracts are enforced by code, smart contracts are enforced by code.

Introduction and History

Nick Szabo, a lawyer and cryptographer, identified the use of a decentralised ledger for smart contracts in 1994. He proposed that these contracts be written in code, which could be kept and copied on the system and overseen by the Blockchain's network of computers. Smart contracts may also aid in the transfer of digital assets between parties in specific circumstances.

What exactly are smart contracts and how do they function?

A smart contract is simply a digital contract with both the Blockchain's security code. A smartcontract has information & permissions expressed in code that needs a precise sequence of actions to trigger the agreement of the smart contract's conditions. It can also contain time limits, which can lead to contract deadlines.

This contract is decentralised, transparent, immutable, & affordable since it is integrated in the Blockchain. The Blockchain contains the address of every smart contract. The contract's address can be used to interact with it if it has been broadcasted on the network.

The Bitcoin network was the first to use smart contracts for transferring value from one person to another. Basic criteria are used in the smart contract, such as ensuring that the money to be sent is truly accessible in the sender account. Later, the Ethereum platform arose, which was seen as more powerful due to the developers'/programmers' ability to create bespoke contracts in a Turing-complete language. It's worth mentioning that the Bitcoin network's contracts were built in a Turing-incomplete language, limiting the usage of smart contracts on the network.

A fundamental principle underpins smart contracts. They are carried out using basic logic, such as IF-THEN:

  • THEN the cash (in cryptocurrency) will be sent to you IF you send me the object A.
  • THE A item will be delivered to you IF you transmit a particular number of digital assets (cryptocurrency, for example, ether, Bitcoin).
  • THEN, IF I finish the work, the digital assets specified in the contract will be given to me.

Note: To integrate the time element in smart contracts, we may include a WHEN restriction. As can be seen, smart contracts aid in the establishment of conditions that must be met in order for the contract agreement's obligations to be carried out. You may insert as many IF or THEN clauses as you like in your smart contract.

Specifications

  • Trust: Because the smart contract is incorporated on the Blockchain, it cannot be lost.
  • Accuracy: Smart contracts are accurate to the extent that they have been correctly coded for execution by a programmer.
  • Speed: Smart contracts employ software code to automate functions, lowering the amount of time it takes to navigate through all of the human contact procedures. The time it takes to accomplish all of the jobs is the same as the time it takes for the smart contract's code to run because everything is coded.
  • Backup: The shared ledger is maintained by each node in the Blockchain, giving the best backup option.
  • Autonomy: There is no need for a 3rd party. You draught the contract, which is then shared among the parties. There are no intermediaries involved, which reduces bullying and gives the trading parties complete control. Furthermore, all nodes on the network maintain and execute the smart contract, eliminating any control power from every single party.
  • Safety: Cryptography can guarantee that the resources are secure. Even if the encryption is broken, the attacker will have to alter all of the blocks that follow the one that was changed. Please keep in mind that this is a very tough and time-consuming process that is almost difficult for a small and medium business to do.
  • Savings: Because smart contracts eliminate the need for intermediaries, they save money. Furthermore, there is little to no money spent on paperwork.

Use Case Examples

  • It's all about real estate. Reduce the amount of money given to the middleman and divide it among the persons directly engaged. For example, a smart contract to transfer ownership of an apartment when a certain amount of resources is paid to the seller's account (or wallet).
  • In a Blockchain, a smart contract may be used to maintain track of car upkeep and ownership. For example, a smart contract may mandate car maintenance every six months, with failure to do so resulting in the suspension of a driver's licence.
  • The music business might use a Blockchain to track song ownership. When a piece of music is used commercially, a smart contract may be stored on the Blockchain, and royalties can be credited to the owner's account. It's also useful for resolving ownership disputes.
  • Governmental elections are taking place. It will be incredibly difficult to decode the voter address and modify the vote once the votes are saved on the Blockchain, giving people more confidence in the system.
  • Management. Using the Blockchain application in management, many late or postponed decisions may be simplified and automated.Every decision is open and transparent, and any person with power may see it (an application on private Blockchain). A smart contract may, for example, be used to trigger the delivery of raw materials when 10 tonnes of plastic bags are produced.
  • Using smart contracts to automate healthcare payment procedures can help avoid fraud. Every treatment is recorded on the ledger, and the smart contract may then determine the total of all transactions. The patient cannot be released from the hospital until the bill is paid, according to the smart contract.

Use cases/applications

  • Other contracts will benefit from your utility. Consider a smart contract that transfers money to party A after 10 days. After 10 days, the above-mentioned smart contract will execute another smart contract that confirms if the required funds are available in the source account (let's call it party B).
  • Allow the introduction of 'multi-signature' accounts, in which assets are only transferred when a specific percentage of individuals agree.
  • Keep track of application data like domain registration and membership records.
  • Organize parties' agreements.

Added benefits –

  • Keeping track of things. The Blockchain stores all contract transactions in chronological order and provides access to the full audit trail. The people engaged, on the other hand, can be encrypted for complete privacy.
  • Direct communication between parties. Smart contracts do away with intermediaries, allowing for direct and transparent interactions with clients.
  • Detection and reduction of fraudulent activities. The Blockchain is where smart contracts are kept. Forcefully altering the Blockchain is extremely difficult due to its computational requirements. In addition, nodes in the network may identify smart contract violations, and such attempts are labelled invalid and not kept in the Blockchain.
  • Failure resistance. Because no single person or entity controls the digital assets, there is no one-party dominance or circumstance of one party backing out because the platform is decentralised, and the contract stays intact even if one node disconnects from the network.
  • Increased confidence. Contracts are automatically implemented and enforced. Furthermore, these agreements are unbreakable and incontrovertible since they are unchangeable.
  • It helps you save money and resources. Smart contracts remove the need for middlemen (brokers, attorneys, notaries, witnesses, and so on), resulting in lower costs. It also removes paperwork, which saves both time and money.

Limitations/Disadvantages

  • Due to a lack of international laws, Blockchain technology (and associated technologies such as smart contracts, mining, and use cases such as cryptocurrencies) is difficult to control.
  • Smart contracts are also difficult to execute since they are still a novel idea, and study is ongoing to fully comprehend the smart contract and its ramifications.
  • They're virtually unchangeable. A new contract must be created and deployed on the Blockchain whenever there is a change that has to be integrated into the contract.

Platforms that employ smart contracts - Smart contracts may now be used on a variety of platforms. Here are a few examples: Today's cryptocurrencies include Ethereum and Bitcoin.