Blockchain DAPP Reference Architecture

Blockchain DAPP Reference Architecture

When I first started learning about blockchain (BC) development I took all my normal steps to increase my skills. I searched the web to understand the 50-thousand-foot view. I read the whitepapers and sought out relevant use cases. I poured through GitHub and all the tutorials I could get my hands on.

I still found myself disappointed. No matter how much I searched I couldn’t find a simple but effective reference architecture showcasing the main considerations one should design for to get a viable application running against a BC. So, I decided to create one.

Now let me preface this by saying that this is not THE reference architecture for a blockchain enabled application, it’s just how I would design it to meet needs as I see them. There are probably dozens of ways to do this. Heck, I may even be wrong on some of this, but I figured I’d rather get something remotely thoughtful out there are hopefully get people talking and improve upon it.

My Guiding Principles

Before we dive into the architecture let’s cover a few fundamentals that guided the design.

  1. Ethereum would be the blockchain of choice
  2. Must leverage a RESTful API
  3. Must be highly available and loosely coupled
  4. Must account for both on and off chain data store
  5. Must account for trust of off chain data
  6. Designed for low transaction (gas) costs
  7. Must protect application IP

If we bear these principles in mind the architecture below should provide an effective starting point.

 

Let’s dig into some of these components. I’d like to highlight a few.

REST API

For me this is node.js or C# running on an Azure App Service API. You could also create an Azure Mobile App and would allow you to take advantage of the “sign-in with”, offline mode, and mobile notification capabilities specific to this service.

Services

For scalability and resiliency reasons I would split a some of our functionality out into their own service domains. These are broken down further into traditional services and Blockchain services and could be implemented as a combination of microservices and Azure functions.

Traditional Services

  • Search service will ensure a consistent and delightful search experience.
  • Notifications service will handle all email, SMS, and web notifications.
  • Billing service ensures transaction integrity and provides plug and play capabilities for multiple payment gateways such as Stripe.

Blockchain Services

  • Transact service is responsible for submitting transactions to the Blockchain.
  • Query service is different from Search; it is solely responsible for reading from the Blockchain.
  • Trust service is responsible for evaluating data read from and written to the Blockchain. It’s main goal it to ensure consistency between off and on-chain data.

Storage Queues

I used a combination of Azure Storage (message) Queues and WebJobs to decouple our application. This level of fault tolerance will come in handy as we scale.

Redis Cache

I couldn’t imagine developing a production ready application without Redis Cache these days, so this is a must have.

Persistent Storage

This consists of a combination of SQL and NoSQL data stores as well as Blob storage fronted with an Azure CDN. We could even bring in distributed file storage solutions such as IPFS or Storj but I would keep it simple to start and go with Azure SQL for relational data and/or Cosmos DB for NoSQL.

Ethereum Blockchain

Lastly our application wouldn’t be a Decentralized Application (DAPP) without the Ethereum Blockchain and Smart Contracts. Our contracts could do any number of things but remember my guiding principles above. We want to do as little processing and writing to the BC as possible to avoid paying higher than needed gas costs.

We also want to protect our IP. Smart Contract code is compiled byte code deployed directly to the BC. Since everything on-chain is visible someone could take our code and decompile it and steal our IP. Just another reason to keep Smart Contracts as thin as possible and perform very little business logic, if any.

For these reasons I recommend recording hashed pointers to our off-chain datasets. Then our Trust service can be used to validate the authenticity of this data. This way we use the blockchain as it was intended, an immutable public ledger. We track transactions and keep other data in normal data stores.

I hope this provides one possible overview of how you can design a real-world application to run against the Blockchain. I also believe the true value of something like this is not in its implementation but in the conversations born as a result. If you have ideas, feedback, or even criticism please comment below and let’s iterate a better solution together.

#blockchain #crypto #cryptocurrencies #altcoin #solidity

Darren Harvey

Helping people team with technology

3 年

Thanks for that…very informative

回复
Nelly Chatue-Diop

Tech Entrepreneur ? Board member ? Data & AI Strategy ? Blockchain expert

6 年
回复
Ajitesh Shukla

Strategic Technology Leader | Transforming Data into Strategic Insights with AI & Advanced Analytics | Published Author

6 年

Good one. Thanks for sharing

回复
Jeff Hotz

Bugs Anger Your Customers & Prospects. Ask me how we can help you make them Smile!

7 年

Nicely done Joe. You explained it in a way that bridges my current tech & business knowledge so that I can increase my understanding and dig a little deeper to learn more.

回复

Nice post, Joe. I like your breakdown as well of the different components and your reason for including them. I'm curious, however, if it might make things a little more real to include a business case that you are working towards. Such as, what reason did you leverage blockchain in the first place? Supply chain? Escrow? Transparent financials? And I especially like your call outs to Azure stack capabilities. Solid write-up... nicely done.

要查看或添加评论,请登录

Dr. Joe Shepherd的更多文章

  • Career Success Framework

    Career Success Framework

    Dedicating substantial time to mentorship has allowed me to share my invaluable insights into achieving success and…

    3 条评论
  • The Fourth Industrial Revolution and the Future of Work

    The Fourth Industrial Revolution and the Future of Work

    Influencing Factors (Social, Technological, Ethical) Society, and the world we have come to know it, have undergone…

    4 条评论
  • Corporate Social Responsibility's Impact on Corporate Branding

    Corporate Social Responsibility's Impact on Corporate Branding

    Consumers look to find deeper meaning in everything they do (Vallaster et al., 2012).

  • The Misapplication of Common Marketing Metrics

    The Misapplication of Common Marketing Metrics

    Introduction To prove their worth in the digital age marketing departments, need to consider numerous factors…

  • When Do You Need a Fractional CTO

    When Do You Need a Fractional CTO

    So, you're in charge of technology at your company and the board has just dropped a huge initiative on your plate…

    2 条评论
  • Are you Locked into your Job Description?

    Are you Locked into your Job Description?

    Not all talent is created equally, but the search for all talent begins the same way. Companies looking to fill a role…

    11 条评论
  • What People Really See in Your Profile

    What People Really See in Your Profile

    I have hired a lot of people in my career. I’ve looked at more resumes and conducted more interviews than I could…

    19 条评论
  • Using Interfaces & Inheritance with Solidity

    Using Interfaces & Inheritance with Solidity

    There is a lot of information out there on #Blockchain but not very much on #Solidity the programming language used to…

  • My Donation Went Towards What!?

    My Donation Went Towards What!?

    As rain continues to hammer Houston Texas, people and nations everywhere are opening their hearts and their wallets to…

    7 条评论
  • There has to be a Better Way to Launch...

    There has to be a Better Way to Launch...

    Recently my team and I were responsible for the launch of several new product lines in the streaming media space…

社区洞察

其他会员也浏览了