EOS Dev Guide 0x01

Prerequisite
This article assumes you've finished git clone and auto-build stages.
If not, please check the previous post: EOS Dev Guide 0x00.
Add nodeos/cleos to PATH
for your convenience.
Make sure to add at least the paths of eos/build/programs
and eos/build/tools
to $PATH
.
Tips: type pwd
to get the full path.
$ export PATH=$PATH:/home/ubuntu/eos/build
You'd better write it to ~/.bashrc
so that you won't need to execute it every time you start a bash.
Start private net
EOS is a kind of consortium blockchain project. You need to start a miner net to produce block for other clients. You can understand it as a server, but it's not exactly.
All of your test operations will be collected and produced by this net.
ref: https://github.com/EOSIO/eos/wiki/Tutorial-Getting-Started-With-Contracts
NOTE: To print contract's output to console by default, add:--contracts-console
ref: https://medium.com/coinmonks/the-ultimate-end-to-end-eos-dapp-development-tutorial-part-1-2f99c512086c
$ nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --contracts-console
You should see the following output:

As you can see, it starts to produce block for every 0.5s.
pause nodeos
ctrl + z
to drag it into background and pause, fg
to bring it front and resume producing blocks.ctrl + c
is not recommended, you may suffer errors and have to delete all the blocks to restart it. check the next post for details.
about restarting nodeos
If you happened ctrl + c
and encountered an exception when restarting nodeos like this:
669409ms thread-0 producer_plugin.cpp:652 start_block ] Not producing block because the irreversible block is too old [age:12s, max:0s]
669411ms thread-0 producer_plugin.cpp:526 plugin_startup ] producer plugin: plugin_startup() end
This means the nodeos net is probably down for a relative long time, longer than the max value in configuration.
The recommended way to fix it is to modify the config file to resume it.
The config file stays at ~/.local/share/eosio/nodeos/config/config.ini
in Ubuntu by default.
On line 102:
max-irreversible-block-age = 1800
Change this to a very large number 99999999
.
Save it then restart the nodeos, it should work now.
Another way is to delete all blocks then restart it from fresh new, which means you need to redo all the operations except for those only affect local wallet.
Delete the blocks and states folder:
mv ~/.local/share/eosio/nodeos/data /tmp
Then restart the nodeos.
Or, you could try first use --delete-all-blocks
, then restart it with --replay-blockchain
flag. But this is not recommended. ref: https://github.com/EOSIO/eos/issues/3047
Create a wallet
A wallet is like a client where it stores and manages your private/public key. It's the only thing you need to connect to a EOS network. Actually, it's true to almost any blockchain network.
This step only affects local wallet.
$ cleos wallet create
"/home/ubuntu/eos/build/programs/keosd/keosd" launched
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"*****************************************************"
Do save the password somewhere, otherwise you'll lose control over the wallet.
The wallet is being managed by the local nodeos
net.
For security purpose, the wallet is locked by default, which means you have to unlock it every time you restart the nodeos net.
To unlock/lock the wallet:
This step only affects local wallet.
$ cleos wallet unlock
$ cleos wallet lock
In the real world, it's highly recommended that you keep the wallet locked for most of the time.
But for our test purpose, you need to keep it unlocked to do operations.
If you see an error when trying to unlock your wallet saying that it's already unlocked, you'll notice that I forgot to say your wallet is unlocked by default when you create it. And yes it was intended, lol.
End
So much for this part, see you in the next post.
Peace.