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,170 points
83 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,550 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
148 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,020 points
284 views
0 votes
1 answer

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

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
94 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
174 views
0 votes
1 answer
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,550 points
44 views
0 votes
2 answers