SlideShare a Scribd company logo
1 of 16
How to create an
Ethereum Token
Roger
What's an ICO/Token Lunch?
◈ Initial Coin Offering
◈ A fundraising tool that trades future cryptocoins in exchange for
cryptocurrencies.
◈ Case
⬥ Basic Attention Token
(USD 35 million in 24 seconds)
⬥ Status
(USD 100 million in 1 hour)
2
Why ICO/Token Lunch?
◈ For company
⬥ The company can raise funds
⬥ The value of the token will change with the company's future development
◈ For investors
⬥ Use the token in exchange for product use rights
⬥ Sell the token, earn the spread from it
3
ERC-20 Token Standard
◈ ERC-20 defines a common list of rules for all Ethereum tokens to
follow.
◈ ERC-20 will allow dapps and wallets to handle tokens across
multiple interfaces/dapps.
4
ERC-20 Specification
◈ function totalSupply() constant returns (uint256 totalSupply)
◈ function balanceOf(address _owner) constant returns (uint256 balance)
◈ function transfer(address _to, uint256 _value) returns (bool success)
◈ function transferFrom(address _from, address _to, uint256 _value) returns (bool success)
◈ function approve(address _spender, uint256 _value) returns (bool success)
◈ function allowance(address _owner, address _spender) constant returns (uint256
remaining)
◈ event Transfer(address indexed _from, address indexed _to, uint256 _value)
◈ event Approval(address indexed _owner, address indexed _spender, uint256 _value)
Github: zeppelin ERC-20 Standard Token
5
Create your own ethereum token
◈ Inherit Standard Token
◈ Basic Parameters
// A Plan Coin
string public name = "A Plan Coin";
string public symbol = "APC";
uint8 public decimals = 18;
// Crowdsale details
address public beneficiary; // Company addres
uint256 public minAmount = 10 ether;
uint256 public maxAmount = 95279487 ether;
uint256 public minAcceptedAmount = 40 finney; // 1/25 ether
contract APCToken is Owned, StandardToken { . . . }
6
Create your own ethereum token (cont.)
◈ Exchange Rate Parameters
◈ Solidity Time Unit
// Eth to APC rate
uint256 public rateAngelMinutes = 650;
uint256 public rateFirstMinutes = 550;
uint256 public rateSecondMinutes = 475;
uint256 public rateThirdMinutes = 425;
uint256 public rateLastMinutes = 400;
uint256 public rateAngelMinutesEnd = 1 minutes;
uint256 public rateFirstMinutesEnd = 2 minutes;
uint256 public rateSecondMinutesEnd = 3 minutes;
uint256 public rateThirdMinutesEnd = 4 minutes;
uint256 public rateLastMinutesEnd = 5 minutes;
1 == 1 seconds , 1 minutes == 60 seconds , 1 hours == 60 minutes
1 days == 24 hours , 1 weeks == 7 days , 1 years == 365 days
7
Create your own ethereum token (cont.)
◈ Modifiers
enum Stages {
InProgress,
Ended,
Withdrawn,
Proposed,
Accepted
}
/* Throw if at stage other than current stage */
modifier atStage(Stages _stage) {
if (stage != _stage) {
Throw;
}
_;
}
/* Access is restricted to owner */
modifier onlyOwner() {
if (msg.sender != owner) throw;
_;
}
/* Throw if sender is not beneficiary */
modifier onlyBeneficiary() {
if (beneficiary != msg.sender) {
Throw;
}
_;
}
8
Create your own ethereum token (cont.)
◈ Payment Methods
function () atStage(Stages.InProgress) payable {
if (now < start) {
throw;
}
if (now > end) {
throw;
}
// Enforce min amount
if (msg.value < minAcceptedAmount) {
throw;
}
createTokens();
}
function createTokens() payable {
uint256 tokens = toAPC();
totalSupply += tokens;
balances[msg.sender] += tokens;
raised += msg.value;
deposit[msg.sender] = msg.value;
// Notify listners
Transfer(msg.sender, owner, msg.value);
Transfer(owner, msg.sender, tokens);
}
function toAPC() payable returns (uint256 amount){
// Convert `eth to APC using the current rate
} 9
Create your own ethereum token (cont.)
◈ Withdraw Methods
/* Function to end the crowdsale */
function endCrowdsale() atStage(Stages.InProgress)
{
// Crowdsale not ended yet
if (now < end) {
throw;
}
stage = Stages.Ended;
}
/** Unlocks the token irreversibly so that the
transfering of value is enabled*/
function unlock() onlyOwner returns (bool
success) {
locked = false;
return true;
}
/* Transfer to the company address */
function withdraw() onlyBeneficiary
atStage(Stages.Ended) {
// Confirm that minAmount is raised
if (raised < minAmount) {
throw;
}
0;
uint256 amountToSend = raised;
if (!beneficiary.send(amountToSend)) {
throw;
}
stage = Stages.Withdrawn;
}
10
Create your own ethereum token (cont.)
◈ Refund Methods
function refund() atStage(Stages.Ended) {
// Only allow refunds if minAmount is not raised
if (raised >= minAmount) throw;
uint256 receivedAmount = deposit[msg.sender];
uint256 tokenAmount = balances[msg.sender];
deposit[msg.sender] = 0;
balances[msg.sender] = 0;
totalSupply -= tokenAmount;
raised -= receivedAmount;
if (receivedAmount > 0 && !msg.sender.send(receivedAmount)) {
deposit[msg.sender] = receivedAmount;
balances[msg.sender] = tokenAmount;
totalSupply += tokenAmount;
raised += receivedAmount;
}
} 11
Create your own ethereum token (cont.)
◈ Block number condition
function APCToken(address _beneficiary, uint256
_start, uint256 _end) {
beneficiary = _beneficiary;
balances[msg.sender] = 0;
totalSupply = 0;
locked = true;
start = _start;
end = _end;
}
12
function () atStage(Stages.InProgress) payable {
if (block.number < start) throw;
if (block.number > end) throw;
// Enforce min amount
if (msg.value < minAcceptedAmount) {
throw;
}
createTokens();
}
DEMO
13
14
Cryptocurrency Exchange
15
Other Ethereum Tokens
Any questions?
16

