Building a Service-Oriented Architecture for the Smart Contract Ecosystem

Service-oriented architecture (SOA) is an approach to software design that enables different, independently maintained components, or “microservices”, to work together in a single application. This separation of services accelerates innovation, reduces development time, and explains the continued burst of growth in the DeFi ecosystem, where multiple permissionless, open-source protocols are leveraged in combination to compose completely new financial applications. When people talk about DeFi composability, in many ways they are talking about a service-oriented architecture for smart contracts.

Sergey Nazarov, Co-founder of Chainlink, recently explained how the Chainlink Network fits into this emerging service-oriented architecture of the larger blockchain ecosystem, providing smart contract applications with highly reliable microservices such as secure Data Feeds, provably random number generation, Proof of Reserve, and other off-chain computations. As a secure data infrastructure for smart contracts, Chainlink is also the gateway for many traditional companies to connect their backend systems to the rapidly growing smart contract economy and integrate decentralized microservices as part of their business model on both the buy and sell side of the marketplace.

This post is taken from excerpts of Sergey’s recent presentation at the 2020 Coindesk Invest: Ethereum conference, The Power of Composability in DeFi Smart Contracts.


The Benefits of Service-Oriented Architecture

A key shift for our ecosystem, which is already underway, will be the shift toward a more service-oriented architecture (SOA), in which protocols can compose services very efficiently and securely. This is the direction in which standard computing architecture has also gone. Monolithic architectures are closed systems that people can’t compose with another system, and so all the work that goes into that system is only for its own benefit and not something that can be reused by others. Then you have a microservices, or a service-oriented architecture, approach, which allows people to make multiple independent services that then interact in secure and very useful ways.

Microservices architecture enables composable application components for web applications.
Microservices architecture enables composable application components for web applications.

This is really what our ecosystem is trying to achieve when we seek to create composability within decentralized finance (DeFi). This is a very common kind of dynamic that the larger computing landscape has gone towards. Before service-oriented architectures, you had these big applications and they lived within these database mainframes, and they all interacted in some limited way. It was really tough to get them to work together. There was a move towards service-oriented architectures initially just by making different services, then microservices, then serverless approaches.

That’s really the same logical direction that the smart contract ecosystem is going towards. A services-oriented architecture improves your assumptions around security by separating different concerns. You also get reusability of the services, so anybody putting effort into those services makes them useful for others, and the composition of those services allows rapid iteration in ways that you couldn’t have in a more monolithic, single application kind of structure.

SOA increases security and reusability, while enabling faster, more iterative product development.
SOA increases security and reusability, while enabling faster, more iterative product development.

DeFi Composability: A Working SOA for Smart Contracts

The parallels within our space are slowly starting to emerge. When I look at the history of smart contracts, which within the world of computing isn’t a very long history, we already have examples of more monolithic smart contracts like The DAO, which were written in these big chunks that ended up not being secure because they were written in this rigid, non-composable kind of format. Many of these early smart contract systems were not really usable or made to be usable by others.

Now we’re going from architecture around a single resource that’s closed and that’s possibly built in a very stacked, very complicated way where a lot of problems can hide, and we’re moving to a dynamic where we have multiple smaller services that interact within one protocol. And those separate services within that protocol can actually be used by other protocols.

Recent developments in composable services-oriented smart contracts have led to a boom in DeFi products — Chainlink provides composable secure data to power this ecosystem.
Recent developments in composable services-oriented smart contracts have led to a boom in DeFi products — Chainlink provides composable secure data to power this ecosystem.

Chainlink fits into this larger architecture by providing secure data into those various protocols and services. Now you see this wide range of advanced DeFi protocols made by amazing teams like Aave and Synthetix all being composed together into more and more advanced products sharing value and sharing functionality.

That’s what I really think DeFi composability is going to achieve for all of us: part of the reason DeFi is moving so much faster now is because our ecosystem has adopted the SOA thinking that is proven to work in the software industry. This is how we compose a bunch of services and build something great.

Service-oriented architecture is becoming more and more prevalent in our space, making it easier for development teams to both add new components in the form of DeFi protocol contracts and for others to then feed value into those contracts. Services like Chainlink Price FeedsVRFProof of Reserve, and oracles for unique datasets like weather data help secure those contracts, feed in additional value, and provide new forms of real-world collateral.

I see a future where the composability from DeFi projects unlocks new services in the form of smart contracts and also generates new financial products, such as gaming products that might serve as collateral for DeFi. Chainlink provides an infrastructure for people to easily put services on-chain, either by running their own Chainlink nodes or by using Chainlink as a middleware for selling their existing data and APIs to the DeFi, decentralized insurance, and blockchain gaming industries.

The faster we can support more microservices on-chain and enable an ecosystem of different, composable building blocks, the more that our industry will begin to look like the web industry and begin to build at web speeds.

Chainlink provides SOA for secure price feeds, RNG, and any other type of external data.
Chainlink provides SOA for secure price feeds, RNG, and any other type of external data.

Creating Virtuous Cycles Around Data Usage and Security

I think the real challenge is, how do you build these composable building blocks in a secure way that abstracts security concerns away from the people that need to build?

You want speed from the point of view of the developers who are building, and you also want to provide them with a system that guarantees certain levels of security while they’re speedily composing these various building blocks together.

We actually see a cyclical dynamic where, as more smart contracts appear, you have more usage of these services, data, and DeFi protocols, and that encourages more data and more services to be placed on-chain. This is a dynamic that Chainlink is intimately involved in and driving forward. We see a circular pattern in which there’s a market for putting more data on-chain, and therefore that’s going to enable more DeFi markets, and subsequently even more DeFi smart contracts that can be composed into more products and services.

Virtuous cycles around Chainlink providing more on-chain data and oracle security, which drives increasingly more smart contracts that secure more value.
Virtuous cycles around Chainlink providing more on-chain data and oracle security, which drives increasingly more smart contracts that secure more value.

Another pattern we see is that people tend to pay for security, and so as the user fees from these smart contracts begin to grow and get fed into a system like Chainlink, where those user fees pay for more data and more security, you’ll arrive at a place where cyclical patterns emerge. More smart contracts generate more usage of data and more demand for data, and then systems like Chainlink enable the secure provision of that data in a signed format by purchasing the data directly from high-quality data sources.

Chainlink accelerates these cycles around data consumption and security, and in accelerating this virtuous cycle, the smart contract ecosystem gets more services to compose into DeFi smart contracts, in the variety of data, in the quality of data, and in the security guarantees with which that data is delivered.


Developers, check out Chainlink’s technical documentation to quickly get started with Chainlink oracles and an array of decentralized microservices for smart contracts. For more in-depth integrations, reach out to our experts.

More on This Topic

Need Integration Support?
Talk to an expert
Faucets
Get testnet tokens
Read the Docs
Technical documentation