As a member of CoinFabrik, during the last year I dedicated myself to teach about Ethereum for the University of Palermo and given what I saw in my classes I required a set of tools that allowed me to observe and quickly analyze different situations in relation to Ethereum.
This was from analyzing the problems of a Node and its connection to the rest, passing through studying a particular blockchain, to seeing how the different transactions of a smart contract behaved.
In view of this, and due to the material conditions of the work, I required an environment where students could do all that but at the same time didn’t need to be connected to the internet. That is why I ended up configuring my personal computer to have those tools. However, the configuration of my computer was not portable enough for the needs I had. This motivated me to create a rapidly configurable environment using Docker and Docker Compose as main tools. This article will describe how to use those tools.
It is necessary to clarify that the configuration of the dockers was developed together with PeGa! (our SysAdmin) who helped the project to be in optimal conditions.
The software described below is intended to be a tool of both educational and development environment purposes.
The purpose of this configuration is to generate a Docker environment of 2 nodes connected together (a.k.a. Node1 and Node2) running on Geth and monitor them using Ethstat (at localhost:3000). Then we can use MetaMask as well as Remix to connect to Node1 (localhost:8545) to send simple transtractions, like sending Ether, or complex transactions like the creation or call of a smart contract.
To start our environment we just need to clone the DockerEthereum repository with:
git clone https://github.com/CoinFabrik/DockerEthereum
Go to the respective folder with
And just start our environment with
This last command will generate the images required for the ecosystem and run each container. We will have one container per service, in this case three containers with the following names:
Attach or connect to the containers as follows:
sudo docker attach
sudo docker exec -it /bin/bash
To detach use “Ctrl + P”, “Ctrl +Q”
The Geth services are running in pm2 so if you want to see the logs of the nodes, you must first attach to the node and then inspect the log.
sudo docker attach Node1
pm2 log node1
sudo ./scripts/Faucet.sh <<Amount>> <<Address>
will send the amount of ethers in the first parameter to the address specified in the second.
In order for the transaction to actually take place, we must start the mining process.
Start and stop mining
These commands will send the Start and Stop command to the Node1 container but, because the two nodes are connected and synchronized, we can see in the Ethstat panel (localhost:3000) that the two nodes are holding the same blockchain.
Monitor the Nodes
just visit localhost:3000
Config MetaMask And Remix
To connect with MetaMask we select the “localhost 8545” option, whereas the connection from Remix to Metamask is done by selecting “Injected Web3” in the Environment option.