More Related Content

What's hot

Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3Gene Leybzon
 
Ravada VDI Eslibre
Ravada VDI EslibreRavada VDI Eslibre
Ravada VDI Eslibrefrankiejol
 
Socket.io under the hood
Socket.io under the hoodSocket.io under the hood
Socket.io under the hoodHaokang Den
 
Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)MoscowDjango
 
Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node jsThomas Roch
 
Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.ioArnout Kazemier
 
it's only abuse if it crashes
it's only abuse if it crashesit's only abuse if it crashes
it's only abuse if it crashesEleanor McHugh
 
Hello world contract
Hello world contractHello world contract
Hello world contractGene Leybzon
 
Hands on with smart contracts
Hands on with smart contractsHands on with smart contracts
Hands on with smart contractsGene Leybzon
 
Avoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jsAvoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jscacois
 
Docker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at TwitterDocker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at TwitterdotCloud
 

What's hot (20)

Textile
TextileTextile
Textile
 
Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3
 
Ravada VDI Eslibre
Ravada VDI EslibreRavada VDI Eslibre
Ravada VDI Eslibre
 
Socket.io
Socket.ioSocket.io
Socket.io
 
Ns tutorial
Ns tutorialNs tutorial
Ns tutorial
 
Socket.io under the hood
Socket.io under the hoodSocket.io under the hood
Socket.io under the hood
 
Shaky ERC20 Allowances
Shaky ERC20 AllowancesShaky ERC20 Allowances
Shaky ERC20 Allowances
 
Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)
 
Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
 
SPICE Model of M1FE60(PDF)
SPICE Model of M1FE60(PDF)SPICE Model of M1FE60(PDF)
SPICE Model of M1FE60(PDF)
 
Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.io
 
Node js lecture
Node js lectureNode js lecture
Node js lecture
 
