I want to create an ERC20 token and launch an ICO. I am new to ethereum solidity.
I have checked smart contracts on http://ethereum.org and https://theethereum.wiki/w/index.php/ERC20_Token_Standard But I am confused which is the standard way to create a smart contract. Some websites says to create a token you need to follow the ERC20 token standard but I don’t understand from where I should start.
I deployed different contracted which are copied from above sites and test it.
I want to know that what are the mandatory functions for a smart contract to create a new token?
I'm a bit confused. First you say you want to create ERC20 token but then you are not sure if you should follow the ERC20 standard.
If you want to create an ERC20 compatible token, you have to follow the ERC20 standard. That means you have to implement in your smart contract all of the functions listed in the standard. The standard page gives you also nice implementation examples - you should read through those carefully until you understand what is happening.
If you just want to create a smart contract, you can just create a contract with whatever contents. There are (almost) no specific rules for creating smart contracts - it's all up to you.
you can get started by following this article: https://medium.com/bitfwd/how-to-do-an-ico-on-ethereum-in-less-than-20-minutes-a0062219374
where you will get some general ideas then you can get more into it (programmatically) with https://github.com/OpenZeppelin/zeppelin-solidity or for some very basic samples you can check https://github.com/bokkypoobah/Tokens/tree/master/contracts
basically, you can create contract anyway you like but ERC20 is a technical standard that should be followed with these functions:
- totalSupply [Get the total token supply] balanceOf(address _owner)
- constant returns (uint256 balance) [Get the account balance of another account with address _owner]
- transfer(address _to, uint256 _value) returns (bool success) [Send _value amount of tokens to address _to]
- transferFrom(address _from, address _to, uint256 _value) returns (bool success)[Send _value amount of tokens from address _from to address _to]
approve(address _spender, uint256 _value) returns (bool success) [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]
allowance(address _owner, address _spender) constant returns (uint256 remaining) [Returns the amount which _spender is still allowed to withdraw from _owner]
- Transfer(address indexed _from, address indexed _to, uint256 _value). [Triggered when tokens are transferred.]
- Approval(address indexed _owner, address indexed _spender, uint256 _value)[Triggered whenever approve(address _spender, uint256 _value) is called.]