Skip to content

Commit 9330504

Browse files
author
Ramesh Tamilselvan
committed
feat: initial commit — Rust SDK
Signed-off-by: Aethelred Team <team@aethelred.io>
0 parents  commit 9330504

28 files changed

Lines changed: 12257 additions & 0 deletions

Cargo.lock

Lines changed: 2662 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
[package]
2+
name = "aethelred-sdk"
3+
version = "1.0.0"
4+
edition = "2021"
5+
rust-version = "1.75"
6+
authors = ["Aethelred Team <developers@aethelred.org>"]
7+
description = "Official Rust SDK for Aethelred AI Blockchain"
8+
license = "Apache-2.0"
9+
repository = "https://github.com/AethelredFoundation/AethelredMVP"
10+
homepage = "https://github.com/AethelredFoundation/AethelredMVP/tree/main/sdk/rust"
11+
documentation = "https://github.com/AethelredFoundation/AethelredMVP/tree/main/sdk/rust#readme"
12+
readme = "README.md"
13+
keywords = ["aethelred", "blockchain", "ai", "cryptography", "sdk"]
14+
categories = ["cryptography", "api-bindings", "web-programming"]
15+
16+
[dependencies]
17+
# Async runtime
18+
tokio = { version = "1.35", features = ["full"] }
19+
async-trait = "0.1"
20+
futures = "0.3"
21+
22+
# HTTP client
23+
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
24+
25+
# Serialization
26+
serde = { version = "1.0", features = ["derive"] }
27+
serde_json = "1.0"
28+
29+
# Error handling
30+
thiserror = "1.0"
31+
anyhow = "1.0"
32+
33+
# Cryptography
34+
sha2 = "0.10"
35+
hex = "0.4"
36+
base64 = "0.21"
37+
38+
# Logging
39+
tracing = "0.1"
40+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
41+
42+
# Time
43+
chrono = { version = "0.4", features = ["serde"] }
44+
45+
# Utils
46+
url = "2.5"
47+
derive_builder = "0.12"
48+
rand = "0.8"
49+
num_cpus = "1.17"
50+
51+
[dev-dependencies]
52+
tokio-test = "0.4"
53+
wiremock = "0.5"
54+
pretty_assertions = "1.4"
55+
56+
[features]
57+
default = ["rustls"]
58+
rustls = ["reqwest/rustls-tls"]
59+
native-tls = ["reqwest/native-tls"]
60+
pqc = []
61+
wasm = [
62+
"wasm-bindgen",
63+
"wasm-bindgen-futures",
64+
"serde-wasm-bindgen",
65+
"js-sys",
66+
"web-sys",
67+
"console_error_panic_hook",
68+
"getrandom/js",
69+
]
70+
distributed = []
71+
quantize = []
72+
gpu = []
73+
full-sdk = []
74+
75+
# WASM dependencies (only included when wasm feature is enabled)
76+
[target.'cfg(target_arch = "wasm32")'.dependencies]
77+
wasm-bindgen = { version = "0.2", optional = true }
78+
wasm-bindgen-futures = { version = "0.4", optional = true }
79+
serde-wasm-bindgen = { version = "0.6", optional = true }
80+
js-sys = { version = "0.3", optional = true }
81+
web-sys = { version = "0.3", optional = true, features = [
82+
"console",
83+
"Window",
84+
"Request",
85+
"RequestInit",
86+
"RequestMode",
87+
"Response",
88+
"Headers",
89+
] }
90+
console_error_panic_hook = { version = "0.1", optional = true }
91+
getrandom = { version = "0.2", features = ["js"] }
92+
93+
[lib]
94+
crate-type = ["cdylib", "rlib"]
95+
96+
[package.metadata.docs.rs]
97+
all-features = false
98+
features = ["rustls"]
99+
rustdoc-args = ["--cfg", "docsrs"]
100+
101+
[[example]]
102+
name = "submit_job"
103+
path = "examples/submit_job.rs"
104+
105+
[[example]]
106+
name = "verify_seal"
107+
path = "examples/verify_seal.rs"

LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Apache License 2.0
2+
SPDX-License-Identifier: Apache-2.0
3+
4+
Copyright (c) 2026 Aethelred Foundation
5+
6+
This SDK package is licensed under the Apache License, Version 2.0.
7+
You may obtain a copy of the license at:
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<h1 align="center">aethelred-sdk-rs</h1>
2+
3+
<p align="center">
4+
<strong>Official Rust SDK for the Aethelred blockchain</strong>
5+
</p>
6+
7+
<p align="center">
8+
<a href="https://crates.io/crates/aethelred"><img src="https://img.shields.io/crates/v/aethelred?style=flat-square&logo=rust" alt="crates.io"></a>
9+
<a href="https://docs.rs/aethelred"><img src="https://img.shields.io/docsrs/aethelred?style=flat-square" alt="docs.rs"></a>
10+
<a href="https://github.com/aethelred/aethelred-sdk-rs/actions"><img src="https://img.shields.io/github/actions/workflow/status/aethelred/aethelred-sdk-rs/rs-ci.yml?style=flat-square&label=CI" alt="CI"></a>
11+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License"></a>
12+
</p>
13+
14+
---
15+
16+
## Install
17+
18+
```toml
19+
# Cargo.toml
20+
[dependencies]
21+
aethelred = "0.1"
22+
tokio = { version = "1", features = ["full"] }
23+
```
24+
25+
## Quick Start
26+
27+
```rust
28+
use aethelred::{AethelredClient, Wallet, pouw::SubmitJobRequest};
29+
30+
#[tokio::main]
31+
async fn main() -> anyhow::Result<()> {
32+
// Connect to testnet
33+
let client = AethelredClient::connect("https://rpc.testnet.aethelred.io").await?;
34+
35+
// Load wallet
36+
let wallet = Wallet::from_mnemonic("your twelve word mnemonic...")?;
37+
38+
// Submit an AI compute job
39+
let job = client.pouw().submit_job(SubmitJobRequest {
40+
model_hash: hex::decode("abc123...")?,
41+
input_data: b"{\"prompt\":\"Hello AI\"}".to_vec(),
42+
verification_type: "hybrid".into(),
43+
priority: "standard".into(),
44+
signer: wallet.clone(),
45+
}).await?;
46+
47+
println!("Job submitted: {}", job.job_id);
48+
49+
// Wait for and verify the seal
50+
let seal = client.seal().await_seal_by_job(&job.job_id).await?;
51+
println!("Output hash: {}", hex::encode(&seal.output_hash));
52+
println!("Agreement: {}/{}", seal.agreement_power, seal.total_power);
53+
54+
Ok(())
55+
}
56+
```
57+
58+
## Features
59+
60+
```toml
61+
[dependencies]
62+
aethelred = { version = "0.1", features = [
63+
"pouw", # PoUW module client
64+
"seal", # Digital Seal queries
65+
"verify", # ZK proof utilities
66+
"bridge", # Ethereum bridge
67+
"tls", # TLS support
68+
"wasm", # WASM target support
69+
]}
70+
```
71+
72+
Full API docs: [docs.rs/aethelred](https://docs.rs/aethelred)
73+
74+
---
75+
76+
## Development
77+
78+
```bash
79+
cargo build
80+
cargo test
81+
cargo clippy -- -D warnings
82+
cargo fmt --check
83+
```

examples/submit_job.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("submit_job example placeholder; wire to network client in integration environments.");
3+
}

examples/verify_seal.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
println!(
3+
"verify_seal example placeholder; wire to network client in integration environments."
4+
);
5+
}

0 commit comments

Comments
 (0)