bestinslot-xyz / OPI

Open Protocol Indexer, OPI, is the best-in-slot open-source indexing client for meta-protocols on Bitcoin.
Apache License 2.0
202 stars 110 forks source link

Ord 0.9.0 running service exception #2

Closed softwarecheng closed 10 months ago

softwarecheng commented 10 months ago

After compiling and installing ord, run:

export bitcoinDataDir="/var/lib/bitcoind" export bitcoinCookie="$bitcoinDataDir/regtest/.cookie" export ordDataDir="/var/lib/ord" export ordWalletName="ord"

ord --bitcoin-data-dir $bitcoinDataDir --cookie-file $bitcoinCookie --data-dir $ordDataDir --chain regtest --index-sats --enable-json-api server --http

Listening on http://0.0.0.0:80 cmd;0;new_block;0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 thread '' panicked at src/index/updater.rs:326:91: called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" } note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Another little question is that the ord in the project is 0.9.0. Compared with https://github.com/ordinals/ord/tree/0.9.0, it seems different. I don't know if I made a mistake.

samedcildir commented 10 months ago

ord version in the project is a slightly modified version of ord 0.9.0 which exports the db changes via files. We used this method instead of writing the whole ord from scratch since we want to work with the exact same rules as main ord wallet. The only changes in the ord code is these file export lines.

After ord finishes indexing some blocks, the main indexer script collects these files and updates the PostgreSQL DB accordingly.

If you run the ord in the project directly, it'll complain about the missing file since it is meant to be run from the main indexer script. I'll update the code to give a better warning when run directly.

To solve the issue, do not run ord directly, instead run the main indexer, which will run the ord indexer periodically.

softwarecheng commented 10 months ago

Thank you for your explanation. Inertial thinking made me think that I would use the server to complete it. While waiting, I made new discoveries that confirmed the logic of explanation(guess the data is obtained through the index command)

cd modules/main_index &&  node index.js
error: failed to connect to Bitcoin Core RPC at 127.0.0.1:8332/wallet/ord
because: I/O error: No such file or directory (os error 2)
ERROR ON ORD!!!
...

vi index.js(goto line 82):
let ord_index_cmd = ord_binary + " --bitcoin-data-dir " + chain_folder + " --data-dir " + ord_datadir + " --height-limit " + (ord_end_block_height) + " index run" 

In addition, if it is convenient, I hope that chain support can be added to env.

Finally, thank your team again for sharing, it's good job.

samedcildir commented 10 months ago

chain support is in our backlog and will be added with the next update 👍