Smart contracts are an upcoming trend in the area of Blockchain technology. And DevOps is an interesting use case for them. DevOps teams can learn a lot from blockchain technology, and especially the use of smart contracts.
But is Blockchain already used in DevOps?
A quick introduction to blockchain technology
Simply said, Blockchain is a digital ledger, distributed database or timeline that enables a secure way of creating transactions, agreements and contracts—virtually anything that needs to be logged and verified as having taken place. This is done by creating ‘blocks’ (public lists of datasets), and distributing them in a decentralized manner to a network of computers.
Each block has a timestamp and link to the one preceding it—something that ensures everybody’s copy of the distributed blockchain is kept in sync.
Figure 1 shows a visualization of how a cryptocurrencies blockchain works.
FIGURE 1: How a blockchain works. Source
Blockchain technology is used for three main use cases:
- Financial transaction recording: cryptocurrencies like Bitcoin
- Establishing trust/identity: digital identities like E-Stonia
- Establishing contracts: smart contracts
Focusing on smart contracts, they can be the blockchain use case for DevOps.
Let’s first see what smart contracts are.
What are smart contracts?
As you may know, blockchains are decentralized without any ‘middlemen.’
A smart contract is best likened to a vending machine. A vending machine has similar properties compared to smart contracts on the blockchain. A vending machine has rules which are hard-coded and that specify what happens when certain conditions are applied. Then it executes (‘enforces’) certain actions when those conditions are fulfilled. (“if this happens then do that”).
Smart contracts are little programs—rules defined and enforced by code on the blockchain.
The contracts are verified by many computers to ensure trustworthiness.
The following figure shows the code for a basic smart contract that was written on the Ethereum blockchain.
Figure 2: An example smart contract on Ethereum. Source
The contract above specifies that the creator of the contract be given an amount of bitcoins. It allows anyone with the necessary balance to distribute these bitcoins to others.
What does a smart contract environment look like? As already stated, it is decentralized, and every computer (“node”) stores the data and runs the smart contract. It runs all the time, even when nobody is ‘mining’ the block.
I will illustrate the use of smart contracts in IT when buying software licenses:
Suppose a DevOps manager wants to buy a software license from a vendor.
This can be done through the blockchain by paying in cryptocurrency. The DevOps manager gets a receipt which is held in a virtual contract; the vendor gives the digital entry key, which comes to the manager by a specified date. If the key doesn’t come on time, the blockchain releases a refund. If the vendor sends the key before the licensing date, the function holds it, releasing both the fee and key to the manager and vendor respectively when the date arrives. The system works on the If-Then premise and is witnessed by multiple people, so a faultless delivery can be expected. If the vendor shares the key with the manager, he is sure to be paid. If the manager sends a certain amount in bitcoins, he receives the key. The document is automatically cancelled after the designated time has passed, and the code can not be interfered with by either manager or vendor without the other knowing, since all participants are simultaneously alerted.
Openchain is an open source distributed ledger technology and offers the just-described software licensing use case through Blockchain.
Smart Contracts and DevOps
Smart contracts may be great, but what are the benefits for DevOps?
Chris Tozzi provides two use cases in this blog. In summary, they are:
- Controlling code flow automatically by relying on smart contracts as gatekeepers during continuous delivery, with increased transparency of errors.
- Enforcing SLA contracts as a functionality guarantee for software.
The article also mentions that no real implementations on continuous delivery and SLA contracts have been made as of now. I personally have not found them, either. But as with all new technology, early adopters will arise, especially when Blockchain is adopted by Fintech companies.
Blockchain technology and smart contracts are being used more and more in today’s businesses.
Smart contracts can be used for cryptocurrencies, digital identities, or such things as software licenses.
DevOps is not yet a part of this space, but it likely will be with increased adoption.
Exciting times ahead!