# namecoin

> Communicate with namecoind via JSON-RPC

Latest version **0.1.4** (published 2014-03-03) · 0 weekly downloads

## Install

```sh
npm install namecoin
pnpm add namecoin
yarn add namecoin
bun add namecoin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2014-03-03 |
| First published | 2014-02-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Josh Beal |
| Maintainers | joshbeal |
| Keywords | namecoin, rpc |

## Links

- npm: https://www.npmjs.com/package/namecoin
- Repository: https://github.com/joshbeal/node-namecoin
- Issues: https://github.com/joshbeal/node-namecoin/issues
- npm.io page: https://npm.io/package/namecoin

## Dependencies (1)

- [deprecate](https://npm.io/package/deprecate.md) ~0.1.0

## Recent versions

- 0.1.4 (latest) — 2014-03-03
- 0.1.3 — 2014-02-17

## README

# node-namecoin

node-namecoin is a simple wrapper for the Namecoin client's JSON-RPC API.

The API is equivalent to the API document [here](https://github.com/namecoin/wiki/wiki/Client-API).
The methods are exposed as lower camelcase methods on the `namecoin.Client`
object, or you may call the API directly using the `cmd` method.

## Install

`npm install namecoin`

## Examples

### Create client
```js
var client = new namecoin.Client({
  host: 'localhost',
  port: 8336,
  user: 'username',
  pass: 'password'
});
```

### Get balance across all accounts with minimum confirmations of 6

```js
client.getBalance('*', 6, function(err, balance) {
  if (err) return console.log(err);
  console.log('Balance:', balance);
});
```
### Getting the balance directly using `cmd`

```js
client.cmd('getbalance', '*', 6, function(err, balance){
  if (err) return console.log(err);
  console.log('Balance:', balance);
});
```

### Batch multiple RPC calls into single HTTP request

```js
var batch = [];
for (var i = 0; i < 10; ++i) {
  batch.push({
    method: 'getnewaddress',
    params: ['myaccount']
  });
}
client.cmd(batch, function(err, address) {
  if (err) return console.log(err);
  console.log('Address:', address);
});
```

## SSL
See [Enabling SSL on original client](https://en.bitcoin.it/wiki/Enabling_SSL_on_original_client_daemon).

If you're using this to connect to namecoind across a network it is highly
recommended to enable `ssl`, otherwise an attacker may intercept your RPC credentials
resulting in theft of your bitcoins.

When enabling `ssl` by setting the configuration option to `true`, the `sslStrict`
option (verifies the server certificate) will also be enabled by default. It is 
highly recommended to specify the `sslCa` as well, even if your bitcoind has
a certificate signed by an actual CA, to ensure you are connecting
to your own bitcoind.

```js
var client = new namecoin.Client({
  host: 'localhost',
  port: 8336,
  user: 'username',
  pass: 'password',
  ssl: true,
  sslStrict: true,
  sslCa: fs.readFileSync(__dirname + '/myca.cert')
});
```

---
_Source: https://npm.io/package/namecoin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
