1
ArcBlock Technical Learning Series
Introduction to Ethereum Smart Contract
2
Introduction to Ethereum Smart Contract
Shijun 20180927
Big Picture
3
Agenda
What is Smart
Contract?
How to write Smart
Contract?
Smart Contract
Tooling?
4
Smart Contract Best
Practice?
Before Dive Into Smart Contract
Core Concepts of Blockchain
6
Ethereum Network = Distributed Network
7
What Is Smart Contract?
What is Smart Contract? (Conceptual)
9
source: https://github.com/Overtorment/awesome-smart-contracts
What is Smart Contract? (Technical)
10
source: https://solidity.readthedocs.io/en/v0.4.24/introduction-to-smart-contracts.html
Contract = Account Controlled By Immutable Code
Contract Account vs. User Account
11
12
3
From Contract Source to Contract Account?
12
Contract Source & Contract Account
13
How To Write Smart Contract?
Solidity Programming Language
๏ Contract oriented, influenced by C++/JS/Python
๏ Statically typed, support inheritance
๏ Source file has .sol extension
๏ Compile to bytecode and run in EVM
๏ Javascript similar syntax (not that similar)
15
Solidity 101: Primitive Types
16
Solidity 101: Reference Types
17
Solidity 101: Functions
18
Assertions Modifiers
Function Call vs. Transaction
19
Solidity 101: Global Variables/Fns
20
block util fns
Demo1
Smart Contract Hello World (Remix: Bytecode + ABI)
21
Smart Contract Tooling?
Code Editor
23
Remix VSCode + Node.js
• Rapid contract prototyping
• Testing with existing instance
• Deploy to any valid network
• Mange code using Git
• Save compile/deploy to file
• Automate things
+
Debug/Inspection
๏ Block Explorer
• etherscan.io
• rinkeby.etherscan.io
• ropsten.etherscan.io
• kovan.etherscan.io
๏ Remix
• Debugger mode
• Transaction Log
24
Testnet/Nodes
๏ Ethereum official testnet (real latency)
• rinkeby
• ropsten
• kovan
๏ In memory testnet (low latency)
• ganache-cli
• remix javascript vm
๏ Infura.io nodes
• require registration
25
Funding for Testing
26
Faucet Builtin Unlocked
• Rinkeby Faucet
• Ropsten Faucet
• Kovan Faucet
• Ganache-cli
• Remix in memory node
Transaction Sign/Send
27
GUI SDK
• Metamask • Javascript: web3.js
• Java: web3j
• Swift: web3.swift
Framework: truffle
28
Demo2
Creating ABT Token Using Remix + Metamask + Rinkeby
29
Smart Contract Best Practice?
Considerations need to write good Contract
๏ Security
• Overflow, using SafeMath library
• Identity check and assertion, using function modifiers
๏ Performance
• Design storage carefully
• Avoid computation intensive contract code: loops
๏ Engineering
• Do automated tests
• Make code modular
31
Demo3
Security practices in ArcBlock Token
32
Where To Go From Here?
Smart Contract + DApp = Awesome
๏ What is DApp?
• End-user app that interacts with contract
• An interface that read/render/update contract data
• Can be in form of Web/Native/Desktop App
• Can be SPA with only blockchain backend
34
Resources From Community
๏ Official documentation
• Solidity
• web3.js 1.x
๏ Awesome series
• BlockchainLabsNZ/awesome-solidity
• cjgdev/awesome-smart-contracts
• JoinColony/awesome-web3
• fivedogit/solidity-baby-steps
35
Resources From Me
๏ Contract + DApp Examples
• Lottery App: wangshijun/ethereum-lottery-dapp
• ICO DApp (Nuxt.js): wangshijun/ethereum-dapp-nuxt
• ICO DApp (Next.js): wangshijun/ethereum-contract-workflow
๏ 掘金小册
• 《从 0 到 1 构建基于以太坊智能合约的 ICO DApp》
36
七折优惠码:shijunvip
Get your hands dirty and build something! 😆
Q&A
38

More Related Content

