client id in Bitstamp s API

0 votes

In Bitstamp's API documentation, a client_id is mentioned. It is used to generate a signature.https://www.bitstamp.net/api/

But I couldn't find how I can get that client_id. Can someone tell me where I can find it?

Sep 3, 2018 in Blockchain by slayer
• 29,370 points
1,281 views

1 answer to this question.

0 votes

You can use this Ruby code:

require 'open-uri'
require 'json'
require 'base64'
require 'openssl'
require 'hmac-sha2'
require 'net/http'
require 'net/https'
require 'uri'

def bitstamp_private_request(method, attrs = {})
  secret = "xxx"
  key = "xxx"
  client_id = "xxx"
  nonce = nonce_generator

  message = nonce + client_id + key
  signature = HMAC::SHA256.hexdigest(secret, message).upcase

  url = URI.parse("https://www.bitstamp.net/api/#{method}/")
  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true

  data = {
    nonce: nonce,
    key: key,
    signature: signature
  }
  data.merge!(attrs)
  data = data.map { |k,v| "#{k}=#{v}"}.join('&')

  headers = {
    'Content-Type' => 'application/x-www-form-urlencoded'
  }

  resp = http.post(url.path, data, headers)
  console_log "https://www.bitstamp.net/api/#{method}/"
  resp.body
end

def nonce_generator
  (Time.now.to_f*1000).to_i.to_s
end
answered Sep 3, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

Curl Script Usage in Ethereum Blockcypher's API

You should store and keep the private ...READ MORE

answered May 28, 2018 in Blockchain by Christine
• 15,790 points
1,433 views
0 votes
1 answer

Send Payment error in Blockchain API

The following code should help: $address = null; try ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
1,754 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,428 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,923 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
0 votes
1 answer

How to get property of non object in Coinbase API

First, your sendMoney() call is stored into ...READ MORE

answered Aug 31, 2018 in Blockchain by digger
• 26,740 points
756 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP