Search content
Sort by

Showing 20 of 25 results by 029xue
Post
Topic
Board Bitcoin Technical Support
Re: Req: Python MtGox auth example
by
029xue
on 20/04/2012, 13:10:56 UTC
Thanks for your help. Your code is working and I finally find out the reason Smiley

My .NET code generate nonce like this:
Code:
string parameters = "nonce=" + DateTime.Now.Ticks.ToString();
it'll generate a 18 length value like 634705522019762907

In Python code, it generate nonce like this:
Code:
string parameters = "nonce=" + DateTime.Now.Ticks.ToString();
which will generate 16 length value like 133492738213800

In like case, as it always smaller than the last .NET nonce in one account, then MtGox regards it as invalid and can't get authorization.

I simply added more zero to "int(time.time()*1000000000)" and it then works.
(or If I using one account for Python only, then it have no such problem also.)

Again, thanks for your code Smiley
Post
Topic
Board Bitcoin Technical Support
Re: Req: Python MtGox auth example
by
029xue
on 17/04/2012, 11:56:47 UTC
I just tried it. However, the result is same:  Huh
Code:
url = "https://mtgox.com/api/0/info.php"

Try APIv1.

https://mtgox.com/api/1/BTCUSD/public/ticker using GET or https://mtgox.com/api/1/generic/private/orders using POST.


Dose the code work on you side? If so, I may need start investigate my network problem instead of code...

I got this "403 {"result":"error","error":"Identification required to access private API","token":"login_required"}" when try https://mtgox.com/api/1/generic/private/orders using POST.

Thanks very much!
Post
Topic
Board Bitcoin Technical Support
Re: Req: Python MtGox auth example
by
029xue
on 17/04/2012, 10:05:54 UTC
I just tried it. However, the result is same:  Huh
Code:
import urllib, time, hashlib, hmac, base64, urllib3

def _create_nonce():
    return int(time.time()*100000)

url = "https://mtgox.com/api/0/info.php"
params = [(u"nonce", _create_nonce())]
headers = {'Rest-Key': key, 'Rest-Sign': base64.b64encode(str(hmac.new(base64.b64decode(secret), urllib.urlencode(params), hashlib.sha512).digest())), 'Content-type': 'application/x-www-form-urlencoded', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}
http_pool = urllib3.connection_from_url(url)
response = http_pool.urlopen('POST', url, body=urllib.urlencode(params), headers=headers)

print response.status, response.data

200 {"error":"Must be logged in"}

May be because I'm under in proxy, but why .NET code work well? It's all in same machine...
Post
Topic
Board Bitcoin Technical Support
Re: Req: Python MtGox auth example
by
029xue
on 17/04/2012, 08:07:53 UTC
Thanks for the code.

However, when I try it, I always get the not logon error like below:
Code:
{u'error': u'Must be logged in'}

The code is like below:
Code:
from urllib import urlencode
import urllib2
import time
from hashlib import sha512
from hmac import HMAC
import base64
import json
def get_nonce():
    return int(time.time()*100000)

def sign_data(secret, data):
    return base64.b64encode(str(HMAC(secret, data, sha512).digest()))
      
class requester:
    def __init__(self, auth_key, auth_secret):
        self.auth_key = auth_key
        self.auth_secret = base64.b64decode(auth_secret)
        
    def build_query(self, req={}):
        req["nonce"] = get_nonce()
        post_data = urlencode(req)
        headers = {}
        headers["User-Agent"] = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
        headers["Accept"] = "application/json"
        headers["Rest-Key"] = self.auth_key
        headers["Rest-Sign"] = sign_data(self.auth_secret, post_data)
        return (post_data, headers)
        
    def perform(self, path, args):
        data, headers = self.build_query(args)
        req = urllib2.Request("https://mtgox.com/api/0/"+path, data, headers)
        res = urllib2.urlopen(req, data)
        return json.load(res)


m = requester(auth_key=mykey, auth_secret = mysecret)
print m.perform("info.php", {})

The wired thing is, when I using the C# code to communicate, it all works well.
I checked the http headers and found there're a little difference:

.NET header
Code:
CONNECT mtgox.com:443 HTTP/1.1
Host: mtgox.com
Connection: Keep-Alive

HTTP/1.1 200 Connection Established
FiddlerGateway: Direct
StartTime: 15:34:07.861
Connection: close

