blockchain_monitor 0.1.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

A high level blockchain monitoring library.

This library allows you to monitor blockchain events:

  • new block
  • new transaction for a particular address
  • new confirmation for a particular transaction

It does so by using 4 different public API's:

It uses 4 different API's for redundancy reasons. All events are normalized and de-duplicated.

Please note that this library does not contain any querying capabilities. Use the individual clients for that instead.

Usage #

A simple usage example:

import 'package:blockchain_monitor/blockchain_monitor.dart';

main() async {
  var monitor = new Monitor();
  Stream<Transaction> txs = monitor.address('some Bitcoin address');
  await for (tx in txs) {
    print(tx);
  }
  
  Stream<int> confirmations = monitor.confirmations('some tx hash');
  await for (confirmation in confirmations) {
    print(confirmation);
  }
  
  Stream<Block> blocks = monitor.blocks();
  await for (block in blocks) {
    print(block);
  }
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.1.5 #

  • Fix bug in Blockbook which was unable to deal with mempool txs

0.1.4 #

  • Fix bug in Blockchair which was unable to deal with mempool txs

0.1.3 #

  • Fix major bug in Blockbook

0.1.2 #

  • Add testnet

0.1.1 #

  • add isRBF call

0.1.0 #

  • Initial version

example/blockchain_monitor_example.dart

import 'package:logger/logger.dart';
import 'package:blockchain_monitor/blockchain_monitor.dart';

void main(List<String> args) {
  var token = args[0];
  var monitor = Monitor.mainnet(
    blockcypherToken: token,
    logger: Logger(
      level: Level.verbose,
      filter: ProductionFilter(),
      printer: LogfmtPrinter(),
    ),
  );
  monitor.blocks().listen(print);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  blockchain_monitor: ^0.1.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:blockchain_monitor/blockchain_monitor.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
83
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

We analyzed this package on Apr 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Format lib/src/adapters/adapter.dart.

Run dartfmt to format lib/src/adapters/adapter.dart.

Format lib/src/adapters/blockchair.dart.

Run dartfmt to format lib/src/adapters/blockchair.dart.

Maintenance suggestions

The package description is too short. (-17 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
async ^2.4.0 2.4.1
blockbook ^1.1.4 1.1.4
blockchain_info ^0.1.3 0.1.3
blockchair ^0.1.2 0.1.3
blockcypher ^0.3.0 0.3.0
equatable ^1.1.1 1.1.1
logger ^0.8.3 0.8.3
retry ^3.0.0 3.0.0+1
Transitive dependencies
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
http 0.12.0+4
http_parser 3.1.4
io 0.3.4
meta 1.1.8
path 1.6.4
source_span 1.7.0
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
uuid 2.0.4
web_socket_channel 1.1.0
Dev dependencies
mockito ^4.1.1
pedantic ^1.9.0 1.9.0
test ^1.14.1