Setting up a development environment on Azure

This article will show you how to create a VPS (Virtual Private Server) in the cloud that can run Visual Studio and a Stratis Node. This will allow you to have a development environment that is remote - separate from your local computer - that you can RDP to and develop on. This is beneficial for people who want to keep any Stratis code they are developing seperate from their local computer, for security reasons.

Create an Azure account

Create Azure subscription

  1. If you don’t have an Azure subscription, create a free account before you begin.

screen shot 2018-04-26 at 4 02 36 am

  1. Create a new Microsoft account if you don’t have one already. You can also create it during the Azure account creation process.

image

Login to Azure

Log in to the Azure portal at https://portal.azure.com using the credentials that was used to create the azure subscription. You can see the Azure portal dashboard after login.

image

Create a windows virtual machine in Azure instance

  1. Choose Create a resource in the upper left-hand corner of the Azure portal.

image

  1. In the search box above the list of Azure Marketplace resources, search for and select Visual Studio Community 2017, then select the first option Visual Studio Community 2017 on Windows Server 2016.

image

  1. Click the Create button.

image

  1. Provide a VM name, such as stratisVM, leave the disk type as SSD, then provide a username, such as azure_ashirvad. The password must be at least 12 characters long .

image

  1. Choose to Create new resource group, then provide a name, such as stratisResourceGroup. Choose your desired Location, then select OK.

  2. Select a size for the VM. You can filter by Compute type or Disk type, . image

  3. Under Settings, leave the defaults and select OK.

image

  1. On the summary page, select Create to start the VM deployment.

image

  1. The VM is pinned to the Azure portal dashboard. Once the deployment has completed, the VM summary automatically opens.

image

RDP to the windows instance

  1. Click the Connect button on the virtual machine properties. A Remote Desktop Protocol file (.rdp file) is created and downloaded.

image

  1. To connect to your VM, open the downloaded RDP file. If prompted, click Connect. On a Mac, you need an RDP client such as this Remote Desktop Client from the Mac App Store.

  2. Enter the user name and password you specified when creating the windows virtual machine, then click Ok.

image

  1. You may receive a certificate warning during the sign-in process. Click Yes or Continue to proceed with the connection.

  2. Congrats! Your windows virtual machine with Visual Studio 2017 community edition is ready.

image

How to create a windows Stratis development environment

  1. Open Visual Studio 2017 from your VM desktop.

image

  1. Create new .Net core console project.

image

image

  1. Open Nuget Manager from Tools.

image

  1. Search for NStratis .

image

  1. Select Console project and click install.

image

  1. Open Program.cs code file and replace the content of the code file with following code. ``` using System; using NBitcoin;

namespace ConsoleApp1 { class Program { static void Main(string[] args) { Key privateKey = new Key(); PubKey publicKey = privateKey.PubKey; Console.WriteLine($”Public Key: {publicKey}”); Console.WriteLine($”Public key hash: {publicKey.Hash}”); Console.WriteLine($”Stratis testnet address: {publicKey.GetAddress(Network.StratisTest)}”); Console.WriteLine($”Statis mainnet address: {publicKey.GetAddress(Network.StratisMain)}”); Console.ReadLine(); } } } ```

  1. Press F5 to run the program in debug mode. image

Congratulations!🎉 . You have now successfully created a new Console project inside a Windows Virtual machine on Azure and interacted with the Stratis Blockchain.

Article written by @ashirvad-github (can be contacted on our Discord) Tip @ashirvad-github with Stratis here