Block Chain: WEEK:1: Perspective
Block Chain: WEEK:1: Perspective
WEEK:1
Perspective:-
ConsenSys is a company that operates in many countries where the largest
blockchain company right now in the world by many accounts, and one of the
fastest growing software companies in the world, and by many accounts, the
largest blockchain company in the world.
Definition:-
What is a blockchain?
Blockchain is about enabling peer to peer transaction in a decentralized
network.
Validation, verification, consensus, and immutable recording lead to the trust
and security of the blockchain.
It was a technology originally created to support the famous
cryptocurrency, BitCoin.
Structure:-
The set of all UTXOs in a bitcoin network collectively defined the state of the
Bitcoin blockchain. UTXO's are referenced as inputs in a transaction. UTXO's
those are also outputs generated by a transaction. All of that UTXO's is in a
system, are stored by the participant nodes in a database.
BEYOND BITCOIN:-
Bitcoin blockchain is open-source and the entire code is available on the
GitHub.
Among all the cryptocurrencies Bitcoin supports an optional and special
feature called scripts for conditional transfer of values.
Bitcoin supports an optional and special feature called scripts for conditional
transfer of values.
Ethereum Blockchain extended the scripting feature into a full-blown code
execution framework called smart contract.
A smart contract provide the very powerful capability of code execution for
embedding business logic on the blockchain.
Three major types of blockchains emerge from Bitcoin foundation.
1. Type one deals with the coins in cryptocurrency currency chain.
Example, Bitcoin.
2. Type two supports cryptocurrency and a business logic layer supported
by code execution.
Example, ethereum.
3. Type three involves no currency but supports software execution for
business logic.
Example, The Linux Foundation's Hyperledger.
WEEK: 2
Smart Contracts:
Bitcoin blockchain is the mother of all blockchains
Around 2013, a framework for code execution was introduced by Ethereum
Founders. The centerpiece and thrust of this Ethereum blockchain is a smart
contract.
A smart contract is a piece of code deployed in the blockchain node.
Execution of a smart contract is initiated by a message embedded in the
transaction.
An auction bidding smart contract could execute this logic. If the age of a
bidder is greater than 18 and the bid is greater than the minimum bid, then,
accept the bid, or else reject the bid.
Structurally, a smart contract resembles a class definition in an object oriented
design. It has data, functions or methods with modifiers public or private, along
with getter and set of functions. Specific programming languages have been
designed for coding smart contracts. Solidity is one such language.
Where does the code in the smart contract get executed? Where is it located in a
node?
We need a computational infrastructure to execute any arbitrary code. Every
node in Ethereum network should be able to execute the code irrespective of
that underlying type of hardware or operating system.
A smart contract written a high level programming language is translated into
EVM byte code, and then, deployed on the Ethereum Virtual Machine, EVM.
First line with pragma indicates the version of the solidity language. The
contract's name is in the first line. This particular contract is for one integer
storage. The data for the integer is defined with type a name, uint
StoredData. Two functions are defined for writing and reading the data.
Set and get. Code execution.
Summarizing, smart contracts add a layer of logic and computation to the trust
infrastructure supported by the blockchain. Smart contracts allow for execution
of code. Enhancing the basic value transfer capability of the Bitcoin blockchain.
The code for this smart contract is written in a high level language like Solidity
and compiled into byte code. The code for the smart contracts is executed on a
special structure known as Ethereum Virtual Machine.
Ethereum structure:
Ethereum formally introduce the concept of an account as a part of the protocol.
The account is the originator and the target of a transaction.
There are two types of accounts, Externally Owned Accounts and Contract Accounts.
Externally Owned Accounts or EOA are controlled by private keys.
Contract Accounts or CA are controlled by the code and can be activated only by an EOA.
An externally owned account is needed to participate in the Ethereum network.
It interacts with the blockchain using transactions.
A Contract Account represents a smart contract.
Every account has a coin balance.
Ethereum operations
he input needed for this execution
is extracted from the payload field of the transaction.
Current state of the smart contract is the values of the variables defined in it.
The state of the smart contract may be updated by this execution.
Results of this execution is told in the receipts.
A blockchain maintains both the state hash and the receipt hash.
All the transactions generated are validated.
Transaction validation involves checking the time-stamp and
the nonce combination to be valid and the availability of sufficient fees for execution.
Miner nodes in the network receive,
verify, gather and execute transactions.
The in-work smart contract code are executed by all miners.
Validated transactions are broadcast and gathered for block creation.
The consensus protocol used is a memory-based rather than a CPU-based proof of work.
WEEK-3
Since the same key is used for encryption and decryption, it is a symmetric key
Example, Ceasar encryption is the simplest one with alphabets of a message
are shifted by a fixed number, and this number is called the Key. In this
example F is a function defined by shift by three in alphabet. Consider, "Meet
me at the cinema." You shift by three the S key value of every letter to encrypt
it, and your receiver decrypts it using the same three as the key. Shift the other
way every character to view the original message. Three is the key in this trivial
example.