Code:
POST /api/0/info.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept: application/json
Rest-Key: fbbb66ba-5740-449d-a078-3d55752d82ed
Rest-Sign: BE3pmUGjOPh4069XH4j28tw3RKd0HEZWIWoJ+gahIXR5Qn4T+rc+E2aN2L0WfUcx4ptzmfuhe9lqKtkJHE+nGQ==
Host: mtgox.com
Content-Length: 24
Expect: 100-continue
Connection: Keep-Alive

HTTP/1.0 200 OK
Date: Tue, 17 Apr 2012 07:34:09 GMT
Server: Apache
X-Powered-By: PHP/5.3.10
Set-Cookie: SESSION_ID=ff7f7d011f6321a87b6cdd93d27fb7e5; expires=Thu, 19-Apr-2012 07:34:09 GMT; path=/; domain=.mtgox.com; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Strict-Transport-Security: max-age=1209600
Content-Length: 1253
nnCoection: close
Content-Type: application/json
Connection: Keep-Alive

Python header:
Code:
CONNECT mtgox.com:443 HTTP/1.0
Host: mtgox.com:443

HTTP/1.0 200 Connection Established
FiddlerGateway: Direct
StartTime: 15:34:20.718
Connection: close

Code:

POST /api/0/info.php HTTP/1.1
Accept-Encoding: identity
Rest-Sign: KV6aRCWoOSJbXMwY/c5hhlZ9GLsqxYfPMzvFWRV7KmrGCnL6dmp3mPAMNO3JCWDWfEFwAbMiCeUoUap7FIdewg==
Content-Length: 21
Rest-Key: fbbb66ba-5740-449d-a078-3d55752d82ed
Connection: close
Accept: application/json
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: mtgox.com
Content-Type: application/x-www-form-urlencoded

HTTP/1.0 200 OK
Date: Tue, 17 Apr 2012 07:34:23 GMT
Server: Apache
X-Powered-By: PHP/5.3.10
Set-Cookie: SESSION_ID=3e8b54b2e889b2516c87639d02252daf; expires=Thu, 19-Apr-2012 07:34:23 GMT; path=/; domain=.mtgox.com; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Strict-Transport-Security: max-age=1209600
Content-Length: 29
Connection: close
Content-Type: application/json

The only difference is that:
https://public.sn2.livefilestore.com/y1pvy4eqYCVgTia_7dDcpCIVy4wQ9-xxLR-VcM-NBvt1cGxzqiv7V2ijeAgimnTpXKXykAjrJlHo9Oz8DMasUL23g/123.png?psid=1

I guess it may related with the connection type, but I'm new to Python and have no idea how to control it...
(why there're dozens of http lib exist in Python Smiley

Any help is appreciate!
Post
Topic
Board Bitcoin Technical Support
Topic OP
Help about MtGox authentication using Python
by
029xue
on 17/04/2012, 08:05:47 UTC
Hi,
I'm recently write a small program to trade bitcoin in MtGox, but I met a wierd problem when using Python to communicate with MtGox API.
The code is from post "Python MtGox auth example", however, I'm always get the not logon error like below:
Code:
{u'error': u'Must be logged in'}

The code is like below:
Code:
from urllib import urlencode
import urllib2
import time
from hashlib import sha512
from hmac import HMAC
import base64
import json
def get_nonce():
    return int(time.time()*100000)

def sign_data(secret, data):
    return base64.b64encode(str(HMAC(secret, data, sha512).digest()))
      
class requester:
    def __init__(self, auth_key, auth_secret):
        self.auth_key = auth_key
        self.auth_secret = base64.b64decode(auth_secret)
        
    def build_query(self, req={}):
        req["nonce"] = get_nonce()
        post_data = urlencode(req)
        headers = {}
        headers["User-Agent"] = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
        headers["Accept"] = "application/json"
        headers["Rest-Key"] = self.auth_key
        headers["Rest-Sign"] = sign_data(self.auth_secret, post_data)
        return (post_data, headers)
        
    def perform(self, path, args):
        data, headers = self.build_query(args)
        req = urllib2.Request("https://mtgox.com/api/0/"+path, data, headers)
        res = urllib2.urlopen(req, data)
        return json.load(res)


m = requester(auth_key=mykey, auth_secret = mysecret)
print m.perform("info.php", {})

The wired thing is, when I using the C# code to communicate, it all works well.
I checked the http headers and found there're a little difference:

.NET header
Code:
CONNECT mtgox.com:443 HTTP/1.1
Host: mtgox.com
Connection: Keep-Alive

HTTP/1.1 200 Connection Established
FiddlerGateway: Direct
StartTime: 15:34:07.861
Connection: close

Code:
POST /api/0/info.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept: application/json
Rest-Key: fbbb66ba-5740-449d-a078-3d55752d82ed
Rest-Sign: BE3pmUGjOPh4069XH4j28tw3RKd0HEZWIWoJ+gahIXR5Qn4T+rc+E2aN2L0WfUcx4ptzmfuhe9lqKtkJHE+nGQ==
Host: mtgox.com
Content-Length: 24
Expect: 100-continue
Connection: Keep-Alive

HTTP/1.0 200 OK
Date: Tue, 17 Apr 2012 07:34:09 GMT
Server: Apache
X-Powered-By: PHP/5.3.10
Set-Cookie: SESSION_ID=ff7f7d011f6321a87b6cdd93d27fb7e5; expires=Thu, 19-Apr-2012 07:34:09 GMT; path=/; domain=.mtgox.com; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Strict-Transport-Security: max-age=1209600
Content-Length: 1253
nnCoection: close
Content-Type: application/json
Connection: Keep-Alive

Python header:
Code:
CONNECT mtgox.com:443 HTTP/1.0
Host: mtgox.com:443

HTTP/1.0 200 Connection Established
FiddlerGateway: Direct
StartTime: 15:34:20.718
Connection: close

Code:

POST /api/0/info.php HTTP/1.1
Accept-Encoding: identity
Rest-Sign: KV6aRCWoOSJbXMwY/c5hhlZ9GLsqxYfPMzvFWRV7KmrGCnL6dmp3mPAMNO3JCWDWfEFwAbMiCeUoUap7FIdewg==
Content-Length: 21
Rest-Key: fbbb66ba-5740-449d-a078-3d55752d82ed
Connection: close
Accept: application/json
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: mtgox.com
Content-Type: application/x-www-form-urlencoded

HTTP/1.0 200 OK
Date: Tue, 17 Apr 2012 07:34:23 GMT
Server: Apache
X-Powered-By: PHP/5.3.10
Set-Cookie: SESSION_ID=3e8b54b2e889b2516c87639d02252daf; expires=Thu, 19-Apr-2012 07:34:23 GMT; path=/; domain=.mtgox.com; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Strict-Transport-Security: max-age=1209600
Content-Length: 29
Connection: close
Content-Type: application/json

The only difference is that:
https://public.sn2.livefilestore.com/y1pvy4eqYCVgTia_7dDcpCIVy4wQ9-xxLR-VcM-NBvt1cGxzqiv7V2ijeAgimnTpXKXykAjrJlHo9Oz8DMasUL23g/123.png?psid=1

I guess it may related with the connection type, but I'm new to Python and have no idea how to control it...
(why there're dozens of http lib exist in Python Smiley

Any help is appreciate!
Post
Topic
Board Service Discussion
Re: MtGox withdrawal API closed?
by
029xue
on 15/04/2012, 15:31:22 UTC
Any one know it?

Dose version 1 API support deposit and withdrawal?

Thanks!
Post
Topic
Board Service Discussion
Topic OP
MtGox withdrawal API closed?
by
029xue
on 15/04/2012, 01:11:50 UTC
I was original post the question in 'Technical support' board, but I guess here may be the better place.


I'm doing a small program want to send bitcoin directly from my MtGox account.

I'm using the version 0 of MtGox API, when I call withdrawal interface I got following error:
{"error":"Authorization to this API denied"}

When I looked the version 1 of MtGox API, it even doesn't have withdrawal interface?

It seems withdrawal is no longer supported now.

Dose any one know how to solve this problem?
Or is any other website can send bitcoin directly from web account?


(I don't want run bitcoind myself.)

It's appreciate for your help!



Quote from: CA Coins on April 14, 2012, 17:48:13
Version 0 withdraw appears to be working fine for me.  I just tested it and I was able to withdraw with the API.

Are the other methods working?  It might be that you don't have withdraw enabled on your API settings page.

You're right, after I enabled withdrawal in settings page, it works now.

Thanks very much!!

BTW, dose the version 1 API support withdrawal? I didn't say any deposit or withdrawal API in wiki page: https://en.bitcoin.it/wiki/MtGox/API/HTTP/v1

Thanks!
Post
Topic
Board Bitcoin Technical Support
Re: MtGox withdrawal API closed?
by
029xue
on 14/04/2012, 10:40:03 UTC
Version 0 withdraw appears to be working fine for me.  I just tested it and I was able to withdraw with the API.

Are the other methods working?  It might be that you don't have withdraw enabled on your API settings page.

You're right, after I enabled withdrawal in settings page, it works now.

Thanks very much!!

BTW, dose the version 1 API support withdrawal? I didn't say any deposit or withdrawal API in wiki page: https://en.bitcoin.it/wiki/MtGox/API/HTTP/v1

Thanks!
Post
Topic
Board Bitcoin Technical Support
Re: MtGox withdrawal API closed?
by
029xue
on 14/04/2012, 09:34:57 UTC
Any helps?
Post
Topic
Board Bitcoin Technical Support
Topic OP
MtGox withdrawal API closed?
by
029xue
on 14/04/2012, 05:06:52 UTC
I'm doing a small program want to send bitcoin directly from my MtGox account.

I'm using the version 0 of MtGox API, when I call withdrawal interface I got following error:
{"error":"Authorization to this API denied"}

When I looked the version 1 of MtGox API, it even doesn't have withdrawal interface?

It seems withdrawal is no longer supported now.

Dose any one know how to solve this problem?
Or is any other website can send bitcoin directly from web account?


(I don't want run bitcoind myself.)

It's appreciate for your help!
Post
Topic
Board Bitcoin Discussion
Re: Public Domain Bitcoin Icons/Graphics for you!
by
029xue
on 27/07/2011, 09:36:23 UTC
Looks good.
Post
Topic
Board Trading Discussion
Re: 100 Pre-Beta Invites - New Secure Multi-Currency Exchange
by
029xue
on 26/07/2011, 21:11:14 UTC
Hi, I want an invitation, mail just sent.
Thanks!
Post
Topic
Board Marketplace
Re: Recent Events At Bitcoin Market
by
029xue
on 07/06/2011, 02:04:30 UTC
I'm getting a lot of inquiries so I will post them here:

LoginID, MemberID, IP Address, Succeeded/Failed, Datetime

19913   5184   93.96.21.223   Succeeded   2011-06-02 19:15:25
20041   5184   82.22.253.146   Failed   2011-06-02 20:12:22
20044   5184   82.22.253.146   Succeeded   2011-06-02 20:12:40
21033   5184   80.7.151.74   Failed   2011-06-03 09:36:20
21034   5184   80.7.151.74   Succeeded   2011-06-03 09:36:50
21069   5184   80.7.151.74   Succeeded   2011-06-03 10:13:24
21515   5184   82.255.162.61   Succeeded   2011-06-03 15:47:56
21819   5184   82.255.162.61   Succeeded   2011-06-03 19:17:23
23760   5184   217.23.3.57   Failed   2011-06-04 12:03:02
23762   5184   217.23.3.57   Failed   2011-06-04 12:03:20
23763   5184   217.23.3.57   Failed   2011-06-04 12:03:33

24372   5806   81.97.172.21   Succeeded   2011-06-04 15:42:10
24768   5806   81.97.172.21   Succeeded   2011-06-04 17:56:06
25197   5806   81.97.172.21   Succeeded   2011-06-04 20:47:08
25483   5806   81.97.172.21   Succeeded   2011-06-04 22:42:58
25828   5806   82.16.104.171   Succeeded   2011-06-05 01:57:57
26252   5806   77.96.212.229   Succeeded   2011-06-05 05:28:31

24125   5810   88.176.67.195   Succeeded   2011-06-04 13:49:04
24147   5810   88.185.237.205   Succeeded   2011-06-04 14:00:20
24309   5810   82.251.192.128   Succeeded   2011-06-04 15:14:48
24631   5810   82.251.192.128   Succeeded   2011-06-04 17:26:42
25029   5810   82.251.192.128   Succeeded   2011-06-04 20:05:51
25123   5810   82.251.192.128   Succeeded   2011-06-04 20:27:28
25165   5810   82.251.192.128   Succeeded   2011-06-04 20:42:49
25186   5810   82.251.192.128   Succeeded   2011-06-04 20:45:33
25687   5810   90.47.111.243   Succeeded   2011-06-05 00:29:31
26598   5810   90.47.111.243   Failed   2011-06-05 09:44:38
26599   5810   90.47.111.243   Failed   2011-06-05 09:45:03
27983   5810   138.37.135.249   Failed   2011-06-06 10:43:45

23883   6038   95.208.79.58   Succeeded   2011-06-04 12:58:36
23889   6038   95.208.79.58   Failed   2011-06-04 12:59:17
23895   6038   95.208.79.58   Succeeded   2011-06-04 12:59:29
23917   6038   95.208.79.58   Failed   2011-06-04 13:01:10
23919   6038   95.208.79.58   Succeeded   2011-06-04 13:01:23
23947   6038   95.208.79.58   Succeeded   2011-06-04 13:03:32
24645   6038   82.65.5.209   Succeeded   2011-06-04 17:27:36
25033   6038   82.65.5.209   Succeeded   2011-06-04 20:06:15
25168   6038   82.65.5.209   Succeeded   2011-06-04 20:43:22
26036   6038   82.65.5.209   Succeeded   2011-06-05 04:06:08
26083   6038   82.65.5.209   Succeeded   2011-06-05 04:27:07
26171   6038   82.65.5.209   Succeeded   2011-06-05 04:55:48
26214   6038   82.65.5.209   Succeeded   2011-06-05 05:13:22
26305   6038   82.65.5.209   Succeeded   2011-06-05 05:57:09
26327   6038   82.65.5.209   Succeeded   2011-06-05 06:01:52
26736   6038   24.218.244.153   Failed   2011-06-05 11:32:02
26738   6038   24.218.244.153   Succeeded   2011-06-05 11:34:27
27008   6038   82.16.104.171   Failed   2011-06-05 15:49:22
27009   6038   82.16.104.171   Succeeded   2011-06-05 15:49:50
27265   6038   67.167.252.102   Failed   2011-06-05 19:28:35
27545   6038   217.23.3.57   Failed   2011-06-05 23:20:37
27546   6038   217.23.3.57   Failed   2011-06-05 23:20:51

As you can see, most of them are from the UK, Netherlands, France, and Germany.

There are a couple more on my watchlist but I don't have any evidence yet.



I've been scammed by seller 6038 two days ago.
He has two LR account: U5611306 (richielambert31) and U0696054 (DzhunietDzhu...)
and also two emails: richielambert31@yahoo.co.uk and richielambert@yahoo.co.uk

I want find him out and kick his ass...

Dose any body get scammed by him also?
Post
Topic
Board Development & Technical Discussion
Re: Vanity bitcoin addresses: a new way to keep your CPU busy
by
029xue
on 04/06/2011, 07:46:00 UTC
The idea is cool, but I think there's a big problem in safty.

After you generated a bitcoin address, that means you hold the 'wallat.data' of this address and of source you've a copy of the file.

After you sending this wallet to others, you may still have a copy of the file, how could others believe that you won't use/steal there bitcoins from this wallat?
Post
Topic
Board 中文 (Chinese)
Re: 浅谈目前获得比特币的四种主流方法
by
029xue
on 31/05/2011, 16:55:52 UTC
可以从这里RMB购买http://shop67101219.taobao.com/
Post
Topic
Board 中文 (Chinese)
Re: 比特币维基中文翻译计划! (Bitcoin Wiki Chinese Translation Project)
by
029xue
on 31/05/2011, 16:55:20 UTC
我不能访问wiki了
页面显示:
Forbidden

You don't have permission to access /wiki/Main_Page on this server.

有人遇到同样情况吗?

同问,这两天都访问不了,提示:
Forbidden

You don't have permission to access / on this server.
Post
Topic
Board Goods
Re: bitcoin mining pool script for sale
by
029xue
on 30/05/2011, 09:39:21 UTC
Kris, you are doing great job.

I'm really considering buying your pool script...

However I'm waiting for a few more important features to be implemented:

- More detailed solved blocks statistics such as the one here for example: http://www.btcguild.com/blocks.php
- Stats for the average bock size and current difficulty information such as the ones available here: https://deepbit.net/stats
- Having an option for direct donations from members of the pool would be nice, like a percentage of the earnings of each block for example set by the user, this may be a good alternative to having fixed fee for the pool.
- Adding Pay Per Share option and not only offering Proportional mode is good to have as an option.


I'm interested in the script also and I think "Adding Pay Per Share option" is also important.

Besides that, I saw your web site it not very professional, e.g., after signed in, the "singup" link is still display in top right. I'm wondering whether your script is including this web site interface?
Post
Topic
Board Project Development
Re: [BOUNTY] Open Source pooled mining platform with web interface
by
029xue
on 29/05/2011, 04:07:59 UTC
I like this project.  Smiley
Post
Topic
Board Mining software (miners)
Re: Mining Monitor - Chrome Extension
by
029xue
on 28/05/2011, 15:34:00 UTC
Looks good.
What value should I put on "token" filed??

It displays "Invalid token" currently...

Probably your deepbit API token, go into account then advanced (i think) and copy/paste.

It works now. Good extension  Smiley
Post
Topic
Board Mining software (miners)
Re: Mining Monitor - Chrome Extension
by
029xue
on 28/05/2011, 14:56:30 UTC
Looks good.
What value should I put on "token" filed??

It displays "Invalid token" currently...