Skip to content

FuelLabs/data-systems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Fuel Data Systems

Official data streaming libraries and tools for the Fuel Network.

CI Coverage

📦 Crates   🐛 Report Bug   ✨ Request Feature

📝 About The Project

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.

🚀 Features

  • 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

⚡ Getting Started

  1. Add fuel-streams to your project:

    cargo add fuel-streams futures tokio
  2. Create a new Rust file (e.g., src/main.rs) with the following code to subscribe to new blocks:

    use fuel_streams::client::Client;
    use fuel_streams::types::FuelNetwork;
    use fuel_streams::stream::{Stream, StreamEncoder};
    use fuel_streams::blocks::Block;
    use futures::StreamExt;
    
    #[tokio::main]
    async fn main() -> Result<(), fuel_streams::Error> {
        let client = Client::connect(FuelNetwork::Mainnet).await?;
        let stream = fuel_streams::Stream::<Block>::new(&client).await;
    
        let mut subscription = stream.subscribe().await?;
        while let Some(entry) = subscription.next().await {
            let entry = entry.unwrap().clone();
            let block = Block::decode(entry).await;
            println!("Received block: {:?}", block);
        }
    
        Ok(())
    }
  3. Run your project:

    cargo run

This example connects to the Fuel Network's NATS server 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.

💪 Contributing

We welcome contributions to Fuel Streams! Please check our contributing guidelines for more information on how to get started.

📜 License

This project is licensed under the Apache-2.0 license. See LICENSE for more information.