ordinals/ord

Implement own `Transport` with `Reqwest` for `bitcoincore_rpc`

Open

#2,707 opened on Nov 21, 2023

View on GitHub
 (6 comments) (1 reaction) (0 assignees)Rust (1,479 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (3,955 stars)
PR merge metrics
 (Avg merge 15d 21h) (5 merged PRs in 30d)

Description

❯ RUST_LOG=debug ./target/release/ord --chain testnet --bitcoin-rpc-user user --bitcoin-rpc-pass pass --rpc-url nd-111-222-333.p2pify.com:80 server
[2023-11-21T06:55:38Z INFO  ord::options] Connecting to Bitcoin Core at nd-111-222-333.p2pify.com:80/wallet/ord
[2023-11-21T06:55:38Z DEBUG bitcoincore_rpc] JSON-RPC request: getblockchaininfo []
[2023-11-21T06:55:38Z DEBUG bitcoincore_rpc] JSON-RPC failed parsing reply of getblockchaininfo: JsonRpc(Transport(HttpErrorCode(404)))
error: JSON-RPC error: transport error: unexpected HTTP code: 404

Whereas

❯ ./src/bitcoin-cli -rpcconnect=nd-111-222-333.p2pify.com -rpcport=80 -rpcuser=user -rpcpassword=pass getblockchaininfo
{
  "chain": "test",
  "blocks": 2539577,
  "headers": 2539577,
  ...
}

And

❯ curl --data-binary '{"jsonrpc": "1.0", "id": "1", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://user:pass@nd-111-222-333.p2pify.com/wallet/ord
{"result":{"chain":"test","blocks":2539577,"headers":2539577, ... },"error":null,"id":"1"}

After looking into the traffic it becomes apparent that ord is resolving the hostname to IP and then querying it instead of making a query using the provided hostname

CleanShot 2023-11-21 at 15 08 46@2x

Looks like something that should be fixed

Contributor guide