Skip to content

Instantly share code, notes, and snippets.

@magician11
Created June 27, 2014 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magician11/31b0d48f3d17b56af999 to your computer and use it in GitHub Desktop.
Save magician11/31b0d48f3d17b56af999 to your computer and use it in GitHub Desktop.
Node.js code to access bitcoin.co.id trading api
var request = require('request');
var qs = require('querystring');
var crypto = require('crypto');
var secretKey = "my secret key";
var apiKey = 'public API key';
var postData = {
method: 'getInfo',
nonce: new Date().getTime()
};
console.log("params: " + qs.stringify(postData));
console.log("Sign: " + crypto.createHmac('sha512', secretKey).update(qs.stringify(postData)).digest('hex'));
console.log("API key: " + apiKey);
var req = request.post({
url: 'https://vip.bitcoin.co.id/tapi',
headers: {
Sign: crypto.createHmac('sha512', secretKey).update(qs.stringify(postData)).digest('hex'),
Key: apiKey
}
}, function(error, response, body){
console.log(body);
});
console.log(req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment