One of the primary advantages of the EOSIO blockchain platform is in empowering the development of usable, scalable, and flexible decentralized applications. To that end, we at Block.one are excited to announce Demux, a new open-source development tool for the EOSIO community that simplifies complex DAPP development.
Demux draws inspiration from Facebook’s Flux Architecture pattern and Redux, creating a back-end infrastructure pattern for sourcing blockchain events in order to deterministically update queryable databases for applications built on the EOSIO blockchain.
This suggested architecture allows application developers to use traditional Mongo or Postgres SQL databases in a way that means the data stored in them is still verifiable by the blockchain. This enables the best of both worlds: the flexibility and speed of traditional databases, coupled with the trust and immutable properties of a blockchain.
Storing and retrieving indexed data is something that developers have commonly utilized for decades. The ability to search, sort, filter etc. are all easily done in traditional database environments, but is something that is missed when working directly with the inherently limited query interface of blockchain nodes.
When building more complex DAPPs, you run into a few problems when retrieving data directly from the blockchain:
- The query interface used to retrieve the indexed data is limited. Complex data requirements can mean you either have to make an excess number of queries and process the data in your DAPP, or you must store additional sorted data on the blockchain itself.
- Additionally, scaling your query load means requiring more blockchain endpoint nodes, which can be expensive.
Demux solves these problems by off-loading storage and queries to your preferred database (MongoDB, Postgres etc). As blockchain events happen, your chosen database is updated by Updater functions, which deterministically process an array of Action objects. The database can then be queried by your front-end DAPP through a suitable API (for example, REST or GraphQL), reducing the amount of direct interaction with the blockchain in order to retrieve data for your application. This also can help developers to limit the amount of data that needs to be stored in RAM, lowering applications’ operating costs whilst also improving their architectural efficiency.
The full details of the release can be viewed on the official GitHub repository. The example library demux-js serves as a reference NodeJS implementation of Demux architecture.
Developer Relations will continue to bring you updates highlighting the features our development teams at Block.one are working on to improve the developer experience on EOSIO. As always, stay tuned for more updates by following EOSIO on our social channels and be sure to subscribe to our mailing list on the EOSIO Developer Portal.
Block.one Developer Relations
All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Important Note: All material is provided subject to this important notice and you must familiarize yourself with its terms. The notice contains important information, limitations, and restrictions relating to our software, publications, trademarks, third-party resources and forward-looking statements. By accessing any of our material, you accept and agree to the terms of the notice.