Error: "API Keys Not Set Correctly"

I just discovered NuBits and I wanted to contribute to at least one liquidity pool.

Everything was smooth, Plunge is working (I am on a Mac), but I just cannot get it to accept my API keys. I followed the instructions at Liquidbits.net to work with CCEDK, generated the API keys, but when I paste them into Plunge for CCEDK, I get the error “API Keys not set Correctly”

I’m not sure if I missed something or what, but if anyone has any advice it would be greatly appreciated!

Can you post your latest .log file from the plunge/log dir?

Make sure to remove any pub keys if they are visible.

Willy

This is just from the terminal window, would the actual log file be more helpful?

[INFO ] [Logger ] Record log in /Applications/Kivy.app/Contents/Resources/.kivy/logs/kivy_15-07-23_3.txt
[INFO ] [Kivy ] v1.9.0
[INFO ] [Python ] v2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]
[INFO ] [Factory ] 173 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using for socket
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] OpenGL version <2.1 INTEL-10.0.86>
[INFO ] [GL ] OpenGL vendor
[INFO ] [GL ] OpenGL renderer <Intel HD Graphics 4000 OpenGL Engine>
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version <1.20>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
2015/07/23-16:00:47 INFO: Fetching language from config
2015/07/23-16:00:47 INFO: Home Page Init
2015/07/23-16:00:47 INFO: getting data for spinners
2015/07/23-16:00:48 INFO: Setting refresh Period to 30
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Base ] Start application main loop
2015/07/23-16:00:48 INFO: getting data for spinners
2015/07/23-16:00:48 INFO: Set Primary Exchange to ccedk
2015/07/23-16:00:48 INFO: Set Primary Currency to ppc
2015/07/23-16:00:48 INFO: Set Primary Currency to ppc
2015/07/23-16:00:48 INFO: Get Personal Stats for ccedk > xxxxx
2015/07/23-16:00:48 INFO: Pool stats returned OK
2015/07/23-16:00:48 WARNING: Personal stats failed. Returned 520
2015/07/23-16:00:48 INFO: Set Primary Exchange to ccedk
2015/07/23-16:00:48 INFO: Set Primary Currency to ppc
2015/07/23-16:00:48 INFO: Exchange stats returned OK
2015/07/23-16:00:49 INFO: Update Pool stats
2015/07/23-16:00:49 INFO: Update Personal stats
2015/07/23-16:00:49 INFO: Calculations
2015/07/23-16:00:58 INFO: Starting client
2015/07/23-16:00:58 WARNING: no data rows added to client
2015/07/23-16:01:13 INFO: Get Personal Stats for ccedk > xxx
2015/07/23-16:01:14 INFO: Pool stats returned OK
2015/07/23-16:01:14 WARNING: Personal stats failed. Returned 520
2015/07/23-16:01:14 INFO: Exchange stats returned OK
2015/07/23-16:01:14 INFO: Update Pool stats
2015/07/23-16:01:14 INFO: Update Personal stats
2015/07/23-16:01:14 INFO: Calculations
[INFO ] [Clipboard ] Provider: sdl2([‘clipboard_nspaste’] ignored)
2015/07/23-16:01:44 INFO: Get Personal Stats for ccedk > xxx
2015/07/23-16:01:44 INFO: Pool stats returned OK
2015/07/23-16:01:44 WARNING: Personal stats failed. Returned 520
2015/07/23-16:01:44 INFO: Exchange stats returned OK
2015/07/23-16:01:44 INFO: Update Pool stats
2015/07/23-16:01:44 INFO: Update Personal stats
2015/07/23-16:01:44 INFO: Calculations
2015/07/23-16:02:07 INFO: saving row 1 for ccedk
2015/07/23-16:02:07 WARNING: API Keys not set correctly
2015/07/23-16:02:14 INFO: Get Personal Stats for ccedk > xxx
2015/07/23-16:02:14 INFO: Pool stats returned OK
2015/07/23-16:02:14 WARNING: Personal stats failed. Returned 520
2015/07/23-16:02:14 INFO: Exchange stats returned OK
2015/07/23-16:02:14 INFO: Update Pool stats
2015/07/23-16:02:14 INFO: Update Personal stats
2015/07/23-16:02:14 INFO: Calculations

That should be enough.

520 errors look strange…

@woolly_sammoth ?

Unfortunately, I don’t have an account at ccedk.
@cybnate or someone tllp’ing on ccedk, can you confirm that problem?

Edit: Can you double check if there are no spaces in front or after the key?

Confirmed, no spaces in front of or after the keys.

