Crates.io | majin-blob |
lib.rs | majin-blob |
version | 0.1.3 |
source | src |
created_at | 2024-02-05 17:47:56.519637 |
updated_at | 2024-04-12 06:48:33.557025 |
description | Command line tool to play with Starknet blobs. |
homepage | |
repository | https://github.com/AbdelStark/majin-blob |
max_upload_size | |
id | 1127810 |
size | 14,531 |
Utility features to play with EIP-4844 blobs for Starknet usage.
You can use the CLI to recover the original data from a blob file and parse it into state diffs.
cargo install majin-blob
# Recover the original data from a blob file
majin-blob recover ./examples/blob/sn_blob_goerli.txt
majin-blob --help
Add the following to your Cargo.toml
:
[dependencies]
majin-blob-core = "0.1.0"
majin-blob-types = "0.1.0"
Then you can use the library as follows:
use majin_blob_core::blob;
use majin_blob_types::serde;
fn main() {
// Read the blob data from a file
let blob_data = serde::parse_file_to_blob_data("./examples/blob/sn_blob_goerli.txt");
// Recover the original data
let original_data = blob::recover(blob_data);
// Parse the original data into state diffs
let state_diffs = serde::parse_state_diffs(original_data.as_slice());
// Serialize the state diffs into JSON
let state_diffs_json = serde::to_json(state_diffs.as_slice());
println!("{}", state_diffs_json);
}
You can use the REST API to recover the original data from a blob file and parse it into state diffs.
cargo run --release -p majin-blob-rest-api
curl -X POST --data-binary "@./examples/blob/sn_blob_goerli.txt" http://127.0.0.1:3030/blob
This project is licensed under the MIT license.