Looking for the easiest way to build blockchain data pipelines? If so, you’re precisely where you need to be. In today’s guide, we’ll introduce you to Moralis’ Streams API – the #1 tool for setting up Web3 data pipelines for any use case. Monitor wallets, token transfers, or any other custom event at the click of a button. If you’re eager to get going, here’s a quick breakdown of how you can build data pipelines with Moralis:
- Step 1 – Sign up for free with Moralis:
- Step 2 – Go to the ”Streams” tab, click the ”+ Create Stream” button, and follow the steps:
- Step 3 – Watch the data flow in:
That’s it. Setting up a Web3 data pipeline doesn’t have to be more challenging than that. However, if you’re looking for a more detailed breakdown, please check out our official Streams API documentation page, watch the video down below, or join us throughout this guide:
Also, if you wish to build blockchain data pipelines yourself, don’t forget to sign up with Moralis. You can set up an account free of charge, and you’ll be able to start building Web3 projects faster and more efficiently today!
Overview
Blockchain data pipelines are the backbone of the Web3 industry, playing an essential role in the development of decentralized applications (dapps). Yet, setting up Web3 data pipelines from scratch can be a tricky and time-consuming endeavor, involving many redundant tasks. As such, there has to be a better way, right?
Fortunately, you can avoid the complexities of setting up the underlying infrastructure required to run and maintain Web3 pipelines with a data provider like Moralis. But what exactly is Moralis? And how can you use our premier tools to build blockchain data pipelines? To find the answers to these questions, join us in this guide. Let’s dive straight in!
What are Web3 Data Pipelines?
Put simply, Web3 data pipelines – also commonly referred to as blockchain data pipelines – are pieces of infrastructure designed to collect, ingest, transform, and deliver data from networks like Ethereum to dapps and databases.
Blockchain data pipelines are crucial for businesses and organizations that depend on a continuous and efficient flow of real-time information, making them fundamental in developing a wide range of dapps. This includes everything from crypto wallets to decentralized exchanges (DEXs), underscoring the importance of pipelines in the growing Web3 industry.
How Do Web3 Data Pipelines Work?
Similar to how water pipelines carry water from a reservoir to your home’s faucets, a Web3 data pipeline transports data from a collection point to a database. Essentially, a Web3 data pipeline retrieves information from a blockchain, indexes and modifies it, and then stores it in a designated location.
The above process can be divided into three core steps:
- Data Collection & Ingestion: Data is collected from various sources – either off- or on-chain – and then gets ingested into the pipeline.
- Data Processing: During this stage, the data undergoes processing, which may include formatting, filtering, and applying transformations. These operations prepare it for effective storage and insightful analysis.
- Storage & Analysis: Finally, the processed data is stored in a location suited to the requirements of the Web3 project, which could range from traditional databases to cloud storage solutions. The choice of storage often depends on the need for security, scalability, and data accessibility.
That’s an overview of how Web3 data pipelines work. In reality, these steps may be somewhat more complicated and can vary depending on your organization’s needs!
Exploring the Benefits of Blockchain Data Pipelines
Data pipelines are crucial for the blockchain industry, offering numerous advantages for Web3 developers and end users alike. Below are four key benefits:
- Real-Time Insights: Web3 data pipelines deliver real-time information, empowering dapp users to derive insights quickly and make informed decisions on the fly.
- Efficiency: By automating the flow of Web3 data, blockchain data pipelines decrease the need for manual intervention and significantly reduce the likelihood of errors.
- Cost-Effectiveness: Automating and optimizing data processing reduces manual labor, improves resource utilization, and decreases error rates, leading to significant cost savings.
- Data Quality: Data pipelines ensure high standards of data quality through meticulous cleansing and formatting steps, ensuring the accuracy and reliability of the data provided.
The Challenge of Building Web3 Data Pipelines
While blockchain data pipelines are essential for Web3 development setting them up can be quite a challenge. Building the required infrastructure to query, process, and analyze blockchain data is both a tedious and expensive endeavor!
Creating Web3 data pipelines from scratch involves several intricate steps. These include establishing a high-performance backfill system, implementing reliable data ingestion mechanisms, and incorporating measures to deal with blockchain reorgs. In addition, you continuously need to check for data completeness. These tasks are time-consuming and divert resources from more strategic activities, such as enhancing product features and crafting engaging user experiences for your dapps.
Fortunately, it’s now possible to circumvent the associated challenges using a Web3 infrastructure provider like Moralis. But what exactly is Moralis? And how can you utilize our industry-leading services to build Web3 data pipelines efficiently?
Introducing Moralis – The Easiest Way to Build Web3 Data Pipelines
Moralis is Web3’s premier data provider, and in our suite of industry-leading development tools, you’ll find nodes for all major chains and ten+ use case-specific APIs. With these resources at your disposal, you can build everything from cryptocurrency wallets to DEXs without breaking a sweat!
But what makes Moralis the industry’s leading Web3 data provider?
- Comprehensive & Simple: All our APIs are designed with the outcome in mind, minimizing the requests you need to build dapps. With single endpoints, you get data from multiple off- and on-chain sources, allowing you to tap into a more seamless developer experience.
- Cross-Chain: Moralis APIs are fully cross-chain compatible, supporting all major networks, including Ethereum, Polygon, BSC, etc. As such, when building with Moralis, you don’t have to bother with a new provider for every chain you interact with.
- Secure: Experience the gold standard of enterprise-grade security with Moralis. We are the only SOC 2 Type 2 certified Web3 infra provider, highlighting our dedication to protecting your data.
In our suite of comprehensive, cross-chain and secure Web3 APIs, you’ll find the Streams API – the ultimate tool for anyone looking to build blockchain data pipelines. But what exactly is the Streams API? And how does it work? Join us as we explore the intricacies of this industry-leading tool below!
The Streams API – Set Up Web3 Data Pipelines with Ease
Our Streams API is the ultimate tool for building blockchain data pipelines. With this industry-leading interface, you can effortlessly set up your own streams at the click of a few buttons. In return, you’ll get instant, fully customizable updates about important on-chain events sent directly to the backend of your projects via Web3 webhooks!
The Streams API is a comprehensive solution, supporting over 44 million contracts and counting across all major chains, including Ethereum, Polygon, BSC, and many others. We also cover all events, ERC-20s, NFTs, wallets, smart contracts, and more, making it a versatile tool for various blockchain applications.
But what makes the Streams API the ultimate tool for setting up Web3 data pipelines?
To answer the above question, let’s explore four benefits of the Streams API:
- Truly Cross-Chain: Moralis’ Streams API supports 20+ chains, including Ethereum, Polygon, BSC, etc. Moreover, this leading-edge tool enables you to seamlessly monitor multiple chains through a single data pipeline.
- Full Data Source Coverage: The Streams API supports all types of data sources, meaning you can monitor any event, wallet, or smart contract.
- Enriched Data: The webhooks returned by the Streams API are enriched with data, including token decimals, address labels, wallet balances, etc., giving you Web3’s most comprehensive responses.
- Highly Dynamic: The Streams API is the industry’s most dynamic and customizable tool for real-time blockchain data. Set up Web3 data pipelines for any custom use case you can imagine.
- Built to Scale: The Streams API offers unmatched scalability, allowing you to listen to everything from one to 100+ million addresses with a single Web3 data pipeline.
Nevertheless, that gives you an overview of the Streams API. In the next section, we’ll show you how you can use this premier tool to set up your own blockchain data pipelines!
Tutorial: How to Set Up Blockchain Data Pipelines Using Moralis
With Moralis’ Streams API, you can now set up customized Web3 data pipelines without breaking a sweat. And to show you how this works, we’ll now walk you through a comprehensive tutorial on how to monitor USDC transactions in eight short steps:
- Step 1 – Sign up for free with Moralis, go to the ”Streams” tab, and click ”+ Create Stream”:
- Step 2 – Give your stream a name and select the type of events you want to monitor. For this tutorial, we’ll choose ”Contract Events”:
- Step 3 – Pick the specific events you wish to track. We’ll go for ”Common Events” and then select ”Token Transfers”:
- Step 4 – Set a tag for your stream and select other information you’d like to be included in the responses:
- Step 5 – Add the address you want to track. In our case, we’ll simply add the USDC contract address. However, you can include more than one if you want to track multiple contracts simultaneously:
- Step 6 – Specify the chain(s) you want to monitor. In this case, we’ll choose Ethereum, but feel free to pick any blockchain(s) you desire:
- Step 7 – Test your stream to make sure everything works as intended (optional):
- Step 8 – Specify a webhook URL, hit the ”Continue” button, get a test webhook, and click ”Save & Deploy”:
That’s it. Setting up blockchain data pipelines doesn’t have to be more challenging than that when using Moralis. In turn, you’ll now receive an update sent directly to your webhook destination as soon as there is a new USDC transfer. Here’s an example of what the response might look like:
//... { transactionHash: '0x1a3807aa7f7d1f4806245115d7b8a32ec105ce20f2b4a8ca31f9a305127c0201', logIndex: '409', contract: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', triggered_by: [Array], from: '0x47fbac3d17dcd481c3bb428adde4272b458cf724', to: '0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8', value: '5187003613', tokenName: 'USD Coin', tokenSymbol: 'USDC', tokenDecimals: '6', valueWithDecimals: '5187.003613', possibleSpam: false }, /...
Web3 Data Pipelines Use Cases
Now that we have explored the fundamentals of Web3 data pipelines and the process of building them using Moralis let’s examine three critical use cases:
- In-App Alerts: Web3 data pipelines enable the integration of real-time alerts and notifications within your dapps, providing users with immediate updates on critical blockchain events such as price fluctuations, token transfers, and more. As such, the Streams API is an excellent tool for boosting user engagement and retention in your dapps.
- Populating Databases: Blockchain data pipelines facilitate the automatic monitoring, indexing, and storage of blockchain events directly into your databases. This ensures that your project retains a precise historical record of blockchain activities related to specific addresses, wallets, or contracts.
- Real-Time Token Balances: With a Web3 data pipeline, you can seamlessly track, update, and display your users’ balances within your projects. Access up-to-date and real-time information on asset holdings, ensuring accurate wallet insights.
The use cases above are only a few examples. With a versatile tool like the Streams API, you can configure Web3 data pipelines to cater to virtually any scenario you can imagine!
Beyond Web3 Data Pipelines – Diving Deeper Into Moralis’ API Suite
In addition to the Streams API, Moralis offers a variety of other resources, making Web3 development a breeze. In our suite of tools, you’ll find nodes for all major chains and ten+ APIs, including the Wallet API, Token API, NFT API, etc. As such, when using Moralis, you get the resources you need to build everything from cryptocurrency wallets to DEXs without breaking a sweat!
To highlight the benefits of working with Moralis further, we’ll now introduce you to three additional Web3 APIs:
- Wallet API
- Token API
- NFT API
However, if you’d like to explore all our interfaces, please visit our official Web3 API page for more information!
Wallet API
Moralis’ Wallet API is the go-to tool for anyone looking to build cryptocurrency wallets or integrate wallet functionality into their dapps. With one line of code, you can use this premier interface to fetch a wallet’s history, token balances, net worth, profitability, and much more!
To highlight the accessibility of the Wallet API, we’ll now take a look at a short script for fetching a wallet’s history:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch( 'https://deep-index.moralis.io/api/v2.2/wallets/0xd06Ffc9107649344e7AB9182B685071163276BE8/history?chain=eth&order=DESC', options ) .then((response) => response.json()) .then((response) => console.log(response)) .catch((err) => console.error(err));
Simply replace YOUR_API_KEY
with your Moralis API key and configure the parameters to fit your query. In return for executing the script, you’ll get a comprehensive response containing the wallet’s history, complete with automatic category tags, address labels, summaries, and more for each event:
{ //... "result": [ { "hash": "0xcee9d47cb827d792f7a25b216e32adad475eac490da40a805cef7554ab7eb308", "nonce": "6037420", "transaction_index": "64", "from_address": "0xddfabcdc4d8ffc6d5beaf154f18b778f892a0740", "from_address_label": "Coinbase 3", "to_address": "0xd06ffc9107649344e7ab9182b685071163276be8", "to_address_label": null, "value": "449953580000000000", "gas": "21000", "gas_price": "311257923036", "receipt_cumulative_gas_used": "7730854", "receipt_gas_used": "21000", "receipt_status": "1", "block_timestamp": "2022-05-11T13:35:40.000Z", "block_number": "14755151", "block_hash": "0x181942955a0fda682b60cad5d2e9ee76f31fcf6349d7653e0b17ccf948bca758", "nft_transfers": [], "erc20_transfers": [], "method_label": null, "native_transfers": [ { "from_address": "0xddfabcdc4d8ffc6d5beaf154f18b778f892a0740", "from_address_label": "Coinbase 3", "to_address": "0xd06ffc9107649344e7ab9182b685071163276be8", "to_address_label": null, "value": "449953580000000000", "value_formatted": "0.44995358", "direction": "receive", "internal_transaction": false, "token_symbol": "ETH", "token_logo": "https://cdn.moralis.io/eth/0x.png" } ], "summary": "Received 0.45 ETH from 0xdd...0740", "possible_spam": false, "category": "receive" }, //... ], }
Token API
The Token API is the ultimate tool for ERC-20 data, allowing you to streamline token data integration for your dapps without breaking a sweat. With just one single endpoint, you can get token balances, metadata, prices, and much more!
To demo the power of the Token API, let’s look at our endpoint for fetching a wallet’s token balances with prices:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/tokens?chain=eth', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Just replace YOUR_API_KEY
, configure the query parameters, and run the script. In return, you’ll get an array of all tokens held by the wallet in question, along with prices. Here’s an example of what it might look like:
{ //... "result": [ { "token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "symbol": "USDC", "name": "USD Coin", "logo": "https://cdn.moralis.io/eth/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png", "thumbnail": "https://cdn.moralis.io/eth/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_thumb.png", "decimals": 6, "balance": "4553447", "possible_spam": false, "verified_contract": true, "balance_formatted": "4.553447", "usd_price": 1.001818879776249, "usd_price_24hr_percent_change": 0.1818879776249283, "usd_price_24hr_usd_change": 0.0018221880998897314, "usd_value": 4.561729172660522, "usd_value_24hr_usd_change": 0.008297236936878599, "native_token": false, "portfolio_percentage": 100 }, //... ] }
NFT API
The NFT API is Web3’s #1 tool for NFT data, making NFT-based dapp development a breeze. With this premier interface, you can seamlessly get NFT balances, prices, up-to-date metadata, and much more with single lines of code!
To highlight the accessibility of the NFT API, we’ll now show you how to fetch the metadata of any NFT:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://deep-index.moralis.io/api/v2.2/nft/0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB/1?chain=eth', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Simply replace YOUR_API_KEY
with your Moralis key, configure the query parameters, and run the code. In return, you’ll get the metadata of the NFT specified in the request. Here’s what it might look like:
{ amount: '1', token_id: '1', token_address: '0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb', contract_type: 'CRYPTOPUNKS', owner_of: '0xffa914c83d851b9fe372e4ba6a6e131373aa16ab', last_metadata_sync: '2024-05-10T08:06:07.736Z', last_token_uri_sync: '2024-05-10T08:06:07.440Z', metadata: '{"image":"https://www.larvalabs.com/cryptopunks/cryptopunk001.png","name":"CryptoPunk 001","attributes":["Smile","Mohawk"],"description":"Male"}', block_number: '16079985', block_number_minted: null, name: 'CRYPTOPUNKS', symbol: 'Ͼ', token_hash: 'a99d02058e62e327e79aabd57e0b88a3', token_uri: 'Invalid uri', minter_address: null, verified_collection: true, possible_spam: false, collection_logo: 'https://i.seadn.io/gae/BdxvLseXcfl57BiuQcQYdJ64v-aI8din7WPk0Pgo3qQFhAUH-B6i-dCqqc_mCkRIzULmwzwecnohLhrcH8A9mpWIZqA7ygc52Sr81hE?w=500&auto=format', collection_banner_image: 'https://i.seadn.io/gae/48oVuDyfe_xhs24BC2TTVcaYCX7rrU5mpuQLyTgRDbKHj2PtzKZsQ5qC3xTH4ar34wwAXxEKH8uUDPAGffbg7boeGYqX6op5vBDcbA?w=500&auto=format' }
Summary: Web3 Data Pipelines – How to Build Blockchain Data Pipelines
Blockchain data pipelines are essential for the Web3 industry, supplying real-time data to dapps and databases. However, building blockchain data pipelines from scratch can take a lot of work. Fortunately, you can now avoid all the associated redundancies with Moralis!
Moralis’ Streams API is the #1 tool for building blockchain data pipelines. With this industry-leading interface, you can monitor wallets, tokens, smart contracts, and much more without breaking a sweat!
Moreover, the Streams API is truly cross-chain compatible, features full data source coverage, is highly flexible, and is built to scale with your projects, making it Web3’s premier tool for building blockchain data pipelines. However, if you’d like to learn more about what makes this tool stand out among the competition, check out our Alchemy Pipelines article.
And the best part? If you’re eager to set up Web3 data pipelines yourself, signing up with Moralis is a no-brainer. You can create an account for free, instantly unlocking the power of our Streams API!