SlideShare a Scribd company logo
1 of 100
GDSC Break-Chain
Welcome!
Building blocks for better world!
Demystifying Web 3.0
Before we begin,
A Quick Introduction
A non-profit developers group to
develop, learn and share.
Who Are We?
Google Developer Student
Clubs - JSSSTU
Currently (in 2021), head of the department of
Computer Science and Engineering, with nearly three
decades of teaching experience. Driven by the motto,
“Anything worth doing is worth doing well,” to create a
challenging and engaging learning environment for
students and self. Her research focuses mainly on
Machine Learning and Healthcare Informatics with a
particular emphasis on the applications of healthcare
technology to socially relevant issues.
Our Faculty Advisor
Dr. M P Pushpalatha
Introduction to
Blockchain
Architecture
These three phases are not based on what technologies are used, rather they
explain how the web is being used.
Web 1.0
Web 1.0 vs Web 2.0 vs Web 3.0
Web 2.0 Web 3.0
(Read) (Read,Write) (Read,Write,Own)
Chain of blocks linked
through cryptographic
hash function.
Blockchain Architecture
Let’s have a demonstration of working of hash function and blockchain.
Head over to-
bit.ly/bc-block-demo
Demo
Decentralised, Distributed,
P2P Network & Immutable Database.
Blockchain Architecture
Blockchain Architecture
Decentralised
Blockchain Architecture
Distributed
Blockchain Architecture
Peer-2-Peer Network
Blockchain Architecture
Immutable
How blocks are verified?
Consensus Model: Procedure through which all the peers of the Blockchain
network reach a common agreement about the present state of the Distributed
Network.
Ex: Proof of Work
Blockchain Architecture
How blocks are added?
Mining: Process of adding new block to the blockchain network
Verify, Verify, Verify… But who does that….? And How?
Blockchain Architecture
● Highly secure
● Difficult to hack the system
● Transparent
Block… Blockchain, Main jukega nahi!
● Very less or almost zero downtime
Conclusions:
Application Devs
(Web3.0 & Smart Contracts)
➔ Solidity
➔ JavaScript
➔ Python
[>90%]
Blockchain Developers
Core Devs
(Architecture)
➔ Go
➔ C++
➔ Rust
[very less]
Blockchain Development
● DeFi (Cryptocurrencies)
○ UniSwap
What Blockchain
developers do?
Blockchain Development
● DApp (Web 3.0)
○ Brave Browser
● NFTs
○ Binance
Bugs are part of programmer’s life…
Dealing with bugs is an art of
programmer’s life!
Ethereum Blockchain,
Smart Contracts
and much more…
Introduction to
Ethereum & Solidity
- Ethereum is a decentralized, open-source
blockchain with smart contract functionality
- Founded in 2013 - Vitalik Buterin
- The main idea: Why not run programs on
the blockchain too? Running applications on
the blockchain could lead to attaching real
world assets, such as stock or property to
the blockchain
- Native cryptocurrency: Ether
What is Ethereum?
Ethereum Concepts
Vitalik Buterin, Founder of Ethereum
- Types of nodes:
- Full node : maintains entire copy of BC
- Light node : only makes transactions, stores
block headers only
- Archive node : stores the entire BC along with
and builds an archive of historical data
Ethereum Nodes
Ethereum Concepts
- IBM
Smart contracts are simply programs stored on a
blockchain that run when predetermined
conditions are met. They are typically used to
automate an agreement's execution so that all
participants can be immediately sure of the
outcome without any intermediary's involvement
or time loss.
- “Program that runs on the
Ethereum blockchain”
- Ethereum allows us to write smart
contracts using a scripting language
called Solidity
- Solidity is “turing complete”
- Wait… but what if my smart contract
is an infinite loop? Can I cease all
nodes on the network?
Smart-contracts
Ethereum Concepts
Smart-contracts
Ethereum Concepts
- The EVM is a sandboxed platform
that runs smart contract code
- EVM sees the entire blockchain as a
state, and the EVM itself, as a
state-machine, which takes the
“current state” to another valid “state”
- It is a sandboxed environment, and
runs bytecode. Makes sure smart
contracts cannot do any harm to
nodes
The Ethereum Virtual Machine
Ethereum Concepts
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
Fill fuel
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
refuel
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
refuel
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
destination
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
EVM
GAS
Operation 1 Operation 2 Operation 3
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
EVM
Operation 1 Operation 2 Operation 3
NOM
NOM
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
EVM
Operation 1 Operation 2 Operation 3
NOM
NOM
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
EVM
Operation 1 Operation 2 Operation 3
Im
Done!
- The total amount of computation
used to process a transaction is
measured in a special unit called gas
- But how exactly is the “amount of
computation” measured?
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
- A transaction need to perform a bunch of
smaller computations
- For example, computing 10 + 20 * 30 requires
you to perform a multiplication and an addition
- Each of these smaller computations have well
defined gas price (in the ethereum white paper)
- For each of these operations, gas is consumed.
The function could run to completion, or run out
of gas and abort its execution. Why is this even a
thing tho?
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
- Everytime you make a transaction, you send the
following information with it
- The gas limit: The maximum amount of gas
you are willing to spend for this transaction
- The gas price: The amount you are willing to
pay for 1 gas, in a unit called gwei (1 gwei =
10^-9 ether)
- Tx price = gas limit x gas price
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
Gas Fee, Gas Price, and the Gas Limit
Ethereum Concepts
Higher gas price,
lower waiting
time
Lower gas price,
Higher waiting
time Lower gas limit,
less computations
in your transaction
Higher gas limit,
more computations in
your transaction
Gas price
Tx waiting time Computations
Gas limit
Intro to Remix IDE
Ethereum Concepts
Let’s look at an environment which will be our playground to learn solidity!
Live demo time!~ :^)
Smart contract compilation process: solc compiler
Ethereum Concepts
.sol file (solidity source)
Solidity compiler (solc)
ABI EVM bytecode
(deployed on the blockchain)
(used by applications to interact with our
smart contract)
Layout of a solidity smart contract
Solidity
Data types and variables
What is a variable?
Variables are just the names of
the memory location !!
Data types and variables
1. Boolean - true✅ / false❌
2. Integer - Your usual numbers
but without a decimal part
ex: 12, 345,...
Integer
Unsigned
integer
Signed
Integer
● uint8
● uint16,
…
● uint256
● int8
● int16,
…
● int256
but why do we need
different types of
integers based on
their size?
3. Address - Address hold a 20-byte value which represents the
size of an Ethereum address.:
0xb794f5ea0ba39494ce839613fffba74279579268
Data types and variables
This is what an
Ethereum address
looks like
Bytes and Strings
Not this Bytes xD
● Bytes are used to store a fixed-sized
character set
● The string is used to store the
character set equal to or more than a
byte and it has dynamic length
Enums
The Enums restrict a variable to have one of only a few
predefined values. The values in this enumerated list are called
enums.
How do functions break up?
They stop calling each other xD
Functions
General Syntax of a function
A function is a block of organized code
that is used to perform a single task.
LET ME TELL YOU MORE
ABOUT FUNCTIONS…
Enums
Without enums With enums
Enums
Code Readability after using enums:
Code Readability before using enums:
Functions
Run
State variables
- State variables are variables that store data on the blockchain
- They persist their value between successive interactions with the smart
contract
- They are declared within a contract block, but outside any function
Let’s have a look
State variables
Local variables
- In contrast to state variables, local variables are only used within a function
- They only store data they hold till the function executes
- After the function finishes execution, they are deallocated from the EVM’s
stack
Let’s have a look
Local variables
(let’s actually play around a bit more on remix)
Global variables
- Global variables are special little things
- They are set up by the EVM for us, and store information about the
blockchain, the transaction, and the account that triggered the transaction
- Although there are a lot of them (refer to solidity docs), we look at the
following important ones
- msg.sender: address of the sender
- msg.value: amount of wei sent in the transaction (uint)
- block.timestamp: the current unix timestamp (a uint)
- block.number: the current block number (a uint)
Global variables
Constructor
Chaliye Constructor
shuru karte hain
Nobody:
Literally Nobody:
Le nodes after deploying a contract:
● Constructor is a special function
declared using constructor keyword.
● It is an optional funtion and is used to
initialize state variables of a contract.
● It runs only once when the smart contract
is deployed to the blockchain network.
Let’s construct some code for constructors!!
Constructor
Arrays are data structures that are used to store the collection of elements of
same type.
Arrey Dudee, What are these Arrays??🧐
Arrays
Arrays
How to declare an Array? Array Operations
Public
Access Specifiers
The methods and variables can be accessed outside the
smart contract.
Main public hoon , mereko sab
access kar sakte hain
Private
Access Specifiers
The methods and variables can be
accessed only within the smart
contract.
Le other smart contracts :
Variables aur
methods kaha hai ???
*Proceeds to add a private access specifier to a variable*
QUIZ - 1 !
Chalo, kuch maza
karthe hain…
slido.com
#295704
Sometimes it’s a convenience to think about a group of data as a single entity
Grouping data together
Structs
Initializing a structure
Structs
- Mapping is very similar to dictionaries in other programming languages.
- It allows for efficient lookup
Imagine looking up the definition of a word in a dictionary.
word → definition
Solidity’s dictionary
Mapping
Simple mapping
Solidity’s dictionary
Mapping
Nested mapping
They seem similar, no?
Mapping vs Arrays
- But array index is always a non negative number! On the other hand, Mapings
“index” can any datatype!
- The main advantage of arrays are that they are iterable. Mappings are not
iterable.
- Mapping can grow as big as they want, and still remain very efficient! Array’s
on the other hand, are not as efficient when they are of huge size.
- Mapping can be used only to store things in storage, Solidity does not
support in-memory mapping.
Returning results from a function
Revisit: Functions
- To mention what datatype a function will return, we use the returns keyword
- To return a value from a function, we use the return keyword
Let’s play around in remix.
Pure and View Functions
Revisit: Functions
- Pure functions: These functions promise the EVM that they will not read or
update any state variables or global variable
- View functions:These functions promise the EVM that they will not update
any state variable
Let’s look at it in remix again!
Pure and View functions do not consume any gas when invoked externally.
However they do cost gas when called from another function.
Storage, memory and calldata
storage: The location type where the state variables are stored on blockchain
which means types that has storage location are persistent
memory: Variables are in memory and they exists during the function call
which means variables that got this location are temporary and after
function execution finished, they won’t exist.
calldata: Non-modifiable, non-persistent data location where function
arguments are stored, behaves mostly like memory data location
Assignment behaviour
- Assignments between storage and memory (or from calldata) always create
an independent copy.
- Assignments from memory to memory only create references. As a result
changes to one memory variable are also visible in all other memory variables
that refer to the same data.
- Assignments from storage to a local storage variable also only assign a
reference.
- All other assignments to storage always creates independent copies.
Ways to send ether
Payable
- The payable keyword adds functionality to send and receive ether.
- If you want a function to be able to receive ether, then tag it with the payable
keyword
- An address datatype can also be made payable, in case you want to transfer
ether to the address stored in it.
- You can send ether to a payable address in three ways. transfer(), send() and
call{value: …}()
Create a CRUD application on a
list of users.
● C - Create
● R - Read
● U - Update
● D - Delete
Let’s write a simple CRUD Smart Contract
Chalo
Code karte hain
However, some gas fee will be spent for this
right?
What if my transaction
fails or if it was an
invalid transaction?
Possible invalid transactions:
1. Invalid access
2. Access something that doesn’t
exist
3. Absence of something that’s a
mandatory field
4. Insufficient amount for transfer
There is no point of spending gas
fee for an invalid transaction!
Abort execution and revert state changes providing an
explanatory string
revert(failure_message)
Abort execution and revert state changes if condition is
false and provide error message.
require(condition, failure_message)
Modifiers are used for automatically checking a condition,
prior to executing a function.
● Reduce code redundancy
● Re-use same modifier in multiple functions
modifier
modifier
QUIZ - 2 !
Chalo, phirse thoda maza
karthe hain…
slido.com
#449244
Develop a smart contract where users create
posts (sastha tweets) and other users who
like it can tip some ethers.
Project: Sastha Twitter
1. Write Smart Contract.
2. Setup local blockchain.
3. Create Frontend website.
4. Connect frontend & blockchain.
5. Interact with the Blockchain
from the website.
Let’s cook something now…
MetaMask provides the
simplest yet most secure
way to connect to
blockchain-based
applications. You are
always in control when
interacting on the new
decentralized web.
Metamask
Tools
Node.js is a JavaScript runtime
environment that helps to run JS
outside that browser.
Node.js
Tools
A world class development
environment, testing
framework and asset pipeline
for blockchains using the
Ethereum Virtual Machine
(EVM), aiming to make life as
a developer easier.
Truffle.js
Tools
npm install -g truffle
Ganache setups up a local
blockchain network in our PC
with just one click that helps
us to test & deploy smart
contracts.
Ganache
Tools
Let’s deploy our smart contract to local blockchain.
Deploy Smart Contract
1. Make sure SasthaTwitter.sol
code is present in
/contracts directory.
2. Add this contract to
/migrations directory.
truffle migrate
Head over to
bit.ly/bc-sastha-tweet
Connect frontend website to our smart contract.
1. cd app/
2. npm install
3. npm run dev
Frontend Website
Connect Metamask to Ganache:
1. Open Metamask
2. Click on Add Networks in Settings
3. New RPC URL: http://localhost:7545
4. Chain Id: 1337
Make our website interactive with the smart contract.
Decentralized Application
1.Create Posts - uncomment lines a to b
In app.js:
2.Get all posts - uncomment lines f to g
3.Tip post - uncomment lines p to r
Play around in the website…
- Create some posts
- Tip some ethers to other posts
That’s cool. Now you all know how to
write smart contracts and connect it
with frontend!
Feel free to ask any doubts/queries or any
questions from today’s workshop.
Don’t feel shy… We are all same😅
QnA
Any queries???
What next?
It is also necessary to create a
user friendly website such that
It allows users to interact with
your smart contract!
What next?
Most importantly,
Frontend + Smart Contract
= FullStack Developer 😉
Web
Development
Blockchain
Development
Me
Connect With Us!
Scan this QR code to access all
our social media handles and
links!
links.dscjssstu.in
We want to hear from you!
We would highly appreciate your honest feedback.
Only the people who’ve filled this form and attended the
entire workshop will receive the digital certificates.
Certificates will be rolled out within a week.
bit.ly/gdsc-breakchain-feedback
Our Event Sponsors
Supreme Sales
and Marketing
Thank you!
Hope you all had fun learning a
new technology and gained awesome
knowledge from this workshop.
See you all soon!

