Azure Cloud: Mining the Ether (a practical guide)

Azure Cloud: Mining the Ether (a practical guide)

A Practical guide to Mining and Transferring Tokens of Your Own Private Cryptocurrency

“Which cryptocurrency is better? Mine, of course!
Please don’t make me sign up to another service, just let me trade Ether and create Tokens …”

Turing's Bombe Enigma Code-Breaker

The British Bombe: Turing’s Enigma

Like many old-school developers, my first instinct and best path to a deeper understanding of any new tech is to mock up a ‘Hello, World’ style proof-of-concept; here’s a quick intro to Ethereum Blockchain in Azure.

Microsoft Azure provides several quick-start Ethereum Consortium Blockchain solution templates. This blog follows one of Azure’s official Ethereum Blockchain walkthroughs, called:

We will use Token Factory to create a token and MetaMask to connect to our distributed ledger app (DAPP), save the token in a wallet, add a second test account, and transfer Ether between accounts.

Azure Ethereum Blockchain Private Network

Azure Ethereum Blockchain Private Network

We assume that you know your Bitcoin from your Ether. If not, you’ll probably want to start with a couple of basic blogs that summarize the crypto-explosion of 2017:

Decentralized applications (DAPPS) normally communicate and execute logic against the public Ethereum blockchain. Our private Ethereum test-bed consists of a peer-to-peer decentralized network of two mining nodes that maintain their own private distributed ledger and one dedicated networking node to support arbitrary computation against the ledger & maintain consensus.

 

How much Bitcoin will this cost?

Metamask Transfer Between AccountsNone, but Azure resources are not free; they require either a paid (credit card backed) or time-limited, free trial subscription. The scaled-down solution deployed as described below should only cost a few cents per day. You should budget for a monthly hosting cost of around $15 USD/mo. for A0 HDD nodes or $50 USD/mo for 1_V2 Standard SSD nodes.

Why Ethereum? Autonomous smart contracts (written in a scripting language called Solidity) are used to author decentralized applications (DAPPS).

“Ethereum is a decentralized platform for applications that run exactly as programmed without any chance of fraud, censorship, or third-party interference.”

You must resist the naive temptation to scale-up your cloud resources to get rich mining Ether. “These are not the droids you’re looking for!” Call Genesis Mining or similar if your after a mining contract or hardware.

 

How do I make and transfer a Token of Ether?

Transfer Failed Intrinsic Gas Too LowYou can buy Ether tokens (in exchange for Bitcoin or fiat currencies) or do cryptographic work to mine them or transfer them; every transaction has a Gas Price that must be satisfied in order for it to succeed. We can use our DAPP to issue tokens in exchange for Ether as follows:

  1. Setup your blockchain in the Azure Portal as described by the Azure walk-through:
    1. I started with A1 nodes (~ $50/mo.) & scaled down to A0 nodes (~$15/mo).
    2. important details of template output are displayed under Resource Group | Overview tab | Last Deployment item
    3. ADMIN-SITE URL is the DNS name of the load balancer: http://alblog6eaztl.canadaeast.cloudapp.azure.com/
  2. Use the Token Factory website to create a token:
    1. Pick your favorite DAPP and enter its Token Contract Address
      1. we chose the Golem Network (GNT): 0xa74476443119A942dE498590Fe1f2454d7D4aC0d
      2. use the default supply of 10 units and 4 decimal places or experiment with custom values
  3. Install the MetaMask Chrome browser extension:
    1. Select “Custom RPC” from the drop-down list under “Ropsten Test Net” (the default network) at the top-left of the MetaMask window:
      1. Enter the value for: ETHEREUM-RPC-ENDPOINT: http://alblog6eaztl.canadaeast.cloudapp.azure.com:8545
      2. This should create a default account & wallet populated with the 1000 ETH (private, not publicly tradeable)
        1. Relax: the ETH on a private network have no value on the publicly-traded “Main Ethereum Network
    2. Add the Token you created from Token Factory
    3. Add a second account so you can test trading
    4. Transfer ETH from one account to the next:
      1. If you set the Gas Price too low, you will receive the Error message: “Transfer Failed Intrinsic Gas Too Low
      2. Since you control the mining nodes, you may wish to experiment with Gas Limits by scaling your mining nodes up & out (YMMV).
  4. SSH to one of your mining nodes to explore the Azure VM implementation in more detail.

 

SSH to Mining Node

SSH to Mining Node

Wrap Up:

Beneath the Bitcoin buzz, the Blockchain bandwagon represents a fundamental paradigm shift toward peer-to-peer smart contracts. Azure’s Ethereum Blockchain templates provide an easily-scaled, safe sandbox for developers in any organization to gain a deeper understanding of the nuts & bolts of blockchain mining and smart contract transactions.

Stay tuned for the next post in this series:

Private Blockchain Consortia & Enterprise Smart Contracts

 

Kevin Belanger

Kevin Belanger

A graduate of the University of Toronto (1996, BSc Physics) and the University of Victoria (2013 MSc, Earth and Ocean Sciences), Kevin enjoys aikido, canoeing, travelling, writing poetry and spending time with his family.

Tags:

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.