PDF
Consensu, Security, and the Blockchain Gateway Interface - Ethan Buchman, Ten...
PPTX
You probably don't need microservices
PPTX
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivity
PPTX
Developers’ mDay 2021: Robert Juhas, SimpleTask – Should I run my own blockc...
PDF
DevDay: Have Your Cake and Eat it Too, Privacy and Security with ZKP, ING
 
PPTX
Hyperledger Composer overview - Hyperledger Budapest Meetup
PDF
Smart contracts in Solidity
PDF
Trading Derivatives on Hyperledger
Consensu, Security, and the Blockchain Gateway Interface - Ethan Buchman, Ten...
You probably don't need microservices
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivity
Developers’ mDay 2021: Robert Juhas, SimpleTask – Should I run my own blockc...
DevDay: Have Your Cake and Eat it Too, Privacy and Security with ZKP, ING
 
Hyperledger Composer overview - Hyperledger Budapest Meetup
Smart contracts in Solidity
Trading Derivatives on Hyperledger

What's hot (20)

PPTX
DevDay: Writing a Secure CorDapp, (almost) Everything You Didn't Know You Nee...
 
PDF
Hyperledger Fabric: A Custom Blockchain Solution for Corporate Use
PPTX
IBM presents: Hyperledger Fabric Hands On Workshop - part 1
PDF
Intro to NFTs
PDF
HACKBCBR - IBM - Percival Lucena
PPTX
Modern Authentication with OpenID Connect and IdentityServer 4 (umBristol - J...
PDF
Bitmark and Hyperledger Workshop: the Digital Assets and Property
PDF
Introduction to Fabric Composer
PDF
Hyperledger Fabric EVM Integration Feb 20, 2018
PDF
Why Message Driven?
PDF
Hyperledger Fabric Application Development 20190618
PPTX
Modern Authentication for ASP.NET Core with IdentityServer 4 (Progressive .NE...
PPTX
Diving into Algorand - Overview, Key Metrics & Future Possibilities
PDF
The Next Generation of Microservices
PDF
Blockchain Explored: A technical deep-dive
PPTX
Fabric Composer - Construct 2017
PDF
How to be a smart contract engineer
PDF
Blockchain explained FIATA Congress 20180910
PDF
Algorand Presentation
PDF
Algorand Technical Workshop 2021
DevDay: Writing a Secure CorDapp, (almost) Everything You Didn't Know You Nee...
 
Hyperledger Fabric: A Custom Blockchain Solution for Corporate Use
IBM presents: Hyperledger Fabric Hands On Workshop - part 1
Intro to NFTs
HACKBCBR - IBM - Percival Lucena
Modern Authentication with OpenID Connect and IdentityServer 4 (umBristol - J...
Bitmark and Hyperledger Workshop: the Digital Assets and Property
Introduction to Fabric Composer
Hyperledger Fabric EVM Integration Feb 20, 2018
Why Message Driven?
Hyperledger Fabric Application Development 20190618
Modern Authentication for ASP.NET Core with IdentityServer 4 (Progressive .NE...
Diving into Algorand - Overview, Key Metrics & Future Possibilities
The Next Generation of Microservices
Blockchain Explored: A technical deep-dive
Fabric Composer - Construct 2017
How to be a smart contract engineer
Blockchain explained FIATA Congress 20180910
Algorand Presentation
Algorand Technical Workshop 2021
Ad

Similar to Introduction to Ethereum Smart Contracts (20)

PPTX
Creating Smart Contract
ODP
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
PPTX
The Foundation of Smart Contract Development on Ethereum
PDF
Smart contracts using web3.js
PDF
Web3-Guide.pdf
PDF
Blockchain Coding Dojo - BlockchainHub Graz
PDF
“Create your own cryptocurrency in an hour” - Sandip Pandey
PDF
Part 4: Understanding the working of Smart Contracts
PPTX
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
PDF
Smart Contracts: From Zero to Dapp Hero | Hedera18
PDF
Handson Smart Contract Development With Solidity And Ethereum From Fundamenta...
PDF
The JavaScript toolset for development on Ethereum
PDF
Javascript toolset for Ethereum Smart Contract development
PPTX
How to design, code, deploy and execute a smart contract
DOCX
PPTX
Smart Contract programming 101 with Solidity #PizzaHackathon
PDF
All watched over machines of loving grace amsterdam
PDF
Blockchain
PDF
Blockchain In Action 1st Edition Bina Ramamurthy
PDF
An Introduction to Decentralized Apps
Creating Smart Contract
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
The Foundation of Smart Contract Development on Ethereum
Smart contracts using web3.js
Web3-Guide.pdf
Blockchain Coding Dojo - BlockchainHub Graz
“Create your own cryptocurrency in an hour” - Sandip Pandey
Part 4: Understanding the working of Smart Contracts
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Smart Contracts: From Zero to Dapp Hero | Hedera18
Handson Smart Contract Development With Solidity And Ethereum From Fundamenta...
The JavaScript toolset for development on Ethereum
Javascript toolset for Ethereum Smart Contract development
How to design, code, deploy and execute a smart contract
Smart Contract programming 101 with Solidity #PizzaHackathon
All watched over machines of loving grace amsterdam
Blockchain
Blockchain In Action 1st Edition Bina Ramamurthy
An Introduction to Decentralized Apps
Ad

More from ArcBlock (18)

PDF
ArcBlock Introduction to Blockchain
PDF
Forge blockchain deployment made easy
PDF
Designing Decentralized Apps: Programmable Tokens
PDF
Build a Decentralized, public verifiable Database with ex_abci and Tendermint
PDF
ArcBlock Presents 5 Winning Factors to Building a Successful DApp
PDF
QRCodes are Fun, Easy, and Useful for Links, Payments and Identity Verification
PDF
Designing Decentralized Applications (DApps)
PDF
Cryptography for everyone
PDF
Introduction to HTTP/2 and How To Use It
PDF
IPFS: A Whole New World
PDF
Ethereum virtual machine for Developers Part 1
PDF
Understanding hd wallets design and implementation
PDF
Technical Learning Series - Elixir ExUnit
PDF
Tendermint in a nutshell
PDF
Introduction to CQRS & Commended
PDF
Decipher Multi-Factor Authentication - A Developers Introduction
PDF
Introduction to aws data pipeline services
PDF
ArcBlock Presents An Introduction to Blockchain
ArcBlock Introduction to Blockchain
Forge blockchain deployment made easy
Designing Decentralized Apps: Programmable Tokens
Build a Decentralized, public verifiable Database with ex_abci and Tendermint
ArcBlock Presents 5 Winning Factors to Building a Successful DApp
QRCodes are Fun, Easy, and Useful for Links, Payments and Identity Verification
Designing Decentralized Applications (DApps)
Cryptography for everyone
Introduction to HTTP/2 and How To Use It
IPFS: A Whole New World
Ethereum virtual machine for Developers Part 1
Understanding hd wallets design and implementation
Technical Learning Series - Elixir ExUnit
Tendermint in a nutshell
Introduction to CQRS & Commended
Decipher Multi-Factor Authentication - A Developers Introduction
Introduction to aws data pipeline services
ArcBlock Presents An Introduction to Blockchain

Recently uploaded (20)

PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
Electrocardiogram sequences data analytics and classification using unsupervi...
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
CEH Module 2 Footprinting CEH V13, concepts
PDF
4 layer Arch & Reference Arch of IoT.pdf
PDF
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
PPTX
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PDF
Auditboard EB SOX Playbook 2023 edition.
PDF
Build Real-Time ML Apps with Python, Feast & NoSQL
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
substrate PowerPoint Presentation basic one
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
EIS-Webinar-Regulated-Industries-2025-08.pdf
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PDF
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
Build automations faster and more reliably with UiPath ScreenPlay
Electrocardiogram sequences data analytics and classification using unsupervi...
Basics of Cloud Computing - Cloud Ecosystem
CEH Module 2 Footprinting CEH V13, concepts
4 layer Arch & Reference Arch of IoT.pdf
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
Early detection and classification of bone marrow changes in lumbar vertebrae...
Auditboard EB SOX Playbook 2023 edition.
Build Real-Time ML Apps with Python, Feast & NoSQL
Introduction to MCP and A2A Protocols: Enabling Agent Communication
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
substrate PowerPoint Presentation basic one
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
EIS-Webinar-Regulated-Industries-2025-08.pdf
Connector Corner: Transform Unstructured Documents with Agentic Automation
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf

Introduction to Ethereum Smart Contracts