001package org.consensusj.bitcoin.rx; 002 003import org.consensusj.bitcoin.json.pojo.ChainTip; 004import org.bitcoinj.core.Block; 005import org.bitcoinj.base.Sha256Hash; 006import org.bitcoinj.core.Transaction; 007import org.reactivestreams.Publisher; 008 009import java.io.Closeable; 010 011/** 012 * Reactive Streams interface for subscribing to reactive blockchain data. 013 * 014 * There are at least 3 possible implementations 015 * 1. A bitcoinj {@link org.bitcoinj.core.PeerGroup} 016 * 2. The ZeroMQ (and JSON-RPC) service of a trusted Bitcoin Core node 017 * 3. A Bitcoin web service using WebSocket 018 * 019 * Note: Implementation instances may throw {@link UnsupportedOperationException} if they don't support a particular 020 * published data type. 021 */ 022public interface RxBlockchainService extends Closeable { 023 Publisher<Transaction> transactionPublisher(); 024 Publisher<Sha256Hash> transactionHashPublisher(); 025 Publisher<Block> blockPublisher(); 026 Publisher<Sha256Hash> blockHashPublisher(); 027 Publisher<Integer> blockHeightPublisher(); 028 Publisher<ChainTip> chainTipPublisher(); 029}