Rust
1
Create a new Rust project:
cargo new radius_quickstart
cd radius_quickstart
2
Add the following dependencies to your Cargo.toml
file:
[dependencies]
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", features = ["full"] }
serde_json = "1.0"
3
Replace the contents of src/main.rs
with the following code:
use reqwest::Client;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let url = "https://rpc.testnet.tryradi.us/<YOUR-RPC-ENDPOINT>";
let client = Client::new();
let response = client.post(url)
.json(&json!({
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}))
.send()
.await?;
let result: Value = response.json().await?;
println!("{}", result);
Ok(())
}
4
Run the code using the following command:
cargo run
Last updated
Was this helpful?