Homework: ERC20

1. What are the benefits of setting a token standard like ERC20?
The benefits of setting a token standard like ERC20 allows wallets and exchanges to be programmed to support any token that is using that standard. It’s easier and scalable, more efficient than each token having its own personalized code.

2. What functions are in the ERC20 Token Standard Interface and what do they do?
Here are a few functions in the ERC20 Token Standard and what each does:

  • TotalSupply( ) Provides maximum number of tokens that exist
  • BalanceOf(Address account) Provides a public addresses’ balance of ERC20 tokens
  • Transfer(X) Allows for a user to transfer their ERC20 tokens (X) to another public address
1 Like

1. What are the benefits of setting a token standard like ERC20?
There are several benefits.
Mainly related to allowing wallets to provide token balances for hundreds of different tokens and creating a means for exchanges to list more tokens by providing nothing more than the address of the token’s contract.
It also allows smart contracts to act very similarly to a conventional cryptocurrency like Bitcoin, or Ethereum. (can be sent, received, checked of its total supply, and checked for the amount that is available on an individual address)

2. What functions are in the ERC20 Token Standard Interface and what do they do?
ERC20 defines the functions:

balanceOf - allows a smart contract to store and return the balance of the provided address .

totalSupply , allows an instance of the contract to calculate and return the total amount of the token that exists in circulation.

transfer - allows the owner of the contract send a given amount of the token to another address just like a conventional cryptocurrency transaction.

transferFrom - allows a smart contract to automate the transfer process and send a given amount of the token on behalf of the owner.

approve - the owner of the contract authorizes, or approves , the given address to withdraw instances of the token from the owner’s address.

allowance - provides the number of tokens allowed to be transferred from a given address by another given address.

It also has a few optional fields like the token name, symbol, and the number of decimal places with which it will be measured.

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    It creates a template across time and space.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    Totalsupply gives you all the tokens. Balanceof gives you the balance of a selected wallet

1 Like

1.What are the benefits of setting a token standard like ERC20?

If there are these token standards within the ERC 20 programming protocol then it is far easier for all of these projects and tokens and networks to communicate with each other. Also this means that the many ERC 20 tokens can be supported by all wallets and exchanges more easily.

2.What functions are in the ERC20 Token Standard Interface and what do they do?

balanceOf(): provides the number of tokens held by a given address.

transfer(): transfers a number of tokens directly from the message sender to another address. This however doesn’t work well when tokens are being used to pay for a function in a smart contract.

approve(): a token holder gives another address approval to transfer up to a certain number of tokens.

transferFrom(): take certain tokes from sender’s account and carry on its work.

allowance(): provides the number of tokens allowed to be transferred from a given address by another given address.

totalSupply(): total number of tokens that exist

1 Like
  1. What are the benefits of setting a token standard like ERC20? [Andy] So everyone can program in the same way in order to make code easier to read and debug
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    [Andy] Some of them are totalSupply, balanceOf, transfer. The names already reveal their function :slight_smile:

The benefits of setting a token standard like ERC20 are that if all tokens are written in the same syntax, then the functions within the standard are usable with any of those tokens. For example, balanceOf() is written in such a way that you should be able to use that function whether checking the balance of one token or another (fungible tokens, anyway).

Some functions in the ERC20 interface are:

totalSupply(): returns the total supply of tokens in the network.

balanceOf(): returns the balance of a particular account.

1 Like
  1. By setting a token standard, the Ethereum creates an ecosystem which allows for more efficient adoption and development of their platform. The ERC20 Token standard accomplishes this by setting basic functions within the code so that developers always code a set of core functions within every token in the ecosystem. This is beneficial because it ensures that all tokens are compatible and can be used by all wallets and exchanges that support ethereum, as well as removing redundant time that developers would use coding their own customer tokens which may require special functionality.

  2. balanceOf(): queries the account balance of an address for a specific erc20 token
    transfer(): allows users to transact with each by transferring tokens from the message sender to the address
    approve() and transferFrom(): are used to transfer funds using a smart contract
    -approve(): a token holder gives another address(usually a smart contract) approval to access a certain number of tokens (an allowance)
    -transferFrom(): the token holder calls this function to have the smart contract take the allowance from his account if the allowance is available
    allowance(): sets the total number of tokens that can be taken
    totalSupply(): total number of tokens that exist
    decimals(): how many decimal points the token should be accounted
    name(): what the token is called
    symbol(): sets the ticker sign

2 Likes

I think doSomething(): isn’t a standard function. From previous coding experience, its usually filler to to create example of a function that someone would create.

1 Like

ok thanks i will delete…

