npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@agilie/electrum-proxy-middleware

v1.0.2

Published

# Electrum Proxy Middleware

Readme

README

Electrum Proxy Middleware

ExpressJS middleware to add functionality for proxying requests to Electrum servers

Agenda

Web applications can't communicate with electrum servers. This package provide ability to make requests to them.

Requirements

Node >= 7.x

Getting started

npm install @agilie/electrum-proxy-middleware
const electrum = require('@agilie/electrum-proxy-middleware');

app.use(electrum.router);

app.listen(3000)
curl -X GET http://localhost:3000/server/version?coinType=btc
> {"status":"success","result":["ElectrumX 1.13.0","1.4"]}

or

curl -X GET 'http://localhost:3000/server/version?port=55002&host=tn.not.fyi&connectionType=ssl&version=1.4'
> {"status":"success","result":["ElectrumX 1.13.0","1.4"]}

Running the tests

npm test

Supported calls

All calls are required to have a coinType param or at least host, port, connectionType and version params.

Param | Value ------------ | ------------- coinType (required) | supported coin types netMode | mainnet(by default) or testnet

or

Param | Value ------------ | ------------- host (required) | e.g. tn.not.fyi port (required)| e.g. 55002 connectionType (required) | ssl or tcp version (required) | e.g 1.4 netMode | mainnet (by default) or testnet

Server methods

[GET] /server/version eq. to server.version

[GET] /server/features eq. to server.features

[GET] /server/banner eq. to server.banner

[GET] /server/donation-address eq. to server.donation_address

[GET] /server/add_peer eq. to server.add_peer

[GET] /server/get-peers eq. to server.peers.subscribe

[GET] /server/ping eq. to server.ping

Example: /server/version?coinType=btc

Blockchain methods

[GET] /block/header eq. to blockchain.block.header

Additional params:

Param | Type | Description ------------ | ------------- | ------------- version | Float | server version height | non-negative integer | the height of the block

Example: /block/header?coinType=btc&height=5

[GET] /block/headers eq. to blockchain.block.headers

Additional params: start_height - the height of the first header requested, count - the number of headers requested.
Example: /block/headers?&coinType=btc&start_height=5&count=1

[GET] /blockchain/estimatefee eq. to blockchain.estimatefee

Additional params:

Param | Description ------------ | ------------- blocks | the number of blocks to target for confirmation

Example: /blockchain/estimatefee?coinType=btc&blocks=1

[GET] /blockchain/relayfee eq. to blockchain.relayfee

Example: /blockchain/relayfee?coinType=btc

Mempool methods

[GET] /mempool/get_fee_histogram eq. to mempool.get_fee_histogram

Example: /mempool/get_fee_histogram?coinType=btc

Scripthash methods

Param | Type | Description ------------ | ------------- | ------------- scripthash |hexadecimal string | script hash

[GET] /scripthash/balance eq. to blockchain.scripthash.get_balance

[GET] /scripthash/listunspent eq. to blockchain.scripthash.listunspent

[GET] /scripthash/get_history eq. to blockchain.scripthash.get_history

[GET] /scripthash/get_mempool eq. to blockchain.scripthash.get_mempool

Example: /scripthash/balance?scripthash=20b360e68b4fe6d1eb460e45434f756fa1582ed687167898f9a716435ecd737f&coinType=btc

Transaction methods

[POST] /transaction/broadcast eq. to blockchain.transaction.broadcast

Additional params:

Param | Type | Description ------------ | ------------- | ------------- raw_tx | hexadecimal string | raw transaction

[GET] /transaction/get eq. to blockchain.transaction.get

Additional params:

Param | Type | Description ------------ | ------------- | ------------- tx_hash | hexadecimal string | transaction hash verbose | boolean | whether a verbose coin-specific response is required

Example: /transaction/get?tx_hash=871af2528c83ba90bd7b3fbfeac703cbd20f204f1b800ba4ec748842fcac0c9b&coinType=btc

[GET] /transaction/get-merkle eq. to blockchain.transaction.get_merkle

Additional params:

Param | Type | Description ------------ | ------------- | ------------- tx_hash | hexadecimal string | raw transaction height | integer | the height at which it was confirmed

[GET] /transaction/id-from-pos eq. to blockchain.transaction.id_from_pos

Additional params:

Param | Type | Description ------------ | ------------- | ------------- height | non-negative integer | the main chain block height tx_pos | integer | a zero-based index of the transaction in the given block merkle | boolean | whether a merkle proof should also be returned

Getting history

Getting history docs.

For more details, refer to the ElectrumX Protocol Methods docs.

Examples

Here are some basic examples.

Protocol version

  • URL

    </server/version?coinType=btc>

  • Method:

    GET

  • URL Params

    Required:

    coinType=[CoinType]

    Optional:

    netMode=[Netmode]

  • Success Response:

    • Code: 200
    • Content:
  • Error Response:

    • Code: 409
    • Content:

Or you can specify electrum server:

  • URL

    </server/version?port=55002&host=tn.not.fyi&connectionType=ssl&version=1.4>

  • Method:

    GET

  • URL Params

    Required:

    port=[integer]

    host=[string]

    connectionType=[ssl | tcp]

    version=[server version]

    Optional:

    netMode=[testnet | mainnet]

Confirmed and unconfirmed history of a script hash.

  • URL

    </history/get_history?address=1BWwXJH3q6PRsizBkSGm2Uw4Sz1urZ5sCj&coinType=btc&page=1&pageSize=2>

  • Method:

    GET

  • URL Params

    Required:

    coinType=[CoinType]

    address=[string]

    Optional:

    netMode=[Netmode]

    page=[number]

    pageSize=[number]

  • Success Response:

    • Code: 200
    • Content:
  • Error Response:

    • Code: 409
    • Content:

License

The MIT License (MIT). Full license text is available in LICENSE.