More Related Content

What's hot

Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
Simplilearn
 

What's hot (20)

All About Ethereum
All About EthereumAll About Ethereum
All About Ethereum
 
The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized A...
The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized A...The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized A...
The Ethereum Blockchain - Introduction to Smart Contracts and Decentralized A...
 
Blockchain Interview Questions and Answers | Blockchain Technology | Blockcha...
Blockchain Interview Questions and Answers | Blockchain Technology | Blockcha...Blockchain Interview Questions and Answers | Blockchain Technology | Blockcha...
Blockchain Interview Questions and Answers | Blockchain Technology | Blockcha...
 
Ethereum
EthereumEthereum
Ethereum
 
Ten Blockchain Applications
Ten Blockchain ApplicationsTen Blockchain Applications
Ten Blockchain Applications
 
Blockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for LibrariesBlockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for Libraries
 
Blockchain Consensus Protocols
Blockchain Consensus ProtocolsBlockchain Consensus Protocols
Blockchain Consensus Protocols
 
Bitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & BlockchainBitcoin, Ethereum, Smart Contract & Blockchain
Bitcoin, Ethereum, Smart Contract & Blockchain
 
Hyperledger Fabric
Hyperledger FabricHyperledger Fabric
Hyperledger Fabric
 
Smart contract
Smart contractSmart contract
Smart contract
 
