Welcome again!, in this scenario we are going to configure an Ethereum Blockchain network, this is an introductory publication about how to build a Decentralized Application (DApp).

What is DApp?

DApp is an abbreviated form for decentralized application. When we talk about DApp backend means the code can be running on decentralized peer-to-peer network, by other hand, in traditionals scenarios we have running the backend in centralized servers.

Okay now I understand what is DApp but… what does this have to do with blockchain?, first of all explain me what is blockchain and why should I care in descentralized applications?

Easily, Blockchain it’s a record keeping system also called ledger, that has two main goals: can be used to record the transfer of “tokens” or “coins” representing wealth such like public blockchains: Ethereum, Bitcoin, Monero or in some business scenarios can record the transactions of importance, with no monetary value.

Awesome, but where can I start if I want to build DApps?

There are a multiple choices to start building your own DApps, but the most common Blockchain ledgers are: Ethereum, Hyperledger and Corda.

So I can develop DApps using Blockchain, but how I save data in the blockchain?

Such as we mentioned before we are going to explore how to create and customize the Ethereum Blockchain project on a couple of VMs using Azure, once we have configured the blockchain we will proceed to write the ‘Smart-Contract’, hold-on, what is that? Smart contracts are available objects in some block chains (such as Ethereum), they allow agreements between the parties to be reduced to code, variables and properties, which can be published in a chain of blocks, promising for multi-party contracts and processes.

** If you still have doubts about how blockchain works I suggest you take 6 mins to watch this video.

C’mon I want to start building something! Okay, let’s start…

In the following tutorial we are going to learn how to:

  • Configure and deploy an Ethereum Proo-of-Work Consortium network.
  • Configure and attach a new VM (node) in the same ETH network.
  • Configure an Open Source Ethereum explorer.

In this scenario we are going to create an Ethereum Proof-of-Work Consortium network on Azure, we can create from scratch the configuration configuring the VM with the genesis node, but we can take advantage of Azure capabilities to start building powerful DApps with the Ethereum Proof-of-Work Consortium ARM Template, this is the fastest way to deploy an Ethereum network on Azure.

Go to Azure portal and create an Ethereum Proof-of-Work Consortium resource.

Step 1

In the first step you need to configure, if your network will be new or will be part of an existing one, in this case will be new.

Next, we need to configure if will be standalone or will be part of a consortium, in this scenario we selected standalone.

Every resource created must have a prefix, you can set a prefix name e.g. dapp.

VMs must have a username and password or ssh authentication, configure it as you prefer.

Remember everytime we create a solution in Azure is a good practice grouping all the resources with the same resource group, in this scenario I will be using the resource group: mobiledapp to allocate whole the resources we are going to use.

As usual, select a location near to you, e.g. South Central US.

Step 2

Now, you can configure the regions you want your DApp will be deployed. In this scenario we are going to have only one pointing to South Central US.

Step 3

Now, you can configure the network size and the performance, in resume, I’m creating 2 nodes for mining and 1 node for transations, this scenario is the basic one, you can follow the image. In case your network requires more processing power, you will need to increase the performance capabilities from Standard to Premium.

Step 4

Now it’s time to configure the Ethereum network.

The Consortium Member Id is a unique identifier per member participant, we can selected a number between 0 - 255.

The Network Id is relevant because is the identifier used to link all nodes on Ethereum, only the nodes that has the same network id will be able to share information.

In addition, Ethereum account and private key password are required, remember keep safe all the passwords used in this wizard.

**If you see there is an Advanced option “Custom Genesis Block”, at this moment we are not going to create a custom block, but later we are going to review what is inside this file.

Step 5

At this moment we are not going to configure the Operations and Monitoring Suite, so we can proceed to disable it.

Step 6

Let’s review all the configurations we created to proceed the resources creation.

Step 7

To finish the wizard proceed accepting terms of use and privacy policy.

Once you have submitted the creation request, your account will be creating all the required resources to use. There are some relevant notes here:

  • Remember all resources are created inside your resource group as we configured in the wizard e.g. mobiledapp.
  • There are 8 resources created in this template:
    • Public IP address
    • Network security group
    • Azure Cosmos DB account
    • Load balancer
    • Network security group
    • Virtual network
    • Virtual machine scale set (mining)
    • Virtual machine scale set (transactions)

This is the list of the resources created:

To get access to the list of endpoints exposed in Azure you need to go to the resource group, then click in deployments, select ‘microsoft-azure-blockchain.azure-blockchain-ether-XXXXXXXXX’ and then click in outputs:

Awesome! you have now setup your Ethereum network in Azure

You can get access to the admin site using the exposed endpoint:

Now you have an Ethereum account (f1cfdc32ab8c02d3f2cb6196bb729e475201d1b3) automatically configured with a lot of Ether (Ether is the ‘money’ we are going to use to pay the transactions over the blockchain), you can create as many Ether accounts you want and fill them with the Ether you like in a private or consortium network.

All VMs created here have been preconfigured by the Azure ARM Template, but what happen if I want to create an additional node that share the same blocks and in addition has an Ethereum explorer to navigate through the blockchain transactions.

Let’s create a new VM in a new resource group, this step is optional but allow you to have more tools to navigate through the blockchain you have been created.

Go to the Azure portal and select the VM image:

** If you don’t have this image you can pick another for Windows 10.

Step 1

