Bitcoin Forum
August 09, 2024, 07:19:22 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Problem API von Bitstamp -> {"error": "Missing key, signature and nonce paramete  (Read 1815 times)
Wolke (OP)
Legendary
*
Offline Offline

Activity: 966
Merit: 1000


View Profile
November 14, 2014, 07:31:19 PM
 #1

hey,

kann hier jemand helfen - bekommen den fehler hier:

Code:
{"error": "Missing key, signature and nonce parameters"}


unser code:
Code:
Dim api_key As String = "APIXXXXXXXXXXXXXXXXXX"
Dim api_secret As String = "APIXXXXXXXXXXXXXXXXXX"
Dim client_id As String = "01020304"
Public Function check_balance()
Try
Dim NONCE As String = DateTime.Now.Ticks
Dim SIGNATURE As String = CreateSignature(NONCE)
Dim request As HttpWebRequest
request = DirectCast(WebRequest.Create("https://www.bitstamp.net/api/balance/"), HttpWebRequest)
request.Method = "POST"
request.Headers("key") = api_key
request.Headers("nonce") = NONCE
request.Headers("signature") = SIGNATURE
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader = Nothing
Dim result As String = Nothing
Try
response = DirectCast(request.GetResponse(), HttpWebResponse)
reader = New StreamReader(response.GetResponseStream())
result = reader.ReadToEnd()
MsgBox(result)
Catch ex As Exception
Return ex.ToString()
Finally
If Not response Is Nothing Then response.Close()
End Try
Return result
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
Private Function CreateSignature(ByVal Nonce As String) As String
Dim msg As String = String.Format("{0}{1}{2}", Nonce, client_id, api_key)
Return ByteArrayToString(SignHMACSHA256(api_secret, StringToByteArray(msg))).ToUpper()
End Function
Private Function SignHMACSHA256(key As [String], data As Byte()) As Byte()
Dim hashMaker As New HMACSHA256(Encoding.ASCII.GetBytes(key))
Return hashMaker.ComputeHash(data)
End Function
Private Function StringToByteArray(str As String) As Byte()
Return System.Text.Encoding.ASCII.GetBytes(str)
End Function
Private Function ByteArrayToString(hash As Byte()) As String
Return BitConverter.ToString(hash).Replace("-", "").ToLower()
End Function

würden uns über tipps oder lösungen sehr freuen...  Smiley

LOBSTER
Hero Member
*****
Offline Offline

Activity: 560
Merit: 500


View Profile
November 14, 2014, 07:36:12 PM
 #2

Liegt wohl an der Authentication.

Bitstamp sagt dazu folgendes:

Quote
Signature is a HMAC-SHA256 encoded message containing: nonce, client ID and API key. The HMAC-SHA256 code must be generated using a secret key that was generated with your API key. This code must be converted to it's hexadecimal representation (64 uppercase characters).

Example (Python):
message = nonce + client_id + api_key
signature = hmac.new(API_SECRET, msg=message, digestmod=hashlib.sha256).hexdigest().upper()
Wolke (OP)
Legendary
*
Offline Offline

Activity: 966
Merit: 1000


View Profile
November 16, 2014, 12:21:10 PM
 #3

kann gelöscht werden -> habe jemand gefunden der super geholfen hat....

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!