1 Like
  1. It effectively allows smart contracts to act very similarly to a conventional cryptocurrency like Bitcoin, or Ethereum itself. In saying this, a token hosted on the Ethereum blockchain can be sent, received, checked of its total supply, and checked for the amount that is available on an individual address.
  2. ERC20 defines the functions balanceOf , totalSupply , transfer , transferFrom , approve , and allowance . It also has a few optional fields like the token name, symbol, and the number of decimal places with which it will be measured.
    function totalSupply() constant returns (uint theTotalSupply);
    function balanceOf(address _owner) constant returns (uint balance);
    function transfer(address _to, uint _value) returns (bool success);
    function transferFrom(address _from, address _to, uint _value) returns (bool success);
    function approve(address _spender, uint _value) returns (bool success);
    function allowance(address _owner, address _spender) constant returns (uint remaining);
    event Transfer(address indexed _from, address indexed _to, uint _value);
    event Approval(address indexed _owner, address indexed _spender, uint _value);
1 Like

2. What functions are in the ERC20 Token Standard Interface and what do they do?

Yes sir (s), but could you please describe what those functions do?

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

totalSupply():
Returns the amount of tokens in existence.

balanceOf(account):
Returns the amount of tokens owned by account.

transfer(recipient, amount):
Moves “amount” tokens from the caller’s account to recipient. Returns a boolean value indicating whether the operation succeeded.

allowance(owner, spender):
Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through transferFrom. This is zero by default.

approve(spender, amount):
Sets amount as the allowance of spender over the caller’s tokens. Returns a boolean value indicating whether the operation succeeded.

transferFrom(sender, recipient, amount):
Moves amount tokens from sender to recipient using the allowance mechanism. amount is then deducted from the caller’s allowance. Returns a boolean value indicating whether the operation succeeded.

2 Likes

1- a token standard like ERC20 allows the community of developers to build on a common set of rules and scale up faster. With a standard it is faster and easier to create new projects and products like wallets
2- Functions in the ERC20 standard:

  • balanceOf() returns the balance of the address given as input
  • transfer() simply transfers the amount given from the sender’s account to the recipient’s account
  • approve() will send to another smart contract an authorization to spend some of the sender’s account money, the limit on that amount is an allowance
  • transferFrom() can be used to transfer money from the sender’s account up to the limit which was set by the approve() function
  • allowance() can query the limit allowed to be spent by an account
1 Like

Of course man!

balanceOf() it returns the balance when given the address of which I wish to know the balance of

totalSupply() returns the total amounts (in tokens) in circulation at any given time (but I dont know which time… it is the time when the user sends the request… it is the time of when the server receives the request… and moreover, who should process this function?? I dont know if each ETH node has the information of the total circulating supply at any given time… but I hope I can learn it some time). Moreover, wha tare the ETH nodes… I know they are computers, but can I have one in my laptop? what happens if I disconnect the Etherent cable and plug it in back a day after?.. it will update from which node??? Oh men … i have so many questions right now … i’ll stick with my courses for now

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    The benefit is that all tokens based on the same standards will be able to communicate, which allows tokens to operate on platforms and wallets seamlessly. Also, with a standard you just have to change a few lines, making it easier to programmers who don’t need to learn every token from scratch.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    function totalSupply() = Get the total token supply
    function balanceOf() = Get the account balance of another account with address owner
    function allowance() = Send value amount of tokens to address to
    function transfer() = Send value amount of tokens from address from to address to
    function approve() = Allow spender to withdraw from your account, multiple times, up to the value amount. If this function is called again it overwrites the current allowance with value
    function transferFrom() = Returns the amount which spender is still allowed to withdraw from owner

1 Like

1.What are the benefits of setting a token standard like ERC20?
Standard that is common knowledge and true for all ERC20 tokens .
Communicate with wallets and entire ecosystem.

2.What functions are in the ERC20 Token Standard
Interface and what do they do?
Totalsupply: Tells you the total supply of that particular token.

Balance: Provides the number of tokens held by the address.

Transfer: To transfer tokens.

Approve: Token holder gives another address approval
to transfer up to a certain number of tokens.

Allowance: Provides the number of tokens allowed to be
transferred from address A to address B.

1 Like
  1. It allows for other fungible tokens to be created on top of etherium and programmed in a way to be supported by all wallets and exchanges with Erc20 without creating a new language for each token.
  2. totalsupply() give number of tokens that exits
    balanceOf() gives balance of available tokens of that address
    transfer() allows transfer of tokens from one address to another
1 Like

They take input(s) and return and output (balance) or perform a function (transfer)

1 Like
  1. What are the benefits of setting a token standard like ERC20?

The benefits are that new tokens can interact with each other on networks much more easily. For example, an ethereum wallet is able to identify and incorporate all ERC20 tokens because the wallet knows that its design follows certain standards.

  1. What functions are in the ERC20 Token Standard Interface and what do they do?

In this interface it has functions for sending tokens to other addresses. how to check the balance of a given address, and functions for how to account for the total supply.

all programs can talk to each other

total supply
balance of
transfer
do something
allowance