Well, eos is quite hot these days and someone says it will be the third generation of blockchain. We will see. But now, I want to write a post for those who want to get into the eos.

So we want to run nodeos first. But you will have to start it with this long command.

1
./build/programs/nodeos/nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin 

In order to make it easier. Change these lines in the ~/.local/share/eosio/nodeos/config/config.ini

1
2
3
4
5
6
7
8
9
10
11
enable-stale-production = true
producer-name = eosio
plugin = eosio::producer_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::history_plugin
plugin = eosio::history_api_plugin
plugin = eosio::wallet_plugin
plugin = eosio::wallet_api_plugin
plugin = eosio::net_plugin
plugin = eosio::net_api_plugin
plugin = eosio::chain_plugin

By the way, to make your life easier just go to the build library and do sudo make install. And also add this to .bashrc

1
export PATH=$PATH:/usr/local/eosio/bin/

Let’s create a wallet named “samtre”.

1
2
3
4
5
6
7
8
9
10
11
sam@man:~/Documents/eos$ ./build/programs/cleos/cleos wallet create
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5K7nrm3VL4RrEWzqeeF77ESBYsCZsJVE7Fh4niVgsNVtcF8A9yK"

sam@man:~/Documents/eos$ ./build/programs/cleos/cleos wallet create -n samtre
Creating wallet: samtre
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5KchrZ2bytr7QiAiNccDxqZetuxLDsei9854uRFhd9QEChKotJx"

And make sure that your wallet is unlocked. Import the key in config.ini.

1
2
sam@man:~/Documents/eos$ ./build/programs/cleos/cleos wallet import
private key: imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV

And then you are able to create an account named “samtre”.

1
2
3
4
sam@man:~/Documents/eos$ ./build/programs/cleos/cleos create account eosio samtre EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
executed transaction: 55e93b0796d61080256c7f689ac084f98ce7f0db7aeb8ba38cd7678d4f491406 200 bytes 1631 us
# eosio <= eosio::newaccount {"creator":"eosio","name":"samtre","owner":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8ud7hVNYcfnVPJq...
2018-07-29T12:38:44.198 thread-0 main.cpp:391 print_result warning: transaction executed locally, but may not be confirmed by the network yet

OK, now let’s create another account “samhero” and “eosio.token”so we can try to create tokens and transfer between these accounts. For “eosio.token”, we don’t need an wallet for it.

Now use the eosio.token to load the eosio.token contract.

1
2
3
4
5
6
7
8
sam@hero:~/Documents/eos$ cleos set contract eosio.token contracts/eosio.token -p eosio.token
Reading WAST/WASM from contracts/eosio.token/eosio.token.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: 6fb1e0289669afd05c208db72f2203bc9da694025316c061048cf87d0d18c990 8112 bytes 3150 us
# eosio <= eosio::setcode {"account":"eosio.token","vmtype":0,"vmversion":0,"code":"0061736d01000000017e1560037f7e7f0060057f7e...
# eosio <= eosio::setabi {"account":"eosio.token","abi":"0e656f73696f3a3a6162692f312e30010c6163636f756e745f6e616d65046e616d65...
2018-07-30T01:51:32.271 thread-0 main.cpp:391 print_result warning: transaction executed locally, but may not be confirmed by the network yet

And let’s create a token named XDS !

1
2
3
4
sam@hero:~/Documents/eos$ cleos push action eosio.token create '{"issuer":"eosio","maximum_supply":"1000 XDS"}' -p eosio.token
executed transaction: 7d01b01caee8cc0055898cc412fa26ad490d0d05856602dc0a64fe7150f5c67a 120 bytes 834 us
# eosio.token <= eosio.token::create {"issuer":"eosio","maximum_supply":"1000 XDS"}
2018-07-30T01:57:01.971 thread-0 main.cpp:391 print_result warning: transaction executed locally, but may not be confirmed by the network yet

After this, let’s give samhero 100 XDS !

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sam@hero:~/Documents/eos$ cleos push action eosio.token issue '["samhero", "100 XDS", "memo"]' -p eosio
executed transaction: 918e6a23e2668b5061da3aaa5916c511ab75eb4656f18c0be77e7e61b7a1cb2a 128 bytes 2291 us
# eosio.token <= eosio.token::issue {"to":"samhero","quantity":"100 XDS","memo":"memo"}
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"samhero","quantity":"100 XDS","memo":"memo"}
# eosio <= eosio.token::transfer {"from":"eosio","to":"samhero","quantity":"100 XDS","memo":"memo"}
# samhero <= eosio.token::transfer {"from":"eosio","to":"samhero","quantity":"100 XDS","memo":"memo"}
2018-07-30T01:58:57.363 thread-0 main.cpp:391 print_result warning: transaction executed locally, but may not be confirmed by the network yet

Than we transfer 66 XDS from samhero to samtre.

sam@hero:~/Documents/eos$ cleos push action eosio.token transfer '["samhero","samtre", "66 XDS","m"]' -p samhero
executed transaction: 7422eeed2fc3af418f63d30c6cb9b828f81f23a3ebb35af0babc5ad1297d3c3b 128 bytes 1233 us
# eosio.token <= eosio.token::transfer {"from":"samhero","to":"samtre","quantity":"66 XDS","memo":"m"}
# samhero <= eosio.token::transfer {"from":"samhero","to":"samtre","quantity":"66 XDS","memo":"m"}
# samtre <= eosio.token::transfer {"from":"samhero","to":"samtre","quantity":"66 XDS","memo":"m"}
2018-07-30T02:01:27.930 thread-0 main.cpp:391 print_result warning: transaction executed locally, but may not be confirmed by the network yet

See how many tokens they’ve got!

1
2
3
4
sam@hero:~/Documents/eos$ cleos get currency balance eosio.token samhero
34 XDS
sam@hero:~/Documents/eos$ cleos get currency balance eosio.token samtre
66 XDS