はじめに
DAppsを作る時の、SmartContractをかくケースの選択肢として、比較的Ethereumを撰択するケースが多かったように思いますが、EOSのドキュメントなどが充実してきて、周囲でも利用している人が増えてきたので、ここらでEOSもDAppsを作る選択肢として考えてみようと思いました。
基本的には本家のドキュメントと同じなので、自分の覚え書きとして残す形になります。
手順
Docker入れる
他に選択肢がないかなと見ていましたが、公式でもDockerを使うのが推奨でしたので、
Dockerを入れることから始めます。すでに入ってる場合はskipします。
1.Home brewでDockerをインストール
$ brew cask install docker
==> Verifying SHA-256 checksum for Cask 'docker'.
==> Installing Cask docker
==> Creating Caskroom at /usr/local/Caskroom
==> We'll set permissions properly so we won't need sudo in the future.
Password:
==> Moving App 'Docker.app' to '/Applications/Docker.app'.
🍺 docker was successfully installed!
2.アプリケーションを起動
open /Applications/Docker.app
3.versionを表示する
docker --version
Docker version 18.06.1-ce, build e68fc7a
EOSIO入れる
1.EOSIOのDockerイメージをinstallする
$ docker pull eosio/eos
Using default tag: latest
latest: Pulling from eosio/eos
6b98dfc16071: Pull complete
4001a1209541: Pull complete
6319fc68c576: Pull complete
b24603670dc3: Pull complete
97f170c87c6f: Pull complete
ca8277dae3e4: Pull complete
49bdd58b12e0: Pull complete
48004ecaaa94: Pull complete
7f11e84fd457: Pull complete
212aadeab614: Pull complete
3e09a471cd15: Pull complete
e442b1315596: Pull complete
Digest: sha256:9c1b72166353036e34b92975e832ab8fdaf488f5e26745071490bd2e0387ce99
Status: Downloaded newer image for eosio/eos:latest
2.起動する
oo
$ docker run --rm --name eosio -d -p 8888:8888 -p 9876:9876 -v /tmp/work:/work -v /tmp/eosio/data:/mnt/dev/data -v /tmp/eosio/config:/mnt/dev/config eosio/eos-dev /bin/bash -c "nodeos -e -p eosio --plugin eosio::producer_plugin --plugin eosio::history_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --plugin eosio::http_plugin -d /mnt/dev/data --config-dir /mnt/dev/config --http-server-address=0.0.0.0:8888 --access-control-allow-origin=* --contracts-console --http-validate-host=false"
3.プロセスを確認する
$docker ps
4.アクセスする
{"server_version":"1e9ca55c","chain_id":"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f","head_block_num":389,"last_irreversible_block_num":388,"last_irreversible_block_id":"00000184c7021d42386ff04bc22faa8de0ef67c8efc2e25051741af34e24d915","head_block_id":"00000185332f84a34668e289e082637e01c7146864cd4b6eccb83a3960e85eb5","head_block_time":"2018-10-10T04:54:58.500","head_block_producer":"eosio","virtual_block_cpu_limit":294627,"virtual_block_net_limit":1545701,"block_cpu_limit":199900,"block_net_limit":1048576,"server_version_string":"v1.3.2"}
5.APIの一覧があるので色々使ってみよう
6.作られたblockを見る
$ docker logs --tail 10 eosio
7.shellに入る
$ docker exec -it eosio bash
8.walletを確認する
/# cleos --wallet-url http://127.0.0.1:5555 wallet list keys
"/opt/eosio/bin/keosd" launched
Wallets:
[]
Error 3120006: No available wallet
Ensure that you have created a wallet and have it open
9.walletを作成する
cleos wallet create -n eosfirstwallet --to-console
> Unable to connect to keosd, if keosd is running please kill the process and try again.
参考
https://developers.eos.io/eosio-home/docs/writing-a-custom-dispatcher
https://note.mu/daidai12/n/n787e009fe6e4
https://medium.com/coinmonks/eos-development-learning-resources-d6875196
b980
https://infinitexlabs.com/eos-development-tutorial-part-1/
https://hackernoon.com/getting-started-on-eos-mainnet-in-10-minutes-bf61dd9ec787