Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carnesen-archive/bitcoin-config-cli
A Node.js command-line interface for bitcoin server software configuration
https://github.com/carnesen-archive/bitcoin-config-cli
bitcoin carnesen cli configuration
Last synced: 4 days ago
JSON representation
A Node.js command-line interface for bitcoin server software configuration
- Host: GitHub
- URL: https://github.com/carnesen-archive/bitcoin-config-cli
- Owner: carnesen-archive
- License: mit
- Created: 2019-01-30T00:03:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-09T17:52:54.000Z (almost 6 years ago)
- Last Synced: 2024-11-14T16:23:49.022Z (2 months ago)
- Topics: bitcoin, carnesen, cli, configuration
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# @carnesen/bitcoin-config-cli [![Build Status](https://travis-ci.com/carnesen/bitcoin-config-cli.svg?branch=master)](https://travis-ci.com/carnesen/bitcoin-config-cli)
A Node.js command-line interface (CLI) for bitcoin server software configuration## Install
```
npm install --global @carnesen/bitcoin-config-cli
```
^^ This installs this package to your global `node_modules` area. Probably you can now invoke this CLI from anywhere using the command `bitcoin-config`. If not you'll need modify your [`PATH`](https://en.wikipedia.org/wiki/PATH_(variable)).## Usage
By default this CLI reads/writes the default bitcoin configuration file location, e.g. `~/.bitcoin/bitcoin.conf` on Linux.The CLI can take a JSON-serialized configuration object and write it as an INI-serialized string as expected by the bitcoin server software:
```
$ bitcoin-config write --json '{"regtest": true, "daemon": true}'
```
Let's check the contents of the configuration file:
```
$ bitcoin-config read --format ini
# This is a bitcoin configuration file written using @carnesen/bitcoin-config# Run this node on its own independent test network.
regtest=1# Spawn bitcoin as a background process
daemon=1
```
Looks good! Now suppose later we want to update a configuration file with a specific value:
```
$ bitcoin-config set --acceptnonstdtxn 1
```
The "set" command preserves existing values and adds the one(s) specified:
```
$ bitcoin-config read
{ regtest: true, daemon: true, acceptnonstdtxn: true }
```
By now there are a TON of available bitcoin configuration options:
```
$ bitcoin-config set --help
Usage: bitcoin-config setOptions:
[--acceptnonstdtxn ] : Relay and mine non-standard transactions
Allowed values {'0', '1'}
[--addresstype ] : p2sh-segwit, legacy, or bech32
[--addnode [...]] : Add a node IP address to attempt to connect to
[--addrmantest ] : allows you to test address relay locally
Allowed values {'0', '1'}
[--alertnotify ] : Execute a command when an alert or long fork is received.
"%s" in the command string is replaced by the alert message.
...
```## Usage as a library
In addition to providing a CLI, this npm package can also be used as a library in conjunction with [`@carnesen/cli`](https://github.com/carnesen/cli/):```ts
import { bitcoinConfig } from '@carnesen/bitcoin-config-cli';
import { branch, cli } from '@carnesen/cli';export const root = branch({
commandName: 'awesome',
subcommands: [bitcoinConfig],
})if (module === require.main) {
cli(root)();
}
```
## Related
- [@carnesen/bitcoin-config](https://github.com/carnesen/bitcoin-config): Constants, utilities, and TypeScript types for bitcoin server software configuration with Node.js
- [@carnesen/cli](https://github.com/carnesen/cli): A library for building Node.js command-line interfaces## License
MIT © [Chris Arnesen](https://www.carnesen.com)