Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
What is EOSÂ Token?
EOS contrary to Ethereum comes with the token smart contract out of the box. As Ethereum has ERC20 smart contract, EOS has eosio.token smart contract. Eosio.token smart contract allows you to create your own token by providing maximum supply and tokenâs literal, issue tokens to an account and transfer tokens between accounts. EOS tokens on EOS blockchain are issued using the same contract.
The `url` parameter specifies to witch node you connect. You can checkout more API endpoints on the official website.
Install Cleos
Cleos is a command line tool that interfaces with the REST API exposed by nodeos. We need cleos to run all the commands to interact with EOS blockchain. You can install cleos using Docker, AWS Image or compiling the source code. The end result has to be cleos avaiable in your terminal.
Create Wallet
Wallets are clients that store keys that may or may not be associated with the permissions of one or more accounts. Ideally, a wallet has a locked (encrypted) and unlocked (decrypted) state that is protected by a high entropy password. The EOSIO/eos repository comes bundled with a command line interface client called cleos that interfaces with a lite-client called keosd and together, they demonstrate this pattern.from âAccounts and Permissionsâ
Letâs create one called âtreasureâ.
You have to save password somewhere safe, because if it is lost, there is no way to recover all the keys inside the wallet.
Now we need to generate two pairs of keys for the owner and active permissions. After that, we import them into our wallet.
Create Account
In order to do anything at EOS blockchain you need to have an account.
An account is a human-readable name that is stored on the blockchain. It can be owned by an individual or group of individuals depending on permissions configuration. An account is required to transfer or otherwise push a transaction to the blockchain.from âAccounts and Permissionsâ
Account essentially is a number of public/privates keys tided to a unique name. Keys are stored in a wallet. Accounts are stored on EOS blockchain.
Creating an account locally is easy, you just run cleos create account command because you own default eosio account, which is obviously not the case on Mainnet. In order to create account on Mainnet you need help from someone who already has it, like zeos or eos-account-creator and it costs money. Moreover, you only can create accounts which are exactly 12 symbols and consist only of a-z lower case only, 1â5 digits. This is incredibly restrictive in my opinion. To get an account with shorter names you have to bid in auction. Taking into account (pun intended) that you can resell EOS account squatting is going to be huge. With all that in mind, we are going to use Testnet for our tutorial to save money and time.
EOS Jungle Tesnet as close to the Mainnet as possible. Go to the jungle.cryptolions.io and press âCreate Accountâ link. It will ask you for the account name and two keys. Use the public keys generated before.
Confirm that account is created:
Now we need to buy some RAM for our account because in order to publish our contract. In EOS blockchain there is RAM marketplace with whales playing bulls, another great speculative opportunity for people with money.Drop some EOS tokens to your account using EOS Jungle Testnet Faucet.
Now we need to buy some RAM for our account because in order to publish our contract. In EOS blockchain there is RAM marketplace with whales playing bulls, another great speculative opportunity for people with money.Drop some EOS tokens to your account using EOS Jungle Testnet Faucet.
After that run cleos system buyram command to buy RAM with EOSÂ tokens.
Create Contract
First we have to upload our contract to the blockchain. Cleos command set contract does exactly that with the following positional parameters:
* account â the account to publish a contract for.* contract-dir â contract directory.* wast-file â the file containing the contract WAST or WASM.* abi-file â the ABI of the contract.
As you can seen we need to specify wast and abi files. If you have built EOS from source code you can find them at ./build/contracts/eosio.token/ folder. Just for convenience Iâve uploaded them both of themâââwast/abi. Letâs call set contractcommand with our account and files. Because our wast/abi files have the same name as the directory name, we can skip these parameters.
Letâs check that code has been uploaded with get code ylvdeveloper command.
Yep, it is there.
Create Token
Finally, we can create and issue our token. We are going to utilize createand issue actions of our smart contract using cleos push action command which takes the following parameters:
* contract â the account providing the contract to execute.* action â the action to execute on the contract.* data â the arguments to the contract.
Letâs create YLV token and issue some tokens.
We just have created YLV token with maximum capacity of 1'000'000.00 tokens. Now letâs issue 1000 tokens to ylvdeveloper account.
Next, check the balance:
Great. We have our token contract and can issue tokens. What else do we need? Ability to transfer tokens from one account to another. Weâll use the same push action command from cleos with transfer method of the token smart contract. You need another account to transfer tokens to. It can be created using the same steps as we did for ylvdeveloper. Weâll send 100 tokens from ylvdeveloper to ylvio account.
Check balances:
Works as expected.
Summary
We went full path from installing cleos and learning about eosio.token smart contract to having our own token and transferring tokens out to other accounts. We did all this using EOS Jungle Testnet which is almost identical to Mainnet. The same steps will work for Mainnet, you just need to use different API endpoint and pay for accounts and RAM.
TL;DR
- EOS token is a smart contract.
- Cleos is command line utility used to interact with wallet and node.
- EOS Jungle Testnet can be used for development.
- You can create, issue and transfer your own token using eosio.token smart contract.
Related
How to Create and Deploy Your Own EOS Token was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.