Showing posts with label Ethereum. Show all posts
Showing posts with label Ethereum. Show all posts

Tuesday, 6 November 2018

Ether Transfer

For a simple ether transfer,  the amount of transfer, target address, along with fees or gas points.

The amount in the fees is transferred to the respective accounts.




An Ethereum node represents the computational business unit or individual participant in the blockchain network.

An Ethereum full node holds the software for transaction initiation, Validation, Mining, Block Creation, Contract Execution, and EVM ( Ethereum Virtual Machine)

The smart contract is Object Oriented code written in a programming language like Solidity.
The Smart Contract is compiled and deployed to EVM.

When the target address in a transaction is a smart contract. The execution code corresponding to the smart contract is executed on the EVM. The input required (if any) to execute the smart contract is extracted from the payload of the transaction.

State of the smart contract may be changed by this execution. Results of the executions are stored in the receipts.
A blockchain maintains both, the state hash and the receipt hash.

All the transactions in the blockchain are validated. Validation includes the timestamp and the nonce of the transaction and also that the required fee is available in the account.

Miner nodes in the network receive, verify, gather and execute transactions. The invoked smart contract code are executed by all miners. Validated transactions are broadcasted and gathered for block creation. The consensus protocol used here is a memory based rather than a CPU based PoW (Proof of Work)

Who pays for verification, validation, and consensus?
The incentive model in the next lesson will answer this question.

Ethereum

What is Ethereum?
  1. Just like the Bitcoin, Ethereum is decentralized — no one regulates or owns it — it has it’s own cryptocurrency or “fuel” called “Ether” which acts in the same way bitcoin does.
  2. However, Ethereum has a few innovations worth noting. It is the second application on its blockchain infrastructure called a “smart contract”, it’s own virtual machine which powers the memory and applications on the network called the “ethereum virtual Machine”, and it's own programmable language called “Solidity”.



Solves issues of Scaling or Privacy in public networks.

Smart Contracts: a piece of code deployed in a blockchain node and are Centerpiece of the Ethereum.

Execution of the smart contract is initiated by a message embedded in the blockchain transaction

Ethereum may carry out more sophisticated transactions than simple subtraction or addition transactions as we saw in bitcoin.

E.g.: conditional transfer
Some evaluations
More than one signature for transfer of assets
OR it may involve waiting for a specific day or time

  1. Smart contract code resembles the structure of OOP
  2. It has data, functions or methods with modifiers and structure
  3. Many languages have been designed for running Ethereum Smart Contracts
  4. SOLIDITY is one such language


EVM : Ethereum Virtual Machine

Bitcoin VS Ethereum



  
Ethereum introduced the concept of the account, as part of the protocol. Accounts are the basic units of the Ethereum protocol. The account is originator as well as the target of the transaction.
Ethereum involves a transfer of value, data or code.

EOA - Externally owned accounts
Controlled by private keys
EOAs are must needed to participate in the Ethereum Blockchain

They interact with the block chain using transactions.

Participant Node can send transaction for Ether transfer or to invoke smart contract or both
Both type of transactions require some fees
Sufficient fees should be present in account needed for the transaction which is activated
The fee is paid in Wei. Wei is a lower denomination of Ether.
1 ether = 10 ^18 Wei
Fees is paid in Wei


Fields in the transaction in Ethereum
  1. Recipient
  2. Digital Signature of sender authorizing transaction
  3. Amount of Wei to transfer
  4. Optional payload containing Message to a contract
  5. Start gas (maximum no. of computational steps  the transaction is allowed.)
  6. Gas price (fee for computations)


CA - Contract accounts
These are controlled by EOA. CA represents a smart contract. Every account has a coin balance.


Ethereum block structure has headers, transactions and runner-up block headers.