Part 1: Ethereum Blockchain on IBM Cloud :- Deploying Private Ethereum Blockchain on IBM Cloud Containers

Saif Rehman
Coinmonks
Published in
4 min readJan 13, 2018

--

What is IBM Cloud ?

IBM Cloud is a cloud platform developed by IBM which is based on Cloud Foundry and runs of SoftLayer Infrastructure. It supports various programming languages, Databases, Services, as well as integrated DevOps to build, run, deploy and manage applications on the cloud using IBM Container service.

Prerequisites

Signup for IBM Cloud free trial

https://console.bluemix.net/registration/

Install IBM Cloud cli

https://console.bluemix.net/docs/cli/reference/bluemix_cli/get_started.html

Install Dockers

https://docs.docker.com/engine/installation/

Install and Setup Kubectl

https://kubernetes.io/docs/tasks/tools/install-kubectl/

Build your Docker Image

Clone my Git repository

> git clone https://github.com/SaifRehman/IBMCLOUD-Ethereum-Blockchain.git
> cd IBMCLOUD-Ethereum-Blockchain/

Build the Image from the Dockerfile

> docker build -t myimage .
Will take some time to build the image :)

Check if you have the image in your system

> docker images

Login to IBM Cloud & Create a new Container

https://console.bluemix.net

IBM Cloud

Create a lite container on IBM Cloud by choosing container service. Do not forget to give your container a name :) Let’s name it “ether”

Create a lite container for free. Wait for for some time it will take some time to deploy
After deploying you will see something like this

Setup your Container

Do not follow along these steps unless your container is fully deployed!

Install container-service bx plugin

> bx plugin install container-service -r Bluemix

Log in to your IBM Cloud account.

> bx login -a https://api.ng.bluemix.net

Set your terminal context to your cluster

> bx cs cluster-config ether
You will see something like this, and configuration will be automatically downloaded

Export environment variables to start using Kubernetes by copy pasting the resulting yellow line of code

> export KUBECONFIG=/Users/saifrehman/.bluemix/plugins/container-service/clusters/ether/kube-config-dal10-ether.yml

Push the image from your machine to IBM Cloud Private Registery

Tag an image to point to this registry. Choose a local image, target namespace, and target repository.

Install the Container Registry plug-in.

> bx plugin install container-registry -r Bluemix

Choose a name for your first namespace, and create that namespace. Use this namespace for the rest of the Quick Start.

bx cr namespace-add <my_namespace>

> bx cr namespace-add etherprivate

Log your local Docker daemon into the IBM Cloud Container Registry.

> bx cr login

docker tag <local_image> registry.ng.bluemix.net/<my_namespaces>/<my_repo>

> docker tag myimage registry.ng.bluemix.net/etherprivate/myimage

docker push registry.ng.bluemix.net/<my_namespace>/<my_repo>

> docker push registry.ng.bluemix.net/etherprivate/myimage
This will push the image to IBM Cloud Private image registry. This will take some time :)

Deploy your Image to Kubernetes Cluster on IBM Cloud

Setup your service.deployment.yml file

Configure your Kubernetes Cluster

Deploy :)

> kubectl create -f service-deployment.yml
You can now access your application through the public IP

Test if you can access

curl http://169.47.252.115:30090

Don’t worry if you do not seen any output, it will not return you anything :)

Access your Private Ethereum Blockchain running on IBM Container

> geth attach http://169.47.252.115:30090
Cooool. You now have a ethereum blockchain spinning on IBM Cloud

Let’s start mining Ether!

Create and unlock your new account to start mining

> personal.newAccount('password')
> personal.unlockAccount(web3.eth.coinbase, "password", 15000)

Start mining to get enough ether for us to deploy smart contract in our next tutorial :-)

> miner.start()

Check your Ether Balance

> web3.fromWei(eth.getBalance(eth.coinbase), "ether")

Stop mining

> miner.stop()

Congratulation you have successfully setup your Private Ethereum Blockchain on IBM Cloud!

Read more:

  1. Follow me for more: https://www.engineerability.com

Get Best Software Deals Directly In Your Inbox

Next

Working with solidity to deploy your first ethereum smart contract on IBM Cloud and creating Dapp front-end on Angular 4

Click to know more about ethereum

--

--

Coinmonks
Coinmonks

Published in Coinmonks

Coinmonks is a non-profit Crypto Educational Publication. Other Project — https://coincodecap.com/ & Email — gaurav@coincodecap.com

Saif Rehman
Saif Rehman

Responses (3)