Registry / payments / blockcypher

blockcypher

JSON →
library0.3.0jsnpmunverified

A REST API client for BlockCypher, a blockchain web service for Bitcoin and other cryptocurrencies. Version 0.3.0 supports Node.js >=4.0.0. Provides methods for blockchain data (blocks, transactions, addresses), wallet management, and webhooks with promisified callbacks. Token-based authentication; no other dependencies. Not actively maintained (last release 2018).

npm install blockcypher
INSTALL
IMPORT
SIG · BLOCKCYPHER
B
blockcypher
paymentsjavascriptv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import bcypher from 'blockcypher'
const bcypher = require('blockcypher')
Use CommonJS require if not using ESM.
BlockCypher
import { BlockCypher } from 'blockcypher'
const { BlockCypher } = require('blockcypher')
Named export available only with ESM import.
new bcypher()
const bcapi = new bcypher('btc', 'main', process.env.TOKEN)
const bcapi = new bcypher(process.env.TOKEN)
First argument is coin (e.g., 'btc'), second is chain (e.g., 'main'), third is token.

Shows initialization with a token, then chaining calls: getChain, getBlock, creating a webhook, and listing webhooks.

const bcypher = require('blockcypher'); const bcapi = new bcypher('btc', 'main', process.env.TOKEN ?? ''); bcapi.getChain((err, data) => { if (err) console.error(err); else console.log('Chain:', data); }); bcapi.getBlock(300000, (err, data) => { if (err) console.error(err); else console.log('Block:', data); }); const webhook = { event: 'unconfirmed-tx', address: '15qx9ug952GWGTNn7Uiv6vode4RcGrRemh', url: 'https://my.domain.com/callbacks/new-tx', }; bcapi.createHook(webhook, (err, data) => { if (err) console.error(err); else console.log('Hook created:', data); }); bcapi.listHooks((err, data) => { if (err) console.error(err); else console.log('Hooks:', data); });
Debug
Known issues
gotchaAll methods use callbacks; no Promise or async/await support.
fix
Wrap calls in a Promise manually or use util.promisify.
affects: <=0.3.0
gotchaConstructor requires coin and chain as strings; 'test3' chain may be deprecated.
fix
Use 'main' or 'test' for chain.
affects: >=0.0.0
deprecatedPackage is not actively maintained; security updates unlikely.
fix
Consider alternative libraries or use raw HTTP requests to BlockCypher API.
affects: >=0.0.0
Errors
Common errors & fixes
Uncaught TypeError: bcypher is not a constructor
Using default export without correct import syntax.
fix
Use `const bcypher = require('blockcypher');`
TypeError: Cannot read property 'getChain' of undefined
Forgetting to instantiate with `new`.
fix
Create instance: `const bcapi = new bcypher('btc', 'main', 'token');`
Error: Invalid API token
TOKEN environment variable not set or invalid.
fix
Set environment variable TOKEN to your BlockCypher token, or pass directly.
Error: Chain parameter must be one of: main, test, test3, testnet
Invalid chain string passed to constructor.
fix
Use 'main' for mainnet, 'test' for testnet.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
62 hits · last 30 days
node
54
Perplexity
1
OpenAI (training)
1
Resources
blockcypher — npm install blockcypher · libregistry