A Node.js library for managing the bitcoin service bitcoind
. The package includes runtime JavaScript files suitable for Node.js >=8 as well as the corresponding TypeScript type declarations.
Here is a little TypeScript Node.js script that starts bitcoind
:
// example.ts
import { startService } from '@carnesen/bitcoin-service';
const bitcoinHome = '/usr/local/bitcoin-0.17.1';
(async () => {
try {
await startService({ bitcoinHome });
process.exit(0);
} catch (ex) {
console.log(ex);
process.exit(1);
}
})()
Running the script looks like:
$ ts-node example.ts
Bitcoin server starting
Sets daemon
to true
in the configuration file and starts bitcoind
if it's not running already
string
. Absolute path of a bitcoin configuration file. Will be created if it does not already exist.
Optional string
. Absolute path of a directory where the bitcoin server software is installed. If not provided, `${bitcoinHome}/bin`
must be on your PATH
.
boolean
. Is false
if bitcoind
was already running, true
if the service was successfully started.
Stops bitcoind
if it's running
boolean
. Is false
if bitcoind
wasn't running. Is true
if the service was running and successfully stopped.
Stops and starts bitcoind
as documented above.
The returned promise resolves to true
if the service is running or false
if it is not.
Check out the tests directory for more examples of how it works. If you encounter any bugs or have any questions or feature requests, please don't hesitate to file an issue or submit a pull request on this project's repository on GitHub.
-
@carnesen/bitcoin-service-cli: A Node.js CLI and library for managing the bitcoin server process
bitcoind
-
@carnesen/bitcoin-config: A Node.js library for bitcoin server software configuration