Bitcoin Forum
November 02, 2024, 04:27:37 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Economy / Service Discussion / Re: HitBTC Post Error Wrong Signature on: July 23, 2014, 04:46:23 PM
HitBTC replied with an example that helped me find the issue!

What I was missing was that I was generating the signature with

http://demo-api.hitbtc.com/api/1/trading/balance?nonce=NONCE&apikey=APIKEY

Rather than just...

api/1/trading/balance?nonce=NONCE&apikey=APIKEY

It appears that the signature cannot include the http portion... It is only required for the HttpGet constructor.

Thank you for your help!
2  Economy / Service Discussion / Re: HitBTC Post Error Wrong Signature on: July 23, 2014, 01:42:48 PM
Thank you for the replies!

I have reached out to the HitBTC staff and they are looking it over. Forum responses are much more prompt and numerous, however Smiley

I do understand that the trading API needs the signature, I'm just not sure I'm providing it properly... Here is a snippet that I sent them, regarding a call to the balance method in the trading API.

First, "url" is being generated as:
      http://demo-api.hitbtc.com/api/1/trading/balance?nonce=1406121935&apikey=MYAPIKEY

This is passed into the mac/signature generation and added to the HttpGet header:
Code:
		key = new SecretKeySpec( SECRET.getBytes( "UTF-8" ), "HmacSHA512" );
// Create a new mac
mac = Mac.getInstance( "HmacSHA512" );
// Init mac with key.
mac.init( key );

headers.add( new BasicHeader( "X-Signature", Hex.encodeHexString( mac.doFinal( new String( url ).toLowerCase( ).getBytes( "UTF-8" ) ) ) ) );

// Now do the actual request
HttpClient client = HttpClientBuilder.create( ).build( );
HttpPost post = null;
HttpGet get = null;
HttpResponse response = null;

  if ( "POST".equalsIgnoreCase( requestType ) ) {


  post = new HttpPost( new URI( url.toLowerCase( ) ) );
post.setEntity( new UrlEncodedFormEntity( urlParameters ) );
post.setHeaders( headers.toArray( new Header[ headers.size( ) ] ) );
response = client.execute( post );

} else if ( "GET".equalsIgnoreCase( requestType ) ) {

get = new HttpGet( new URI( url.toLowerCase( ) ) );
get.setHeaders( headers.toArray( new Header[ headers.size( ) ] ) );
response = client.execute( get );
3  Economy / Service Discussion / HitBTC Post Error Wrong Signature on: July 23, 2014, 04:28:01 AM
Good afternoon,

I'm getting a message back that is specifying "Wrong signature" with code "NotAuthorized" when sending any requests from the HitBTC Trading API. The market data API requests work fine, all of the permissions are checked in the setting in my account.

Any ideas what the problem could be?
Let me know what info would be helpful.

Thank you!
Ryan
4  Economy / Service Discussion / BTER API Java Example on: April 05, 2014, 07:02:23 AM
Hello all,

I was taking a look at the API that BTER provides and didn't see any Java examples for it anywhere.

I've posted my own for anyone interested. This is a convenient Java wrapper for API calls to BTER for Bitcoin, Litecoin, Dogecoin, etc. Includes stub methods for calls for current prices between coin pairs, executing trades, querying outstanding orders, order history, etc.

Check it out on GitHub:
https://github.com/fiveironfrnzy08/BTER

Suggestions are welcome, and questions I'll do my best!

Thanks, good luck!
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!