Warning
This project is currently under development and is not yet ready for production use.
Fuel Data Systems is a comprehensive suite of libraries and tools designed to enable real-time data streaming and processing from the Fuel Network. This repository houses the official data streaming ecosystem, offering developers a powerful and flexible API to interact with Fuel Network data in real-time.
With Fuel Data Systems, developers can build sophisticated applications that leverage the full potential of the Fuel Network's data, from simple block explorers to complex analytics engines and trading systems.
- Real-time streaming of Fuel blockchain data
- Support for various Fuel-specific data types
- Customizable filters for targeted data retrieval
- Flexible delivery policies for historical and real-time data
- Seamless integration with other Fuel ecosystem tools
-
Add
fuel-streams
to your project:cargo add fuel-streams futures tokio
-
Create a new Rust file (e.g.,
src/main.rs
) with the following code to subscribe to new blocks:use fuel_streams::prelude::*; use futures::StreamExt; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { // Create a client and establish connection let mut client = Client::new(FuelNetwork::Local).await?; let mut connection = client.connect().await?; println!("Listening for blocks..."); // Create a subject for all blocks let subject = BlocksSubject::new(); // Subscribe to blocks with last delivery policy let mut stream = connection .subscribe::<Block>(subject, DeliverPolicy::Last) .await?; while let Some(block) = stream.next().await { println!("Received block: {:?}", block); } Ok(()) }
-
Run your project:
cargo run
This example connects to the Fuel Network and listens for new blocks. You can customize the data types or apply filters based on your specific requirements.
For advanced usage, including custom filters and delivery policies, refer to the fuel-streams
documentation.
We welcome contributions to Fuel Streams! Please check our contributing guidelines for more information on how to get started.
This project is licensed under the Apache-2.0
license. See LICENSE
for more information.