Getting started with blockchain design patterns


Blockchain is a shared, immutable ledger for recording transactions, tracking assets, and building trust. An asset can be tangible (for example, a house, car, cash, or land) or intangible (for example, intellectual property, patents, copyrights, or branding). You can track and trade virtually anything of value on a blockchain network, reducing risk and cutting costs for all involved. This article points to a set of design patterns for blockchain-based applications. Blockchain has unique properties including immutability, non-repudiation, data integrity, and transparency.

Blockchain is an emerging technology that enables new forms of decentralized software architectures, where distributed components can reach agreements on shared system states without trusting a central integration point. Blockchain provides a shared infrastructure to execute programs, called smart contracts, and to store data. This emerging technology requires patterns for using blockchain in the design of software architecture or applications.

Why design patterns are important to software developers

In general, design patterns define development best practices for software developers. The patterns themselves serve as solutions to general problems — in this case, within the blockchain space. In software engineering, a design pattern is a reusable solution to a problem that commonly occurs within a given context during software design. A design pattern defines constraints that restrict the roles of architectural elements (processing, connectors, and data) and the interaction among those elements.

There are two main applications for design patterns:

  • Define a common platform: Design patterns provide a standard terminology to a specific scenario.

  • Best practices: Design patterns have been around since the start of object-oriented programming. Less experienced developers learn software design faster and easier by leveraging the best practices documented within a design pattern. Developers should be familar with programming and sofware design principles.

Blockchain design patterns

IBM Developer is starting with these three design patterns, but we expect the list to grow over time. You can apply the context of these design patterns to end-to end-applications.

Non Blocking UI design for Blockchain based applications

Non Blocking UI design for Blockchain based applications starts by taking you through the problems that plague a traditional user interface when interacting with complex back-end APIs with high response times. The design pattern then presents some key concepts and approaches that you can use to alleviate the problem at hand and follows up by providing an end-to-end architecture and solution overview of how the different solution components can come together to create an interactive user interface.

Asynchronous API design for Blockchain based applications

Asynchronous API design for Blockchain based applications is a continuation of the non-blocking UI design pattern above. This pattern dives deeper into the asynchronous back-end API and discusses the API design and its interaction with other components, such as off chain storage and the events service.

Secure Sync pattern

Secure Sync pattern covers the design of the event service that you can use to securely sync blockchain with an application’s off-chain store. You can then leverage this off-chain store for running functional queries/searches. You can also use the event service as an integration point to set up a data warehouse or provide streaming data as input to a computing framework, such as Apache spark for learning and analytics.