Search Header Logo
Introduction to Ethereum and Smart Contracts

Introduction to Ethereum and Smart Contracts

Assessment

Presentation

Practice Problem

Hard

Created by

Solomon Abalaka

Used 2+ times

FREE Resource

22 Slides • 0 Questions

1

Lecture 8: Introduction to Ethereum and Smart Contracts (Part 1)

media

2

Learning Objective

  1. To learn what Ethereum is, its history, and how it differs from other blockchain platforms.

  2. To understand what smart contracts are, how they work, and their significance in the Ethereum ecosystem.

  3. To gain hands-on experience in writing, deploying, and interacting with smart contracts.

3

What is Ethereum?

  • Ethereum (https://www.ethereum.org/) is a new generation of blockchain (first generation is the bitcoin).

  • It is an open-source, public, blockchain-based distributed computing platform featuring smart contract functionality.

  • It is a programmable Blockchain platform for Decentralized Applications (DApps) that run on Ethereum Virtual Machine (EVM)

  • Developers can create smart contract DApps on EVM using Solidity programming language

4

History of Ethereum

  • Ethereum was proposed in late 2013 by Vitalik Buterin

  • Development was funded by an online crowdsale that took place between July and August 2014.

  • Ethereum went live on 30 July 2015

media

5

How Ethereum work?

Contracts written in a smart contract-specific programming languages eg Solidity are compiled into 'bytecode' that can run on 'ethereum virtual machine' (EVM)

media

6

Transactions

  • An Ethereum transaction refers to an action initiated by an externally-owned account, in other words an account managed by a human, not a contract.

  • For example, if Bob sends Alice 1 ETH, Bob's account must be debited and Alice's must be credited. This state-changing action takes place within a transaction.

media

7

Ethereum Blocks

  • Blocks are batches of transactions with a hash of the previous block in the chain.

  • This links blocks together (in a chain) because hashes are cryptographically derived from the block data.

  • This prevents fraud, because one change in any block in history would invalidate all the following blocks as all subsequent hashes would change and everyone running the blockchain would notice.

media

8

Ethereum Blocks - Continue

Blocks are the main building blocksof a blockchain. Ethereum blocks consist of various components, which are described as follows:

• The block header

• The transactions list

• The list of headers of ommers or uncles

The transaction list is simply a list of all transactions included in the block.

9

Consensus Mechanism

  • When it comes to blockchains like Ethereum, which are in essence distributed databases, the nodes of the network must be able to reach agreement on the current state of the system. This is achieved using consensus mechanisms.

  • A consensus mechanism in a crypto economic system also helps prevent certain kinds of economic attacks. In theory, an attacker can compromise consensus by controlling 51% of the network.

  • Consensus mechanisms are designed to make this "51% attack" unfeasible. Different mechanisms are engineered to solve this security problem differently.

  • Ethereum, like Bitcoin, currently uses a proof-of-work (POW) consensus protocol. However Ethereum change to proof-of-stake (PoS) on 2022.

10

Smart Contract

• Smart Contracts are sets of Business Rules in the system.

• All smart contracts are verified and signed by participants.

• When certain conditions are met, auto execute it with together the transaction

• Ethereum is the first blockchain platform that implement smart contracts in Dapp

media

11

Overview of Smart Contract

12

What is Ether?

  • Ether is the transactional token that facilitates operations on the Ethereum network. All of the programs and services linked with the Ethereum network require computing power (and that computing power is not free). Ether is a form of payment for network participants to execute their requested operations on the network.

  • While ether can be thought of as the cryptocurrency of the Ethereum network, metaphorically speaking, it is more accurate to refer to it as the "fuel" of the network.

13

Ether (ETH) Unit

media

14

Ethereum Wallet - MetaMask

  • MetaMask (https://metamask.io/) is a browser extension that provide a way for way for normal web browser to access the blockchain and propose transactions.

  • It injects web3 API into every website you visit.

  • It allows you to run Ethereum dApps right in your browser without running a full Ethereum node

  • It encrypts your private key locally and ask users to confirm and sign transactions as requested before relaying to the Ethereum blockchain.

15

Ethereum Account

  • An Ethereum account is an entity with an ether (ETH) balance that can send transactions on Ethereum. Accounts can be user-controlled or deployed as smart contracts

  • Ethereum has two account types:

- Externally-owned - controlled by anyone with the private keys

- Contract - a smart contract deployed to the network, controlled by code. Learn about smart contracts

  • Both account types have the ability to:

-Receive, hold and send ETH and tokens

-Interact with deployed smart contracts

16

Public Network and Mainnet

  • Since Ethereum is a protocol, this means there can be multiple independent "networks" conforming to this protocol that do not interact with each other.

  • Networks are different Ethereum environments you can access for development, testing, or production use cases. Your Ethereum account will work across the different networks but your account balance and transaction history wont carry over from the main Ethereum network.

  • Mainnet is the primary public Ethereum production blockchain, where actual-value transactions occur on the distributed ledger.

  • When people and exchanges discuss ETH prices, they're talking about mainnet ETH.

17

Testnets

  • In addition to mainnet, there are public testnets. These are networks used by protocol developers or smart contract developers to test both protocol upgrades as well as potential smart contracts in a production-like environment before deployment to mainnet.

  • ETH on testnets has no real value; therefore, there are no markets for testnet ETH. Since you need ETH to actually interact with Ethereum, most people get testnet ETH from faucets.

  • Görli, Kovan,Rinkeby, Ropsten

18

Gas and Fee

  • Gas is essential to the Ethereum network. It is the fuel that allows it to operate, in the same way that a car needs gasoline to run.

  • Gas refers to the unit that measures the amount of computational effort required to execute specific operations on the Ethereum network.

  • Since each Ethereum transaction requires computational resources to execute, each transaction requires a fee. Gas refers to the fee required to successfully conduct a transaction on Ethereum.

  • Let's say Alice has to pay Bob 1ETH. In the transaction the gas limit is 21,000 units and the gas price is 200 gwei.

  • Total fee will be: Gas units (limit) Gas price per unit i.e 21,000 200 = 4,200,000 gwei or 0.0042 ETH

19

Gas and Fee- Continue

  • Fee schedule

    Gas is charged in three scenarios as a prerequisite tothe execution of an operation:

    • The computation of an operation

    • For contract creation or message call

    • Increase in the usage of memory

20

How Ethereum Gas work?

21

Replace this with a header

Replace this with your body text. Duplicate this text as many times as you would like. All provided templates can be reused multiple times. Wish you a good day.

Happy teaching!

22

Solidity

  • Solidity is an object-oriented, high-level language for implementing smart contracts. Smart contracts are programs which govern the behaviour of accounts within the Ethereum state.

  • Solidity was influenced by C++, Python and JavaScript and is designed to target the Ethereum Virtual Machine (EVM).

  • Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

  • With Solidity you can create contracts for uses such as voting, crowdfunding, blind auctions, and multi-signature wallets.

Lecture 8: Introduction to Ethereum and Smart Contracts (Part 1)

media

Show answer

Auto Play

Slide 1 / 22

SLIDE