Everything Blockchain Presentation - Feb 2022
Everything Blockchain Presentation -  Feb 2022Everything Blockchain Presentation -  Feb 2022
Everything Blockchain Presentation - Feb 2022
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
 
Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
 
Blockchain Based Decentralized Cloud System
Blockchain Based Decentralized Cloud SystemBlockchain Based Decentralized Cloud System
Blockchain Based Decentralized Cloud System
 
Exploring Blockchain Technology, Risks, and Emerging Trends
Exploring Blockchain Technology, Risks, and Emerging TrendsExploring Blockchain Technology, Risks, and Emerging Trends
Exploring Blockchain Technology, Risks, and Emerging Trends
 
What is Erc20 token? How it Works/
What is Erc20 token? How it Works/What is Erc20 token? How it Works/
What is Erc20 token? How it Works/
 
Blockchain
BlockchainBlockchain
Blockchain
 
Brand New Web3 Wallet
Brand New Web3 WalletBrand New Web3 Wallet
Brand New Web3 Wallet
 
Building Ethereum Dapp using Solidity | Ethereum Dapp Tutorial | Ethereum Dev...
Building Ethereum Dapp using Solidity | Ethereum Dapp Tutorial | Ethereum Dev...Building Ethereum Dapp using Solidity | Ethereum Dapp Tutorial | Ethereum Dev...
Building Ethereum Dapp using Solidity | Ethereum Dapp Tutorial | Ethereum Dev...
 