Can you check plunge.ini?

The keys should have been saved there like this:

[ccedk]
ltc = 0
ppc = 0
secret = secretkey
usd = 0
btc = 1
address = address
nubot = 0
public = publickey
eur = 0

Anything odd visible?

I’m not sure api_keys.json is still in use, I guess woolly would have to take it further from here.

Hi @farout

First off, welcome to Nu. I’m glad you like what you see enough to want to join in. I hope this Plunge issue can get fixed quickly so that you can start providing liquidity with one or more of the pools.

The error you are seeing is due to the fact that adding API keys is a two step process.
From the Settings page choose the Exchange you wish to add keys for. Press the ‘Set Keys’ button under the ‘API Keys’ heading. On the pop up window hit ‘Add Keys’ to bring up a second pop up window in which you can enter your public and secret keys. When you hit ‘OK’ you should see the keys in the dropdown list in the middle of the first pop up window. Hit ‘OK’ on this window. You should see that the text of the ‘Set Keys’ button changes to show the API key pair you just selected. If it hasn’t, hit the button again and choose the key pair in the drop down list on the pop up window. You can then carry on with adding a payout address and setting your minimal rates.
There are further instructions in the Plunge announcement thread here: [TLLP] Plunge GUI beta

As @willy pointed out the 502 error in your log look odd. They are there because you haven’t yet started the client successfully with your API Keys. That means they haven’t yet registered as a user on the server and so you have no personal stats to see, hence the 502 error.

If you have further issues, please do post back here, I’ll try to get them sorted as soon as I can.

Sammoth

Edit: api_keys.json is where the API keys get stored. I moved them out of plunge.ini once it became obvious that having multiple keys for each exchange was desirable

Thanks for your reply. That is exactly the way I have been adding my keys and I am getting this error when it tries to save the data:

Saving…
Saving row 1
=> API Keys not set correctly
Data Saved

Any other thoughts?

EDIT: Also, I have followed your guide in the link you provided to get Plunge running in the first place. I noticed you have a screenshot showing the same error I am currently getting.

https://discuss.nubits.com/uploads/default/_optimized/3e5/5d8/1cef100491_403x500.png

mind blown

This is how my plunge.ini looks:

[server]
host = nbt.liquidbits.net
port = 80

[exchanges]
poloniex = 0
ccedk = 0
bittrex = 0
bitcoincoid = 0
bter = 0

[standard]
show_disclaimer = 1
monitor = 0
language = English
start_min = 0
period = 30
smooth_line = 1
data = 0

And my keys are showing in my api_keys.json

Yup, the error message is known and occurs when a specific situation is reached.
This is the code that causes it

The get_keys() method uses the trucated api key text from the button to get the full keys from the api_keys.json file. If either public or secret key are ‘None’ then it fails and shows the error you can see.

Could you check in your api_keys.json file and see if the keys are set properly there?
They should be in the format [{"exchange": "ccedk", "public": "public_key", "secret": "secret_key"}]

Edit: Just saw your reply about the keys existing in api_keys.json

Have you restarted Plunge since adding the keys?

api_keys.json seems fine, but the order is different, not sure if that matters. Instead of the way you have shown, it goes [{“secret”: “public”: “exchange”: “ccedk”}]

That’s fine, the order doesn’t matter to the code.

Could you add a debugging line on line 473 of the overrides.py file?

It currently reads
api_keys = self.fetch_api_keys_from_file() for key_set in api_keys:

could you change it to read
api_keys = self.fetch_api_keys_from_file() print 'API KEYS = %s' % str(api_keys) for key_set in api_keys:

Then restart Plunge and try again. That should show us what the application is actually reading from the api_keys.json file

I just restarted Plunge, issue is still present

Ok, so I just added that line of code, restarted Plunge, and tried to add the keys again. In terminal there is now a line:

2015/07/23-16:44:26 INFO: saving row 1 for ccedk
API KEYS = []

Does this mean it is not reading the keys for some reason?

thanks. That seems to be the case.

can you add another change, still in overrides.py but this time in the fetch_api_keys_from_file() method on line 563

it currently says this:

except ValueError:
    api_keys = []

I’d like it to say this:

except ValueError as e:
    print 'ERROR %s' % e.message
    api_keys = []

Made the change, now I’m getting:

ERROR No JSON object could be decoded
API KEYS = []

EDIT: Sent you a PM, the forum won’t let me post any more for the day…

Hmm, very weird.
Which OS are you on? I wonder if this has to do with line endings in the file

It seems that for some reason Plunge isn’t seeing the contents of your api_keys.json file as a json object.