Giter VIP home page Giter VIP logo

ethereum-docker's Introduction

Ethereum Docker

Get started creating Ethereum development and test single and multi-node clusters rapidly using Docker.

We provide full Ethereum test nodes (using the Ethereum Go client with all APIs enabled by default as well as a monitoring dashboard (for the cluster version) provided via Netstats.

Alternative projects

TestRPC - https://github.com/ethereumjs/testrpc

Getting started

1. Installing

1.1. Standalone Ethereum node

Prerequisites

Docker Toolbox installed.

To download and install Docker Toolbox for your environment please follow the Docker Toolbox instructions.

After Docker Toolbox has been installed, create a default machine to run Docker against.

Lets go

To run a single test Ethereum node run the following:

$ docker-compose -f docker-compose-standalone.yml up -d

If using docker-machine you should be able to get to the JSON RPC client by doing:

open http://$(docker-machine ip default):8545

Assuming you ran docker-compose against the default machine.

1.2. Ethereum Cluster with netstats monitoring

To run an Ethereum Docker cluster run the following:

$ docker-compose up -d

By default this will create:

  • 1 Ethereum Bootstrapped container
  • 1 Ethereum container (which connects to the bootstrapped container on launch)
  • 1 Netstats container (with a Web UI to view activity in the cluster)

To access the Netstats Web UI:

open http://$(docker-machine ip default):3000

Scaling the number of nodes/containers in the cluster

You can scale the number of Ethereum nodes by running:

docker-compose scale eth=3

This will scale the number of Ethereum nodes upwards (replace 3 with however many nodes you prefer). These nodes will connect to the P2P network (via the bootstrap node) by default.

1.3. Test accounts ready for use

As part of the bootstrapping process we bootstrap 10 Ethereum accounts for use pre-filled with 20 Ether for use in transactions by default.

If you want to change the amount of Ether for those accounts See files/genesis.json.

2. Interact with geth

To get attached to the geth JavaScript console on the node you can run the following

docker exec -it ethereumdocker_eth_1 geth attach ipc://root/.ethereum/devchain/geth.ipc

Then you can miner.start(), and then check to see if it's mining by inspecting web3.eth.mining.

See the Javascript Runtime docs for more.

2.1 Use an existing DAG

To speed up the process, you can use a pre-generated DAG. All you need to do is add something like this

ADD dag/full-R23-0000000000000000 /root/.ethash/full-R23-0000000000000000

to the monitored-geth-client Dockerfile.

ethereum-docker's People

Contributors

andrewdong14 avatar blockchainphil avatar daragao avatar davesag avatar marcospoerl avatar meken avatar tayzlor avatar walkeralencar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethereum-docker's Issues

Can't start any nodes.

Hello there,
I have a question, i can grab the repo and enter the folder "ethereum-docker", when i run the command "docker-compose -f docker-compose-standalone.yml up -d" it says "ethereumdocker_geth_1 is up-to-date", nothing more.
I've managed to run the same command and get the response "ethereumdocker_geth_1 is up-to-date... done" at some point, but when i enter the ip and the port 8545 of the default virtual machine, i see nothing.
So i ran the command "docker-compose ps" to see the container ive created and i don't see the ethereumdocker_geth_1, i don't know if i am missing something but i wanted to ask you, this is normal?
i tried to follow this tutorial and i only managed to run the netstats node, i get the screen of the tutorial, the only different thing is that i don't have the 2 created nodes (the bootstrap node and the other one), so i want to know if i am missing something, i am using the docker toolbox.

Standalone: bridge network not found?

Seems like the bridge network for standalone version is not working.

$ docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:21:31 2018
 OS/Arch:           darwin/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:29:02 2018
  OS/Arch:          linux/amd64
  Experimental:     true



$ docker-compose version
docker-compose version 1.22.0, build f46880f
docker-py version: 3.4.1
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2o  27 Mar 2018



$ cat docker-compose-standalone.yml
version: '2'
services:
  geth:
    image: ethereum/client-go
    command: --datadir=/root/.ethereum/devchain --nodekeyhex=091bd6067cb4612df85d9c1ff85cc47f259ced4d4cd99816b14f35650f59c322 --rpcapi "db,personal,eth,net,web3" --rpccorsdomain='*' --networkid=1234 --rpc --rpcaddr="0.0.0.0" init=/root/files/genesis.json --mine
    volumes:
      - ./files/password:/root/files/password:ro
      - ./files/genesis.json:/root/files/genesis.json:ro
      - ./files/keystore:/root/.ethereum/devchain/keystore:rw
    ports:
      - "30303:30303"
      - "30303:30303/udp"
      - "8545:8545"



$ docker-compose -f docker-compose-standalone.yml up
Starting ethereum-docker_geth_1 ... error

ERROR: for ethereum-docker_geth_1  Cannot start service geth: b'network db00b6e6970542f8ad5006caa9a70cca3eeb306169a737a5ca9737d82c4df5dd not found'

ERROR: for geth  Cannot start service geth: b'network db00b6e6970542f8ad5006caa9a70cca3eeb306169a737a5ca9737d82c4df5dd not found'
ERROR: Encountered errors while bringing up the project.

Can someone help me?

Thanks.

Bootstrap node does not work (regular nodes only see bootstrap node)

Problem:
Bootstrap node can see all the nodes in the private network (peers=number of nodes), but each regular node only can see bootstrap node (peers=1).

So, if we have 2 nodes (eth1 and eth2) and a bootstrap node (bootstrap), what we will have is:
peers of eth1 = 1
peers of eth2 = 1
peers of bootstrap = 2

Bootstrap node does not have to help regular nodes with discovery protocol?
How can I fix this situation? Maybe is a problem of docker communication? (ip adrresses seem right)
The only possible solution I found is add peers statically, manually.

Thanks in advance

Can`t start websockets

Ive tried to start websocket connection by adding that to command --datadir=~/.ethereum/devchain --nodekeyhex=091bd6067cb4612df85d9c1ff85cc47f259ced4d4cd99816b14f35650f59c322 --rpcapi "db,personal,eth,net,web3" --rpccorsdomain="*" --networkid=456719 --rpc --rpcaddr="0.0.0.0" --ws --ws.origins "*" --ws.addr 0.0.0.0 --ws.port 8546 --ws.api "personal,web3,eth,net,db" --allow-insecure-unlock --unlock 0 --password /root/files/passwords/password.txt in docker-compose.yml and added port mapping 8546:8546, but cant start websocket connection on that port

Add ability to start/stop mining in the cluster easily

In order to start mining you have to -

  • connect to a container
  • attach to the running geth consul
  • execute miner.start(1) - where 1 is the number of threads

We should be able wrap this all up into a single command that does it via docker exec

Mount denied - Path /etc/localtime is not shared from OS X and is not known to Docker

MAC OS version - Sierra 10.12.6 (16G1408)
Docker version - 18.03.0-ce, build 0520e24

Reproduce this error as

$ docker-compose up -d
Starting c1b9c5a1c9d4_netstats ... error

ERROR: for c1b9c5a1c9d4_netstats  Cannot start service netstats: b'Mounts denied: \r\nThe path /etc/localtime\r\nis not shared from OS X and is not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'

ERROR: for netstats  Cannot start service netstats: b'Mounts denied: \r\nThe path /etc/localtime\r\nis not shared from OS X and is not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'
ERROR: Encountered errors while bringing up the project.

Database compacting

Trying to save docker tar file from the blockchain commited image, it takes over an hour to be saved! (>docker logs container_id: Database compacting, degraded performance database=/root/.ethereum/geth/chaindata.)

Error when trying to connect to the Javascript console on the standalone stack

Hello,

Following the tutorial here https://capgemini.github.io/blockchain/ethereum-docker-compose/

Just after starting the standalone compose, I encountered an error when trying to do: docker exec -it bootstrap geth --datadir=~/.ethereum/devchain attach

Fatal: Unable to attach to remote geth: dial unix /root/.ethereum/geth.ipc: connect: no such file or directory

I tried to add the --ipcpath option with /root/.ethereum/devchain/geth.ipc with no success.

To make it works I had to manually create a symbolic link inside the container:
ln -s /root/.ethereum/devchain/geth.ipc /root/.ethereum/geth.ipc

PS: docker exec -it ethereumdocker_eth_1 geth attach ipc://root/.ethereum/devchain/geth.ipc in the README works.

bignumber.js.git - not accessible

# wget https://github.com/debris/bignumber.js
https://github.com/debris/bignumber.js
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-06-24 20:52:17 ERROR 404: Not Found.
Step 3/7 : RUN cd /root &&    git clone https://github.com/cubedro/eth-net-intelligence-api &&    cd eth-net-intelligence-api &&    npm install &&    npm install -g pm2
 ---> Running in dda962a3c7b8
Cloning into 'eth-net-intelligence-api'...
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/debris/bignumber.js.git /root/.npm/_git-remotes/git-https-github-com-debris-bignumber-js-git-master-df3f1ce1: Cloning into bare repository '/root/.npm/_git-remotes/git-https-github-com-debris-bignumber-js-git-master-df3f1ce1'...
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/debris/bignumber.js.git /root/.npm/_git-remotes/git-https-github-com-debris-bignumber-js-git-master-df3f1ce1: remote: Invalid username or password.
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/debris/bignumber.js.git /root/.npm/_git-remotes/git-https-github-com-debris-bignumber-js-git-master-df3f1ce1: fatal: Authentication failed for 'https://github.com/debris/bignumber.js.git/'
npm ERR! Linux 4.4.0-79-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code 128

npm ERR! Command failed: git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/debris/bignumber.js.git /root/.npm/_git-remotes/git-https-github-com-debris-bignumber-js-git-master-df3f1ce1
npm ERR! Cloning into bare repository '/root/.npm/_git-remotes/git-https-github-com-debris-bignumber-js-git-master-df3f1ce1'...
npm ERR! remote: Invalid username or password.
npm ERR! fatal: Authentication failed for 'https://github.com/debris/bignumber.js.git/'
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /root/eth-net-intelligence-api/npm-debug.log
ERROR: Service 'bootstrap' failed to build: The command '/bin/sh -c cd /root &&    git clone https://github.com/cubedro/eth-net-intelligence-api &&    cd eth-net-intelligence-api && 

While deploying the docker-compose there are errors on the primus module as strict & const seem not compatible...

I just launched the docker compose to run a cluster, and launching the eth-netstats is broken.
JMarc
/eth-netstats/node_modules/primus/index.js:177
const sandbox = Object.keys(global).reduce((acc, key) => {
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/eth-netstats/app.js:44:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)

npm ERR! Linux 3.13.0-52-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.17
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./bin/www'.
npm ERR! This is most likely a problem with the eth-netstats package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can g

Add support for running arbritary scripts against the nodes

For example (the below script) -

i = 0;
while (i < eth.accounts.length) {
  account = eth.accounts[i];
  balance = web3.fromWei(eth.getBalance(account), "ether");
  console.log("Account: " + account);
  console.log("Balance: " + balance + '\n');
  i++;
}

Can be run like -

docker exec -it bootstrap geth --datadir=~/.ethereum/devchain --jspath "/tmp/scripts" --exec 'loadScript("getAccountBalances.js")' attach

Should wrap this up to make it a bit easier to consume and less convoluted

Not able to start up a single Ethereum node

This is my response after running (somehow I cannot use docker-compose without sudo):

$ sudo docker-compose -f docker-compose-standalone.yml up -d

response:

erik@Erik-Ubuntu:~/Development/ethereum-docker$ sudo docker-compose -f docker-compose-standalone.yml up -d
Creating network "ethereumdocker_default" with the default driver
Starting ethereumdocker_geth_1

But I'm not able to start the web interface by executing:

xdg-open http://$(docker-machine ip default):8545

First I had to install docker-machine (which wasn't installed on my Ubuntu machine along with the toolbox). After installing docker-machine I had to create a machine, so I did and called it default. Still Google Chrome returns a "This site can’t be reached" page. Even on port 3000

It seems like it does not run docker-compose on the default docker-machine and I cannot figure out how to. What does work, is starting a complete cluster on localhost by executing sudo docker-compose up. But I would like to run the standalone version...

How to send contracts to the node?

I can't find any instructions to deploy contracts to the docker-node. Is there a way to do so using truffle-contract or any other method ?

Mining ethers

I grabbed and run 3 nodes. In one node I have created an account and run miner.start(). After some blocks found, I checked the balance. It is zero.
I cannot transfer ethers from pre-allocated accounts because I have no passwords for them. How can I put some ethers to an account in order to play around?
Sorry for stupid questions.

Test accounts passwordless?

Metamask needs password to import an account along with the private key/json
However, it looks like the test accounts with 20 ether all have no password set.
So how do we go about that?

Basically, those accounts are rendered useless from Metamask standpoint.

loadScript failing

Successfully spin up Docker cluster using docker-compose command.
Connected to the bootstrap docker image.
However, when trying to load a script in order to execute a transaction I am getting following response

> loadScript("/Users/bapatch/eth/ethereum-docker/balance.js")
false

Despite being the fully qualified path for the javascript file, it still isn't being loaded.

Can't start multi-node

Error with multi-node docker:
standard_init_linux.go:195: exec user process caused "exec format error"
with the error message:
ERROR: Service 'bootstrap' failed to build: The command '/bin/sh -c apk add --update git bash nodejs nodejs-npm perl' returned a non-zero code: 1

Standalone fails to start in Ubuntu

Standalone fails to start in Ubuntu with following error
"Incorrect Usage. flag provided but not defined: -ipcapi"
--ipcapi is not showing as an option under CLI "API AND CONSOLE OPTIONS"

account unlock with HTTP access is forbidden

I try to use web3j to unlock the account and it returns the error
'account unlock with HTTP access is forbidden'
the same in Geth ...

docker-compose up -d
docker exec -it bootstrap geth --datadir=~/.ethereum/devchain attach

what's wrong?

Issue starting service bootstrap

Hey, love what you're doing here, but I'm having an issue with the bootstrap service... Logs below:

$ docker-compose up -d
WARNING: Found orphan containers (ethereumdocker_geth_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
netstats is up-to-date
Starting bootstrap

ERROR: for bootstrap  Cannot start service bootstrap: driver failed programming external connectivity on endpoint bootstrap (533de706220b8c5b4da165813efa9acdaed5aafc11ddc610e67d41e94894e4bf): Bind for 0.0.0.0:30303 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.

Any help/suggestions here would be greatly appreciated!!

How to unlock accounts placed in the keystore?

I've tried to log in via account placed in the key store and realized that i don't know the password. Then I've tried to seek password in the repository but unsuccessfully.

Could you add the password for the accounts in the keystore into readme file?

Standalone fails to start on CENTOS 7

Below is the error once I pass the command

**[osboxes@osboxes ethereum-docker]$ docker-compose -f docker-compose-standalone.yml up -d

Service "version" doesn't have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.**

"apt-get: not found" during Building bootstrap

Hello, really interested in this project - was trying to get the following to work:

$ docker-compose up -d

but I get this:

Creating netstats
Building bootstrap
Step 1 : FROM ethereum/client-go
---> 4b290a5d5747
Step 2 : RUN apt-get update && apt-get install -y curl git-core && curl -sL https://deb.nodesource.com/setup_4.x | bash - && apt-get update && apt-get install -y nodejs
---> Running in 839ec68e0b63
←[91m/bin/sh: apt-get: not found
←[0m←[31mERROR←[0m: Service 'bootstrap' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y curl git-core && curl -sL https://deb.nodesource.com/setup_4.x | bash - &&
apt-get update && apt-get install -y nodejs' returned a non-zero code: 127

please help!

Password is missing

I'm looking for the password of those 10 provided accounts. How can I find them?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.