0.1.37 • Published 1 year ago

spv-store v0.1.37

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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.

Storage

Services

0.1.37

1 year ago

0.1.30

1 year ago

0.1.31

1 year ago

0.1.32

1 year ago

0.1.33

1 year ago

0.1.34

1 year ago

0.1.35

1 year ago

0.1.36

1 year ago

0.1.27

1 year ago

0.1.28

1 year ago

0.1.29

1 year ago

0.1.24

1 year ago

0.1.25

1 year ago

0.1.26

1 year ago

0.1.22

1 year ago

0.1.23

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.20

1 year ago

0.1.21

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago