Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Presentation link

Demo code


  • Live in Australia (30 hour travel time to Trufflecon)
  • Blockchain Domain lead @ Microsoft.
  • CSE (Commercial Software Engineering), work with Microsoft's top 400 enterprises globally to help their dev teams be awesome on Azure.
  • Been using Truffle since 2016, I created a lot of the early Truffle on Windows tutorials

Dev environment

Ubuntu on Windows (Windows Subsystem for Linux)

Because some npm packages don't run nicely on windows (due to node-gyp), I recommend devs use Ubuntu on Windows.

Demo: show that screenfetch & htop work

Visual Studio Code

Free. Open Source. Runs on Windows / Linux / Mac. Lots of plugins available.

Enterprise truffle usage

Setting up the project

Start with metacoin box as it has things nicely configured

truffle unbox metacoin

PAIN POINT: Truffle boxes missing licensing.

Continuous test runner

PAIN POINT: truffle watch does not work

Need to use a tool like nodemon or chokidar-cli to watch and run tests.

npm install -g chokidar-cli
chokidar 'contracts/*.sol' 'test/*.js' -c 'truffle test' --initial

PAIN POINT: I want a common artifact format across Truffle & Nethereum. Load a metacoin.json file into Nethereum and have it auto detect the ABI & deployed address.

Async tests

PAIN POINT: the sample tests are sync. Async tests are smaller and cleaner.

Change unit tests to async

Blockchain DevOps

Prerequisite: Install truffle as a dev dependency

npm init -y
npm install truffle --save-dev

Azure DevOps Pipeline

Cloud-hosted pipelines for Linux, macOS, and Windows with unlimited minutes and 10 free parallel jobs for open source.

Install and configure via GitHub marketplace

Compile & test

# azure-pipelines.js - npm install, then run the tests
- script: |
    npm install
  displayName: 'npm install'

- script: |
    npx truffle compile
    npx truffle test
  displayName: 'truffle compile & test'

Advanced test results

# Install mocha & junit reporter, allowing output in JUnit XML
npm install truffle mocha mocha-junit-reporter --save-dev
// truffle.js - specify mocha output options
// set the reporter to "spec" to output to terminal, or "mocha-junit-reporter" to output XML
mocha: {
    reporter: "spec",
    reporterOptions: {
      mochaFile: 'TEST-truffle.xml'

PAIN POINT: Need to change test runner manually. Can I pass a param into truffle test to change the test runner.

# azure-pipelines.js

# Insert this before running Truffle Test. This will set the reporter to output junit XML
- script: |
    sed -i -e 's/reporter: "spec"/reporter: "mocha-junit-reporter"/g' truffle.js
  displayName: 'configure mocha to output junit'

# Put this after running Truffle Test. Publishes Test Results in Azure DevOps
- task: PublishTestResults@2
  condition: always()
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/TEST-*.xml' 

break a test and do a pull request

  • modify metacoin.sol to break test
  • check broken code on a branch and push
  • create a pull request

add the build status badge

Ethereum on Azure

Automated deployment

npm install truffle-hdwallet-provider --save

PAIN POINT: requires node-gyp. Can we have this web packed like Truffle?

Note: don't put raw mnemonic in truffle.js, use pipeline variables to keep them secret

// truffle.js
var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat";
var networkEndpoint = "";
// var mnemonic = process.env.deploymentMnemonic;
// var networkEndpoint = process.env.deploymentNetworkEndpoint;

module.exports = {
	networks: {
		azure: {
			provider: function () {
			    return new HDWalletProvider(mnemonic, networkEndpoint, 0)
		gasPrice : 0,
		network_id: "*"
- script: |
    npx truffle migrate --network azure
  displayName: 'contract deployment'

PAIN POINT: Once migrations are run, where to store the artifacts? EthPM?

You can’t perform that action at this time.