it's only abuse if it crashes
it's only abuse if it crashesit's only abuse if it crashes
it's only abuse if it crashes
 
Hello world contract
Hello world contractHello world contract
Hello world contract
 
Hands on with smart contracts
Hands on with smart contractsHands on with smart contracts
Hands on with smart contracts
 
Introduction to asyncio
Introduction to asyncioIntroduction to asyncio
Introduction to asyncio
 
Socket.IO
Socket.IOSocket.IO
Socket.IO
 
Avoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jsAvoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.js
 
Lecture16
Lecture16Lecture16
Lecture16
 
Docker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at TwitterDocker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at Twitter
 

Similar to How to create ethereum token (A plan coin ico)

ERC20 Token Contract
ERC20 Token ContractERC20 Token Contract
ERC20 Token ContractKC Tam
 
“Create your own cryptocurrency in an hour” - Sandip Pandey
“Create your own cryptocurrency in an hour” - Sandip Pandey“Create your own cryptocurrency in an hour” - Sandip Pandey
“Create your own cryptocurrency in an hour” - Sandip PandeyEIT Digital Alumni
 
Tucson Blockchain Developers Meetup #1 - Cryptokitties by Destry
Tucson Blockchain Developers Meetup #1 - Cryptokitties by DestryTucson Blockchain Developers Meetup #1 - Cryptokitties by Destry
Tucson Blockchain Developers Meetup #1 - Cryptokitties by DestryDestry Saul
 
以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12Aludirk Wong
 
BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session
BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session
BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session 병완 임
 
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereumDappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereumTomoaki Sato
 
Actor Concurrency
Actor ConcurrencyActor Concurrency
Actor ConcurrencyAlex Miller
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeShakacon
 
FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2rohassanie
 
Solidity Simple Tutorial EN
Solidity Simple Tutorial ENSolidity Simple Tutorial EN
Solidity Simple Tutorial ENNicholas Lin
 
Kostas Kloudas - Extending Flink's Streaming APIs
Kostas Kloudas - Extending Flink's Streaming APIsKostas Kloudas - Extending Flink's Streaming APIs
Kostas Kloudas - Extending Flink's Streaming APIsVerverica
 
Facts about multithreading that'll keep you up at night - Guy Bar on, Vonage
Facts about multithreading that'll keep you up at night - Guy Bar on, VonageFacts about multithreading that'll keep you up at night - Guy Bar on, Vonage
Facts about multithreading that'll keep you up at night - Guy Bar on, VonageCodemotion Tel Aviv
 
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015ThierryAbalea
 
Cvim half precision floating point
Cvim half precision floating pointCvim half precision floating point
Cvim half precision floating pointtomoaki0705
 
Hot Code is Faster Code - Addressing JVM Warm-up
Hot Code is Faster Code - Addressing JVM Warm-upHot Code is Faster Code - Addressing JVM Warm-up
Hot Code is Faster Code - Addressing JVM Warm-upMark Price
 
BitVisor Summit 11「2. BitVisor on Aarch64」
BitVisor Summit 11「2. BitVisor on Aarch64」BitVisor Summit 11「2. BitVisor on Aarch64」
BitVisor Summit 11「2. BitVisor on Aarch64」BitVisor
 
Robust Programming of Smart Contracts in Solidity+, RK Shyamasundar
Robust Programming of Smart Contracts in Solidity+, RK ShyamasundarRobust Programming of Smart Contracts in Solidity+, RK Shyamasundar
Robust Programming of Smart Contracts in Solidity+, RK ShyamasundarNapier University
 

Similar to How to create ethereum token (A plan coin ico) (20)

ERC20 Token Contract
ERC20 Token ContractERC20 Token Contract
ERC20 Token Contract
 
“Create your own cryptocurrency in an hour” - Sandip Pandey
“Create your own cryptocurrency in an hour” - Sandip Pandey“Create your own cryptocurrency in an hour” - Sandip Pandey
“Create your own cryptocurrency in an hour” - Sandip Pandey
 
