ordinals / ord

👁‍🗨 Rare and exotic sats
https://ordinals.com
Creative Commons Zero v1.0 Universal
3.84k stars 1.37k forks source link

Error: "JSON result had an unexpected structure" When Connecting Ord Wallet to Bitcoin Core RPC #3998

Closed AksharPrajapati03 closed 1 hour ago

AksharPrajapati03 commented 13 hours ago

Description:

I followed the installation guide to set up the Ord wallet on top of my Bitcoin Core node without Docker. Everything seems correctly configured, but I get the following error when I try to check the wallet balance:

Command:

./target/release/ord \
  --bitcoin-rpc-username=bitcoinuser \
  --bitcoin-rpc-password=strongpassword \
  --bitcoin-rpc-url=http://127.0.0.1:8332 wallet balance

error: Failed to connect to Bitcoin Core RPC at http://127.0.0.1:8332/wallet/ord: the JSON result had an unexpected structure

What I’ve Tried:

Verified Bitcoin Core is running: bitcoin-cli getblockchaininfo

Created the wallet: bitcoin-cli createwallet "ord"

Tested RPC manually:

curl --user bitcoinuser:strongpassword --data-binary \
'{"jsonrpc": "1.0", "id": "ord", "method": "getwalletinfo", "params": []}' \
-H 'content-type: text/plain;' http://127.0.0.1:8332/wallet/ord

Response:

{
  "result": { "walletname": "ord", "balance": 0.0 }, "error": null, "id": "ord"
}

Bitcoin Core Configuration (bitcoin.conf):

server=1
rpcuser=bitcoinuser
rpcpassword=strongpassword
rpcport=8332
txindex=1
wallet=ord

Question:

  1. What could be causing this "JSON result had an unexpected structure" error?
  2. Is there an issue with the RPC call or wallet integration?
so7ow commented 8 hours ago

Two thoughts:

AksharPrajapati03 commented 8 hours ago

Two thoughts:

  • you don't mention what versions of ord or bitcoin you are running. v28 of bitcoin has some issues.
  • that's not how you create an ord wallet. delete that one and use ord wallet create instead.

Thanks, @so7ow!

I confirmed that I'm using ord version 0.20.1. Regarding the sync status, here’s the output from bitcoin-cli -getinfo:

Chain: main  
Blocks: 103595  
Headers: 103595  
Verification progress: 41.0849%  
Difficulty: 65147121151.24176  

Network: in 8, out 10, total 18  
Version: 201  
Time offset (s): 0  
Proxies: n/a  
Min tx relay fee rate (BTC/kvB): 0.00001000  

Wallet: ord  
Keypool size: 4000  
Transaction fee rate (-paytxfee) (BTC/kvB): 0.00000000  

Balance: 0.00000000  
Warnings: (none)  

Since the verification progress is currently 41.08%, I assume this could be contributing to the issue. From what I understand, ord requires a fully synced Bitcoin node with txindex enabled to function correctly.

Could you please correct me if I'm wrong anywhere ?

And about ord wallet creation, I'm getting auth error.

ubuntu@Fractal-Bitcoin-Node:~/ord$ ord wallet create
error: Failed to connect to Bitcoin Core RPC at `127.0.0.1:8332/`:  the JSON result had an unexpected structure
so7ow commented 8 hours ago

Yes, a fully synced (and indexed) node is required but a non-synced node is not the reason that ord is producing the error you're seeing. As you finally revealed in your last command snippet there, it's because you're using Fractal, not Bitcoin Core.

AksharPrajapati03 commented 7 hours ago

Yes, a fully synced (and indexed) node is required but a non-synced node is not the reason that ord is producing the error you're seeing. As you finally revealed in your last command snippet there, it's because you're using Fractal, not Bitcoin.

Okay, got it!

I’ve also tried the ord wallet from Fractal: https://github.com/fractal-bitcoin/ord

Currently, my server has two wallets: the ord wallet from Bitcoin and the one from Fractal Bitcoin. Do you recommend removing the Bitcoin one that I’ve been working with, or is there a better way to handle both wallets on the same server? Any suggestions would be appreciated!

so7ow commented 7 hours ago

My only advice would be to pick a direction, and get ord working on one node before confusing things and trying to run multiple instances at once. If it's Fractal, then go find Fractal's support offerings.

AksharPrajapati03 commented 7 hours ago

My only advice would be to pick a direction, and get ord working on one node before confusing things and trying to run multiple instances at once. If it's Fractal, then go find Fractal's support offerings.

Got your point. Thank you!

Currently I'm trying to install ord on fratcal bitcoin node. So I'll remove bitcoin core wallet and try with fractal one.