Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bennotti/2b289b5d57cd9bedfa0d9221e5e44d4a to your computer and use it in GitHub Desktop.
Save bennotti/2b289b5d57cd9bedfa0d9221e5e44d4a to your computer and use it in GitHub Desktop.

Revisions

  1. nhapentor revised this gist May 13, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion genesis.json
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,6 @@
    "ethash": {}
    },
    "difficulty": "1",
    "gasLimit": "8000000",
    "gasLimit": "12000000",
    "alloc": {}
    }
  2. nhapentor revised this gist May 13, 2021. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,9 @@ services:
    --nodiscover
    --ipcdisable
    --networkid=${NETWORK_ID}
    --netrestrict="172.25.0.0/24"
    --netrestrict="172.16.254.0/28"
    networks:
    chainnet:
    priv-eth-net:

    geth-rpc-endpoint:
    hostname: geth-rpc-endpoint
    @@ -34,11 +34,11 @@ services:
    --http.api="eth,web3,net,admin,personal"
    --http.corsdomain="*"
    --networkid=${NETWORK_ID}
    --netrestrict="172.25.0.0/24"
    --netrestrict="172.16.254.0/28"
    ports:
    - "8545:8545"
    networks:
    chainnet:
    priv-eth-net:

    geth-miner:
    hostname: geth-miner
    @@ -52,13 +52,13 @@ services:
    --mine
    --miner.threads=1
    --networkid=${NETWORK_ID}
    --netrestrict="172.25.0.0/24"
    --netrestrict="172.16.254.0/28"
    networks:
    chainnet:
    priv-eth-net:

    networks:
    chainnet:
    priv-eth-net:
    driver: bridge
    ipam:
    config:
    - subnet: 172.25.0.0/24
    - subnet: 172.16.254.0/28
  3. nhapentor revised this gist May 13, 2021. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion .env
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # The ID of Ethereum Network
    NETWORK_ID=1212
    NETWORK_ID=1214

    # The password to create and access the primary account
    ACCOUNT_PASSWORD=5uper53cr3t
    2 changes: 1 addition & 1 deletion genesis.json
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    {
    "config": {
    "chainId": 1212,
    "chainId": 1214,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
  4. nhapentor renamed this gist Apr 13, 2021. 1 changed file with 0 additions and 0 deletions.
  5. nhapentor renamed this gist Apr 13, 2021. 1 changed file with 0 additions and 0 deletions.
  6. nhapentor revised this gist Apr 13, 2021. 4 changed files with 98 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions .env
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    # The ID of Ethereum Network
    NETWORK_ID=1212

    # The password to create and access the primary account
    ACCOUNT_PASSWORD=5uper53cr3t
    13 changes: 13 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    FROM ethereum/client-go:v1.10.1

    ARG ACCOUNT_PASSWORD

    COPY genesis.json /tmp

    RUN geth init /tmp/genesis.json \
    && rm -f ~/.ethereum/geth/nodekey \
    && echo ${ACCOUNT_PASSWORD} > /tmp/password \
    && geth account new --password /tmp/password \
    && rm -f /tmp/password

    ENTRYPOINT ["geth"]
    64 changes: 64 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    version: '3.7'

    services:
    geth-bootnode:
    hostname: geth-bootnode
    env_file:
    - .env
    image: geth-client
    build:
    context: .
    args:
    - ACCOUNT_PASSWORD=${ACCOUNT_PASSWORD}
    command:
    --nodekeyhex="b0ac22adcad37213c7c565810a50f1772291e7b0ce53fb73e7ec2a3c75bc13b5"
    --nodiscover
    --ipcdisable
    --networkid=${NETWORK_ID}
    --netrestrict="172.25.0.0/24"
    networks:
    chainnet:

    geth-rpc-endpoint:
    hostname: geth-rpc-endpoint
    env_file:
    - .env
    image: geth-client
    depends_on:
    - geth-bootnode
    command:
    --bootnodes="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@geth-bootnode:30303"
    --allow-insecure-unlock
    --http
    --http.addr="0.0.0.0"
    --http.api="eth,web3,net,admin,personal"
    --http.corsdomain="*"
    --networkid=${NETWORK_ID}
    --netrestrict="172.25.0.0/24"
    ports:
    - "8545:8545"
    networks:
    chainnet:

    geth-miner:
    hostname: geth-miner
    env_file:
    - .env
    image: geth-client
    depends_on:
    - geth-bootnode
    command:
    --bootnodes="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@geth-bootnode:30303"
    --mine
    --miner.threads=1
    --networkid=${NETWORK_ID}
    --netrestrict="172.25.0.0/24"
    networks:
    chainnet:

    networks:
    chainnet:
    driver: bridge
    ipam:
    config:
    - subnet: 172.25.0.0/24
    16 changes: 16 additions & 0 deletions genesis.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    {
    "config": {
    "chainId": 1212,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "ethash": {}
    },
    "difficulty": "1",
    "gasLimit": "8000000",
    "alloc": {}
    }
  7. nhapentor created this gist Apr 13, 2021.
    7 changes: 7 additions & 0 deletions Running a Private Ethereum Blockchain using Docker.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Running a Private Ethereum Blockchain using Docker
    --------------------
    Put genesis.json, Dockerfile, docker-compose.yml and .env files together in the same folder. Then run the command.

    ```
    docker-compose up
    ```