Tucson Blockchain Developers Meetup #1 - Cryptokitties by Destry
Tucson Blockchain Developers Meetup #1 - Cryptokitties by DestryTucson Blockchain Developers Meetup #1 - Cryptokitties by Destry
Tucson Blockchain Developers Meetup #1 - Cryptokitties by Destry
 
以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12以太坊代幣付款委託 @ Open Source Developer Meetup #12
以太坊代幣付款委託 @ Open Source Developer Meetup #12
 
BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session
BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session
BlockchainDay "Ethereum Dapp - Asset Exchange YOSEMITE alpha" Session
 
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereumDappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
 
Actor Concurrency
Actor ConcurrencyActor Concurrency
Actor Concurrency
 
Ethereum A to Z
Ethereum A to ZEthereum A to Z
Ethereum A to Z
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts Bytecode
 
FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2
 
Solidity Simple Tutorial EN
Solidity Simple Tutorial ENSolidity Simple Tutorial EN
Solidity Simple Tutorial EN
 
Advanced smart contract
Advanced smart contractAdvanced smart contract
Advanced smart contract
 
Kostas Kloudas - Extending Flink's Streaming APIs
Kostas Kloudas - Extending Flink's Streaming APIsKostas Kloudas - Extending Flink's Streaming APIs
Kostas Kloudas - Extending Flink's Streaming APIs
 
Facts about multithreading that'll keep you up at night - Guy Bar on, Vonage
Facts about multithreading that'll keep you up at night - Guy Bar on, VonageFacts about multithreading that'll keep you up at night - Guy Bar on, Vonage
Facts about multithreading that'll keep you up at night - Guy Bar on, Vonage
 
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
 
Cvim half precision floating point
Cvim half precision floating pointCvim half precision floating point
Cvim half precision floating point
 
Hot Code is Faster Code - Addressing JVM Warm-up
Hot Code is Faster Code - Addressing JVM Warm-upHot Code is Faster Code - Addressing JVM Warm-up
Hot Code is Faster Code - Addressing JVM Warm-up
 
4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf
 
BitVisor Summit 11「2. BitVisor on Aarch64」
BitVisor Summit 11「2. BitVisor on Aarch64」BitVisor Summit 11「2. BitVisor on Aarch64」
BitVisor Summit 11「2. BitVisor on Aarch64」
 
Robust Programming of Smart Contracts in Solidity+, RK Shyamasundar
Robust Programming of Smart Contracts in Solidity+, RK ShyamasundarRobust Programming of Smart Contracts in Solidity+, RK Shyamasundar
Robust Programming of Smart Contracts in Solidity+, RK Shyamasundar
 

More from 承翰 蔡

Notes for AWS IoT
Notes for AWS IoTNotes for AWS IoT
Notes for AWS IoT承翰 蔡
 
Node-red Chatbot module
Node-red Chatbot moduleNode-red Chatbot module
Node-red Chatbot module承翰 蔡
 
Bitcoin developer guide
Bitcoin developer guideBitcoin developer guide
Bitcoin developer guide承翰 蔡
 
The 3rd generation blockchain
The 3rd generation blockchainThe 3rd generation blockchain
The 3rd generation blockchain承翰 蔡
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction承翰 蔡
 
AWS IoT introduction
AWS IoT introductionAWS IoT introduction
AWS IoT introduction承翰 蔡
 
IoT開發平台NodeMCU
IoT開發平台NodeMCUIoT開發平台NodeMCU
IoT開發平台NodeMCU承翰 蔡
 
Node mcu x raspberrypi2 x mqtt
Node mcu x raspberrypi2 x mqttNode mcu x raspberrypi2 x mqtt
Node mcu x raspberrypi2 x mqtt承翰 蔡
 
Arduino mqtt client introduction
Arduino mqtt client introductionArduino mqtt client introduction
Arduino mqtt client introduction承翰 蔡
 
Webduino introduction
Webduino introductionWebduino introduction
Webduino introduction承翰 蔡
 
MongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark
MongoDB 3.0.0 vs 2.6.x vs 2.4.x BenchmarkMongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark
MongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark承翰 蔡
 
Kimono sharing
Kimono sharingKimono sharing
Kimono sharing承翰 蔡
 

More from 承翰 蔡 (13)

Notes for AWS IoT
Notes for AWS IoTNotes for AWS IoT
Notes for AWS IoT
 
Node-red Chatbot module
Node-red Chatbot moduleNode-red Chatbot module
Node-red Chatbot module
 
Ipfs
IpfsIpfs
Ipfs
 
Bitcoin developer guide
Bitcoin developer guideBitcoin developer guide
Bitcoin developer guide
 
The 3rd generation blockchain
The 3rd generation blockchainThe 3rd generation blockchain
The 3rd generation blockchain
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction
 
AWS IoT introduction
AWS IoT introductionAWS IoT introduction
AWS IoT introduction
 
IoT開發平台NodeMCU
IoT開發平台NodeMCUIoT開發平台NodeMCU
IoT開發平台NodeMCU
 
Node mcu x raspberrypi2 x mqtt
Node mcu x raspberrypi2 x mqttNode mcu x raspberrypi2 x mqtt
Node mcu x raspberrypi2 x mqtt
 
Arduino mqtt client introduction
Arduino mqtt client introductionArduino mqtt client introduction
Arduino mqtt client introduction
 
Webduino introduction
Webduino introductionWebduino introduction
Webduino introduction
 
MongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark
MongoDB 3.0.0 vs 2.6.x vs 2.4.x BenchmarkMongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark
MongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark
 
Kimono sharing
Kimono sharingKimono sharing
Kimono sharing
 

