- all interacting parties (i.e. other programs like wallets, exchanges) can handle a set of tokens equal to all others, that follow the same standards; developers have only to know one standard to write code equally, if they work for another project, following the same standard.
- the functions are:
balanceOf
(store and return the balance of an account/address)
totalSupply
(total supply of token that exist in circulation
transfer
(send an amount of tokens to another address)
transferFrom
(automatically send tokens to another address - kind of like an automatic pay of regular bills (rent)
approve
(approves an address to withdraw tokens from the address of the owner.)
allowance
(determines which address is given what amount of tokens to be used)
-
If tokens comply with a certain standard, and wallets and exchances do the same, then the wallets and exchangers can easily support the tokens without further integration.
-
totalSupply() returns the sum of all balances. balanceOf() returns the balance of a certain address. transfer() is used to transfer tokens to another address. approve() is used to allow tokens to be used usually by smart contract. transferFrom() can then be called to use the allowed tokens. allowance() provides the number tokens in an address that are allowed to be transferred by another address.
-
So that everyone knows how to communicate with the token/contract. In that way all applications like wallets support it automatically.
-
balance 0f () gives balance of a specific account, total supply the number total fungible tokens.
Just like an OS u need a framework that apps can run off of & it needs to b standardized. So the ERC-20 has a standardized framework which everyone can agree & transact with.
The function in the ERC20 token standard interface r to get total supply, max supply, balances, transfers to other ERC20 compatible addresses.
- What are the benefits of setting a token standard like ERC20?
All tokens that are developed with the ERC20 standard can immediately be supported by exchanges and wallets, allowing the space to grow quickly.
- What functions are in the ERC20 Token Standard Interface and what do they do?
ERC20 functions essentially allow transactions taking place on Enthereum involving tokens to occur and be accounted for. They check for account balances and record transfers.
[quote=“filip, post:1, topic:8440”]
Homework on ERC20 token standard.
- What are the benefits of setting a token standard like ERC20?
Everyone knows that all functions are standard and everyone understands them. Tokens can be exchanged easily because all exchanges will use standard language. Programmers have a same standard to operate. Standard increases efficiency of the whole system. - What functions are in the ERC20 Token Standard Interface and what do they do?
balanceOf() function provides the number of tokens held by a given address.
transfer() function transfers a number of tokens directly from the message sender to another address.
approve() function is used by a token holder to give another address (usually of a smart contract) approval to transfer up to a certain number of tokens, known as an allowance.
allowance() function provides the number of tokens allowed to be transferred from a given address by another given address.
doSomething() function that provides operating instructions
transferFrom() function is used to send value amount of tokens from address to another address
1. What are the benefits of setting a token standard like ERC20?
Using a standard like ERC20 means that all tokens using the Ethereum blockchain are created using the same language and functions, so they are immediately supported by exchanges and wallets.
2. What functions are in the ERC20 Token Standard Interface and what do they do?
balanceOf() : returns the balance (number of tokens) in the given address
transfer() : transfers token from sender to another
approve() : someone can use this function to approve a set number of tokens that can be transferred out of their address to another address which can be used by a smart contract. This amount becomes the allowance.
doSomething(): a function which requires an input of tokens to execute successfully
transferFrom(): will transfer tokens from a holder’s account to an allowance address so that the tokens can be used in the execution of the smart contract
allowance() : displays the maximum number of tokens that a holder has allowed the transferFrom() function to take from their address. The allowance is ‘soft’ meaning that it can be higher than the actual balance in the holder’s address.
- fungibility , all wallets can read the balance
- balance Of() = balance of thokens of an account
transfer () = trnafer tokens from one adress to another afress.
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 doubt, please let us know so we can help you!
Carlos Z.
Sorry accidentally deleted the other post.
I am not especially technical, but maybe to put another way the functions are implemented to enable integration between contracts and with wallets. As balances can now be verified this integration enables the processes mentioned earlier (?)…
Yes obviously can use help…
In programming we call ERC20 an interface or contract.
We use interfaces to make things exchangeable, meaning that every “program” that implements this interface (it fullfills the contract) can be exchanged by any other program that implements it.
For Ethereum it means that every service or application you build upon this “standard” can instantly handle all ERC20-tokens no matter what they exactly do. When a new “token” is created your service or application will instantly be able to use it and your “token” is compatible with any services or application that supports this “standard”.
Term Definitions
Imagine a token to be a currency or any kind of asset (apples, reputation, followers).
A token indeed is a virtual digital representation of this asset (not the real asset itself)
In the follwoing description i will use “Currency” representing the wider meaning of a “Token”
and “Coin” representing the wider meaning of an “Asset”. Also i will use the term “User” representing a specific “Account” or “Balance” although a real person may have several accounts.
The ERC20 Interface defines the following functions:
balanceOf()
Return the toal amount of coins (in its smallest unit) a specific user owns.
transfer()
Transfer a specific amount of coins to a specific User.
approve()
Allow a specific User to withdram a max. amount of coins from your account.
transferFrom()
Transfer a specific amount of coins from a User to another User.
allowance()
Check how much coins a user is still allowed to withdra from another user.
Also the Interface defines the following properties (implemented as functions):
name()
The name of the Currency (eg.“United States eDollar”)
symbol()
The short Name / Symbol of the Currency (e.g. “USDE”)
decimals()
The decimals the Currency has, representing it’s smallest possible unit.
(e.g. “4” , means the smallest possible unit is 0,0001 USDE = 0,01 cent)
totalSupply()
Returns the total amount of coins in its smallest unit created in this Currency.
(e.g. “550000” = 55 USDE (becasue 0,0001 USDE is the smallest unit)
-
The benefits are that everyone of the thousands of different tokens built on ETH use the same program language or standard so it creates a bigger ecosystem and easy to understand and communicate with each other and efficient for everyone.
-
Functions like “totalSupply” to see the total number of ETH tokens exist of a particular ERC 20 token,
another is " balanceOf" to see how many tokens in a wallet
Thinking about this i get confused, so something is wrong with this.
The ERC20 Interface does not define the token itself, indeed is is the token contract.
We call this the “smart contract”. So “token contract” = “smart contract”.
This “token contract” is not the token itself, it is the rules how the token is handled,
meaning that it controls how tokens are created and transferred and it gives those tokens a name.
So the “Currency” is not a token. “Currency” is a missleading because it is just another term for the name of the token. The name of the token is defined by the contract itself.
Let’s try a different example:
Lets say the contract itself is a product that is tied to a specific company. The company is the only one that gives this product a name, produces them and distributes them. So this company has full control about the product.
Lets imagine the company is a central bank (meaning a bank that can create it’s own money).
central bank = creator of the contract (a programmer)
contract = the rules how the product is created and distributed (the program)
token = the product itself (a digital asset handled by the program)
A different try (still not perfect):
Product-Type | Creator & Initial Owner | Storage | Product | Amount |
---|---|---|---|---|
Fruit, Food, Decoration, … | Tree | Tree, Basket, … | Apple | 5 |
Car, Transport-Commodit, … | Audi AG | Car-Dealer, Garage, … | A6 | 2 |
Currency, Trade-Commodity, Money, … | Central Bank Inc. | Account, Wallet,… | eDollar | 100 |
Asset, Token-Type | Smart Contract | Blockchain / Token | Token |
Still not perfect, because a Token is the Product but it is also a storage for a specific amount of the product and also the certificate to whom it belongs. …
- standards are always crucial for the development of an economy.
Summary
for example, power sockets are produced following standards as well. Every electrical device you buy in country A will be connectable to power sockets in this country. Or, HTML 5.0 is a standard. Developing a website following html 5.0 rules, every modern browser will know how to interpret it and everyone in the world can visit and use the site. We obtain similar benefits with the erc-20 token standard.
Following the erc-20 token standard, no matter what token we create, it will be understood and can be used immediately on each exchange or wallet. Smart contracts created on Ethereum blockchain are able to “talk” to each other.
-
totalSupply(): we define the total amount of tokens
balanceOf(): shows the balance of a single address
transfer(): direct transfer of tokens to another address. (not recommended for smart contracts)
approve(): not sure if I understood right: The token holder defines here the amount of tokens and the target address (just like an envelope with a certain amount of money, completed with the recipient’s address)
transferFrom(): if I understood it right, this function will be activated if a formerly defined circumstance is true and tokens can be sent. Only if the token holder owns the tokens defined in approve() function, transferFrom() will be executed.
allowance(): the max tokens allowed to be transferred
- It allows exchanges to support any token by treating them using the standard like ERC20.
- totalSupply() - Although the supply could easily be fixed, as it is with Bitcoin, this function allows an instance of the contract to calculate and return the total amount of the token that exists in circulation.
- balanceOf() - This function allows a smart contract to store and return the balance of the provided address. The function accepts an address as a parameter, so it should be known that the balance of any address is public.
- approve() - When calling this function, the owner of the contract authorizes, or approves , the given address to withdraw instances of the token from the owner’s address.
- transfer() - This function lets the owner of the contract send a given amount of the token to another address just like a conventional cryptocurrency transaction.
- transferFrom() - This function allows a smart contract to automate the transfer process and send a given amount of the token on behalf of the owner.
- A common token standard like ERC20 is important to ensure that wallets and exchanges can communicate with each other.
- totalSupply => number of total supply of the token
- balanceOf => number of tokens held by a specific address
- transfer => transfers tokens from one address to another
- What are the benefits of setting a token standard like ERC20?
The ERC20 standard creates a common ground for all developers. It makes it more effiecent for wallets and tokens to communicate. - What functions are in the ERC20 Token Standard Interface and what do they do?
Function totalSupply()= Get the total token supply in circulation.
Function balanceOf() = Provides the number of tokens held by a given address.
Function allowance()= Provides the max number of tokens allowed to be transferred from a given address to another given address.
Function transfer() = Adds an amount of tokens from one address to another.
Function approve() = Gives another address approval to transfer funds from a given address. SC can then use needed funds to perform the given request.
Function transferFrom()= Allows a SC to automate transactions to a given address on behalf of the owner.
- The benefits of having a standard token like ERC20 means there is an agreed upon baseline for all tokens to build upon that assists in guaranteeing functionality and consistency when creating new tokens.
- Total Supply sets a max number of tokens that can exist in the system, Balance of Address gives a public addresses’ balance of tokens, and Transfer allows the function to send and receive tokens from one address to another.
- different tokens can communicate with each other or exchanges/wallets
- totalSupply = number of total supply of the token
balanceOf = number of tokens held by a specific address
transfer = transfers tokens from one address to another
-
It increases efficiency and allows wallets and exchanges to be made to support any token that uses that standard.
totalSupply() - returns maximum number of existing tokens
balanceOf(account address) - returns number of ERC20 tokens in the given public address’ balance
transfer() - transfers ERC20 tokens from your account to given public address
allowance() - returns how many tokens are allowed to be transferred.