Digital signature & eSign overview
Digital signature & eSign overviewDigital signature & eSign overview
Digital signature & eSign overview
 

Similar to Blockchain Development

Blockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptxBlockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptx
saiproject
 
Daniel Connelly Ethereum Smart Contract Master's Thesis
Daniel Connelly Ethereum Smart Contract Master's ThesisDaniel Connelly Ethereum Smart Contract Master's Thesis
Daniel Connelly Ethereum Smart Contract Master's Thesis
Daniel Connelly
 

Similar to Blockchain Development (20)

Ethereum
EthereumEthereum
Ethereum
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)
 
Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018
Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018
Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018
 
Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018
Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018
Jerome de Tychey - Building Web3.0 with Ethereum - Codemotion Berlin 2018
 
Blockchain, Ethereum and ConsenSys
Blockchain, Ethereum and ConsenSysBlockchain, Ethereum and ConsenSys
Blockchain, Ethereum and ConsenSys
 
Best practices to build secure smart contracts
Best practices to build secure smart contractsBest practices to build secure smart contracts
Best practices to build secure smart contracts
 
How to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contractHow to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contract
 
Ethereum Solidity Fundamentals
Ethereum Solidity FundamentalsEthereum Solidity Fundamentals
Ethereum Solidity Fundamentals
 
Blockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptxBlockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptx
 
