Getting Started with EOSIO - Tutorial 1

in #utopian-io6 years ago

What Will I Learn?

EOSIO - Tutorial 1
Setting up a EOSIO for smart contract development.

  • You will learn how to download and build EOSIO
  • You will learn how to install EOSIO
  • You will learn how to create genesis.json
  • You will learn how to configure nodeos
  • You will learn how to run nodeos
  • You will learn how to create the default wallet
  • You will learn how to check wallets and keys
  • You will learn how to set BIOS contract
  • You will learn how to create keys
  • You will learn how to import key to the wallet
  • You will learn how to unlock wallet
  • You will learn how to create an account

Requirements

  • Linux OS
  • 4 GB RAM

Difficulty

  • Basic

Tutorial Contents

In this tutorial shows setting up EOSIO node and basics of using EOSIO.
Tested on:
Linux Mint 18.3 Sylvia x86_64
Kernel: 4.13.0-38-generic
Memory: 3873MiB

eostuts 24.png

1. Download and build all packages
git clone https://github.com/EOSIO/eos --recursive
cd eos
./eosio_build.sh



If you get...

Your system must have 7 or more Gigabytes of physical memory installed.


Not enough RAM. This worked for me.

edit the script in eos/scripts/eosio_build_ubuntu.sh
line 27 ' if ["${MEM_MEG}" -lt 7000] ' --> ' if ["${MEM_MEG}" -lt 3700]'
2. Install
cd build
sudo make install
3. Create genesis file
cd ~/Desktop/eos
nodeos --extract-genesis-json genesis.json
4. Nodeos first run
nodeos -e -p eosio --genesis-json genesis.json --delete-all-blocks --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin

Congrats! EOS is hopefully running :D

Press Ctrl + C to stop nodeos

5. Configure

Edit and save ~/.local/share/eosio/nodeos/config/config.ini

...
enable-stale-production = true
...
producer-name = eosio
...
plugin = eosio::producer_plugin
plugin = eosio::wallet_api_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::http_plugin
plugin = eosio::history_api_plugin
6. Start nodeos
cd ~/Desktop/eos
nodeos
7. Create default wallet
cleos wallet create

...result:

    Creating wallet: default
    Save password to use in the future to unlock this wallet.
    Without password imported keys will not be retrievable.
    "PW5Hvj7S5gEB5afuV42KghUv8QQNQm16zB6sa1SP3qAHj1pqjSRE3"

Wallets are saved in ~/eosio-wallet/

Open ~/.local/share/eosio/nodeos/config/config.ini and find this line

signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

Import (owner) key into default wallet

cleos wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
8. How to check wallets and keys
cleos wallet list keys

...result:

    Wallets:
    [
        "default *"
    ]
    [
        "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
    ]

9. Set BIOS contract
cd ~/Desktop/eos
cleos set contract eosio build/contracts/eosio.bios -p eosio@active

10. How to create key
cleos create key
cleos create key
... result:
    Private key: 5JDRyqykySoRnfR5gJ3K2MbkyUBonNW43grRfab5KmDkv5Vr1vB
    Public key: EOS6e8Bv7F3wDDS6JnwPyAoeC9Wft2V6KZgoEUjauAMru1KtR6Ehp

    Private key: 5Khx1HhkqBsx44nSi41dj9Bfz8isCUVb8TYogTm2EwU4shaGkSY
    Public key: EOS6vZh8hdVY22YjZvunnmvobjWsXL1yx6qBzRxn2S6Fr88ewcUPc
How to:
11. Create (named) wallet for user..1,
12. Import created keys (owner key and active key),
13. Unlock default wallet,
14. Create new account with default account (eosio)
cleos wallet create -n user01-wallet01

...result:

    Creating wallet: user01-wallet01
    Save password to use in the future to unlock this wallet.
    Without password imported keys will not be retrievable.
    "PW5JtUqnULEFtSrY8eseNibftTvUY9cYMbtNzLSbFZD7bnLE6rJUs"

cleos wallet import -n user01-wallet01 5JDRyqykySoRnfR5gJ3K2MbkyUBonNW43grRfab5KmDkv5Vr1vB
cleos wallet import -n user01-wallet01 5Khx1HhkqBsx44nSi41dj9Bfz8isCUVb8TYogTm2EwU4shaGkSY

...result:
    imported private key for: EOS6e8Bv7F3wDDS6JnwPyAoeC9Wft2V6KZgoEUjauAMru1KtR6Ehp
    imported private key for: EOS6vZh8hdVY22YjZvunnmvobjWsXL1yx6qBzRxn2S6Fr88ewcUPc

cleos wallet list keys

...result:
    Wallets:
    [
      "default",
      "user01-wallet01 *"
    ]
    [
      "EOS6e8Bv7F3wDDS6JnwPyAoeC9Wft2V6KZgoEUjauAMru1KtR6Ehp",
      "EOS6vZh8hdVY22YjZvunnmvobjWsXL1yx6qBzRxn2S6Fr88ewcUPc"
    ]

cleos wallet unlock
//password: PW5Hvj7S5gEB5afuV42KghUv8QQNQm16zB6sa1SP3qAHj1pqjSRE3

...result:

    password: Unlocked: default

cleos create account eosio user..1 EOS6e8Bv7F3wDDS6JnwPyAoeC9Wft2V6KZgoEUjauAMru1KtR6Ehp EOS6vZh8hdVY22YjZvunnmvobjWsXL1yx6qBzRxn2S6Fr88ewcUPc

...result:

    executed transaction: 5ecd8bcab9ec04933928a990c068d7f0148e51029960f16226e3467bf5006181  200 bytes  27350 us
    #         eosio <= eosio::newaccount            {"creator":"eosio","name":"user..1","owner":{"threshold":1,"keys":      [{"key":"EOS6e8Bv7F3wDDS6JnwPyAoeC...
    warning: transaction executed locally, but may not be confirmed by the network yet

15. How to delete wallets and all blocks if necessary

Delete genesis.json file in ~/Desktop/eos

cleos wallet stop
nodeos --genesis-json genesis.json --delete-all-blocks

Delete wallets in ~/eosio-wallet

Curriculum

This is first tutorial

Proof of Work Done

https://github.com/blws/eos-tut-1

Sort:  

Thank you for your contribution.
While I liked the content of your contribution, I would still like to extend few advices for your upcoming contributions:

  • The EOS github repository is missing.
  • You have to do a more detailed explanation of each command.

I found tutorials on this topic, however your tutorial is simpler and more practical. Link1, Link2

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @proba1
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.033
BTC 93097.49
ETH 3121.46
USDT 1.00
SBD 3.04