Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CITGuru opened this issue Dec 14, 2023 · 6 comments
Open

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

CITGuru opened this issue Dec 14, 2023 · 6 comments

Comments

@CITGuru
Copy link

CITGuru commented Dec 14, 2023

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

@apoelstra
Copy link
Member

Is it an HTTPS URL?

@CITGuru
Copy link
Author

CITGuru commented Dec 14, 2023 via email

@apoelstra
Copy link
Member

Unfortunately this library doesn't support HTTPS right now because the underlying JSONRPC library (rust-jsonrpc) has only been recently updated to support a HTTPS-supporting backend (minreq).

We need to update our copy of rust-jsonrpc and enable the minreq feature on it.

@CITGuru
Copy link
Author

CITGuru commented Jan 29, 2024

@apoelstra is it something you need help with?

@mprakhov17
Copy link

Hello, do you have any updates on this ticket? It's weird that rust-bitcoincore-rpc can't work with HTTPS

@apoelstra
Copy link
Member

Bitcoin Core doesn't use HTTPS..

But anyway yes, now rust-jsonrpc has a minreq backend which supports HTTPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants