Today we’re embarking on our mission to make Arweave friendlier for rustaceans (🦀), starting with the arbundles SDK (ANS-104 dataitems), a bundling client, and a near-term rustification roadmap.
The problem
The problem is, if you try to find an actively maintained Arweave Rust SDK (either as an Arweave SDK or a bundling/ANS-140 client), the most recently updated repositories are over 1 year old. Or, even funnier, the most used bundling Rust SDK is developed by a team that left the ecosystem to build a competitor-positioned network against Arweave.
As developers with Rust as primarily stack we were facing 2 main issues:
- Using old unmaintained SDKs
- Using an SDK maintained by an ex-Arweave eco team
We don’t like either option. And, the lack of client diversity in any decentralized network adds a deplatforming risk for a given set of users (in our case, Rusteceans).
As a team that deals mainly in Rust, we’re taking up the torch and are committed to bring Arweave Rust development back into the core ecosystem.
Introducing bundles-rs
Until today, we’ve relied on these unmaintained SDKs in our core stack – even the Reth EVM client. We decided it’s better to defuse this ticking bomb and contribute to the Arweave ecosystem by actively maintaining the rusty part. Therefore, today we are introducing bundles-rs v0.1.1, an ANS-104 client to create, manage, verify and upload Arweave dataitems.
At the time of writing this blog post, bundles-rs is still under development and will most probably face breaking changes before reaching stable release in v1.0.0. However, it can be used today for the ANS-104 utilities!
use bundles_rs::{
ans104::{data_item::DataItem, tags::Tag},
crypto::ethereum::EthereumSigner,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// create a signer
let signer = EthereumSigner::random()?;
// create tags (metadata)
let tags = vec![
Tag::new("Content-Type", "text/plain"),
Tag::new("App-Name", "Load-Network"),
];
// create and sign a dataitem
let data = b"Hello World Arweave!".to_vec();
// first None for Target and the second for Anchor
// let target = [0u8; 32]; -- 32-byte target address
// let anchor = b"unique-anchor".to_vec(); -- max 32 bytes
let item = DataItem::build_and_sign(&signer, None, None, tags, data)?;
// get the dataitem id
let id = item.arweave_id();
println!("dataitem id: {}", id);
// serialize for upload
let bytes = item.to_bytes()?;
println!("Ready to upload {} bytes", bytes.len());
// upload to Turbo
Ok(())
}
bundles-rs supports Arweave, Ethereum, Solana and Ed25519Core signers, and is developed on the ANS-104 protocol specification as-is. And while v0.1.1 does not have a bundler crate yet, it is possible to use Turbo over HTTP to post dataitems created with bundles-rs to Arweave.
use reqwest::Client;
async fn upload_to_turbo(item: &DataItem) -> Result<String, Box<dyn std::error::Error>> {
let client = Client::new();
let bytes = item.to_bytes()?;
let response = client
.post("https://turbo.ardrive.io/tx/solana")
.header("Content-Type", "application/octet-stream")
.body(bytes)
.send()
.await?;
if response.status().is_success() {
let tx_id = response.text().await?;
Ok(tx_id)
} else {
Err(format!("Upload failed: {}", response.status()).into())
}
}
Long story short, despite the pre-stable release status, it’s possible to use bundles-rs to create, manage, verify, and post dataitems to Arweave bundling services.
For more examples, check out the repository.
What’s next?
The roadmap is pretty simple. As the most Rust-heavy team in the eco, we plan to contribute to the Arweave Rust ecosystem by shipping the whole client stack.
Starting with bundles-rs and its ANS-104 utilities, then adding it to the bundlers crate and going to the deepest linked dependency in the Arweave rust stack, developing Rust based SDK to interact with the Arweave network, and ao-hyperbeam.