Difference between revisions of "Node Litecoin"

From Litecoin Wiki
Jump to: navigation, search
Line 24: Line 24:
  
 
== Examples ==
 
== Examples ==
 +
### Create client <code>js var litecoin = require('litecoin'); var client = new litecoin.Client('localhost', 9332, 'username', 'password');</code>
 +
 +
=== Create client with single object ===
 +
 +
<pre class="js">var client = new litecoin.Client({
 +
  host: 'localhost',
 +
  port: 9332,
 +
  username: 'username',
 +
  password: 'password'
 +
});</pre>
 +
=== Get balance across all accounts with minimum confirmations of 6 ===
 +
 +
<pre class="js">
 +
client.getBalance('*', 6, function(err, balance) {
 +
  if (err) console.log(err);
 +
  console.log('Balance: ' + balance);
 +
});</pre>
 +
=== Get the network hash rate ===
 +
 +
<pre class="js">client.getNetworkHashPS(function(err, hashps) {
 +
  if (err) console.log(err);
 +
  console.log('Network Hash Rate: ' + hashps);
 +
});</pre>

Revision as of 08:24, 30 April 2013

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox