This is an article to record how i use smart contract to launch an ERC 20 Token of myself in Testnet.
Basic Tools -
ERC20 Tokens: ERC20 standard is that your tokens will be compatible with any other client or wallets that use the same standards.
Smart Contracts: Smart Contracts are self executing code blocks deployed on the Ethereum blockchain. They contain data & code functions. Contracts make decisions, interact with other contracts, store data and transfer Ether among users.
Solidity: A language for writing smart contracts.
MetaMask: A digital wallet that holds your Ether and other Ethereum based tokens.
1. Go to Atom
Edit your ERC20 token smart contract, here i select the part need to be changed .
2. For the sake of simplicity, download MetaMask chrome extension to generate a wallet. This is going to be the owner of the smart contract.
Choose "Ropsten TestNet" from the top left corner after login into your account.
Before we deploy the contract to Main Ethereum blockchain, we'll test it against TestNet and make sure everything works as expected.
Now head over to Remix IDE paste the code you just modified. Ignore any warnings you see. Next go to settings and uncheck "Enable Optimizations" if it's checked.
Now go to "Run" tab and click Deploy .
However, as executing smart contract required ether pay, it is suggested to visit http://faucet.ropsten.be:3001/. Your account will be automatically transferred one test ether.
Just make sure you are on Ropsten TestNet and not on the MainNet and then hit Submit. Now open up MetaMask again and click on the first transaction. It'll take you to Etherscan where you can observe the ongoing transaction. It may take up to 30s to confirm the transaction. Once it's confirmed it looks like the following:
Please note thetoaddress in the above transaction page. That's your contract address.
Now it's time to verify if it actually works.
3. if you've set up everything correctly you should receive all the initial tokens (1000 in my case) when you add it to your wallet. So, copy the contract address, go to MetaMask -> Add Token and paste the address. You will be able to add your own token OYC to your account.
4. To deploy your contract to production, you just need to switch to MainNet on MetaMask (located at top left corner) and repeat step 2 to 3. Please be aware that you will have to spend real Ether over there to deploy your contract. So, don't deploy the contract unless you are fully ready (Contracts are immutable and can't be updated once deployed).
5. Now you can test the token trading by creating a new account and loading it with some Test Ether,as a part of the ICO, your users will buy tokens from you by paying ETH. as I set the price as 1 ETH = 10 OYC in smart contract, So, if a user wants to buy 10 OYCs, they have to pay 1 ETH.
SO it is quite simple to build your own ERC20 token in Ethereum network.
Please feel free send me any crypto token to my account address for experiment purpose :) 0xb5749ff5dd44d917062f68f149dbc9aa25919aad
Relevant Link:
HiBlock区块链技术布道 GitHub