SlideShare a Scribd company logo
1 of 16
Download to read offline
ERC20
Josh Chu
Introduction
● ICO (Initial Coin Offering) means a company uses blockchain technology
to issue new coin, token, and sells it to investors in exchange for
cryptocurrencies to raise money
● Currently, most ICOs utilize ERC20 on Ethereum to issue token
● ERC20 is a standard interface for the implementation of a standard API
for tokens within smart contracts on Ethereum, which provides basic
functionality to query and transfer tokens
ERC20 Interface
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
Active Transfer
Passive Transfer1
Passive Transfer2
Call Function: totalSupply
● contract.totalSupply()
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0x0f560ffc6e1f87f1c73506b361f72376be23c
2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x18160ddd"},"latest"],"id":1}' 
http://127.0.0.1:8545/
Call Function: balanceOf
● contract.balanceOf("0x0f560ffc6e1f87f1c73506b361f72376be23c2d1")
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0x0f560ffc6e1f87f1c73506b361f72376be23c
2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x70a082310000000000000000
000000000f560ffc6e1f87f1c73506b361f72376be23c2d1"},"latest"],"id":1}' 
http://127.0.0.1:8545/
Call Function: allowance
● contract.allowance("0x0f560ffc6e1f87f1c73506b361f72376be23c2d1","0x
d6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a")
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0x0f560ffc6e1f87f1c73506b361f72376be23c
2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0xdd62ed3e0000000000000000
000000000f560ffc6e1f87f1c73506b361f72376be23c2d1000000000000000000000000d6eeb2ae4e2a
b52c42d5ed4d8cc8318a10fd951a"},"latest"],"id":1}' 
http://127.0.0.1:8545/
Call Function: transfer
● contract.transfer("0xd6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a",10)
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x0f560ffc6e1f87f1c73506b361
f72376be23c2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0xa9059cbb000000
000000000000000000d6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a000000000000000000000000
000000000000000000000000000000000000000a"}],"id":1}' 
http://127.0.0.1:8545/
Call Function: approve
● contract.approve("0xd6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a",10)
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x0f560ffc6e1f87f1c73506b361
f72376be23c2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x095ea7b3000000
000000000000000000d6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a000000000000000000000000
000000000000000000000000000000000000000a"}],"id":1}' 
http://127.0.0.1:8545/
Call Function: transferFrom
● contract.transferFrom("0x0f560ffc6e1f87f1c73506b361f72376be23c2d1","
0xd6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a",10)
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x0f560ffc6e1f87f1c73506b361
f72376be23c2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x23b872dd000000
0000000000000000000f560ffc6e1f87f1c73506b361f72376be23c2d1000000000000000000000000d6
eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a00000000000000000000000000000000000000000000
0000000000000000000a"}],"id":1}' 
http://127.0.0.1:8545/
Monitor Event: Transfer
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock":"0x2B3300","address":["0x410972
9e35500c4aa11729af0965bf2c8cdfcf94"],"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f1
63c4a11628f55a4df523b3ef"]}],"id":1}' 
http://127.0.0.1:8545/
curl 
-X POST 
-H 'Content-Type: application/json' 
-d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x03"],"id":1}' 
http://127.0.0.1:8545/
● Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.
Monitor Event: Approval
curl 
-X POST 
-H 'Content-Type: application/json' 
-d
'{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock":"0x2B3300","address":["0x410972
9e35500c4aa11729af0965bf2c8cdfcf94"],"topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c
0f7b2291e5b200ac8c7c3b925"]}],"id":1}' 
http://127.0.0.1:8545/
curl 
-X POST 
-H 'Content-Type: application/json' 
-d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x04"],"id":1}' 
http://127.0.0.1:8545/
● Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.
Future
● ERC223 token standard, https://github.com/ethereum/eips/issues/223
● Non-fungible Token Standard,
https://github.com/ethereum/eips/issues/721
Reference
● ERC20 Token Standard,
https://theethereum.wiki/w/index.php/ERC20_Token_Standard
● Token standard,
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
● Parity JSONRPC Guide - The eth Module,
https://wiki.parity.io/JSONRPC-eth-module

More Related Content

Similar to ERC20

Presto anatomy
Presto anatomyPresto anatomy
Presto anatomyDongmin Yu
 
以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12Aludirk Wong
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGIMike Pittaro
 
Mastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura BhaveMastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura BhaveVMware Tanzu
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingMichelle Holley
 
Moony li pacsec-1.8
Moony li pacsec-1.8Moony li pacsec-1.8
Moony li pacsec-1.8PacSecJP
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이GangSeok Lee
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기NAVER D2
 
Fiware io t_ul20_cpbr8
Fiware io t_ul20_cpbr8Fiware io t_ul20_cpbr8
Fiware io t_ul20_cpbr8FIWARE
 
Connect to Bitcoin & Ethereum networks (RPC APIs)
Connect to Bitcoin & Ethereum networks (RPC APIs)Connect to Bitcoin & Ethereum networks (RPC APIs)
Connect to Bitcoin & Ethereum networks (RPC APIs)Dilum Navanjana
 
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020Sandesh Rao
 
Wan Interface Configuration
Wan Interface ConfigurationWan Interface Configuration
Wan Interface ConfigurationKishore Kumar
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
Robotics on Java Simplified
Robotics on Java SimplifiedRobotics on Java Simplified
Robotics on Java SimplifiedMarcus Hirt
 
ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale Subbu Allamaraju
 

Similar to ERC20 (20)

Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
 
Mastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura BhaveMastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura Bhave
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
 
Marat-Slides
Marat-SlidesMarat-Slides
Marat-Slides
 
3
33
3
 
Moony li pacsec-1.8
Moony li pacsec-1.8Moony li pacsec-1.8
Moony li pacsec-1.8
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 
Fiware io t_ul20_cpbr8
Fiware io t_ul20_cpbr8Fiware io t_ul20_cpbr8
Fiware io t_ul20_cpbr8
 
Connect to Bitcoin & Ethereum networks (RPC APIs)
Connect to Bitcoin & Ethereum networks (RPC APIs)Connect to Bitcoin & Ethereum networks (RPC APIs)
Connect to Bitcoin & Ethereum networks (RPC APIs)
 
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020
 
Wan Interface Configuration
Wan Interface ConfigurationWan Interface Configuration
Wan Interface Configuration
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Ripple
RippleRipple
Ripple
 
A Year in the Empire
A Year in the EmpireA Year in the Empire
A Year in the Empire
 
Robotics on Java Simplified
Robotics on Java SimplifiedRobotics on Java Simplified
Robotics on Java Simplified
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale
 

Recently uploaded

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

ERC20

  • 2. Introduction ● ICO (Initial Coin Offering) means a company uses blockchain technology to issue new coin, token, and sells it to investors in exchange for cryptocurrencies to raise money ● Currently, most ICOs utilize ERC20 on Ethereum to issue token ● ERC20 is a standard interface for the implementation of a standard API for tokens within smart contracts on Ethereum, which provides basic functionality to query and transfer tokens
  • 3. ERC20 Interface // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); }
  • 7. Call Function: totalSupply ● contract.totalSupply() curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0x0f560ffc6e1f87f1c73506b361f72376be23c 2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x18160ddd"},"latest"],"id":1}' http://127.0.0.1:8545/
  • 8. Call Function: balanceOf ● contract.balanceOf("0x0f560ffc6e1f87f1c73506b361f72376be23c2d1") curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0x0f560ffc6e1f87f1c73506b361f72376be23c 2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x70a082310000000000000000 000000000f560ffc6e1f87f1c73506b361f72376be23c2d1"},"latest"],"id":1}' http://127.0.0.1:8545/
  • 9. Call Function: allowance ● contract.allowance("0x0f560ffc6e1f87f1c73506b361f72376be23c2d1","0x d6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a") curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0x0f560ffc6e1f87f1c73506b361f72376be23c 2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0xdd62ed3e0000000000000000 000000000f560ffc6e1f87f1c73506b361f72376be23c2d1000000000000000000000000d6eeb2ae4e2a b52c42d5ed4d8cc8318a10fd951a"},"latest"],"id":1}' http://127.0.0.1:8545/
  • 10. Call Function: transfer ● contract.transfer("0xd6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a",10) curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x0f560ffc6e1f87f1c73506b361 f72376be23c2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0xa9059cbb000000 000000000000000000d6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a000000000000000000000000 000000000000000000000000000000000000000a"}],"id":1}' http://127.0.0.1:8545/
  • 11. Call Function: approve ● contract.approve("0xd6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a",10) curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x0f560ffc6e1f87f1c73506b361 f72376be23c2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x095ea7b3000000 000000000000000000d6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a000000000000000000000000 000000000000000000000000000000000000000a"}],"id":1}' http://127.0.0.1:8545/
  • 12. Call Function: transferFrom ● contract.transferFrom("0x0f560ffc6e1f87f1c73506b361f72376be23c2d1"," 0xd6eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a",10) curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x0f560ffc6e1f87f1c73506b361 f72376be23c2d1","to":"0x4109729e35500c4aa11729af0965bf2c8cdfcf94","data":"0x23b872dd000000 0000000000000000000f560ffc6e1f87f1c73506b361f72376be23c2d1000000000000000000000000d6 eeb2ae4e2ab52c42d5ed4d8cc8318a10fd951a00000000000000000000000000000000000000000000 0000000000000000000a"}],"id":1}' http://127.0.0.1:8545/
  • 13. Monitor Event: Transfer curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock":"0x2B3300","address":["0x410972 9e35500c4aa11729af0965bf2c8cdfcf94"],"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f1 63c4a11628f55a4df523b3ef"]}],"id":1}' http://127.0.0.1:8545/ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x03"],"id":1}' http://127.0.0.1:8545/ ● Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.
  • 14. Monitor Event: Approval curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock":"0x2B3300","address":["0x410972 9e35500c4aa11729af0965bf2c8cdfcf94"],"topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c 0f7b2291e5b200ac8c7c3b925"]}],"id":1}' http://127.0.0.1:8545/ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x04"],"id":1}' http://127.0.0.1:8545/ ● Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.
  • 15. Future ● ERC223 token standard, https://github.com/ethereum/eips/issues/223 ● Non-fungible Token Standard, https://github.com/ethereum/eips/issues/721
  • 16. Reference ● ERC20 Token Standard, https://theethereum.wiki/w/index.php/ERC20_Token_Standard ● Token standard, https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md ● Parity JSONRPC Guide - The eth Module, https://wiki.parity.io/JSONRPC-eth-module