Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.