question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bitstamp v2 API should be taking UUID nonces

See original GitHub issue

It appears that methods that call the Bitstamp v2 api are sending Long nonces rather than UUID nonces. This breaks with a nonce error much of the time.

Some background: I just upgraded some code that fetches balances from Bitstamp to xchange 5.0.6, which includes a change to use the v2 API for fetching balances: https://github.com/knowm/XChange/commit/dd134e31dd50663b30bb61ae19150e7b6d387e0f

Shortly after the change, we started getting 403’s with an “Invalid nonce” message. I’ve taken a (newbie, not-too-detailed) look at your code, and it looks like the nonce generation algorithm used for Bitstamp’s v2 api still relies on sending a Long nonce, rather than a UUID.

Falling back to xchange 5.0.4 immediately fixed this error.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mathvdhcommented, Apr 28, 2021

Hi @joakjo , Yes I was seeing that we are actually sending form params instead of headers … I’m working on it … Thanks

1reaction
earcecommented, Apr 23, 2021

@joakjo that’s interesting because some of the API endpoint present in v1 I do not see in v2.

@mathvdh I can give you some guidance.

In bitstamp exchange you will probably want to add a second nonceFactory

  private final SynchronizedValueFactory<String> uuidNonceFactory = 
          () -> UUID.randomUUID().toString();

You will probably need to pass it into BitstampTradeService & BitstampAccountService so you can use it there.

Then in bitstampauthenticatedv2 you will need to change the nonce param from <Long> to <String>

See how far this gets you

Read more comments on GitHub >

github_iconTop Results From Across the Web

API: Trade with custom written software - Bitstamp
Bitstamp application programming interface (API) allows our clients to access and control their accounts, using custom written software.
Read more >
Bitstamp API Authentication - Stack Overflow
I have used the bitstamp api successfully in the past with python and i ... '/api/v2/user_transactions/' + \ '' + \ content_type +...
Read more >
KRAKEN WEB API via Python - Bitcoin Forum
Hello, i'm trying to use the Kraken WEB API via a simple Python Script for placing Orders or getting the actual User Balance...
Read more >
python/rotki/rotki/rotkehlchen/exchanges/bitstamp.py Example
import hashlib import hmac import logging import uuid from http import ... NB: when `since_id` is used, the Bitstamp API v2 will return...
Read more >
How to Connect Your Bitstamp API to ACCOINTING.com
Here's how to import your Bitstamp API into ACCOINTING.com1.) Log in into your Bitstamp account and navigate to Security option, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found