rust-bitcoin / rust-bitcoincore-rpc

Rust RPC client library for the Bitcoin Core JSON-RPC API.
333 stars 245 forks source link

Transport(HttpResponseTooShort { actual: 0, needed: 12 }) #333

Closed Sotatek-VuNguyen2 closed 6 months ago

Sotatek-VuNguyen2 commented 6 months ago

Hi I am struggling with very simple code using public node. Currently use the 0.18.0 version

    let rpc_url = "http://198.154.93.110:8333/";

    let client = Client::new(
        rpc_url,
        Auth::None,
    )
    .unwrap();
    let info = client.get_blockchain_info().unwrap();
    println!("info {:?}", info);

Sadly I search but couldn't find the solution for this, tried to use different version but it keep getting different errors

RCasatta commented 6 months ago

Hi, what do you mean by public node?

Rpc port should not be exposed publicly

Sotatek-VuNguyen2 commented 6 months ago

@RCasatta I got from this link https://bitnodes.io/nodes/leaderboard/. I tried some others 3rd party like quicknode, etc but seem like it use https which is cause the error response 400. Then my only option is to run my own node ? that kinda hard for my mid range computer

RCasatta commented 6 months ago

You are connecting to the P2P port (8333 by default) while the RPC port is 8332 by default. But you can't access RPC on public nodes you need your own

Once synced bitcoind with pruning enabled doesn't require much resources

Sotatek-VuNguyen2 commented 6 months ago

Thanks, then I'll try to use my own node

Sotatek-MinhNguyen11 commented 6 months ago

@RCasatta i follow this link: https://github.com/ruanbekker/bitcoin-full-node-demo/blob/main/guides/setup_bitcoin_core.md, but i have this issue: Screenshot from 2024-04-04 17-51-37

RCasatta commented 6 months ago

Bitcoin core repo is https://github.com/bitcoin/bitcoin Or you can download binaries from https://bitcoincore.org/en/download/

Closing because we are off topic now