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

spv-store

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spv-store

**SPV-Store** is a modular engine to used to locally store and index Bitcoin transaction history with pluggable support for custom indexers, persistance layers, and API providers.

  • 0.1.44
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-97.11%
Maintainers
0
Weekly downloads
 
Created
Source

SPV-Store

SPV-Store is a modular engine to used to locally store and index Bitcoin transaction history with pluggable support for custom indexers, persistance layers, and API providers.

Usage

Install

npm install spv-store

Instantiate

Initialize for use in web browser with OneSat API provider

import {
    Bsv21Indexer,
    FundIndexer,
    Indexer,
    IndexMode,
    InscriptionIndexer,
    LockIndexer,
    MapIndexer,
    OneSatWebSPV,
    OrdLockIndexer,
    OriginIndexer,
} from 'spv-store';

const owners = new Set<string>([bsvAddress, identityAddress, ordAddress, /*...other owners */]);

const indexers: Indexer[] = [
    new FundIndexer(owners, IndexMode.TrustAndVerify),
    new LockIndexer(owners, IndexMode.TrustAndVerify),
    new OrdLockIndexer(owners, IndexMode.TrustAndVerify),
    new InscriptionIndexer(owners, IndexMode.TrustAndVerify),
    new MapIndexer(owners, IndexMode.Verify),
    new OriginIndexer(owners, IndexMode.TrustAndVerify),
    new Bsv21Indexer(owners, IndexMode.Trust),
];
const startSync = true
const oneSatSPV = await OneSatWebSPV.init(
    'accountId',
    indexers,
    owners,
    startSync,
);

Broadcast

const tx = Transaction.fromHex('010000....')
const txResponse = await oneSatSPV.broadcast(tx)

Search UTXOs

// funding utxos
const fundResults = await oneSatSPV.search(new TxoLookup('fund'));

// lock utxo
const lockTxos = await oneSatSPV.search(new TxoLookup('lock'));

// load all jpeg inscriptions
const ordinals = await oneSatSPV.search(new TxoLookup('origin', 'type', 'image/jpeg'), TxoSort.DESC, 0);

Extensibility

Indexers

Indexers parse transactions and identify if a transaction output fits a specified set of rules. If a match is identified, the indexer can extract pertinant data from the transaction and save that data in a fashion where it can be retrieved and searched.

  • Indexer

Storage

Services

FAQs

Package last updated on 06 Nov 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