Post
Topic
Board Development & Technical Discussion
Re: Good Programming Tutorials? [MeanStack]
by
Linkeex
on 20/03/2014, 23:43:01 UTC
Hi!

It's pretty easy to get going.
You could use npm bitcoin: https://www.npmjs.org/package/bitcoin

It just converts a method call to a bash command.
For example you want to generate a new address in your wallet you could connect to your bitcoind client and execute

Code:
client.cmd('getnewaddress', function(err, address, resHeaders){
  if (err) return console.log(err);
  console.log('New Address:', address);
});

or you could just do it by implementing the above mentioned library in your code.
To make a connection to your node call this:

Code:
// all config options are optional
var client = new bitcoin.Client({
  host: 'localhost',
  port: 8332,
  user: 'username',
  pass: 'password',
  timeout: 5000
});


With the client variable you can now execute its implemented methods:
Code:
client.getNewAddress('*', function(err, address) {
  if(err) return err;
  console.log('Address: '+ address);
});


Also, if you want to get started and do not want to download the whole blockchain, blockchain.info has a wallet API for you to play: https://blockchain.info/de/api/json_rpc_api