Counterparty-server cannot connect to database

I’m a Linux n00b. I run Ubuntu on my desktop.

I installed Bitcoin, synced (took a couple days) and reindexed (took another few days).
I modified bitcoin.conf as described -

I installed counterparty-cli.
sudo pip3 install counterparty-cli did not work for me.
sudo pip3 install --no-use-wheel counterparty-cli worked -

Then counterparty-server bootstrap executes okay.
But counterparty-server start fails

[2016-03-18 10:15:15][INFO] Running v1.1.1 of counterparty-server. [2016-03-18 10:15:15][INFO] Running v9.54.0 of counterparty-lib. [2016-03-18 10:15:15][INFO] Acquiring lock. [2016-03-18 10:15:15][INFO] Connecting to database.

It stays here for more than an hour, then:

[2016-03-18 11:41:19][INFO] Connecting to backend. [2016-03-18 11:41:21][ERROR] Unhandled Exception Traceback (most recent call last): File "/usr/local/bin/counterparty-server", line 9, in <module> load_entry_point('counterparty-cli==1.1.1', 'console_scripts', 'counterparty-server')() File "/usr/local/lib/python3.4/dist-packages/counterpartycli/", line 16, in server_main server.main() File "/usr/local/lib/python3.4/dist-packages/counterpartycli/", line 135, in main server.start_all(db) File "/usr/local/lib/python3.4/dist-packages/counterpartylib/", line 359, in start_all connect_to_backend() File "/usr/local/lib/python3.4/dist-packages/counterpartylib/", line 353, in connect_to_backend backend.getblockcount() File "/usr/local/lib/python3.4/dist-packages/counterpartylib/lib/backend/", line 42, in getblockcount return BACKEND().getblockcount() File "/usr/local/lib/python3.4/dist-packages/counterpartylib/lib/backend/", line 221, in getblockcount return rpc('getblockcount', []) File "/usr/local/lib/python3.4/dist-packages/counterpartylib/lib/backend/", line 75, in rpc return rpc_call(payload) File "/usr/local/lib/python3.4/dist-packages/counterpartylib/lib/backend/", line 47, in rpc_call raise BackendRPCError(str(response.status_code) + ' ' + response.reason) counterpartylib.lib.backend.addrindex.BackendRPCError: 401 Unauthorized

The connection files:
bitcoin.comf (~/.bitcoin)
rpcuser=bitcoin-rpc rpcpassword=PaSS server=1 daemon=1 rpcthreads=1000 rpctimeout=300 txindex=1 addrindex=1 minrelaytxfee=0.00005 limitfreerelay=0

server.conf (~/.config/counterparty)
[Default] backend-name = addrindex backend-user = bitcoin-rpc backend-password = PaSS rpc-host = localhost rpc-user = counterparty-rpc rpc-password = WoRD

client.conf (~/.config/counterparty)
[Default] counterparty-rpc-user = counterparty-rpc counterparty-rpc-password = WoRD wallet-name = bitcoincore wallet-connect = localhost wallet-user = bitcoin-rpc wallet-password = PaSS

EDIT : First I did not use btcdrak’s version. Then I downloaded newest btcdrak tar.gz for linux 64-bit. I copied the bin folder over to my existing .bitcoin folder. Now I’ve run $ ~/.bitcoin/bin/bitcoin-qt and finished new reindexing.

It does not change anything. I still don’t get past ‘Connecting to database.’

UPDATE : I deleted the fhree files at ‘./local/share/counterparty’ and then tried counterparty-server bootstrap followed by `counterparty-server start. As before, I could not connect to DB.

Then I deleted the DB files again. Without first bootstrapping I ran `counterparty-server start’. It connects to the DB now (actually creates a new DB) amd processes blocks. But it works VERY SLOW. Each block takes around 20 seconds! It will take weeks unless it speeds up

This is telling you your Counterparty-Server can’t access Bitcoin Core due to incorrect credentials.

You don’t have to delete Counterparty DB, it’s just a file that Counterparty will use as it starts.

Does bitcoin-cli getinfo work and what does it show?

What does this show?

counterparty-client wallet

Yes, because it reparses the DB you download (which is a > 1GB Sqlite3 file).

Yes, so in the meantime (perhaps you didn’t notice) you fixed the username/password thing, so this works now.

Your problem is not related to the DB.
counterparty-server processes blocks because now that you deleted the bootstrapped DB, there’s nothing to check so it starts parsing the blockchain immediately (no one hour long pause). But as you noticed it’s slow. So you want to CTRL+C that, bootstrap, and start it again without changing anything.
It will take a while to reparse the DB, but it will be 50-100 blocks behind so it’ll catch up within an hour after the reparse is done.

It works now. You were right. I just had to wait a long time after counterparty-server start.
Thank you!

Oh no! It got stuck on reparse.

[2016-03-22 10:17:18][INFO] Send: 19391.0 SJCX from 183VEpjYMafTk5Y19wR8q1b924DRbnBXPF to 1SJCXrYsuWmZzmAhA9K4fYkKqgGyLim79 (3839186f80d7d84e81a8d68686cfcefd46a53f9d1287b768e20c833434fcaac0) [valid] [2016-03-22 10:17:18][INFO] Block (re-parse): 401242 (hashes: L:0ba38 / TX:07394 / M:91207) [2016-03-22 11:28:07][DEBUG] Could not connect to backend athttp://bitcoin-rpc:PaSS@localhost:8332. (Try 1/12)

11:28:07 is simply because I closed bitcoin-qt. I restarted it with $ ~/.bitcoin/bin/bitcoin-qt --reindex. I’m afraid that was a terrible idea. It started reindexing from the beginning again. It will take 48 hours to finish :frowning:

Yes, now there’s no way to recover after that.

Before I also used to think it’s possible to stop bitcoin and restart it as long as you do that before 12 retries are done, but I think because mempool gets cleared Counterparty Server has no way to refresh it or invalidate its own.

1 Like