#blockchain #data-stream

fuel-streams-core

Core components for working with streams of Fuel blockchain data

13 releases

0.0.16 Dec 28, 2024
0.0.15 Dec 27, 2024
0.0.13 Nov 28, 2024
0.0.11 Oct 15, 2024
0.0.6 Aug 29, 2024

#50 in #cryptocurrencies

Download history 168/week @ 2024-09-21 43/week @ 2024-09-28 8/week @ 2024-10-05 125/week @ 2024-10-12 18/week @ 2024-10-19 2/week @ 2024-10-26 6/week @ 2024-11-02 1/week @ 2024-11-09 130/week @ 2024-11-16 170/week @ 2024-11-23 30/week @ 2024-11-30 28/week @ 2024-12-07 3/week @ 2024-12-14 172/week @ 2024-12-21 217/week @ 2024-12-28 2/week @ 2025-01-04

398 downloads per month
Used in 2 crates

Apache-2.0

270KB
5K SLoC


Logo

Fuel Streams Core

The core library for data streaming in the Fuel Data Systems project.

CI Coverage Crates.io MSRV crates.io docs

📚 Documentation   🐛 Report Bug   ✨ Request Feature

📝 About The Project

Fuel Streams Core is a library for building data streaming applications on the Fuel blockchain. It provides tools for efficient handling of real-time blockchain data, using NATS for scalable streaming and offering support for Fuel-specific data types.

[!NOTE] This crate is specifically modeled for the Fuel Data Systems project, and is not intended for general use outside of the project.

🛠️ Installing

Add this dependency to your Cargo.toml:

[dependencies]
fuel-streams-core = "*"

🚀 Usage

Here's a simple example to get you started with Fuel Streams Core:

use std::sync::Arc;
use fuel_streams_core::prelude::*;
use futures::StreamExt;

#[tokio::main]
async fn main() -> BoxedResult<()> {
    // Connect to NATS server
    let nats_opts = NatsClientOpts::admin_opts();
    let nats_client = NatsClient::connect(&nats_opts).await?;
    let storage_opts = S3StorageOpts::new(StorageEnv::Local, StorageRole::Admin);
    let storage = Arc::new(S3Storage::new(storage_opts).await?);

    // Create a stream for blocks
    let stream = Stream::<Block>::new(&nats_client, &storage).await;

    // Subscribe to the stream
    let wildcard = BlocksSubject::wildcard(None, None); // blocks.*.*
    let mut subscription = stream.subscribe(None).await?;

    // Process incoming blocks
    while let Some(block) = subscription.next().await {
        dbg!(block);
    }

    Ok(())
}

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

For more information on contributing, please see the CONTRIBUTING.md file in the root of the repository.

📜 License

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

Dependencies

~190MB
~3.5M SLoC