Set a name, e.g. customdappnode.

Since is a POC purposes you can set HDD VM disk type.

Select a username, password and suscription for your VM.

Select a new resource group, e.g. mobiledappcustom.

Select a location, e.g. South Central US.

Step 2

Select a VM with the size you prefer, in this sample I use: A2_v2 SKU.

Step 3

There is no special configuration needed, you can proceed to review the summary.

Step 4

Review the summary and create the VM resources.

Awesome! you have now setup your new Windows VM that will be shortly a new Ethereum node

Once the resources for the VM have been created successfully, you can go directly to the new resource group e.g. mobiledappcustom, and select the network security group then add an inbound and outbound rules.

Inbound rule:

  • Source: Any
  • Source port ranges: *
  • Destination: Any
  • Destination port ranges: 30301
  • Protocol: Any
  • Action: Allow
  • Priority: 1010
  • Name: EthInbound

Outbound rule:

  • Source: Any
  • Source port ranges: *
  • Destination: Any
  • Destination port ranges: 30301
  • Protocol: Any
  • Action: Allow
  • Priority: 100
  • Name: EthOutbound

** This ports will be used by Ethereum to expose the child node to the master node hosted in the Ethereum network previously created.

Let’s go and connect by remote desktop to the Windows 10 VM.

For testing purposes, you need to disable the Windows Firewall or create the same inbound and outbound rules.

Perfect, we are connected and we need to install some tools in the new VM:

  • NodeJS LTS version (https://nodejs.org/en/)
  • Download Geth for Windows (https://geth.ethereum.org/downloads/)
  • Open a new console and install the Windows build tools:
    • npm install –global –production windows-build-tools
  • Download Git for Windows (https://git-scm.com/download/win)

Once we have installed all the required tools, we can proceed creating the custom node genesis extracted from the Ethereum network, this file must share the same characteristics as the master node.

We are going to create a root folder and save the Genesis file: c:\blockchain\Genesis.json

There is a chainID that must have the same id previously configured in the Ethereum network.

  "alloc": {
    "f1cfdc32ab8c02d3f2cb6196bb729e475201d1b3": {
      "balance": "1000000000000000000000000000000"
  "config": {
    "homesteadBlock": 0,
    "chainID": 10101010,
    "eip155Block": 0,
    "eip158Block": 0
  "nonce": "0x0000000000000042",
  "difficulty": "0x6666",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "timestamp": "0x00",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
  "gasLimit": "0x4c4b40"

Now let’s create two command scripts:


Purpose: this script will run just one time when you set by first time your blockchain.

geth --datadir "blockchain" init "blockchain\Genesis.json"


Purpose: this script must run everytime you turn on the virtual machine, this script will sync your blocks.

geth --identity "customdappnode" --rpc --rpcaddr localhost --rpcport 8545 --rpcapi "db,eth,net,web3,personal,miner,admin" --rpccorsdomain "http://localhost:8000" --datadir "blockchain" --port "30301" --networkid 10101010 --fast --cache=1024 --pprof

** If you need to check the meaning of each parameter check the ethereum documentation.

Ensure startup.cmd is running and open a command window then run:

C:\>geth attach ipc:\\.\pipe\geth.ipc

Let’s get the node information, this will use to add


Let’s copy the enode and save it to use it later:

enode: "enode://91920fedd885e19471d0f0a5a420de0ea2f51420de5ebf77c2dce8bee1dd89ffec40bd1f4b79b0cdcfa1eb896142303e887144ef218ed7e24c72532aa9502b42@[::]:30301"

Replace the [::] chars by the VM public IP address, e.g.:

enode: "enode://91920fedd885e19471d0f0a5a420de0ea2f51420de5ebf77c2dce8bee1dd89ffec40bd1f4b79b0cdcfa1eb896142303e887144ef218ed7e24c72532aa9502b42@[]:30301"

The enode is the unique public identifier that will allow link nodes peer-to-peer.

Now let’s go back to the Azure portal and open the SSH connection using the SSH connection string exposed previously when we finished the Ethereum network.

Once we are in the SSH session, we are going to access via geth attach.

rcervantes@tx-dapptc-reg1000000:~$ geth attach
Welcome to the Geth JavaScript console!

instance: Geth/tx-dapptc-reg1000000/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.2
coinbase: 0xf1cfdc32ab8c02d3f2cb6196bb729e475201d1b3
at block: 3937 (Mon, 14 May 2018 17:48:59 UTC)
 datadir: /home/rcervantes/.ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0


If you count the peer nodes you should see: 2

> net.peerCount

Now it’s time to add our new enode configured before:

> admin.addPeer("enode://91920fedd885e19471d0f0a5a420de0ea2f51420de5ebf77c2dce8bee1dd89ffec40bd1f4b79b0cdcfa1eb896142303e887144ef218ed7e24c72532aa9502b42@[]:30301")

If you count again the peer nodes you should see: 3

> net.peerCount

Congratulations it means that your new node has been successfully configured

Now you can see how your startup.cmd is synchronizing all the blocks to your new node.

Now it’s time to configure an explorer to navigate through the transactions.

  • Download the following code: https://github.com/etherparty/explorer
  • Unzip the code in c:\explorer\
  • Open a console window in c:\explorer\ and execute the command: npm start

Once the explorer app has been configured the command will open the port: localhost:8000 and you will be able to access to the web app.