Skip to Content
Ethereum Cookbook
book

Ethereum Cookbook

by Manoj P R
August 2018
Intermediate to advanced
404 pages
11h 19m
English
Packt Publishing
Content preview from Ethereum Cookbook

How to do it…

  1. To create an ERC20-based token in Ethereum, you need to follow a certain standard. The contract should include the following functions:
    • totalSupply()
    • balanceOf(address _owner)
    • transfer(address _to, uint256 _value)
    • transferFrom(address _from, address _to, uint256 _value)
    • approve(address _spender, uint256 _value)
    • allowance(address _owner, address _spender)

It should also include these events:

    • transfer(address indexed _from, address indexed _to, uint256 _value)
    • approval(address indexed _owner, address indexed _spender, uint256 _value)

We will discuss each function and event in detail throughout this chapter.

  1. Create a contract with the target compiler version and a name:
pragma solidity ^0.4.23;contract ERC20 {    ..
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Ethereum Dapps

Building Ethereum Dapps

Roberto Infante
Ethereum For Dummies

Ethereum For Dummies

Michael G. Solomon

Publisher Resources

ISBN: 9781789133998Supplemental Content