Design pattern of developing Ethereum applications on EthVigil API gateway
Building apps on a decentralized blockchain platform like Ethereum requires integration of different moving parts, the most important being that operations that change data(aka state) on the chain are “confirmed” only after the inclusion of a transaction in a block and the same being agreed upon by participating peers in a consensus protocol.
(a) Client-server paradigm, centralized databases and guaranteed confirmations
Let us take the example of working with a Pet Store on REST APIs, in the classic server-client paradigm.
Request to server: POST https://petstore.swagger.io/v2/pet
Response from server: 200 OK
Here the app receives a
HTTP POST request and returns back a confirmation with the HTTP status code set to 200. The UI usually reflects the same back to the user within a few seconds of delay. Behind the scenes, the backend server, storage, database and other services that make up the PetStore App coordinate on a
HTTP POST request to create a new entry against a pet.
In short, the database is centralized (belongs to PetStoreCo.) and operations on it can be confirmed without much delay and with no consensus involved.
(b) Peer-to-peer paradigm, decentralized and distributed databases and confirmations-on-consensus
When it comes to a decentralized database, and the blockchain protocol encapsulating it, there is no one central server or endpoint that can definitively confirm the append of data and an application should not update its UI or backend state unless a consensus has been reached among peers that participate in the network and propose new blocks.
This new paradigm of of waiting for consensus and confirmation of write operations, requires adaptation among application developers new to blockchain to move to an asynchronous callback, event-driven architecture.
If you wish to delve deeper into the life-cycle of a transaction on Ethereum, go through the following article on our blog.
BlockVigil Transaction Manager — Part 1: The Ethereum transaction life-cycle
Platforms providing support for decentralised application development, inevitably face the requirement of a management…
Asynchronous, Event-driven application architecture powered by EthVigil
So far we have released projects and code snippets that demonstrate the several ways you can compose such an architecture across different stacks and platforms — whether it be a command line application or a full-fledged web application. Go ahead and check out the implementation details to see the above proposed architecture in action.
Atlas Library System: A blockchain based hassle-free library rental system built around the concept of ERC20 tokens powered by EthVigil API. This was built by Aditya Vijaykumar (Twitter: @AdityaVijaykum4 ), one of our remote bootcamp graduates for the EthGlobal Hackmoney 2020 hackathon.
Adabdha: a web application for generating secure, auditable and verifiable movement passes. Restricted authorized vehicle passes issued in a centralized, opaque manner during COVID-19 lockdowns was the motivation behind us proposing a decentralized protocol for the same.
EIP-712 compliant signing of messages
Reach out to us
- Join our discord server. This is where we can be found most of the time and is the best place for technical discussions. Want to discuss blockchain protocols? Facing issues or doubts about integrating our APIs into a blockchain app? Shoot us a message!
- You can raise Issues on our github repos if you face trouble using our CLI or following any of the API usage examples.
- Join our twitter to get updates on our latest code releases, development guides, upcoming meetups and webinars.
- Any other questions? Email us at firstname.lastname@example.org
- Don’t forget to sign up for your EthVigil Beta account at https://beta.ethvigil.com (Docs: ethvigil.com/docs)
If you are not aware yet of what EthVigil aims to achieve for Ethereum, we recommend reading our very first introductory article.
EthVigil — API gateway for Ethereum
EthVigil is an offering from a broader vision of our project named BlockVigil that aims to provide a familiar interface…
TL:DR; We bring you HTTP APIs to interact with the Ethereum chain without worrying about
- synchronizing with the chain and other infrastructural concerns
- gas estimation for transactions and transaction fees
- nonce correction
- chain reorganization
…and quite a few other protocol dependent primitives. Visit our publication page on Medium to read more articles.