Skip to content

JSON-RPC error: transport error: unexpected HTTP code: 400 #323

Open
@CITGuru

Description

@CITGuru

I keep getting this error when making RPC calls with this library.

pub async fn fetch_new_blocks() -> Result<(), Box<dyn Error>> {
    let rpc_url = "rpc_url";
    
    let client = Client::new(&rpc_url, Auth::None).expect("Failed to create client");
    let best_block_hash = client.get_best_block_hash()?;
    println!("best block hash: {}", best_block_hash);
    let current_height = client.get_block_count()?;
    println!("{}", current_height);
    Ok(())
}

Error:

JSON-RPC error: transport error: unexpected HTTP code: 400

PS: My RPC URL does not have a username and password. The URL contains a token for auth

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions