Getting started with EOS Mainnet in 10 minutes



    The launch of the EOS network has become the most anticipated event of this summer for the cryptocurrency community. Now that the network is running (albeit with flaws), we are all eager to start developing applications on EOS.

    I will not argue about the problems with the launch and the overall EOS model, but I will give only a brief introduction so that everyone can immediately try their hand at development.

    Here is what I will discuss in this article:

    • What is the easiest way to connect to EOS Mainnet
    • How to use wallets and bills
    • How resources are allocated
    • What else is worth reading

    Beginning of work


    This article does not use the local EOS node. Although it is fairly easy to create , for simplicity we will connect to the API of one of the 21 producers' blocks.

    To work with the API, you need to install several local applications. The main one is cleos , a command line utility for signing transactions and forming API calls. Now for the local installation cleos best Docker .

    Here is what you need to do:

    # Скачайте Docker-образ EOS:
    docker pull eosio/eos-dev
    # Запустите инструмент keosd в Docker:
    docker run --rm --name eosio -d -v ~/eosio-wallet:/root/eosio-wallet eosio/eos-dev /bin/bash -c 'keosd'# Для удобства создайте alias:alias cleos='docker exec -i eosio /opt/eosio/bin/cleos --wallet-url http://localhost:8888 -u https://api.eosnewyork.io:443'

    After running these commands, you can connect to Mainnet. Try the following:

    cleos get info

    If the result is about the same as in the picture below, then everything is done correctly!



    Wallets


    In the EOS network, as in any other blockchain, each transaction must be signed with a private key before being sent. Your keys are stored in a local wallet.

    Initially there is no wallet, so let's create it.

    # не забудьте сохранить отображаемый пароль — он нужен для разблокировки кошелька и просмотра закрытых ключей
    cleos wallet create

    This command creates a wallet named default .

    Check if there are any keys in it:

    cleos wallet private_keys

    !!! ATTENTION!!! The default wallet is written next pair of public and private keys EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV / 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 . Never use this pair: it is tightly embedded in the source code and insecure.
    Let's create a new key pair:

    # создаем новую пару ключей
    cleos create key
    # импортируем закрытый ключ в кошелек
    cleos wallet import ${private key you just generated}

    The wallet is automatically locked after 15 minutes of inactivity. To unlock, enter:

    cleos wallet unlock

    Now the wallet is fully configured. Go to the accounts.

    Accounts


    Unlike bitkion and ether, where the public key is the account from which transactions are sent, another principle is implemented in EOS. It is closer to traditional web applications.

    You create a personal account in EOS with a length of 12 characters, for example, eoscentralio , and the private key will be the password to the created account.

    This is a somewhat simplified description - everything is detailed in the official EOS documentation .

    There is one “but”: it is impossible to create an account if you do not have another account with some amount of EOS. That is, to interact with the network, you need to ask the user who already has an account to create an account for you.

    And it is not free! What??Yes, yes, the classic “chicken and egg problem,” and it is related to how resources are allocated in EOS. About this below.

    As a result, there are services offering to create an account at EOS for a modest fee.

    There have already been published articles with detailed instructions , but I cannot advise any service, as I have not used any of them.

    Resource allocation


    Now a few words about how resources are allocated and why accounts are not free.

    Unlike broadcast, Bitcoin and other blockchains, EOS does not charge for transactions.

    Instead, spam protection and resource allocation are regulated through the stacking and memory market.

    Accounts use three types of resources:

    • Network traffic and log space on disk - stacking
    • Computational power and reserves (CPU) - staking
    • RAM - buying on the market

    The first two resources (network traffic and CPU) are allocated in proportion to the amount of tokens in a three-day staking contract.

    Let, for example, the total computing power of a network be 1000 CPU units. If during these three days you want to use 10 CPUs, then you should have 1% of all tokens in the staking contract. In other words, you are competing with other users for the available resources of the CPU, and the higher your rate compared to others, the more resources you will receive.

    Over time, the resources used by the CPU and network will be released, and you will be able to reuse the same tokens. For example, if you do not have transactions in 3 days, your resources will be completely free and you will be able to use them again even without staking additional tokens.

    With RAM, everything is wrong. It should be bought at the market price, which is determined by the ratio of supply and demand .

    The RAM is allocated for the data that the accounts store in the blockchain. For example, RAM is needed when creating an account to make an entry about it.

    Unlike CPU and network traffic, RAM is not automatically released. To clear it, you must delete the data from the memory. Then the cleared random access memory can be sold at the market price.

    It is worth noting that in order to obtain CPU and network resources, you can make a steak with your EOS, or by strangers on your own behalf (if delegated to them). Delegation is not a gift, but rather a temporary use: the owner of EOS has the right to take them back.

    The same is true for RAM, but you can donate it, if you transfer it from one account to another - you will not be able to take it forcibly.

    What else is worth reading


    Now you have everything you need to interact with EOS Mainnet, publish transactions, and create distributed applications. The following links to resources will help in further work.

    If you know other useful tools, suggest them in the comments.

    Also popular now: