Blockchain Frameworks — Part 2: Smart Contracts

In this and the next articles, I will make an explanation of the Blockchain technology and its most known frameworks

Antonio Payá González
Coinmonks
Published in
3 min readApr 3, 2020

--

INDEX:

  1. Part 1: Introduction
  2. Part 2: Smart Contracts
  3. Part 3: Blockchain Types
  4. Part 4: Ethereum
  5. Part 5: Hyperledger
  6. Part 6: IOTA
  7. Part 7: Quorum
  8. Part 8: Extra 1; Hedera Hashgraph
  9. Part 8: Extra 2; Libra

Part 2: Smart Contracts:

The initial use of the Blockchain technology was to make peer-to-peer monetary transactions without the need of a trusted third party.

Bitcoin is the best example.

Later, the Blockchain technology started growing and began to support the execution of smart contracts during transactions, adding much more functionality to Blockchain.

A Smart Contract is a program or a piece of code that runs in the Blockchain, and it is executed when a transaction occurs and its correct execution is enforced by the consensus algorithm of the network.

A contract can encode any set of rules represented in its programming language — for instance, a contract can execute transfers when certain events happen (e.g. payment of security deposits in an escrow system).

Accordingly, smart contracts can implement a wide range of applications, including financial instruments (e.g., sub-currencies, financial derivatives, savings wallets, wills) and self-enforcing or autonomous governance applications.

Example:

Smart Contract Example from https://hyperledger-fabric.readthedocs.io/en/release-2.0/smartcontract/smartcontract.html

In the previous example, we can see how two organizations, ORG1 and ORG2 have defined a car smart contract to query, transfer and update cars.

Applications from these organizations invoke this smart contract to perform an agreed step in a business process, for example to transfer ownership of a specific car from ORG1 to ORG2.

Ledger:

Centralized and Distributed Ledger

In a simple way, a Blockchain registers in an immutable way all the transactions that take place in a distributed ledger. Every node in the Blockchain network has an updated copy of that ledger.

A smart contract programmatically accesses two distinct pieces of the ledger:

  • A blockchain, which immutably records the history of all transactions,
  • A world state that holds a cache of the current value of these states, as it’s the current value of an object that is usually required.

Normally, Smart Contracts are mainly used to add, remove, obtain or update states in the world state as well as may query the immutable blockchain record of transaction.

Any action (either adding a new element or deleting an existing one from the world state) is in the Blockchain immutable record.

Smart Contracts Languages:

To develop a Smart Contract, depending on which Blockchain framework you are using, you will must code it in a specific programming language (although, currently multiples frameworks support several programming languages).

Some examples are:

Get Best Software Deals Directly In Your Inbox

--

--