Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
The EOS network launch was one of the most anticipated events of this summer in the crypto developer community. Although not without issues, the launch happened, and weâre super excited to start building applications on EOS. Weâll stay away from any debate surrounding the launch and EOSâs overall model, and instead provide a short intro that allows anyone to get their hands dirty as quickly as possible.
Here weâll describe:
- Connecting to Mainnet with minimum effort
- Wallets and Accounts
- How the resource allocation works
- Useful links
Getting started
For the purpose of this article, weâre not concerned with running a local EOS node. Although this is pretty easy to do, for the sake of simplicity weâll be connecting to an API endpoint of one of the 21 block producers.
We still need to install some local software in order to interact with the API. The main tool we need is cleos, a command line interface allowing users to sign transactions and make API calls. Currently, the easiest way to install cleos locally is via Docker. Hereâs how you do it:
# Download EOS docker imagedocker pull eosio/eos-dev
# Run keosd tool in dockerdocker run --rm --name eosio -d -v ~/eosio-wallet:/root/eosio-wallet eosio/eos-dev /bin/bash -c 'keosd'
# Create an alias for conveniencealias cleos='docker exec -i eosio /opt/eosio/bin/cleos --wallet-url http://localhost:8888 -u https://api.eosnewyork.io:443'
Once you run these commands youâre ready to interact with the Mainnet. Letâs test that itâs working:
cleos get info
If this produces output similar to below, youâre good to go!
Wallets
Just like in any other blockchain, when you send transactions to the EOS network you authorize them by signing with a private key. Your keys are stored in a local wallet. Initially, you donât have any wallets, so letâs create one.
# donât forget to save the displayed password â youâll need it to unlock the wallet and view private keys
cleos wallet create
This creates a wallet named default. Letâs check if it has any keys in it:
cleos wallet private_keys
!!WARNING!! The default wallet comes with initial private/public key pair EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV / 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3. Never use this one, it is hardcoded in the source code and is not secure. Instead, letâs generate a new key pair.
# generate new key paircleos create key
# import the private key into the walletcleos wallet import ${private key you just generated}
The wallet will be auto-locked after 15 minutes of inactivity. To unlock it run:
cleos wallet unlock
Now youâre all set with the wallet. Letâs get to accounts.
Accounts
Unlike Bitcoin or Ethereum where your public key is an account that you send transactions from, there is a separate concept of accounts in EOS. Itâs more like in traditional web applications. You create a named accountâââwhich in EOS is 12 characters long, e.g. eoscentralioâââand your private key is similar to a password that controls the account. This is a slightly oversimplified description, and you can learn more in the official EOSÂ docs.
Now, thereâs a bummer: you canât create an account unless you already have an account with some EOS in it. Meaning you canât really interact with the network unless you ask somebody with an account to create one for you. And itâs not free! What?? Yes, this chicken-and-egg problem is due to how EOS resource allocation works. Weâll explain this below.
Knowing this, we developed a service that allows one to quickly create a functioning EOS account by paying a small amount with PayPal. You can use eoscentral.io to get your own named account in a few clicks.
Resource allocation
Now a word on the resource allocation and why accounts are not free. In EOS, unlike other blockchains such as Ethereum or Bitcoin, there are no transaction fees. Instead, spam prevention and resource distribution are regulated through staking and RAM market. There are three types of resources consumed by accounts:
- Bandwidth and Log Storage (Disk)âââstaking
- Computation and Computational Backlog (CPU)âââstaking
- State Storage (RAM)âââmarket purchase
The first two (bandwidth and CPU) are allocated proportional to the amount of tokens held in a 3-day staking contract. For example, letâs say the total CPU capacity of the network is 1,000 units. If during a 3-day window you want to consume 10 CPU units, you need to have 1% of all CPU-staked tokens in your name. In other words, youâre competing with other accounts for available CPU capacity, and the more you stake relative to others the more you get.
As time goes by, the consumed CPU and bandwidth free up and you can use the same staked tokens again and again. For example, if you donât produce any activity for 3 days, your resources fully free up and you can consume them again without staking any additional tokens.
RAM is a different story. You need to purchase it at the market price that is determined by supply and demand. RAM is consumed by data your accounts store in the blockchain state. For example, creating a new account consumes RAM as there is now a record describing this account. Unlike CPU and bandwidth RAM doesnât get freed up automatically. The only way to free it up is to delete data from the account state. Once freed up, the RAM can be sold at the market price.
Itâs worth noting that for CPU and bandwidth you can either stake your own EOS or somebody else can stake it in your name (i.e. delegate it). Delegation canât be considered a gift, because they can un-delegate the staked EOS later. Same goes for RAM, however in this case somebody has to actually transfer the RAM to your account as a gift as there is no way for them to force you to return it.
Useful links
Now you have all you need to interact with the EOS Mainnet, publish transactions and start building DApps. Below are some useful resources to help get you further. Feel free to suggest other tools that can benefit readers.
- Official EOSÂ docs
- Official Github repo
- EOS explorer
- EOS account creator
- List of block producer API endpoints
- Node.js SDK
- Scatter wallet (i.e. MetaMask of EOS)
- Dan Larimer (creator of EOS) Medium profile
- RAM market monitor
Getting started on EOS Mainnet in 10 minutes 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.