ion: Wallet file verification failure on npm run bitcoin

I’m following installation instruction to get a working testnet ION node. I have a single instance of bitcoind, mongodb and ipfs running and then I get this:

$ npm run build && npm run bitcoin

...

Collection 'transactions' found.
Sending jRPC request: id: 5mq6r6sfrah, method: createwallet
Wallet with name sidetreeDefaultWallet already exists.
Sending jRPC request: id: 3624m93nnhi, method: loadwallet
Sidetree-Bitcoin node initialization failed with error: {"stack":"Error: Unexpected fetch HTTP response: [500]: {\"result\":null,\"error\":{\"code\":-4,\"message\":\"Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another instance of Bitcoin Core?\\n\"},\"id\":\"3624m93nnhi\"}\n\n    at BitcoinClient.<anonymous> (/home/dr/ion/node_modules/@decentralized-identity/sidetree/dist/lib/bitcoin/BitcoinClient.js:815:27)\n    at Generator.next (<anonymous>)\n    at fulfilled (/home/dr/ion/node_modules/@decentralized-identity/sidetree/dist/lib/bitcoin/BitcoinClient.js:5:58)\n    at process._tickCallback (internal/process/next_tick.js:68:7)","message":"Unexpected fetch HTTP response: [500]: {\"result\":null,\"error\":{\"code\":-4,\"message\":\"Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another instance of Bitcoin Core?\\n\"},\"id\":\"3624m93nnhi\"}\n","code":"bitcoin_client_fetch_unexpected_error"}

About this issue

Most upvoted comments

I had exactly the same issue than the one described above. After trying a lot of different version of ION and Bitcoin I could get it run with ION v.1.0.2… As far as I have seen ION v.1.0.3 uses another SideTree version ( v1.0.5. instead of v1.0.3 ) which is ending in the issue mentioned above.

here… paste your error 😄

I worked around this by editing ./node_modules/@decentralized-identity/sidetree/dist/lib/bitcoin/BitcoinClient.js:273 to remove true as the second parameter on the loadwallet call. Calling bitcoin-cli loadwallet sidetreeDefaultWallet true was failing and giving me the same error as I was seeing from ion, and the help for bitcoin-cli in v25 doesn’t mention this second parameter, which was supposed indicate whether the wallet should be loaded on start. Ironically, if the wallet is already loaded then the loadwallet call fails, so we wouldn’t want to load the wallet on start in the first place.

So now I have a running ion instance and it’s scanning the chain for the pub key that was imported, but it looks like there’s a bug in the sidetree code when it comes to loading wallets. I can open a PR for that.