Recently uploaded

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Recently uploaded (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

How to create ethereum token (A plan coin ico)

  • 1. How to create an Ethereum Token Roger
  • 2. What's an ICO/Token Lunch? ◈ Initial Coin Offering ◈ A fundraising tool that trades future cryptocoins in exchange for cryptocurrencies. ◈ Case ⬥ Basic Attention Token (USD 35 million in 24 seconds) ⬥ Status (USD 100 million in 1 hour) 2
  • 3. Why ICO/Token Lunch? ◈ For company ⬥ The company can raise funds ⬥ The value of the token will change with the company's future development ◈ For investors ⬥ Use the token in exchange for product use rights ⬥ Sell the token, earn the spread from it 3
  • 4. ERC-20 Token Standard ◈ ERC-20 defines a common list of rules for all Ethereum tokens to follow. ◈ ERC-20 will allow dapps and wallets to handle tokens across multiple interfaces/dapps. 4
  • 5. ERC-20 Specification ◈ function totalSupply() constant returns (uint256 totalSupply) ◈ function balanceOf(address _owner) constant returns (uint256 balance) ◈ function transfer(address _to, uint256 _value) returns (bool success) ◈ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) ◈ function approve(address _spender, uint256 _value) returns (bool success) ◈ function allowance(address _owner, address _spender) constant returns (uint256 remaining) ◈ event Transfer(address indexed _from, address indexed _to, uint256 _value) ◈ event Approval(address indexed _owner, address indexed _spender, uint256 _value) Github: zeppelin ERC-20 Standard Token 5
  • 6. Create your own ethereum token ◈ Inherit Standard Token ◈ Basic Parameters // A Plan Coin string public name = "A Plan Coin"; string public symbol = "APC"; uint8 public decimals = 18; // Crowdsale details address public beneficiary; // Company addres uint256 public minAmount = 10 ether; uint256 public maxAmount = 95279487 ether; uint256 public minAcceptedAmount = 40 finney; // 1/25 ether contract APCToken is Owned, StandardToken { . . . } 6
  • 7. Create your own ethereum token (cont.) ◈ Exchange Rate Parameters ◈ Solidity Time Unit // Eth to APC rate uint256 public rateAngelMinutes = 650; uint256 public rateFirstMinutes = 550; uint256 public rateSecondMinutes = 475; uint256 public rateThirdMinutes = 425; uint256 public rateLastMinutes = 400; uint256 public rateAngelMinutesEnd = 1 minutes; uint256 public rateFirstMinutesEnd = 2 minutes; uint256 public rateSecondMinutesEnd = 3 minutes; uint256 public rateThirdMinutesEnd = 4 minutes; uint256 public rateLastMinutesEnd = 5 minutes; 1 == 1 seconds , 1 minutes == 60 seconds , 1 hours == 60 minutes 1 days == 24 hours , 1 weeks == 7 days , 1 years == 365 days 7
  • 8. Create your own ethereum token (cont.) ◈ Modifiers enum Stages { InProgress, Ended, Withdrawn, Proposed, Accepted } /* Throw if at stage other than current stage */ modifier atStage(Stages _stage) { if (stage != _stage) { Throw; } _; } /* Access is restricted to owner */ modifier onlyOwner() { if (msg.sender != owner) throw; _; } /* Throw if sender is not beneficiary */ modifier onlyBeneficiary() { if (beneficiary != msg.sender) { Throw; } _; } 8
  • 9. Create your own ethereum token (cont.) ◈ Payment Methods function () atStage(Stages.InProgress) payable { if (now < start) { throw; } if (now > end) { throw; } // Enforce min amount if (msg.value < minAcceptedAmount) { throw; } createTokens(); } function createTokens() payable { uint256 tokens = toAPC(); totalSupply += tokens; balances[msg.sender] += tokens; raised += msg.value; deposit[msg.sender] = msg.value; // Notify listners Transfer(msg.sender, owner, msg.value); Transfer(owner, msg.sender, tokens); } function toAPC() payable returns (uint256 amount){ // Convert `eth to APC using the current rate } 9
  • 10. Create your own ethereum token (cont.) ◈ Withdraw Methods /* Function to end the crowdsale */ function endCrowdsale() atStage(Stages.InProgress) { // Crowdsale not ended yet if (now < end) { throw; } stage = Stages.Ended; } /** Unlocks the token irreversibly so that the transfering of value is enabled*/ function unlock() onlyOwner returns (bool success) { locked = false; return true; } /* Transfer to the company address */ function withdraw() onlyBeneficiary atStage(Stages.Ended) { // Confirm that minAmount is raised if (raised < minAmount) { throw; } 0; uint256 amountToSend = raised; if (!beneficiary.send(amountToSend)) { throw; } stage = Stages.Withdrawn; } 10
  • 11. Create your own ethereum token (cont.) ◈ Refund Methods function refund() atStage(Stages.Ended) { // Only allow refunds if minAmount is not raised if (raised >= minAmount) throw; uint256 receivedAmount = deposit[msg.sender]; uint256 tokenAmount = balances[msg.sender]; deposit[msg.sender] = 0; balances[msg.sender] = 0; totalSupply -= tokenAmount; raised -= receivedAmount; if (receivedAmount > 0 && !msg.sender.send(receivedAmount)) { deposit[msg.sender] = receivedAmount; balances[msg.sender] = tokenAmount; totalSupply += tokenAmount; raised += receivedAmount; } } 11
  • 12. Create your own ethereum token (cont.) ◈ Block number condition function APCToken(address _beneficiary, uint256 _start, uint256 _end) { beneficiary = _beneficiary; balances[msg.sender] = 0; totalSupply = 0; locked = true; start = _start; end = _end; } 12 function () atStage(Stages.InProgress) payable { if (block.number < start) throw; if (block.number > end) throw; // Enforce min amount if (msg.value < minAcceptedAmount) { throw; } createTokens(); }

Editor's Notes

  1. Solidity Global Variables: http://solidity.readthedocs.io/en/develop/units-and-global-variables.html top50 ethereum token: https://ethplorer.io/top token contract: https://etherscan.io/token-search Zeppelin github: https://github.com/OpenZeppelin/zeppelin-solidity
  2. top 40 exchange: https://www.bestbitcoinexchange.io/
  3. top 50 ethereum tokens: https://ethplorer.io/top search token contract: https://etherscan.io/token-search