paint-brush
Creating Web3 Apps with Real-Time Blockchain Databy@datastax
474 reads
474 reads

Creating Web3 Apps with Real-Time Blockchain Data

by DataStaxMarch 20th, 2023
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

You can now stream real-time Ethereum blockchain data to your Web3 app with DataStax Astra Block - a queryable, enriched blockchain data service built on DataStax Astra DB.
featured image - Creating Web3 Apps with Real-Time Blockchain Data
DataStax HackerNoon profile picture


Since the introduction of DataStax Astra DB in 2019, we've had the privilege of working with developers who build innovative blockchain applications on Apache Cassandra®.


Astra DB is the DBaaS of choice for blockchain applications because of its unique combination of low latency at a global scale, massive data on any cloud, and serverless, pay-as-you-go pricing.


Over the past several years, we’ve also seen Web3 developers run into a host of problems managing blockchain data.


For single-block queries, reading from the blockchain is as simple as signing for a free node as a service and making a single RPC call with a library like Web3.js.


But as you try to run more advanced queries, like aggregations or log analysis, you’re forced to manage your own blockchain data and it gets super complicated quickly.


“Node-as-a-Service” gets expensive for applications that require massive amounts of remote procedure calls. You try to run your node, but it’s surprisingly difficult to keep a node in sync. If your node isn’t in sync, you can’t subscribe to new block headers. And you need to decode from hex into human-readable to process data for your application.


If your app needs additional related data, you need to either build your own indexing solution or subscribe to an indexing service, which can also get expensive with a ton of API calls. And while you might think the blockchain is immutable, blockchain reorgs happen and require you to build complex indexer logic.


Then you have to pick a datastore, but databases struggle with massive amounts of data, as you’ll see when you start working with logs and trace data. If you make it this far, you’ll need to evolve your data models to maintain the latency you need for queries.

Introducing Astra Block

We built the new Astra Block service to take these issues off of your plate so that it’s a lot easier to build applications with blockchain data. We’re excited to make it available to developers via invitation access as a free service!


Astra Block is a real-time blockchain data service that is always in sync with Ethereum and soon for Bitcoin, Polygon, Solana, Binance, and other blockchains.


You get decoded blockchain data updates streamed in a clean, human-readable format ready for your app to consume. You don’t need to run nodes or build batch ETL jobs.


This new data service is delivered within Astra DB, so there’s no additional setup or cost. And because it’s built on Astra–the serverless, database-as-a-service powered by Cassandra—you can autoscale from zero to massive, global scale while maintaining lightning-fast queries across terabytes of blockchain data.


Astra Block is also reorg-aware with a data model designed by Cassandra experts to deliver millisecond latency for advanced blockchain queries.


So it’s a lot easier for you to build applications that:

  • Display real-time NFT mints and transfers
  • Enable a block explorer using our now open-source template
  • Alerts for large USDC transfers via a Twitter bot




How does Astra Block work?

DataStax operates blockchain nodes for you. Whenever a new block is mined, Astra Block detects that event, processes it, enriches it, and saves it to a master copy of the chain that the system uses internally.


Your Astra Block account is kept up to date with our “master copy” via change data capture (CDC). Astra Block uses CDC for Astra DB to propagate change events to your Astra Block database for your dApps to work against. And even more, you get access to the same great capabilities of Astra DB, multi-cloud regions, private endpoints, IP access lists, Stargate APIs, Stargate APIs, and more.


Use Cases

Astra Block gives you a blockchain operational data store for use cases such as:


  • Blockchain processing offload - Rather than taxing the blockchain with reads and writes, you can use Astra Block as an operational database for all blockchain reads. You can continue to use the blockchain directly for writes such as consensus validations and transaction processing.


  • Multi-chain data analysis - You can build Bloomberg-style services or APIs for financial applications across multiple blockchains, or run machine-learning models against Astra Block as an operational data store.


  • Blockchain indexing -  Your service might need related data such as user, product, or pricing information.  Much of this data makes sense to index into and query from a real-time operational database.

    Try It Out

    You can request access to use Astra Block right now. You’ll be able to choose between a free or a pay-as-you-go tier. The free tier gives you a clone of the Ethereum blockchain with $25 in monthly free credits that cover up to 40 million read/write operations and 80 GB in storage. The pay-as-you-go plan adds streaming of Ethereum blockchain updates you can use in your applications.


    As part of the early access program, we can also give you a walkthrough of the data models and show you how you can add to them for additional data you’d like to use. We're excited to help you build and scale Web3 apps on the entire Ethereum data set faster than ever. Don't wait -- request your invite now!



Also published here.