Inside Microsoft's Blockchain as a Service
Since bringing blockchain tools and distributed ledgers to its Azure cloud, Microsoft's Ethereum-based framework has begun evolving rapidly with three core components either in preview or under development.
By Terrence Dorsey
The foundation for Microsoft's Blockchain-as-a-Service (BaaS) portfolio took form two years ago when the company decided to build its service on Azure based on Ethereum and adding tools based on Solidity. While blockchain promises to revolutionize computing by removing traditional intermediaries from various forms of complex transactions and information exchange, the networks and tools are still in the formative stages. Nevertheless, Microsoft is looking to accelerate its adoption in the next few years and plans to streamline blockchain development with a trio of new BaaS offerings.
As such, this technical primer will describe blockchain in terms of its application architecture and components and then outline some of the tools Microsoft is providing through its Azure-based BaaS roadmap and for developing blockchain applications with its Visual Studio development environment.
What Is Blockchain?
In broad terms, blockchain is a data store. More specifically, a blockchain is a cryptographically authenticated, shared, distributed ledger. Technically, blockchain refers to the original bitcoin implementation and other implementations are shared ledgers using a chain of blocks with various types of cryptographic authentication, distribution, and block architectures and capabilities. For clarity, however, the industry refers to all of these offerings as blockchains.
Each block represents a record in the ledger. The block record contains data, along with a timestamp and a cryptographic hash of the previous block. The hashes link the chain of blocks together, one after another. The hashes also provide a chain of proof regarding the provenance and authenticity of each block. If any block in the chain is changed retroactively, the hash chain is broken.
Based on the distributed data system that makes up blockchain networks, typically, a community, organization, or "consortium" using blockchain technology sets up multiple nodes, each of which contains a duplicate of the blockchain and its logic. Changes to any single node are replicated to all other nodes. A constraint on logic within the blockchain application is that it must be able to execute on any node at any time and return the same result.
Other than the timestamps and hashes, the contents and capabilities of blocks vary by implementation. Blocks used by the bitcoin blockchain and other cryptocurrencies contain information about transactions. Other blockchain solutions enable smart contracts, which contain contract data and some limited types of logic. Most current blockchain implementations have constraints around strong typing, limited supported data types, restrictions on interactive access to external data sources, distributed concurrency and transaction speed. But that just makes the problem interesting, and you can theoretically use lots of different kinds of real-world data in the blocks.
So, given that logic within the blockchain is far more limited than most simple stored procedures, the final technical element is your application architecture, which uses the blockchain as its data store. Because blockchain logic can't interactively fetch data, this includes "oracles," which are programs that can provide external data.
Developing for Blockchain
Existing blockchain development technologies have mostly followed an old-school two-tier architecture: the blockchain data tier and the application tier. Because the blockchain itself typically defines the data tier, development tasks fall into the following areas:
Building, configuring and deploying data-tier blockchain nodes.
Writing smart contracts that live in blockchain.
Developing supporting data providers (oracles) in the application tier.
Developing the rest of the application-tier services.
After you've chosen a blockchain implementation, getting to the point where you've deployed nodes for your network is probably the easiest task. Even then, it's a non-trivial process when tackled for the first time. The rest of the development process has been a lot more murky: Development tools are immature and frameworks nonexistent.
The Microsoft BaaS approach makes every step of the blockchain implementation process easier so you can focus on the business case rather than scaffolding. Let's take a look at the current tool offerings.
Azure Blockchain as a Service
Your starting point for blockchain solutions is
Azure-based BaaS, a collection of ready-to-deploy ledger and tool solutions within the
Microsoft Azure Marketplace. You can select from a variety of distributed ledger solutions, including Azure Blockchain Service, BlockApps STRATO, Blockchain Foundry Syscoin, Chain Core, Emercoin, Enterprise Etherium Alliance Quorum, Ethcore Parity Ethereum, R3 Corda and more. Licensing options start at free for some solutions and include hourly or bring-your-own-license.
Once you select a blockchain solution, the Azure Management Portal walks you through the steps needed to configure and deploy nodes. Rather than searching through documentation and source code, you could be up and running in minutes, and you'll be able to use the familiar Azure tools to monitor and manage your blockchain nodes.
The Azure Marketplace also provides access to some Blockchain Tools, including Blockstack Labs Blockstack Core, ether.camp Ethereum Studio and ConenSys Truffle.
Smart Contracts with Solidity
Smart contracts were the first extension of blockchain technology beyond digital currencies. It's important to note that practical implementations of smart contracts only debuted in 2015, but high-quality development tools and standards are already available. They remain a segment of high potential and rapid refinement of development resources, so while changes are inevitable, the tools are only going to get better and better.
A smart contract is a type of blockchain transactional record that contains the kinds of data you might expect from a traditional contract: identities of counter-parties, the contracted object or outcome, prices, dates, and so on. Smart contracts may also contain logic triggered by external data such as dates, prices or the completion of related transactions. However, as mentioned earlier, the logic cannot directly access external data sources.
Solidity is the contract-oriented programming language currently used for most smart contract development. To get started, there's fairly extensive Solidity documentation with examples and common patterns on Read the Docs, and a powerful, browser-based Remix Solidity IDE with built-in examples, debugger, analysis, and more.
ConsenSys also provides a Solidity Visual Studio extension, which adds IntelliSense and syntax highlighting support for Solidity, along with project templates and application scaffolding for ASP.NET and Node.js applications that work with the smart contracts.
Cryptlet Fabric (formerly code-named "Project Bletchley") is Microsoft's effort to provide a much more robust and flexible development architecture for smart contracts. Currently, most blockchain smart contract solutions employed a simple two-tier architecture. Cryptlet Fabric intends to enable a three-tier architecture that separates the data tier (blockchain and other storage), business layer (smart contracts, oracles and other logic) and the presentation layer (typically Web applications).
The primary intent of Cryptlet Fabric is a much more sophisticated business logic layer for building smart contracts, utility oracles and APIs that allow the presentation layer to work with smart contracts. Cryptlet Fabric also extends runtime support to include any languages supported by the Microsoft .NET Framework, .NET Core, and Java virtual machine, as well as the native Solidity and C++ code traditionally used for smart contract development.
Within the context of smart contracts, Cryptlet Fabric extends the capabilities of smart contracts with two kinds of Cryptlets: Utility Cryptlets and Contract Cryptlets.
Utility Cryptlets are an extension of the blockchain oracle concept. They provide pub-sub access between external data and the smart contract logic, for such information as prices, notifications, and other event-driven triggers, workflow status, timestamps, and even conditional evaluation of external data. Within Cryptlet Fabric, Utility Cryptlets also give other applications, such as ERP or CRM systems, direct, secure-channel access to blockchain data.
Contract Cryptlets are bound to specific smart contracts and provide a separate layer containing business logic, rules and external APIs that aren't supported by blockchain-based smart contracts themselves. To simplify development, allow code reuse and optimize execution, Contract Cryptlets separate your contract code from the blockchain data tier, while still running in a digitally signed, secure channel.
In addition to these contract-focused features, Cryptlet Fabric also includes built-in support for leveraging existing Azure services. For example, Cryptlet Fabrick uses Azure Key Vault as a wallet for secure key storage and other secrets, and uses Azure Active Directory (Azure AD) for authentication and identity services.
For a deeper dive on Cryptlet Fabric, see "The Cryptlet Fabric & Evolution of Blockchain Smart Contracts" blog post by Marley Gray, principal program manager of Azure Blockchain Engineering, which provides great context with existing smart contract development tools and details on the entire Cryptlet Fabric stack. The Cryptlet Fabric is still in preview, but it was demonstrated at the recent Consensus 2017 in New York City and the goal is to release it later this year.
Blockchain Proof-of-Concept Framework
The third piece in Microsoft's blockchain development offering is the proof-of-concept (PoC) framework. All of the building blocks for a blockchain solution exist today, but the reality is that setting up the scaffolding of an application with those pieces is still a very work-intensive process. Microsoft's Marc Mercuri, director of Applied Innovation, notes in a blog post, "
Azure Introduces a New Blockchain Proof-of-Concept Framework for Developers," notes that "it can take [eight to 12] weeks and cost as much as $300,000" just to build a PoF blockchain-based solution.
To streamline the blockchain development process, Microsoft is working on an all-inclusive PoC framework that will included pre-configured assets and resources to get a project off the ground as quickly as possible.
Though release details are still to be determined, we do have a pretty good idea what the PoC framework will include, starting with Visual Studio project templates to jump-start code development and Azure Resource Manager deployment templates for the Azure service scaffolding needed to support a blockchain network. The scaffolding includes the Web application and API elements supported by Cryptlet Fabric, Azure AD, Azure Key Vault, an Azure SQL Database as an off-chain data store, and code to support additional hashing and signing services.
The framework also incorporates Azure Event Hubs for high-scale, low-latency data ingest, which enables integration with additional services like Azure Data Lake Analytics as a data store, Azure Stream Analytics for real-time dashboards, and even Apache Spark for HDInsight and Hadoop clusters for distributed Big Data processing, machine learning, and data warehousing.
Like Cryptlet Fabric, Microsoft demonstrated the PoC framework at Consensus 2017, but remains in preview and development is ongoing.
Terrence Dorsey is a technical writer, editor and content strategist specializing in technology and software development. Over the last 25-plus years he has worked on developer-focused projects at ESPN, The Code Project, and Microsoft. Read his blog at http://terrencedorsey.com or follow @tpdorsey on Twitter.