Daniel Connelly Ethereum Smart Contract Master's Thesis
Daniel Connelly Ethereum Smart Contract Master's ThesisDaniel Connelly Ethereum Smart Contract Master's Thesis
Daniel Connelly Ethereum Smart Contract Master's Thesis
 
Blockchain architected
Blockchain architectedBlockchain architected
Blockchain architected
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
 
Building Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart ContractBuilding Apps with Ethereum Smart Contract
Building Apps with Ethereum Smart Contract
 
Evaluation of Ethereum
Evaluation of Ethereum Evaluation of Ethereum
Evaluation of Ethereum
 
Ergo Hong Kong meetup
Ergo Hong Kong meetupErgo Hong Kong meetup
Ergo Hong Kong meetup
 
How to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart ContractsHow to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart Contracts
 
Ingredients for creating dapps
Ingredients for creating dappsIngredients for creating dapps
Ingredients for creating dapps
 
Ethereum bxl
Ethereum bxlEthereum bxl
Ethereum bxl
 
Developing Blockchain Applications
Developing Blockchain Applications Developing Blockchain Applications
Developing Blockchain Applications
 
Blockchain
BlockchainBlockchain
Blockchain
 

Recently uploaded

Call Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night StandCall Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........
deejay178
 
Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...
Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...
Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...
poojakaurpk09
 
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdfreStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
Ken Fuller
 
➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men 🔝bhavnagar🔝 Esc...
➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men  🔝bhavnagar🔝   Esc...➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men  🔝bhavnagar🔝   Esc...
➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men 🔝bhavnagar🔝 Esc...
amitlee9823
 
Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制
怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制
怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制
yynod
 
➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men 🔝Bulandshahr🔝 ...
➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men  🔝Bulandshahr🔝  ...➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men  🔝Bulandshahr🔝  ...
➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men 🔝Bulandshahr🔝 ...
amitlee9823
 
Call Girls In Chandapura ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Chandapura ☎ 7737669865 🥵 Book Your One night StandCall Girls In Chandapura ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Chandapura ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
amitlee9823
 
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men 🔝Nandyal🔝 Escorts...
➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men  🔝Nandyal🔝   Escorts...➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men  🔝Nandyal🔝   Escorts...
➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men 🔝Nandyal🔝 Escorts...
amitlee9823
 
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 

Recently uploaded (20)

Call Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night StandCall Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Devanahalli ☎ 7737669865 🥵 Book Your One night Stand
 
Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........
 
Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hosur Road Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...
Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...
Virgin Call Girls Delhi Service-oriented sexy call girls ☞ 9899900591 ☜ Rita ...
 
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
 
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdfreStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
reStartEvents 5:9 DC metro & Beyond V-Career Fair Employer Directory.pdf
 
➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men 🔝bhavnagar🔝 Esc...
➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men  🔝bhavnagar🔝   Esc...➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men  🔝bhavnagar🔝   Esc...
➥🔝 7737669865 🔝▻ bhavnagar Call-girls in Women Seeking Men 🔝bhavnagar🔝 Esc...
 
Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Bidadi ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
 
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制
怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制
怎样办理哥伦比亚大学毕业证(Columbia毕业证书)成绩单学校原版复制
 
➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men 🔝Bulandshahr🔝 ...
➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men  🔝Bulandshahr🔝  ...➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men  🔝Bulandshahr🔝  ...
➥🔝 7737669865 🔝▻ Bulandshahr Call-girls in Women Seeking Men 🔝Bulandshahr🔝 ...
 
Call Girls In Chandapura ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Chandapura ☎ 7737669865 🥵 Book Your One night StandCall Girls In Chandapura ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Chandapura ☎ 7737669865 🥵 Book Your One night Stand
 
Brand Analysis for reggaeton artist Jahzel.
Brand Analysis for reggaeton artist Jahzel.Brand Analysis for reggaeton artist Jahzel.
Brand Analysis for reggaeton artist Jahzel.
 
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men  🔝Tirupati🔝   Escor...
➥🔝 7737669865 🔝▻ Tirupati Call-girls in Women Seeking Men 🔝Tirupati🔝 Escor...
 
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Sarjapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men 🔝Nandyal🔝 Escorts...
➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men  🔝Nandyal🔝   Escorts...➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men  🔝Nandyal🔝   Escorts...
➥🔝 7737669865 🔝▻ Nandyal Call-girls in Women Seeking Men 🔝Nandyal🔝 Escorts...
 
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Miletti Gabriela_Vision Plan for artist Jahzel.pdf
Miletti Gabriela_Vision Plan for artist Jahzel.pdfMiletti Gabriela_Vision Plan for artist Jahzel.pdf
Miletti Gabriela_Vision Plan for artist Jahzel.pdf
 
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
 

