Click here to Skip to main content
13,803,579 members
Click here to Skip to main content
Add your own
alternative version

Stats

7.9K views
121 downloads
17 bookmarked
Posted 6 Jun 2018
Licenced CPOL

Setting up Ethereum Blockchain on Azure

, 6 Jun 2018
Rate this:
Please Sign up or sign in to vote.
Step by step setting up of Ethereum Blockchain on Microsoft Azure

Introduction

This article will focus on setting up a custom Ethereum Blockchain on Azure. The article will be less of theory and will focus more on the practical implementation of step by step setting up the Ethereum blockchain on Azure and transferring some Ethers between accounts using MetaMask. The article is for the readers who are more into development and have the background of Blockchain, Ethereum, and Ether. We’ll cover theory in the next article of understanding Ethereum and Blockchain.

Blockchain

The following is the description from MSDN blogs:

"At the most basic level of understanding, blockchains are a simple approach to a distributed database. A blockchain is a peer-to-peer system with no central authority managing data flow. One of the key ways to removing central control while maintaining data integrity is to have a large distributed network of independent users. You can think of blockchains as distributed databases that a group of individuals controls and that store and share information. The most popular form of a blockchain implementation out there is BitCoin which is a cryptocurrency.

A blockchain is a data structure that makes it possible to create a digital ledger of data and share it among a network of independent parties. There are three main categories of blockchains: Public, Private and Permission. Each type uses cryptography to allow each participant on any given network to manage the ledger in a secure way without the need for a central authority to enforce the rules. The removal of central authority from database structure is one of the most important and powerful aspects of blockchains."

Ethereum

Ethereum is one of the largest and widely used blockchains based on the proposal from Vitalic Buterin in 2013. Ethereum was publicly made available in 2015. Ethereum is very easy to use with private blockchains and is an open source. Ethereum is not just limited to being a platform, but also serves as a programming language that runs on the blockchain, therefore helps to build and publish distributed applications on the blockchain. Ethereum has a benefit of having very fast transaction times as compared to Bitcoin. For Bitcoins, transaction times are commonly in minutes but using Ethereum, it could be made in seconds. So Ethereum could be used for the applications where a fast response is needed.

Ether

Ether is the cryptocurrency that Ethereum has and is very similar to Bitcoins. It could be used like any other cryptocurrency and serves as a base for transactions in Ethereum. It is traded under the ETH symbol. Ether is very volatile currency and worth considering for investment (that’s my opinion). Ether has around 12 denominations. The smallest denomination is WEI and 1 ETH is 1 quintillion WEI. Finney is also often used and 1 ETH is 1000 Finney. Another one is Szabo, and 1 ETH is 1 million Szabo. Denominations like Kether, Mether, Gether are used when denominations are larger. Kether is 1000 ETH i.e. kilo. Similarly, M is for mega and G is for Giga.

Azure

This article will focus on working with Ethereum on the Microsoft Azure platform. Azure is a cloud platform from Microsoft and could be used for other beneficial purposes as well. We’ll use consortium from Azure. A consortium in Ethereum’s context means a collaboration between supporting members of a blockchain with the underlying infrastructure. Consortium helps us configure the blockchain and its controlling parts on Azure. We create a Genesis block and a default account with initial Ether allocations. Setting up consortium here would be a private blockchain and would not be part of public Ethereum blockchain that means Ethers from private blockchain could not be transferred or exchanged directly with Ether from public blockchains. Azure helps us to set up the baseline blockchain infrastructure by providing the templates. We’ll first set up a blockchain consortium on Azure and Azure will create a genesis block for us.

Azure Account Setup

If one does not have a paid Azure account, one could leverage Azure’s new account’s benefits of giving $200 credits. That means if you are new to Azure and want to play around with its free trial, you’ll get $200 credits that you can use to explore Azure. If you are new to Azure and do not have an account, follow the process below, else directly login to your portal.

  1. Open the Azure web site, i.e., azure.moicrosoft.com

  2. Click on Start free to create your free Azure account and get $200 as credits.

Creating an account and claiming $200 would need your credit/debit card for verification purposes only and will not deduct any amount from your card. You can play around with this credit and account for 30 days. You’ll see the signup page, where you fill all your information and signup step by step. Once signed-up successfully, you’ll see the link to the portal as shown below:

Click on the portal and you land up on the dashboard and are ready to use/play around with Azure.

Ethereum Account Setup on Azure

