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

@electrum-cash/application

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electrum-cash/application

...

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

Introduction

The @electrum-cash/application library provides a robust framework for building SPV-validated tools and services.

  • Full SPV-validation of monitored transactions and blocks.
  • Rich notifications for each step in the transaction, block or address life-cycle.
  • You can ask for partial data without needing to understand how to acquire it.
  • Automatic handling of network edge-cases, fail-over and opportunistic caching.

For complete information on all typings, arguments and options available, read to the documentation generated from the source code.

Usage

Installation

Installation is easy, just get the library from NPM:

npm install @electrum-cash/application

Setup

// Import library features.
import { initializeElectrumApplication } from '@electrum-cash/application';

// Initialize the electrum application.
const electrumEvents = await initializeElectrumApplication('My Electrum Application');

Event handling

Tracking the blockchain

Once you have initialized the electrum application you can monitor when new blocks become available.

// Log when new block headers are available.
electrumEvents.on('BlockReceived', console.log);

// Log when new block headers have been verified.
electrumEvents.on('BlockVerified', console.log);

// Log what chain height and percent of the chain has been verified.
electrumEvents.on('ChainStatus', console.log);

Tracking transactions

After you monitor an address or transaction, you get events for each step in each transactions life-cycle.

// Log when new transactions are available.
electrumEvents.on('TransactionReceived', console.log);

// Log when new transactions are verified.
electrumEvents.on('TransactionVerified', console.log);

// Log when new transactions are doublespent.
electrumEvents.on('TransactionDoubleSpendDetected', console.log);

// Either monitor a specific transaction...
await monitorTransaction(transactionHash);

// .. or all pending transactions for a specific address.
await monitorAddress(address);

Tracking address history

After you monitor an address, you get events when an address history is updated.

// Log when the address history has changed.
electrumEvents.on('AddressUpdateReceived', console.log);

// TODO: Add events for address balance updates.

// Monitor a specific address.
await monitorAddress(address);

Requesting Data

Getting balance, UTXOs and transaction history.

...

Support

If you find bugs or have problems using this library, you can file issues on the Gitlab.

FAQs

Package last updated on 03 Feb 2024

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