Blockchain Development

  • 1. GDSC Break-Chain Welcome! Building blocks for better world! Demystifying Web 3.0
  • 2. Before we begin, A Quick Introduction
  • 3. A non-profit developers group to develop, learn and share. Who Are We? Google Developer Student Clubs - JSSSTU
  • 4. Currently (in 2021), head of the department of Computer Science and Engineering, with nearly three decades of teaching experience. Driven by the motto, “Anything worth doing is worth doing well,” to create a challenging and engaging learning environment for students and self. Her research focuses mainly on Machine Learning and Healthcare Informatics with a particular emphasis on the applications of healthcare technology to socially relevant issues. Our Faculty Advisor Dr. M P Pushpalatha
  • 5.
  • 7. These three phases are not based on what technologies are used, rather they explain how the web is being used. Web 1.0 Web 1.0 vs Web 2.0 vs Web 3.0 Web 2.0 Web 3.0 (Read) (Read,Write) (Read,Write,Own)
  • 8. Chain of blocks linked through cryptographic hash function. Blockchain Architecture
  • 9. Let’s have a demonstration of working of hash function and blockchain. Head over to- bit.ly/bc-block-demo Demo
  • 10. Decentralised, Distributed, P2P Network & Immutable Database. Blockchain Architecture
  • 15. How blocks are verified? Consensus Model: Procedure through which all the peers of the Blockchain network reach a common agreement about the present state of the Distributed Network. Ex: Proof of Work Blockchain Architecture How blocks are added? Mining: Process of adding new block to the blockchain network Verify, Verify, Verify… But who does that….? And How?
  • 16. Blockchain Architecture ● Highly secure ● Difficult to hack the system ● Transparent Block… Blockchain, Main jukega nahi! ● Very less or almost zero downtime Conclusions:
  • 17. Application Devs (Web3.0 & Smart Contracts) ➔ Solidity ➔ JavaScript ➔ Python [>90%] Blockchain Developers Core Devs (Architecture) ➔ Go ➔ C++ ➔ Rust [very less] Blockchain Development
  • 18. ● DeFi (Cryptocurrencies) ○ UniSwap What Blockchain developers do? Blockchain Development ● DApp (Web 3.0) ○ Brave Browser ● NFTs ○ Binance
  • 19. Bugs are part of programmer’s life… Dealing with bugs is an art of programmer’s life!
  • 20. Ethereum Blockchain, Smart Contracts and much more… Introduction to Ethereum & Solidity
  • 21. - Ethereum is a decentralized, open-source blockchain with smart contract functionality - Founded in 2013 - Vitalik Buterin - The main idea: Why not run programs on the blockchain too? Running applications on the blockchain could lead to attaching real world assets, such as stock or property to the blockchain - Native cryptocurrency: Ether What is Ethereum? Ethereum Concepts Vitalik Buterin, Founder of Ethereum
  • 22. - Types of nodes: - Full node : maintains entire copy of BC - Light node : only makes transactions, stores block headers only - Archive node : stores the entire BC along with and builds an archive of historical data Ethereum Nodes Ethereum Concepts
  • 23. - IBM Smart contracts are simply programs stored on a blockchain that run when predetermined conditions are met. They are typically used to automate an agreement's execution so that all participants can be immediately sure of the outcome without any intermediary's involvement or time loss.
  • 24. - “Program that runs on the Ethereum blockchain” - Ethereum allows us to write smart contracts using a scripting language called Solidity - Solidity is “turing complete” - Wait… but what if my smart contract is an infinite loop? Can I cease all nodes on the network? Smart-contracts Ethereum Concepts
  • 26. - The EVM is a sandboxed platform that runs smart contract code - EVM sees the entire blockchain as a state, and the EVM itself, as a state-machine, which takes the “current state” to another valid “state” - It is a sandboxed environment, and runs bytecode. Makes sure smart contracts cannot do any harm to nodes The Ethereum Virtual Machine Ethereum Concepts
  • 27. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts Fill fuel
  • 28. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts refuel
  • 29. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts refuel
  • 30. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts destination
  • 31. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts EVM GAS Operation 1 Operation 2 Operation 3
  • 32. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts EVM Operation 1 Operation 2 Operation 3 NOM NOM
  • 33. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts EVM Operation 1 Operation 2 Operation 3 NOM NOM
  • 34. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts EVM Operation 1 Operation 2 Operation 3 Im Done!
  • 35. - The total amount of computation used to process a transaction is measured in a special unit called gas - But how exactly is the “amount of computation” measured? Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts
  • 36. - A transaction need to perform a bunch of smaller computations - For example, computing 10 + 20 * 30 requires you to perform a multiplication and an addition - Each of these smaller computations have well defined gas price (in the ethereum white paper) - For each of these operations, gas is consumed. The function could run to completion, or run out of gas and abort its execution. Why is this even a thing tho? Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts
  • 37. - Everytime you make a transaction, you send the following information with it - The gas limit: The maximum amount of gas you are willing to spend for this transaction - The gas price: The amount you are willing to pay for 1 gas, in a unit called gwei (1 gwei = 10^-9 ether) - Tx price = gas limit x gas price Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts
  • 38. Gas Fee, Gas Price, and the Gas Limit Ethereum Concepts Higher gas price, lower waiting time Lower gas price, Higher waiting time Lower gas limit, less computations in your transaction Higher gas limit, more computations in your transaction Gas price Tx waiting time Computations Gas limit
  • 39. Intro to Remix IDE Ethereum Concepts Let’s look at an environment which will be our playground to learn solidity! Live demo time!~ :^)
  • 40. Smart contract compilation process: solc compiler Ethereum Concepts .sol file (solidity source) Solidity compiler (solc) ABI EVM bytecode (deployed on the blockchain) (used by applications to interact with our smart contract)
  • 41. Layout of a solidity smart contract Solidity
  • 42. Data types and variables What is a variable? Variables are just the names of the memory location !!
  • 43. Data types and variables 1. Boolean - true✅ / false❌ 2. Integer - Your usual numbers but without a decimal part ex: 12, 345,... Integer Unsigned integer Signed Integer ● uint8 ● uint16, … ● uint256 ● int8 ● int16, … ● int256 but why do we need different types of integers based on their size?
  • 44. 3. Address - Address hold a 20-byte value which represents the size of an Ethereum address.: 0xb794f5ea0ba39494ce839613fffba74279579268 Data types and variables This is what an Ethereum address looks like
  • 45. Bytes and Strings Not this Bytes xD ● Bytes are used to store a fixed-sized character set ● The string is used to store the character set equal to or more than a byte and it has dynamic length
  • 46. Enums The Enums restrict a variable to have one of only a few predefined values. The values in this enumerated list are called enums.
  • 47. How do functions break up? They stop calling each other xD Functions General Syntax of a function A function is a block of organized code that is used to perform a single task. LET ME TELL YOU MORE ABOUT FUNCTIONS…
  • 49. Enums Code Readability after using enums: Code Readability before using enums:
  • 51. State variables - State variables are variables that store data on the blockchain - They persist their value between successive interactions with the smart contract - They are declared within a contract block, but outside any function Let’s have a look
  • 53. Local variables - In contrast to state variables, local variables are only used within a function - They only store data they hold till the function executes - After the function finishes execution, they are deallocated from the EVM’s stack Let’s have a look
  • 54. Local variables (let’s actually play around a bit more on remix)
  • 55. Global variables - Global variables are special little things - They are set up by the EVM for us, and store information about the blockchain, the transaction, and the account that triggered the transaction - Although there are a lot of them (refer to solidity docs), we look at the following important ones - msg.sender: address of the sender - msg.value: amount of wei sent in the transaction (uint) - block.timestamp: the current unix timestamp (a uint) - block.number: the current block number (a uint)
  • 57. Constructor Chaliye Constructor shuru karte hain Nobody: Literally Nobody: Le nodes after deploying a contract: ● Constructor is a special function declared using constructor keyword. ● It is an optional funtion and is used to initialize state variables of a contract. ● It runs only once when the smart contract is deployed to the blockchain network.
  • 58. Let’s construct some code for constructors!! Constructor
  • 59. Arrays are data structures that are used to store the collection of elements of same type. Arrey Dudee, What are these Arrays??🧐 Arrays
  • 60. Arrays How to declare an Array? Array Operations
  • 61. Public Access Specifiers The methods and variables can be accessed outside the smart contract. Main public hoon , mereko sab access kar sakte hain
  • 62. Private Access Specifiers The methods and variables can be accessed only within the smart contract. Le other smart contracts : Variables aur methods kaha hai ??? *Proceeds to add a private access specifier to a variable*
  • 63. QUIZ - 1 ! Chalo, kuch maza karthe hain… slido.com #295704
  • 64.
  • 65. Sometimes it’s a convenience to think about a group of data as a single entity Grouping data together Structs
  • 67. - Mapping is very similar to dictionaries in other programming languages. - It allows for efficient lookup Imagine looking up the definition of a word in a dictionary. word → definition Solidity’s dictionary Mapping
  • 69. They seem similar, no? Mapping vs Arrays - But array index is always a non negative number! On the other hand, Mapings “index” can any datatype! - The main advantage of arrays are that they are iterable. Mappings are not iterable. - Mapping can grow as big as they want, and still remain very efficient! Array’s on the other hand, are not as efficient when they are of huge size. - Mapping can be used only to store things in storage, Solidity does not support in-memory mapping.
  • 70. Returning results from a function Revisit: Functions - To mention what datatype a function will return, we use the returns keyword - To return a value from a function, we use the return keyword Let’s play around in remix.
  • 71. Pure and View Functions Revisit: Functions - Pure functions: These functions promise the EVM that they will not read or update any state variables or global variable - View functions:These functions promise the EVM that they will not update any state variable Let’s look at it in remix again! Pure and View functions do not consume any gas when invoked externally. However they do cost gas when called from another function.
  • 72. Storage, memory and calldata storage: The location type where the state variables are stored on blockchain which means types that has storage location are persistent memory: Variables are in memory and they exists during the function call which means variables that got this location are temporary and after function execution finished, they won’t exist. calldata: Non-modifiable, non-persistent data location where function arguments are stored, behaves mostly like memory data location
  • 73. Assignment behaviour - Assignments between storage and memory (or from calldata) always create an independent copy. - Assignments from memory to memory only create references. As a result changes to one memory variable are also visible in all other memory variables that refer to the same data. - Assignments from storage to a local storage variable also only assign a reference. - All other assignments to storage always creates independent copies.
  • 74. Ways to send ether Payable - The payable keyword adds functionality to send and receive ether. - If you want a function to be able to receive ether, then tag it with the payable keyword - An address datatype can also be made payable, in case you want to transfer ether to the address stored in it. - You can send ether to a payable address in three ways. transfer(), send() and call{value: …}()
  • 75. Create a CRUD application on a list of users. ● C - Create ● R - Read ● U - Update ● D - Delete Let’s write a simple CRUD Smart Contract Chalo Code karte hain
  • 76. However, some gas fee will be spent for this right? What if my transaction fails or if it was an invalid transaction?
  • 77. Possible invalid transactions: 1. Invalid access 2. Access something that doesn’t exist 3. Absence of something that’s a mandatory field 4. Insufficient amount for transfer There is no point of spending gas fee for an invalid transaction!
  • 78. Abort execution and revert state changes providing an explanatory string revert(failure_message)
  • 79. Abort execution and revert state changes if condition is false and provide error message. require(condition, failure_message)
  • 80. Modifiers are used for automatically checking a condition, prior to executing a function. ● Reduce code redundancy ● Re-use same modifier in multiple functions modifier
  • 82. QUIZ - 2 ! Chalo, phirse thoda maza karthe hain… slido.com #449244
  • 83. Develop a smart contract where users create posts (sastha tweets) and other users who like it can tip some ethers. Project: Sastha Twitter
  • 84. 1. Write Smart Contract. 2. Setup local blockchain. 3. Create Frontend website. 4. Connect frontend & blockchain. 5. Interact with the Blockchain from the website. Let’s cook something now…
  • 85. MetaMask provides the simplest yet most secure way to connect to blockchain-based applications. You are always in control when interacting on the new decentralized web. Metamask Tools
  • 86. Node.js is a JavaScript runtime environment that helps to run JS outside that browser. Node.js Tools
  • 87. A world class development environment, testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM), aiming to make life as a developer easier. Truffle.js Tools npm install -g truffle
  • 88. Ganache setups up a local blockchain network in our PC with just one click that helps us to test & deploy smart contracts. Ganache Tools
  • 89. Let’s deploy our smart contract to local blockchain. Deploy Smart Contract 1. Make sure SasthaTwitter.sol code is present in /contracts directory. 2. Add this contract to /migrations directory. truffle migrate Head over to bit.ly/bc-sastha-tweet
  • 90. Connect frontend website to our smart contract. 1. cd app/ 2. npm install 3. npm run dev Frontend Website Connect Metamask to Ganache: 1. Open Metamask 2. Click on Add Networks in Settings 3. New RPC URL: http://localhost:7545 4. Chain Id: 1337
  • 91. Make our website interactive with the smart contract. Decentralized Application 1.Create Posts - uncomment lines a to b In app.js: 2.Get all posts - uncomment lines f to g 3.Tip post - uncomment lines p to r
  • 92. Play around in the website… - Create some posts - Tip some ethers to other posts
  • 93. That’s cool. Now you all know how to write smart contracts and connect it with frontend!
  • 94. Feel free to ask any doubts/queries or any questions from today’s workshop. Don’t feel shy… We are all same😅 QnA Any queries???
  • 96. It is also necessary to create a user friendly website such that It allows users to interact with your smart contract! What next? Most importantly, Frontend + Smart Contract = FullStack Developer 😉 Web Development Blockchain Development Me
  • 97. Connect With Us! Scan this QR code to access all our social media handles and links! links.dscjssstu.in
  • 98. We want to hear from you! We would highly appreciate your honest feedback. Only the people who’ve filled this form and attended the entire workshop will receive the digital certificates. Certificates will be rolled out within a week. bit.ly/gdsc-breakchain-feedback
  • 99. Our Event Sponsors Supreme Sales and Marketing
  • 100. Thank you! Hope you all had fun learning a new technology and gained awesome knowledge from this workshop. See you all soon!