<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=ERC20</id>
	<title>ERC20 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=ERC20"/>
	<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=ERC20&amp;action=history"/>
	<updated>2026-05-15T06:34:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://en.zaoniao.it/index.php?title=ERC20&amp;diff=1333&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;{{#seo: |title=ERC20 Token Standard – Ethereum Smart Contracts – zaoniao Wiki |keywords=erc 20, token, ethereum, token standard, coin, blockchain, protocol |description=ER...&quot;</title>
		<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=ERC20&amp;diff=1333&amp;oldid=prev"/>
		<updated>2019-02-28T09:22:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{#seo: |title=ERC20 Token Standard – Ethereum Smart Contracts – zaoniao Wiki |keywords=erc 20, token, ethereum, token standard, coin, blockchain, protocol |description=ER...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{#seo:&lt;br /&gt;
|title=ERC20 Token Standard – Ethereum Smart Contracts – zaoniao Wiki&lt;br /&gt;
|keywords=erc 20, token, ethereum, token standard, coin, blockchain, protocol&lt;br /&gt;
|description=ERC20 is the Ethereum token standard which is used for ETH Smart contracts. ERC-20 coins gained popularity with crowdfunding companies via ICO. This token standard describes the functions and events that an Ethereum token contract has to implement. &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;amp/&amp;gt;&lt;br /&gt;
[[File:erc20.png|400px|right|ERC20 token]]&lt;br /&gt;
'''ERC20''' is the [[Ethereum]] token standard which is used for Ethereum [[Smart_contract|smart contracts]]. Developed in 2015, '''ERC-20''' defines a common list of rules that an Ethereum token has to implement. Giving developers the ability to program how new tokens will function within the Ethereum ecosystem. This token protocol became popular with crowdfunding companies via [[Initial_coin_offering|Initial Coin Offering]] (ICO).&lt;br /&gt;
&lt;br /&gt;
Mercury Protocol's Global Messaging Token is an example of an application based on ERC20 tokens.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md ERC20] token standard describes the functions and events that an Ethereum token contract has to implement. &lt;br /&gt;
&lt;br /&gt;
==The ERC20 Token Standard Interface==&lt;br /&gt;
Following is an interface contract declaring the required functions and events to meet the ERC20 standard:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; line='line'&amp;gt;&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
// ERC Token Standard #20 Interface&lt;br /&gt;
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
contract ERC20Interface {&lt;br /&gt;
    function totalSupply() public constant returns (uint);&lt;br /&gt;
    function balanceOf(address tokenOwner) public constant returns (uint balance);&lt;br /&gt;
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);&lt;br /&gt;
    function transfer(address to, uint tokens) public returns (bool success);&lt;br /&gt;
    function approve(address spender, uint tokens) public returns (bool success);&lt;br /&gt;
    function transferFrom(address from, address to, uint tokens) public returns (bool success);&lt;br /&gt;
&lt;br /&gt;
    event Transfer(address indexed from, address indexed to, uint tokens);&lt;br /&gt;
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the major tokens on the Ethereum blockchain are ERC-20-compliant. The [[GNT]] [[Golem Network Token]] is only partially-ERC20 blockchain-compliant as it does not implement the &amp;lt;code&amp;gt;approve(...)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;allowance(..)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;transferFrom(...)&amp;lt;/code&amp;gt; functions, and the &amp;lt;code&amp;gt;Approval(...)&amp;lt;/code&amp;gt; event.&lt;br /&gt;
&lt;br /&gt;
Some of the tokens include further information describing the token contract:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; line='line'&amp;gt;&lt;br /&gt;
    string public constant name = &amp;quot;Token Name&amp;quot;;&lt;br /&gt;
    string public constant symbol = &amp;quot;SYM&amp;quot;;&lt;br /&gt;
    uint8 public constant decimals = 18;  // 18 is the most common number of decimal places&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How Does ERC-20 Token Contract Work?==&lt;br /&gt;
&lt;br /&gt;
Following is a fragment of a token contract to demonstrate how a token contract maintains the token balance of Ethereum accounts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; line='line'&amp;gt;&lt;br /&gt;
contract TokenContractFragment {&lt;br /&gt;
 &lt;br /&gt;
    // Balances for each account&lt;br /&gt;
    mapping(address =&amp;gt; uint256) balances;&lt;br /&gt;
 &lt;br /&gt;
    // Owner of account approves the transfer of an amount to another account&lt;br /&gt;
    mapping(address =&amp;gt; mapping (address =&amp;gt; uint256)) allowed;&lt;br /&gt;
 &lt;br /&gt;
    // Get the token balance for account `tokenOwner`&lt;br /&gt;
    function balanceOf(address tokenOwner) public constant returns (uint balance) {&lt;br /&gt;
        return balances[tokenOwner];&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    // Transfer the balance from owner's account to another account&lt;br /&gt;
    function transfer(address to, uint tokens) public returns (bool success) {&lt;br /&gt;
        balances[msg.sender] = balances[msg.sender].sub(tokens);&lt;br /&gt;
        balances[to] = balances[to].add(tokens);&lt;br /&gt;
        Transfer(msg.sender, to, tokens);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    // Send `tokens` amount of tokens from address `from` to address `to`&lt;br /&gt;
    // The transferFrom method is used for a withdraw workflow, allowing contracts to send&lt;br /&gt;
    // tokens on your behalf, for example to &amp;quot;deposit&amp;quot; to a contract address and/or to charge&lt;br /&gt;
    // fees in sub-currencies; the command should fail unless the _from account has&lt;br /&gt;
    // deliberately authorized the sender of the message via some mechanism; we propose&lt;br /&gt;
    // these standardized APIs for approval:&lt;br /&gt;
    function transferFrom(address from, address to, uint tokens) public returns (bool success) {&lt;br /&gt;
        balances[from] = balances[from].sub(tokens);&lt;br /&gt;
        allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);&lt;br /&gt;
        balances[to] = balances[to].add(tokens);&lt;br /&gt;
        Transfer(from, to, tokens);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    // Allow `spender` to withdraw from your account, multiple times, up to the `tokens` amount.&lt;br /&gt;
    // If this function is called again it overwrites the current allowance with _value.&lt;br /&gt;
    function approve(address spender, uint tokens) public returns (bool success) {&lt;br /&gt;
        allowed[msg.sender][spender] = tokens;&lt;br /&gt;
        Approval(msg.sender, spender, tokens);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blockchain Token Balance===&lt;br /&gt;
For an example, assume that this token contract has two token holders:&lt;br /&gt;
* &amp;lt;code&amp;gt;0x1111111111111111111111111111111111111111&amp;lt;/code&amp;gt; with a balance of 100 units&lt;br /&gt;
* &amp;lt;code&amp;gt;0x2222222222222222222222222222222222222222&amp;lt;/code&amp;gt; with a balance of 200 units&lt;br /&gt;
&lt;br /&gt;
The token contract's &amp;lt;code&amp;gt;balances&amp;lt;/code&amp;gt; data structure will contain the following information:&lt;br /&gt;
 balances[0x1111111111111111111111111111111111111111] = 100&lt;br /&gt;
 balances[0x2222222222222222222222222222222222222222] = 200&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;balanceOf(...)&amp;lt;/code&amp;gt; function will return the following values:&lt;br /&gt;
 tokenContract.balanceOf(0x1111111111111111111111111111111111111111) will return 100&lt;br /&gt;
 tokenContract.balanceOf(0x2222222222222222222222222222222222222222) will return 200&lt;br /&gt;
&lt;br /&gt;
===Transfer Token Balance===&lt;br /&gt;
If &amp;lt;code&amp;gt;0x1111111111111111111111111111111111111111&amp;lt;/code&amp;gt; wants to transfer 10 tokens to &amp;lt;code&amp;gt;0x2222222222222222222222222222222222222222&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x1111111111111111111111111111111111111111&amp;lt;/code&amp;gt; will execute the function:&lt;br /&gt;
 tokenContract.transfer(0x2222222222222222222222222222222222222222, 10)&lt;br /&gt;
&lt;br /&gt;
The token contract's &amp;lt;code&amp;gt;transfer(...)&amp;lt;/code&amp;gt; function will alter the &amp;lt;code&amp;gt;balances&amp;lt;/code&amp;gt; data structure to contain the following information:&lt;br /&gt;
 balances[0x1111111111111111111111111111111111111111] = 90&lt;br /&gt;
 balances[0x2222222222222222222222222222222222222222] = 210&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;balanceOf(...)&amp;lt;/code&amp;gt; function will now return the following values:&lt;br /&gt;
 tokenContract.balanceOf(0x1111111111111111111111111111111111111111) will return 90&lt;br /&gt;
 tokenContract.balanceOf(0x2222222222222222222222222222222222222222) will return 210&lt;br /&gt;
&lt;br /&gt;
===Approve And TransferFrom Token Balance===&lt;br /&gt;
'''ERC20 Source code'''&lt;br /&gt;
If &amp;lt;code&amp;gt;0x1111111111111111111111111111111111111111&amp;lt;/code&amp;gt; wants to authorise &amp;lt;code&amp;gt;0x2222222222222222222222222222222222222222&amp;lt;/code&amp;gt; to transfer some tokens to &amp;lt;code&amp;gt;0x2222222222222222222222222222222222222222&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x1111111111111111111111111111111111111111&amp;lt;/code&amp;gt; will execute the function:&lt;br /&gt;
 tokenContract.approve(0x2222222222222222222222222222222222222222, 30)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;approve&amp;lt;/code&amp;gt; data structure will now contain the following information:&lt;br /&gt;
 tokenContract.allowed[0x1111111111111111111111111111111111111111][0x2222222222222222222222222222222222222222] = 30&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;0x2222222222222222222222222222222222222222&amp;lt;/code&amp;gt; wants to later transfer some tokens from &amp;lt;code&amp;gt;0x1111111111111111111111111111111111111111&amp;lt;/code&amp;gt; to itself, &amp;lt;code&amp;gt;0x2222222222222222222222222222222222222222&amp;lt;/code&amp;gt; executes the &amp;lt;code&amp;gt;transferFrom(...)&amp;lt;/code&amp;gt; function:&lt;br /&gt;
 tokenContract.transferFrom(0x1111111111111111111111111111111111111111, 0x2222222222222222222222222222222222222222, 20)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;balances&amp;lt;/code&amp;gt; data structure will be altered to contain the following information:&lt;br /&gt;
 tokenContract.balances[0x1111111111111111111111111111111111111111] = 70&lt;br /&gt;
 tokenContract.balances[0x2222222222222222222222222222222222222222] = 230&lt;br /&gt;
&lt;br /&gt;
And the &amp;lt;code&amp;gt;approve&amp;lt;/code&amp;gt; data structure will now contain the following information:&lt;br /&gt;
 tokenContract.allowed[0x1111111111111111111111111111111111111111][0x2222222222222222222222222222222222222222] = 10&lt;br /&gt;
&amp;lt;code&amp;gt;0x2222222222222222222222222222222222222222&amp;lt;/code&amp;gt; can still spend 10 tokens from &amp;lt;code&amp;gt;0x1111111111111111111111111111111111111111&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;balanceOf(...)&amp;lt;/code&amp;gt; function will now return the following values:&lt;br /&gt;
 tokenContract.balanceOf(0x1111111111111111111111111111111111111111) will return 70&lt;br /&gt;
 tokenContract.balanceOf(0x2222222222222222222222222222222222222222) will return 230&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sample Fixed Supply Token Contract==&lt;br /&gt;
Following is a sample [https://github.com/bokkypoobah/Tokens#fixed-supply-token Fixed Supply Token] contract with a fixed supply of 1,000,000 units that are initially assigned to the owner of the contract. This token has 18 decimal places:&lt;br /&gt;
'''ERC20 Code''':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; line='line'&amp;gt;&lt;br /&gt;
pragma solidity ^0.4.18;&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
// 'FIXED' 'Example Fixed Supply Token' token contract&lt;br /&gt;
//&lt;br /&gt;
// Symbol      : FIXED&lt;br /&gt;
// Name        : Example Fixed Supply Token&lt;br /&gt;
// Total supply: 1,000,000.000000000000000000&lt;br /&gt;
// Decimals    : 18&lt;br /&gt;
//&lt;br /&gt;
// Enjoy.&lt;br /&gt;
//&lt;br /&gt;
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2017. The MIT Licence.&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
// Safe maths&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
library SafeMath {&lt;br /&gt;
    function add(uint a, uint b) internal pure returns (uint c) {&lt;br /&gt;
        c = a + b;&lt;br /&gt;
        require(c &amp;gt;= a);&lt;br /&gt;
    }&lt;br /&gt;
    function sub(uint a, uint b) internal pure returns (uint c) {&lt;br /&gt;
        require(b &amp;lt;= a);&lt;br /&gt;
        c = a - b;&lt;br /&gt;
    }&lt;br /&gt;
    function mul(uint a, uint b) internal pure returns (uint c) {&lt;br /&gt;
        c = a * b;&lt;br /&gt;
        require(a == 0 || c / a == b);&lt;br /&gt;
    }&lt;br /&gt;
    function div(uint a, uint b) internal pure returns (uint c) {&lt;br /&gt;
        require(b &amp;gt; 0);&lt;br /&gt;
        c = a / b;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
// ERC Token Standard #20 Interface&lt;br /&gt;
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
contract ERC20Interface {&lt;br /&gt;
    function totalSupply() public constant returns (uint);&lt;br /&gt;
    function balanceOf(address tokenOwner) public constant returns (uint balance);&lt;br /&gt;
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);&lt;br /&gt;
    function transfer(address to, uint tokens) public returns (bool success);&lt;br /&gt;
    function approve(address spender, uint tokens) public returns (bool success);&lt;br /&gt;
    function transferFrom(address from, address to, uint tokens) public returns (bool success);&lt;br /&gt;
&lt;br /&gt;
    event Transfer(address indexed from, address indexed to, uint tokens);&lt;br /&gt;
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
// Contract function to receive approval and execute function in one call&lt;br /&gt;
//&lt;br /&gt;
// Borrowed from MiniMeToken&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
contract ApproveAndCallFallBack {&lt;br /&gt;
    function receiveApproval(address from, uint256 tokens, address token, bytes data) public;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
// Owned contract&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
contract Owned {&lt;br /&gt;
    address public owner;&lt;br /&gt;
    address public newOwner;&lt;br /&gt;
&lt;br /&gt;
    event OwnershipTransferred(address indexed _from, address indexed _to);&lt;br /&gt;
&lt;br /&gt;
    function Owned() public {&lt;br /&gt;
        owner = msg.sender;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    modifier onlyOwner {&lt;br /&gt;
        require(msg.sender == owner);&lt;br /&gt;
        _;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function transferOwnership(address _newOwner) public onlyOwner {&lt;br /&gt;
        newOwner = _newOwner;&lt;br /&gt;
    }&lt;br /&gt;
    function acceptOwnership() public {&lt;br /&gt;
        require(msg.sender == newOwner);&lt;br /&gt;
        OwnershipTransferred(owner, newOwner);&lt;br /&gt;
        owner = newOwner;&lt;br /&gt;
        newOwner = address(0);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
// ERC20 Token, with the addition of symbol, name and decimals and an&lt;br /&gt;
// initial fixed supply&lt;br /&gt;
// ----------------------------------------------------------------------------&lt;br /&gt;
contract FixedSupplyToken is ERC20Interface, Owned {&lt;br /&gt;
    using SafeMath for uint;&lt;br /&gt;
&lt;br /&gt;
    string public symbol;&lt;br /&gt;
    string public  name;&lt;br /&gt;
    uint8 public decimals;&lt;br /&gt;
    uint public _totalSupply;&lt;br /&gt;
&lt;br /&gt;
    mapping(address =&amp;gt; uint) balances;&lt;br /&gt;
    mapping(address =&amp;gt; mapping(address =&amp;gt; uint)) allowed;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Constructor&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function FixedSupplyToken() public {&lt;br /&gt;
        symbol = &amp;quot;FIXED&amp;quot;;&lt;br /&gt;
        name = &amp;quot;Example Fixed Supply Token&amp;quot;;&lt;br /&gt;
        decimals = 18;&lt;br /&gt;
        _totalSupply = 1000000 * 10**uint(decimals);&lt;br /&gt;
        balances[owner] = _totalSupply;&lt;br /&gt;
        Transfer(address(0), owner, _totalSupply);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Total supply&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function totalSupply() public constant returns (uint) {&lt;br /&gt;
        return _totalSupply  - balances[address(0)];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Get the token balance for account `tokenOwner`&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function balanceOf(address tokenOwner) public constant returns (uint balance) {&lt;br /&gt;
        return balances[tokenOwner];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Transfer the balance from token owner's account to `to` account&lt;br /&gt;
    // - Owner's account must have sufficient balance to transfer&lt;br /&gt;
    // - 0 value transfers are allowed&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function transfer(address to, uint tokens) public returns (bool success) {&lt;br /&gt;
        balances[msg.sender] = balances[msg.sender].sub(tokens);&lt;br /&gt;
        balances[to] = balances[to].add(tokens);&lt;br /&gt;
        Transfer(msg.sender, to, tokens);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Token owner can approve for `spender` to transferFrom(...) `tokens`&lt;br /&gt;
    // from the token owner's account&lt;br /&gt;
    //&lt;br /&gt;
    // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md&lt;br /&gt;
    // recommends that there are no checks for the approval double-spend attack&lt;br /&gt;
    // as this should be implemented in user interfaces &lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function approve(address spender, uint tokens) public returns (bool success) {&lt;br /&gt;
        allowed[msg.sender][spender] = tokens;&lt;br /&gt;
        Approval(msg.sender, spender, tokens);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Transfer `tokens` from the `from` account to the `to` account&lt;br /&gt;
    // &lt;br /&gt;
    // The calling account must already have sufficient tokens approve(...)-d&lt;br /&gt;
    // for spending from the `from` account and&lt;br /&gt;
    // - From account must have sufficient balance to transfer&lt;br /&gt;
    // - Spender must have sufficient allowance to transfer&lt;br /&gt;
    // - 0 value transfers are allowed&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function transferFrom(address from, address to, uint tokens) public returns (bool success) {&lt;br /&gt;
        balances[from] = balances[from].sub(tokens);&lt;br /&gt;
        allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);&lt;br /&gt;
        balances[to] = balances[to].add(tokens);&lt;br /&gt;
        Transfer(from, to, tokens);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Returns the amount of tokens approved by the owner that can be&lt;br /&gt;
    // transferred to the spender's account&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {&lt;br /&gt;
        return allowed[tokenOwner][spender];&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Token owner can approve for `spender` to transferFrom(...) `tokens`&lt;br /&gt;
    // from the token owner's account. The `spender` contract function&lt;br /&gt;
    // `receiveApproval(...)` is then executed&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {&lt;br /&gt;
        allowed[msg.sender][spender] = tokens;&lt;br /&gt;
        Approval(msg.sender, spender, tokens);&lt;br /&gt;
        ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Don't accept ETH&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function () public payable {&lt;br /&gt;
        revert();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    // Owner can transfer out any accidentally sent ERC20 tokens&lt;br /&gt;
    // ------------------------------------------------------------------------&lt;br /&gt;
    function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {&lt;br /&gt;
        return ERC20Interface(tokenAddress).transfer(owner, tokens);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [https://medium.com/bitfwd/how-to-issue-your-own-token-on-ethereum-in-less-than-20-minutes-ac1f8f022793 How to issue your own token on Ethereum in less than 20 minutes] for steps to deploy a token contract.&lt;br /&gt;
&lt;br /&gt;
==Further Information On ERC20 network and platform for tokens==&lt;br /&gt;
* Ethereum.org Token page: https://www.ethereum.org/token.&lt;br /&gt;
* Etherscan token selection of popular tokens: https://etherscan.io/tokens&lt;br /&gt;
* EtherScan ERC20 token search: https://etherscan.io/token-search&lt;br /&gt;
* The HumanStandardToken: a specialisation of ERC20 that provides a name, decimals, symbol  and version as public variables, so these can be read from the contract and do not need to be configured: https://github.com/ConsenSys/Tokens/blob/master/Token_Contracts/contracts/HumanStandardToken.sol&lt;br /&gt;
* Token Factory, an application that lets you create these tokens, just to play around with: https://tokenfactory.surge.sh&lt;br /&gt;
* ERC 20 Blockchain Libraries:&lt;br /&gt;
** OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/tree/master/contracts/token&lt;br /&gt;
** Minime token contract  that allows to clone itself, so it can be used for things like voting, or even splitting off a token for a separate application: https://github.com/Giveth/minime&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Ethereum Based Tokens]]&lt;br /&gt;
* [[Mining]]&lt;br /&gt;
* [[BTC China]]&lt;br /&gt;
* [[CEX.IO]]&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
[http://wikipedia.org/ http://wikipedia.org/]&lt;br /&gt;
&lt;br /&gt;
[[de:ERC20]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Ethereum]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>