Once on the dashboard, click on the big + button, i.e., create a resource to create a new resource. In the search box, type and enter Ethereum to get all the Ethereum related templates that we would need.

From the list of templates, select Ethereum Proof-of-Work Consortium. It is not certain that you see the exact templates as shown in this article. Since the development is always on for Azure, you may see different names of templates or different templates altogether when you are following this implementation.

Once clicked on Ethereum Proof-of-Work Consortium, leave the deployment model as it is and press on Create button as shown in the following image:

Once you click on create, you’ll see the page where you need to fill certain details. Following are the step by step creation guidelines:

  1. For Step 1, i.e., Basics, provide the Resource prefix to keep the consortium items segregated from other existing resources on your Azure portal. For example, I have given it a name "eth", you can have your own or else can use this as well.

    Provide the VM username of your choice as shown in above image. I have used,athadmin though I wanted to use ethadmin but it was a typo from me to use athadmin that hardly matters as we are developing to learn.

    You can choose to have Authentication type as Password or SSH public key. For now, I am using Password, make sure you remember the password that you provide here. You can choose to have "Free Trial" as Subscription or your paid account if you have one. Create a resource group, by providing a name so that all your resources in the context of this consortium lie in this resource group. All the items in the resource group share the same permissions, policies and life cycle. I have provided the name "etherium-blockchain" as resource group (again mistakenly misspelled Ethereum). Last, choose a location close to where your application will run. I have chosen "Central India". Click OK.

  2. Choose Deployment regions in the second step, I have chosen 1 in the number of regions and "Central India" as the region for it.

  3. The third step is to choose network size and performance factors. Leave the mining nodes to the default value, i.e.,2 I chose mining node virtual machine size as 2X Standard D1 v2, i.e., the minimum one and may vary while working on large applications. Choice of virtual machine size and transaction node virtual machine size id directly proportional to size and performance. Transaction nodes could be left to 1 as shown in the following image. I choose the transaction node virtual machine size as the default one, i.e., 1X Standard D1 v2.

  4. Step 4 is Ethereum related settings and are very important. Provide the Consortium Id as 0 and leave network id as it is to what is already selected. The network id serves as the name of the Ethereum network that we will set up. It means the only the nodes that have same network id can pair with each other. You can provide the custom genesis block here, it would be useful if you want to use the existing account for the settings but for now, we stick to default and proceed to provide Ethereum account password. Provide the password, confirm it and save it somewhere so that you remember. You need to provide the passphrase to generate the private key. Provide the passphrase of your choice and confirm that as well as you have done for Passwords.

  5. In step 5, choose OMS Workspace location as per your nearest location. I choose Central India here.

  6. In the sixth step, you’ll see the summary of what we chose and selected. Review everything and Click OK to go to purchase section.

  7. Step 7 is Buy option section, where you read all the terms and conditions before you make a purchase and then click Create.

  8. After you click Create, it will take some time to setup and create the resources. It says something like Submitting deployment for Ethereum…. Wait for a while and it would be fine.

Once deployment is done, you can navigate to Resource groups as shown in the below image and choose your newly created resource with the resource group name you provided.

Clicking on the resource group will land you to all the resource created for the consortium as shown in the below image. Now click on "Deployments" in the left sidebar to see all the deployments made.

You’ll be redirected to the section where you’ll see all the deployments made.

Select the first link that is an Azure multi-member to find all the information about the newly created blockchain.

You’ll get to see the page for sections like Overview, Outputs, Inputs, and Template as shown below:

Choose Outputs, and you’ll get all the information you need in order to connect to the chain. Copy the address of ADMIN-SITE and open the same in the browser as shown below:

The admin site would be opened in the browser and would look like below. At this page, you see the information about blockchain. Azure has created a genesis block for us with the default account showing as "My Account Address" on the page. We see that we also have some Ether balance in our account to get started with our blockchain.

Our half of the job is done and we have successfully set up an account on Azure for Ethereum blockchain.

Setup Second Account with MetaMask

