Deploying An Ethereum Consortium Blockchain on Azure
Using the Azure portal
To get started, you’ll need a valid Azure subscription.
Sign in to your Azure portal: portal.azure.com. Click on the “New” button, and search for “Ethereum Consortium Blockchain” on the Marketplace.
Select it and click on the “Create” button. You’ll be directed to a set of configuration options for your blockchain.
Configuring Your Blockchain
Basic Settings
- Resource prefix: A string, < 6 characters, used for naming resources. I’m using “test” for this particular test deployment.
- Password: The password you want to use when signing into this network. Used for signing in via SSH.
- Resource group: The Azure resource group to use for this deployment. If you don’t already have one set up, select “Create new” and input that resource group’s name
Network Size and Performance
Here, you can configure settings specific to your blockchain. You can choose the number of members in the consortium, the number of mining and transaction nodes, and the size of the VM for each of the nodes. Since the application we’re creating is just for testing, I’m using the default options, which uses the smallest amount of computing power.
Ethereum Settings
This is the information that Ethereum needs. The “Ethereum Account Password” you choose will be used to interact with your Ethtereum accounts via Geth.
After you finish going through the Summary and Buy screens, you’ll be redirected to the Azure Dashboard, where you’ll be able to see your new deployment in progress. It should take a couple of minutes for it to finish deploying.
Connecting To Your Blockchain
Congratulations! Your blockchain is now live on Azure. Now, let’s get the information we need in order to log in.
On your Azure dashboard, click on the resource group you just deployed. In my case, it’s “resource7”.
Once you’re inside your resource group, click on the “Deployments” tab. This will show you all of the deployments that use this resource group. Click on the blockchain deployment.
On this screen, you can see all of the configuration options that you filled out when you were first deploying to Azure.
Admin Site: A website you can navigate to showing the status for the nodes on your Ethereum network.
Ethereum-RPC-Endpoint: An endpoint for connecting to your Ethereum network via an API like Truffle or web3 js.
Ssh-to-first-tx-node: To interact with your blockchain, you can log in using your SSH client. I’m currently working on Windows, so I’ll be using PuTTY to log in. On Mac, you can just copy and paste the “ssh” line into your terminal.
Interacting With Your Blockchain Using Geth
After you enter your password (the one you used in the “Basics” screen for Azure, not Ethereum), you’ll be logged in to geth, the command line interface for running an ethereum node. For more information on using geth, I encourage you to check out the official documentation.
With geth, you can interact with and configure a variety of settings within your blockchain. In this example, we list our Ethereum accounts and create a new one:
geth account list
// List of all Ethereum accounts
Account #0: {ec39bea3e66a7e9064af10e3990760dff9449e01}geth account new
// Creates new Ethereum Account, returns address
Address: {ae3ad20bd7225e121ec66892a03f209871c52c2d}geth account list
Account #0: {ec39bea3e66a7e9064af10e3990760dff9449e01}
Account #1: {ae3ad20bd7225e121ec66892a03f209871c52c2d}
You can also use Geth via its Javascript console by executing “geth attach”:
geth attach
//Opens the geth javascript console
> personal.listAccounts
// Returns array of Ethereum accounts
// Indexable: personal.listAccounts[0]> personal.newAccount(passwd)
// Creates a new Ethereum account
// Be careful, because your password will be logged> personal.unlockAccount(addr, passwd, duration)/
// Must unlock accounts used by a decentralized application via RPC> personal.unlockAccount(personal.listAccounts[0], "MyPassword20!", 0)
// Unlocks my first account
// Set duration to be 0 to unlock indefinitely (while geth instance is active)
And there you have it! How to deploy your own private blockchain on Microsoft Azure. In the next article, I’ll talk about how you can use the Truffle Framework to deploy your Smart Contracts onto Ethereum.