Skip to content

Commit

Permalink
Rename eosiod to nodeos and eosioc to cleos and update docs and scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgiszczak committed Mar 19, 2018
1 parent 521ddf7 commit 59fcb59
Show file tree
Hide file tree
Showing 36 changed files with 204 additions and 185 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(VERSION_MAJOR 3)
set(VERSION_MINOR 0)
set(VERSION_PATCH 1)

set( CLI_CLIENT_EXECUTABLE_NAME eosioc )
set( CLI_CLIENT_EXECUTABLE_NAME cleos )
set( GUI_CLIENT_EXECUTABLE_NAME eosio )
set( CUSTOM_URL_SCHEME "gcs" )
set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )
Expand Down
14 changes: 6 additions & 8 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ RUN git clone -b master --depth 1 https://github.com/EOSIO/eos.git --recursive \
FROM ubuntu:16.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl && rm -rf /var/lib/apt/lists/*

COPY --from=builder /opt/eosio /opt/eosio
COPY --from=builder /contracts /contracts
COPY start_eosiod.sh /opt/eosio/bin/
COPY config.ini /
COPY genesis.json /

COPY --from=builder /usr/local/lib/* /usr/local/lib/
COPY --from=builder /tmp/build/bin /opt/eosio/bin
COPY --from=builder /tmp/build/contracts /contracts
COPY --from=builder /eos/Docker/config.ini /eos/genesis.json /
COPY start_eosiod.sh /opt/eosio/bin/start_eosiod.sh
ENV EOSIO_ROOT=/opt/eosio
RUN chmod +x /opt/eosio/bin/start_eosiod.sh
RUN chmod +x /opt/eosio/bin/start_nodeos.sh
ENV LD_LIBRARY_PATH /usr/local/lib
VOLUME /opt/eosio/bin/data-dir
ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
30 changes: 15 additions & 15 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ cd eos/Docker
docker build . -t eosio/eos
```

## Start eosiod docker container only
## Start nodeos docker container only

```bash
docker run --name eosiod -p 8888:8888 -p 9876:9876 -t eosio/eos start_eosiod.sh arg1 arg2
docker run --name nodeos -p 8888:8888 -p 9876:9876 -t eosio/eos start_nodeos.sh arg1 arg2
```

By default, all data is persisted in a docker volume. It can be deleted if the data is outdated or corrupted:
``` bash
$ docker inspect --format '{{ range .Mounts }}{{ .Name }} {{ end }}' eosiod
$ docker inspect --format '{{ range .Mounts }}{{ .Name }} {{ end }}' nodeos
fdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc
$ docker volume rm fdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc
```

Alternately, you can directly mount host directory into the container
```bash
docker run --name eosiod -v /path-to-data-dir:/opt/eosio/bin/data-dir -p 8888:8888 -p 9876:9876 -t eosio/eos start_eosiod.sh arg1 arg2
docker run --name nodeos -v /path-to-data-dir:/opt/eosio/bin/data-dir -p 8888:8888 -p 9876:9876 -t eosio/eos start_nodeos.sh arg1 arg2
```

## Get chain info
Expand All @@ -40,29 +40,29 @@ docker run --name eosiod -v /path-to-data-dir:/opt/eosio/bin/data-dir -p 8888:88
curl http://127.0.0.1:8888/v1/chain/get_info
```

## Start both eosiod and walletd containers
## Start both nodeos and walletd containers

```bash
docker-compose up
```

After `docker-compose up`, two services named eosiod and walletd will be started. eosiod service would expose ports 8888 and 9876 to the host. walletd service does not expose any port to the host, it is only accessible to eosioc when runing eosioc is running inside the walletd container as described in "Execute eosioc commands" section.
After `docker-compose up`, two services named nodeos and walletd will be started. nodeos service would expose ports 8888 and 9876 to the host. walletd service does not expose any port to the host, it is only accessible to cleos when runing cleos is running inside the walletd container as described in "Execute cleos commands" section.


### Execute eosioc commands
### Execute cleos commands

You can run the `eosioc` commands via a bash alias.
You can run the `cleos` commands via a bash alias.

```bash
alias eosioc='docker-compose exec walletd /opt/eosio/bin/eosioc -H eosiod'
eosioc get info
eosioc get account inita
alias cleos='docker-compose exec walletd /opt/eosio/bin/cleos -H nodeos'
cleos get info
cleos get account inita
```

Upload sample exchange contract

```bash
eosioc set contract exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi
cleos set contract exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi
```

If you don't need walletd afterwards, you can stop the walletd service using
Expand All @@ -78,9 +78,9 @@ You can use docker compose override file to change the default configurations. F
version: "2"

services:
eosiod:
nodeos:
volumes:
- eosiod-data-volume:/opt/eosio/bin/data-dir
- nodeos-data-volume:/opt/eosio/bin/data-dir
- ./config2.ini:/opt/eosio/bin/data-dir/config.ini
```
Expand All @@ -95,5 +95,5 @@ docker-compose up
The data volume created by docker-compose can be deleted as follows:

```bash
docker volume rm docker_eosiod-data-volume
docker volume rm docker_nodeos-data-volume
```
17 changes: 17 additions & 0 deletions Docker/cleos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Usage:
# Go into cmd loop: sudo ./cleos.sh
# Run single cmd: sudo ./cleos.sh <cleos paramers>

PREFIX="docker exec docker_nodeos_1 cleos"
if [ -z $1 ] ; then
while :
do
read -e -p "cleos " cmd
history -s "$cmd"
$PREFIX $cmd
done
else
$PREFIX $@
fi
12 changes: 6 additions & 6 deletions Docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
version: "2"
version: "3"

services:
eosiod:
nodeos:
build:
context: .
image: eosio/eos
command: /opt/eosio/bin/start_eosiod.sh
command: /opt/eosio/bin/start_nodeos.sh
ports:
- 8888:8888
- 9876:9876
expose:
- "8888"
volumes:
- eosiod-data-volume:/opt/eosio/bin/data-dir
- nodeos-data-volume:/opt/eosio/bin/data-dir

walletd:
image: eosio/eos
command: /opt/eosio/bin/eosiowd
links:
- eosiod
- nodeos
volumes:
- walletd-data-volume:/opt/eosio/bin/data-dir

volumes:
eosiod-data-volume:
nodeos-data-volume:
walletd-data-volume:
17 changes: 0 additions & 17 deletions Docker/eosioc.sh

This file was deleted.

2 changes: 1 addition & 1 deletion Docker/start_eosiod.sh → Docker/start_nodeos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ else
CONFIG_DIR=""
fi

exec /opt/eosio/bin/eosiod $CONFIG_DIR $@
exec /opt/eosio/bin/nodeos $CONFIG_DIR $@
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ To run the test suite after building, run the `chain_test` executable in the `te

EOS comes with a number of programs you can find in `~/eos/build/programs`. They are listed below:

* eosiod - server-side blockchain node component
* eosioc - command line interface to interact with the blockchain
* nodeos - server-side blockchain node component
* cleos - command line interface to interact with the blockchain
* eosiowd - EOS wallet
* eosio-launcher - application for nodes network composing and deployment; [more on eosio-launcher](https://github.com/EOSIO/eos/blob/master/testnet.md)

<a name="singlenode"></a>
### Creating and launching a single-node testnet

After successfully building the project, the `eosiod` binary should be present in the `build/programs/eosiod` directory. Run `eosiod` -- it will probably exit with an error, but if not, close it immediately with <kbd>Ctrl-C</kbd>. If it exited with an error, note that `eosiod` created a directory named `data-dir` containing the default configuration (`config.ini`) and some other internals. This default data storage path can be overridden by passing `--data-dir /path/to/data` to `eosiod`. These instructions will continue to use the default directory.
After successfully building the project, the `nodeos` binary should be present in the `build/programs/nodeos` directory. Run `nodeos` -- it will probably exit with an error, but if not, close it immediately with <kbd>Ctrl-C</kbd>. If it exited with an error, note that `nodeos` created a directory named `data-dir` containing the default configuration (`config.ini`) and some other internals. This default data storage path can be overridden by passing `--data-dir /path/to/data` to `nodeos`. These instructions will continue to use the default directory.

Edit the `config.ini` file, adding/updating the following settings to the defaults already in place:

Expand Down Expand Up @@ -264,10 +264,10 @@ plugin = eosio::chain_api_plugin
plugin = eosio::http_plugin
```

Now it should be possible to run `eosiod` and see it begin producing blocks.
You can specify the location of a custom `config.ini` by passing the `--config-dir` argument to `eosiod`.
Now it should be possible to run `nodeos` and see it begin producing blocks.
You can specify the location of a custom `config.ini` by passing the `--config-dir` argument to `nodeos`.

When running `eosiod` you should get log messages similar to below. It means the blocks are successfully produced.
When running `nodeos` you should get log messages similar to below. It means the blocks are successfully produced.

```
1575001ms thread-0 chain_controller.cpp:235 _push_block ] initm #1 @2017-09-04T04:26:15 | 0 trx, 0 pending, exectime_ms=0
Expand All @@ -292,24 +292,24 @@ EOS comes with example contracts that can be uploaded and run for testing purpos
First, run the node

```bash
cd ~/eos/build/programs/eosiod/
./eosiod
cd ~/eos/build/programs/nodeos/
./nodeos
```

<a name="walletimport"></a>
### Setting up a wallet and importing account key

As you've previously added `plugin = eosio::wallet_api_plugin` into `config.ini`, EOS wallet will be running as a part of `eosiod` process. Every contract requires an associated account, so first, create a wallet.
As you've previously added `plugin = eosio::wallet_api_plugin` into `config.ini`, EOS wallet will be running as a part of `nodeos` process. Every contract requires an associated account, so first, create a wallet.

```bash
cd ~/eos/build/programs/eosioc/
./eosioc wallet create # Outputs a password that you need to save to be able to lock/unlock the wallet
cd ~/eos/build/programs/cleos/
./cleos wallet create # Outputs a password that you need to save to be able to lock/unlock the wallet
```

For the purpose of this walkthrough, import the private key of the `eosio` account, a system account included within genesis.json, so that you're able to issue API commands under authority of an existing account. The private key referenced below is found within your `config.ini` and is provided to you for testing purposes.

```bash
./eosioc wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
./cleos wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
```

<a name="createaccounts"></a>
Expand All @@ -318,9 +318,9 @@ For the purpose of this walkthrough, import the private key of the `eosio` accou
First, generate some public/private key pairs that will be later assigned as `owner_key` and `active_key`.

```bash
cd ~/eos/build/programs/eosioc/
./eosioc create key # owner_key
./eosioc create key # active_key
cd ~/eos/build/programs/cleos/
./cleos create key # owner_key
./cleos create key # active_key
```

This will output two pairs of public and private keys
Expand All @@ -336,15 +336,15 @@ Save the values for future reference.
Run the `create` command where `eosio` is the account authorizing the creation of the `currency` account and `PUBLIC_KEY_1` and `PUBLIC_KEY_2` are the values generated by the `create key` command

```bash
./eosioc create account eosio currency PUBLIC_KEY_1 PUBLIC_KEY_2
./cleos create account eosio currency PUBLIC_KEY_1 PUBLIC_KEY_2
```

You should then get a JSON response back with a transaction ID confirming it was executed successfully.

Go ahead and check that the account was successfully created

```bash
./eosioc get account currency
./cleos get account currency
```

If all went well, you will receive output similar to the following:
Expand All @@ -362,7 +362,7 @@ If all went well, you will receive output similar to the following:
Now import the active private key generated previously in the wallet:

```bash
./eosioc wallet import XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
./cleos wallet import XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

<a name="uploadsmartcontract"></a>
Expand All @@ -371,22 +371,22 @@ Now import the active private key generated previously in the wallet:
Before uploading a contract, verify that there is no current contract:

```bash
./eosioc get code currency
./cleos get code currency
code hash: 0000000000000000000000000000000000000000000000000000000000000000
```

With an account for a contract created, upload a sample contract:

```bash
./eosioc set contract currency ../../contracts/currency/currency.wast ../../contracts/currency/currency.abi
./cleos set contract currency ../../contracts/currency/currency.wast ../../contracts/currency/currency.abi
```

As a response you should get a JSON with a `transaction_id` field. Your contract was successfully uploaded!

You can also verify that the code has been set with the following command:

```bash
./eosioc get code currency
./cleos get code currency
```

It will return something like:
Expand All @@ -397,13 +397,13 @@ code hash: 9b9db1a7940503a88535517049e64467a6e8f4e9e03af15e9968ec89dd794975
Before using the currency contract, you must issue the currency.

```bash
./eosioc push action currency issue '{"to":"currency","quantity":"1000.0000 CUR"}' --permission currency@active
./cleos push action currency issue '{"to":"currency","quantity":"1000.0000 CUR"}' --permission currency@active
```

Next verify the currency contract has the proper initial balance:

```bash
./eosioc get table currency currency account
./cleos get table currency currency account
{
"rows": [{
"currency": 1381319428,
Expand All @@ -422,13 +422,13 @@ Anyone can send any message to any contract at any time, but the contracts may r
The content of the message is `'{"from":"currency","to":"eosio","quantity":"20.0000 CUR","memo":"any string"}'`. In this case we are asking the currency contract to transfer funds from itself to someone else. This requires the permission of the currency contract.

```bash
./eosioc push action currency transfer '{"from":"currency","to":"eosio","quantity":"20.0000 CUR","memo":"my first transfer"}' --permission currency@active
./cleos push action currency transfer '{"from":"currency","to":"eosio","quantity":"20.0000 CUR","memo":"my first transfer"}' --permission currency@active
```

Below is a generalization that shows the `currency` account is only referenced once, to specify which contract to deliver the `transfer` message to.

```bash
./eosioc push action currency transfer '{"from":"${usera}","to":"${userb}","quantity":"20.0000 CUR","memo":""}' --permission ${usera}@active
./cleos push action currency transfer '{"from":"${usera}","to":"${userb}","quantity":"20.0000 CUR","memo":""}' --permission ${usera}@active
```

As confirmation of a successfully submitted transaction, you will receive JSON output that includes a `transaction_id` field.
Expand All @@ -439,7 +439,7 @@ As confirmation of a successfully submitted transaction, you will receive JSON o
So now check the state of both of the accounts involved in the previous transaction.

```bash
./eosioc get table eosio currency account
./cleos get table eosio currency account
{
"rows": [{
"currency": 1381319428,
Expand All @@ -448,7 +448,7 @@ So now check the state of both of the accounts involved in the previous transact
],
"more": false
}
./eosioc get table currency currency account
./cleos get table currency currency account
{
"rows": [{
"currency": 1381319428,
Expand Down Expand Up @@ -479,15 +479,15 @@ This command will generate two data folders for each instance of the node: `tn_d
You should see the following response:

```bash
spawning child, programs/eosiod/eosiod --skip-transaction-signatures --data-dir tn_data_0
spawning child, programs/eosiod/eosiod --skip-transaction-signatures --data-dir tn_data_1
spawning child, programs/nodeos/nodeos --skip-transaction-signatures --data-dir tn_data_0
spawning child, programs/nodeos/nodeos --skip-transaction-signatures --data-dir tn_data_1
```

To confirm the nodes are running, run the following `eosioc` commands:
To confirm the nodes are running, run the following `cleos` commands:
```bash
~/eos/build/programs/eosioc
./eosioc -p 8888 get info
./eosioc -p 8889 get info
~/eos/build/programs/cleos
./cleos -p 8888 get info
./cleos -p 8889 get info
```

For each command, you should get a JSON response with blockchain information.
Expand Down
Loading

0 comments on commit 59fcb59

Please sign in to comment.