In order to setup second account to transfer some Ether to it, copy the ETHEREUM-RPC-ENDPOINT address as shown below from the same location where we copied the ADMIN-SITE address on Azure.

  1. Now go to Chrome extensions and search for MetaMask in Chrome web store. It is an extension to Chrome, so it can be easily added to Chrome. MetaMask is the good wallet application for development and testing purposes.

  2. Once added to Chrome, you’ll see the MetaMask icon in the upper right corner of chrome browser. This indicates that MetaMask is added to Chrome. Click on that icon and click on Accept button after reading the terms and conditions.

  3. After you click on "Accept", you’ll be redirected to create an account with MetaMask. Provide the password as shown in the below image and click on "CREATE".

    After creating the password, you’ll be shown a unique account image that you’ll see each time you make a transaction.

  4. Click "NEXT".

  5. On the next page, you’ll see the terms and conditions. Read those carefully and click "ACCEPT" if you wish to proceed as shown in the following image.

  6. After you accept the terms and conditions, you’ll be shown the secret backup phrase as shown in the following image used for restoring and backing up your account. Better to save these codes somewhere safe where only you can access. Click on "CLICK HERE TO REVEAL SECRET WORDS " to get the phrase.

  7. On the next page, you need to verify your phrase. So, select the words in the same order as the phrase was initially on that page.

  8. Choose a test network of your choice as shown in the following image:

  9. Now, in the settings below, paste the RPC URL that we copied from the Azure portal in the "New RPC URL" text box.

  10. Return to chrome MetaMask extension and we see our newly created account here now as shown below. Copy the account address as shown in the following image:

  11. Go to the admin page we opened in another tab and paste the copied address of MetaMask Account 1 in the "Address of Recipients" box as shown below:

  12. Add some Ether amount to be sent to recipient for e.g., 1000 and click on submit.

Once submitted, you’ll see the message Ether Sent!

But were they sent? We can quickly check this by again going back to our Chrome extension and click on Fox icon. Congratulations, we see the 1000 ETH transferred to this account now.

Hence, we successfully transferred Ethers from one account to another using our Azure Blockchain Consortium. We can now develop smart contracts for our Blockchain. I’ll cover Smart Contracts and other related topics in my upcoming articles.

Conclusion

In this article, we learned how to set up an Ethereum Blockchain on Azure and use MetaMask to test our blockchain by transferring some Ethers to another account. In my next article, I’ll focus on Smart Contracts and how-to setup development environment for writing smart contracts.

Here is a list of articles that will help you getting good insights about Azure, Blockchain, Ethereum and Smart Contracts development using Solidity.

1. Creating Virtual Machine (VM) on Microsoft Azure[^]
2. Setting up Ethereum Blockchain on Azure[^
3. Blockchain Development (Part 1): Development Environment Setup for Smart Contracts[^
4. Blockchain Development (Part 2): Programming Smart Contracts using Solidity, Truffle and Test-RPC[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Akhil Mittal
Architect Magic Software Inc.
India India
Akhil Mittal is a Microsoft MVP(Most Valuable Professional), C# Corner MVP, Codeproject MVP, a blogger, author and likes to write/read technical articles. Akhil has an experience of around 11 years in developing, designing, architecting enterprises level applications primarily in Microsoft Technologies. Akhil enjoys working on technologies like MVC, Web API, Entity Framework, Angular, C# and BlockChain. Akhil is an MCP( Microsoft Certified Professional) in Web Applications (MCTS-70-528, MCTS-70-515) and .Net Framework 2.0 (MCTS-70-536). Visit Akhil Mittal’s personal blog CodeTeddy (https://codeteddy.com) for some good and informative articles.
Group type: Collaborative Group

704 members


You may also be interested in...

Comments and Discussions

 
QuestionVery very nice. Thanks (-) Pin
Michael Breeden8-Jun-18 8:06
memberMichael Breeden8-Jun-18 8:06 
GeneralRe: Very very nice. Thanks (-) Pin
Akhil Mittal 8-Jun-18 9:01
mvp Akhil Mittal 8-Jun-18 9:01 
PraiseMy vote of 5 Pin
Vikas Sharma6-Jun-18 16:55
professionalVikas Sharma6-Jun-18 16:55 
GeneralRe: My vote of 5 Pin
Akhil Mittal 7-Jun-18 3:16
mvp Akhil Mittal 7-Jun-18 3:16 
GeneralMy vote of 5 Pin
prashita gupta6-Jun-18 11:10
memberprashita gupta6-Jun-18 11:10 
GeneralRe: My vote of 5 Pin
Akhil Mittal 7-Jun-18 3:14
mvp Akhil Mittal 7-Jun-18 3:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.181215.1 | Last Updated 6 Jun 2018
Article Copyright 2018 by Akhil Mittal
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid