Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@runcitadel/bitcoin-rpc

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@runcitadel/bitcoin-rpc

The library used by Citadel for connecting to Bitcoin Core

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Bitcoin simple RPC

This library is a very simple wrapper for communicating with a bitcoind instance through the JSON-RPC.

Usage

const client = new Client({
  baseURL: 'http://localhost:18443/',
  auth: { username: 'user', password: 'pass' },
})
const address = await client.getNewAddress()

Usage with Tor

The library can easily be used to communicate with a bitcoind node over Tor using a socks5 proxy. For example with sock-proxy-agent:

const proxyOptions = 'socks5h://127.0.0.1:9050'
const httpsAgent = new SocksProxyAgent(proxyOptions)
const config : ClientOption = {
  baseURL: 'http://onionaddress.onion:port',
  auth: {
    username: 'user',
    password: 'password',
  },
  httpAgent: httpsAgent,
}
const client = new Client(config)

Error handling

The client throws four types of errors.

BitcoinRpcError

This indicates that an error was returned by the bitcoind instance. The list of error code is available in the RPCErrorCode enum.

ConnectionError

This usually indicates that a connection to the specified address could not be established.

AuthError

This indicates that the credential provided were not valid.

UnknownError

This indicates that something unexpected happened.

FAQs

Package last updated on 30 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc