Skip to content

Err(JsonRpc(Transport(SocketError(...)))) #262

Closed
@gd87429

Description

@gd87429

Trying to get basic sample code working with a public hosting provider (quicknode, getblock, etc).

Something like this works when connecting to my personal localhost, but doesn't when connecting to a 3rd party provider:

// let client = Client::new("http://127.0.0.1:8332", Auth::UserPass(...)).ok(); // works
let client = Client::new("https://btc.getblock.io/XXX/mainnet/", Auth::None).ok(); // doesn't work
client.get_blockchain_info().is_ok();

Gives the following:

Err(JsonRpc(Transport(SocketError(Os { code: 54, kind: ConnectionReset, message: "Connection reset by peer" }))))

Even tho this works for both quicknode & getblock.io (API key is correct in code and in curl):

curl --location --request POST 'https://btc.getblock.io/XXX/mainnet/' \
      --header 'Content-Type: application/json' \
      --data-raw '{"jsonrpc": "1.0",
  "method": "getblockchaininfo",
  "params": [],
  "id": ""}'

Any idea what I'm doing wrong in code?


tl&dr: Rust w/ localhost works, curl works, rust w/ 3rd-party doesn't work

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