I am trying to write a simple app that uses the Mt Gox. (bitcoin exchange) API.

It's very simple to use the price API it's just a http request that returns a .JSON string.

However now I want to do more with my app, I was thinking it would be good to be able to log into the users mtgox account and show their balance of bitcoin.

I have an API key (you can generate one on their site) but I'm finding it really hard to understand whats required to generate a connection and pull the balance.

Is there anyone who might be able to point me in the right direction?

I have researched quite a bit and turned up very little information - API Overview: https://bitbucket.org/nitrous/mtgox-api/overview

In the above link they have some python code, but i'm finding it difficult to translate into Objective C.

So if anyone can:

A. Give me a highlevel overview of the steps required to log in and get a bitcoin balance using the API.

B. Give me some pointers on how to turn their Python example into Objective C I would really appreciate it.

I understand to use the API I need to use this URL to Get my current balance mtgox.com/api/0/getFunds.php -- however first I need to get a "nonce" parameter to the post data (which must be an ever-increasing interger, for example with PHP in 64bits: (int)(microtime(true)*1000000)) and two HTTP headers: Rest-Key (your key) nad Rest-Sign (a signature generated by doing a sha512-hmac on the POST data with the secret as key, encoded in base64).

I found this documentation: bitbucket.org/nitrous/mtgox-api/overview -- still not clear however, how to code in Objective C thanks

  • This is a badly titled question. Please give some kind of indication of what the question is about in the title. – user1068446 Aug 9 '13 at 4:32
  • Updated thanks. need to type more chars because of the silly limit where by you cannot just say thank you. – Woodstock Aug 9 '13 at 6:27

Take a look at the Java XChange project

While it is not Objective C it will provide you with all the details you'll need to get your library off the ground including the HMAC authentication process and websockets.

You'll also find a range of other exchanges supported so you can implement those as well thus providing your application with a broader range of potential users since not everyone uses MtGox these days.

| improve this answer | |
  • Yep, I'm very pleased with the way that XChange has shaped up. There's been a lot of good work done on it. – Gary Rowe Aug 9 '13 at 11:27
  • 1
    going to mark this as answered as yours is as close as I'll get! – Woodstock Aug 9 '13 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.