Getting started with blockchain smart contracts

Cryptocurrency garners most of the headlines when it comes to blockchain, but the biggest impact over the long run will come from many other practical uses including banking, property records and healthcare, just to name a few. For all of the different use cases, blockchain apps have one thing in common that should be at the forefront of anything developers are working on: smart contracts.

Smart contracts are the programming model for blockchains. That may sound relatively straightforward on the surface, but here we will take a look at what that actually means in practice, why developers should care, and the approach they should take when getting started with smart contracts.

First Thing’s First: What are Smart Contracts?

In a blockchain or other similar distributed ledger technology (DLT), there is infrastructure under the hood that gives developers a way to build an app across multiple organizations. While you usually build an app running within your organization, the paradigm created for DLTs and blockchains was to span multiple organizations. Smart contacts are the programming layer of that underlying infrastructure.

An increasingly common way to start is with DAML, an open-source smart contract language that abstracts away many of the nitty-gritty details and runs on most blockchain platforms. It simplifies things because each of the blockchains has its own smart contract language tightly connected to the underlying infrastructure. DAML abstracts away the complexities of knowing those different languages, making it much more familiar to web or mobile app developers in the process.

Generally speaking, a developer on any platform develops against some abstraction of that platform. Web and mobile app developers think more in terms of the screens they want people to see and the interactions the users will experience; not as much about how the underlying data is being moved. For example, a web developer would typically design the application’s data model, the views that users will see, and the interactions used to control the data. They wouldn’t have to think about how the web server works or how data gets authenticated and moved through the network.

Another example of abstraction is a smart phone’s operating system. You don’t necessarily think about the internals of how each model of smartphone works, you just use the Android or iOS operating system abstraction instead. 

With blockchains, that equivalent is smart contracts. For example, DAML abstracts so you can develop for many platforms regardless of the underlying database, blockchain, or distributed ledger infrastructure.

Smart Contracts: good for business, good for your career

There are two main reasons developers should care about smart contracts. First, businesses are extremely interconnected, both from a business perspective and a technical perspective. It doesn’t take long before a partnership or series of partnerships gets hampered with the bureaucracy of where data lives, the workflows you have for the data, and how to manage access to the data.

Distributed ledgers that have privacy built-in to solve those problems. Each involved entity owns the data that it is allowed to see, and they have continual access to that data. This distribution of data defines — at the application level — which data is where, who should view it, and who owns what.

The second and arguably more important reason that you as a developer should care about smart contracts. Your career. It’s taking longer than some initially expected (similar to many hyped up technologies, but enterprise software done right takes time), but the wave is coming. Capital markets, healthcare, and many other industries are already moving to blockchains. I believe that, eventually, every digital asset — financial markets like stocks and bonds, data embedded within healthcare devices, and beyond — will live on some version of distributed ledger or blockchain.

This is happening, so all developers should know it. And developers coming out of college and entering the workforce should get smart about it.

The First Step to Smart Contracts: Getting Your Hands Dirty

My advice on smart contracts is to dive in headfirst. If you’re an executive, evaluate. Would your company benefit if you could share workflows and business processes with other companies or across data boundaries within your company, either now or in the future? Then you should think of smart contracts. If you’re a developer, start today. Build a very quick proof of concept, learn how easy it is, and use it as part of your initial pitches to see if it sticks. It takes less than an hour to get a first app up and running, and you’ll be amazed how far the tooling has gone to make you productive quickly.

 

Start with the basics:

  • If you’re interested where it all started, read the bitcoin whitepaper. It’s 9 pages long and created an entire industry.

     
  • Visit the DAML site to learn more about the language and get your first app deployed.

     
  • Learn about a few distributed ledgers: For example Ethereum, a decentralized open-source blockchain that uses smart contract functionality. Corda, an open source blockchain for business. VMware Blockchain, an Enterprise-grade blockchain platform.

 

Generally speaking, if you have a public use case that doesn’t have privacy or scalability requirements, Ethereum may be sufficient. If there are privacy needs, an enterprise blockchain is the way to go. If you don’t see any reason for data to be distributed, then you can simply deploy to the cloud and blockchain is probably an overkill. 

In all of these cases, the safest bet is to use DAML. It gives you the option to move to a distributed deployment later if you need to, and it is a very powerful language regardless of whether it’s distributed or not. In an era when many organizations are looking for ways to innovate faster and become “future proof,” strategic use of DAML and smart contracts is a part of the solution.


This content is made possible by a guest author, or sponsor; it is not written by and does not necessarily reflect the views of App Developer Magazine’s editorial staff.


Become a subscriber of App Developer Magazine for just $5.99 a month and take advantage of all these perks.