Part 1: Ethereum Blockchain on IBM Cloud :- Deploying Private Ethereum Blockchain on IBM Cloud Containers
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
Install and Setup 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 .
Check if you have the image in your system
> docker images
Login to IBM Cloud & Create a new Container
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”
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
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
Deploy your Image to Kubernetes Cluster on IBM Cloud
Setup your service.deployment.yml file
Deploy :)
> kubectl create -f service-deployment.yml
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
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:
- Follow me for more: https://www.engineerability.com
Next
Working with solidity to deploy your first ethereum smart contract on IBM Cloud and creating Dapp front-end on Angular 4