EOS Local provides a really quick way to setup an EOS local network for development.
The primary benefits of containers are consistency accross different environments and deployment ease.
This project has a companion boilerplate for your dApp. https://github.com/eoscostarica/eos-dapp-boilerplate
Disclaimer: It works, but it's still a work in progress...
Table of Contents generated with DocToc
- Services
- Getting started
- Aliases
- Chain Initialization
- Commands
- Cleos through docker exec
- Accessing the container
- Directory Structure
- Contributing
- About EOS Costa Rica
- License
- Contributors
Every service/process runs on a separate container.
The eosio node acts as producer and history api node, this configuration is just for development.
MongoDB instance for to story hisotry. The eosio::mongo_db_plugin provides archiving of blockchain data into a MongoDB.
https://developers.eos.io/eosio-nodeos/docs/mongo_db_plugin
https://github.com/EOS-BP-Developers/eosio-graphql
https://github.com/CryptoLions/EOS-mongo-history-API
Nginx reverse proxy that allows accesing the services directly on the host machine the wildcard *.esolocal.io
that points to 127.0.0.1
, therefore as long as you can hit the dns server it will redirect all requests to your machine and nginx-proxy does the internal docker network routing to the right service.
Run ping {whatever}.eoslocal.io
to verify.
Basic knowledge about Docker, Docker Compose, EOS and NodeJS is required.
- Video tutorial Docker Containers | Learn Docker Basics in 30 Mins
Global Dependencies
- Docker https://docs.docker.com/install/.
At least 10GB RAM (Docker -> Preferences -> Advanced -> Memory -> 10GB or above)
It is useful to have aliases for the docker
, docker-compose
and cleos
.
alias cleos_local='docker exec -i eoslocal_eosio cleos -u http://eosio:8888 --wallet-url http://wallet:8901'
alias eosio_local='docker exec -it eoslocal_eosio bash'
alias unlock_eoslocal='docker exec -i eoslocal_eosio ./scripts/unlock.sh'
alias dk='docker'
alias dc='docker-compose'
Make sure the following ports are available on your host machine.
8888, 9830, 8901, 27017, 4001, 5001, 8081, 80
See docker-compose.yml
port mapping for details.
Execute make setup
for:
- Docker volumes creation and containers startup.
- EOSIO local chain initialization.
- Testing accounts creation.
Verify Setup
Run the following command to verify afterwards
β docker network ls
NETWORK ID NAME DRIVER SCOPE
f72523603a2d bridge bridge local
113510307ce3 eoslocal bridge local
886afbf5db1a host host local
53d0d3f8d910 none null local
β docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------------------------------
eoslocal_eosio /bin/sh -c /wait && /opt/a ... Up 0.0.0.0:8888->8888/tcp, 0.0.0.0:9830->9876/tcp
eoslocal_ipfs /sbin/tini -- /usr/local/b ... Up 0.0.0.0:4001->4001/tcp, 0.0.0.0:5001->5001/tcp, 0.0.0.0:8081->8080/tcp, 8081/tcp
eoslocal_mongo docker-entrypoint.sh mongod Up 0.0.0.0:27017->27017/tcp
eoslocal_nginx /app/docker-entrypoint.sh ... Up 0.0.0.0:80->80/tcp
eoslocal_wallet /opt/eosio/bin/keosd --wal ... Up 0.0.0.0:8901->8901/tcp
β cleos_local wallet keys
[
"EOS6kYgMTCh1iqpq9XGNQbEi8Q6k5GujefN9DSs55dcjVyFAq7B6b",
"EOS78RuuHNgtmDv9jwAzhxZ9LmC6F295snyQ9eUDQ5YtVHJ1udE6p",
"EOS5yd9aufDv7MqMquGcQdD6Bfmv6umqSuh9ru3kheDBqbi6vtJ58",
"EOS7XPiPuL3jbgpfS3FFmjtXK62Th9n2WZdvJb6XLygAghfx1W7Nb",
"EOS6TVQ6EmphCWavUuYiZMmDNYMRgbb96wgqWDncjrkvFPcpokgdD",
"EOS5btzHW33f9zbhkwjJTYsoyRzXUNstx1Da9X2nTzk8BQztxoP3H",
"EOS8Du668rSVDE3KkmhwKkmAyxdBd73B51FKE7SjkKe5YERBULMrw"
]
β cleos_local get info
{
"server_version": "59626f1e",
"chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
"head_block_num": 675,
"last_irreversible_block_num": 674,
"last_irreversible_block_id": "000002a2a6228780c7facc225ff53609ed072d57e7b6abb9a0ba92ab63b5d160",
"head_block_id": "000002a3b39afb5f16ac7a59f747e21ef6bcc060a856237016af48ad677c7f52",
"head_block_time": "2018-12-07T18:03:08.500",
"head_block_producer": "eosio",
"virtual_block_cpu_limit": 392064,
"virtual_block_net_limit": 2057598,
"block_cpu_limit": 199900,
"block_net_limit": 1048576,
"server_version_string": "v1.4.4"
}
β curl http://eosio.eoslocal.io/v1/chain/get_info | jq
or
β curl http://localhost:8888/v1/chain/get_info | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 566 100 566 0 0 72554 0 --:--:-- --:--:-- --:--:-- 80857
{
"server_version": "59626f1e",
"chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
"head_block_num": 970,
"last_irreversible_block_num": 969,
"last_irreversible_block_id": "000003c9846265cddc9133024d9bd2adb1531378da8172318fe2a142b843c02a",
"head_block_id": "000003ca6e3448f540c36f70a176f5cc4769514f8018b07fbbf32b27f532fb6b",
"head_block_time": "2018-12-07T18:05:36.000",
"head_block_producer": "eosio",
"virtual_block_cpu_limit": 526492,
"virtual_block_net_limit": 2763849,
"block_cpu_limit": 199900,
"block_net_limit": 1048576,
"server_version_string": "v1.4.4"
}
make setup
run chain initialization.make start
starts all services.make stop
stops all services.make flush
stops all services and removes all data.make fresh
stops all services and removes all data and run chain initialization again.docker-compose exec [service_name] [bash | sh]
open bash or sh in a container.docker-compose down
stops and removes all containers.docker-compose restart
restarts all services.
You can execute commands on any container from you host machine using the docker exec
command.
Eg:
docker exec -i eoslocal_eosio cleos --url http://localhost:8888/ get info
Notice it uses docker directly through the container_name
insted of docker compose, this allows you to invoke it from any path in your computer, you don't have to be a the root dir of eoslocal.
You can also login into the containers using the following docker-compose command
docker exec -it eoslocal_eosio bash
That will log you in and you will be able to execute cleos directly within the ubuntu server.
Testing Accounts
-
name: eostestusera
privateKey: 5K7mtrinTFrVTduSxizUc5hjXJEtTjVTsqSHeBHes1Viep86FP5
publicKey: EOS6kYgMTCh1iqpq9XGNQbEi8Q6k5GujefN9DSs55dcjVyFAq7B6b
-
name: eostestuserb
privateKey: 5KLqT1UFxVnKRWkjvhFur4sECrPhciuUqsYRihc1p9rxhXQMZBg
publicKey: EOS78RuuHNgtmDv9jwAzhxZ9LmC6F295snyQ9eUDQ5YtVHJ1udE6p
-
name: eostestuserc
privateKey: 5K2jun7wohStgiCDSDYjk3eteRH1KaxUQsZTEmTGPH4GS9vVFb7
publicKey: EOS5yd9aufDv7MqMquGcQdD6Bfmv6umqSuh9ru3kheDBqbi6vtJ58
-
name: eostestuserd
privateKey: 5KNm1BgaopP9n5NqJDo9rbr49zJFWJTMJheLoLM5b7gjdhqAwCx
publicKey: EOS8LoJJUU3dhiFyJ5HmsMiAuNLGc6HMkxF4Etx6pxLRG7FU89x6X
-
name: eostestusere
privateKey: 5KE2UNPCZX5QepKcLpLXVCLdAw7dBfJFJnuCHhXUf61hPRMtUZg
publicKey: EOS7XPiPuL3jbgpfS3FFmjtXK62Th9n2WZdvJb6XLygAghfx1W7Nb
-
name: eostestuserf
privateKey: 5KaqYiQzKsXXXxVvrG8Q3ECZdQAj2hNcvCgGEubRvvq7CU3LySK
publicKey: EOS5btzHW33f9zbhkwjJTYsoyRzXUNstx1Da9X2nTzk8BQztxoP3H
-
name: eostestuserg
privateKey: 5KFyaxQW8L6uXFB6wSgC44EsAbzC7ideyhhQ68tiYfdKQp69xKo
publicKey: EOS8Du668rSVDE3KkmhwKkmAyxdBd73B51FKE7SjkKe5YERBULMrw
.
βββ docs/ .............................................. documentation files and media
βββ services/ .......................................... microservices
| βββ graphql/ ....................................... graphql service
| |
| βββ history-api/ ................................... express/swagger history api
| |
| βββ ngnix/ ......................................... nginx service for routing
| |
| βββ mongo/ ......................................... mongodb data
| |
| βββ eosio/ ......................................... nodeos service
| βββ utils/ ..................................... service utilities
| βββ config/ .................................... eosio node configuration
| βββ scripts/ ................................... eosio scripts
| βββ contracts/ ................................. smart contracts
| βββ Dockerfile ................................. service image specification
|
βββ docker-compose.yaml ................................ docker compose for local dev
βββ contributing.md .................................... contributing guidelines
βββ license ............................................ project license
βββ makefile ........................................... make tasks manifest
βββ readme.md .......................................... project documentation
βββ .editorconfig ...................................... common text editor configs
We use a Kanban-style board. That's were we prioritize the work. Go to Project Board.
Contributing Guidelines https://developers.eoscostarica.io/docs/open-source-guidelines.
Please report bugs big and small by opening an issue
EOS Costa Rica is an independently-owned, self-funded, bare-metal genesis block producer that provides stable and secure infrastructure for EOSIO blockchains. We support open source software for our community while offering enterprise solutions and custom smart contract development for our clients.
MIT Β© EOS Costa Rica
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!