Skip to content

Class BSV::Transaction::ChainTrackers::Chaintracks

Inherits: BSV::Transaction::ChainTracker

Chain tracker that verifies merkle roots using the Chaintracks API (Arcade/GorillaPool).

Delegates all HTTP communication to {BSV::Network::Protocols::Chaintracks}. The constructor signature and {ChainTracker} contract are preserved.

@example

tracker = BSV::Transaction::ChainTrackers::Chaintracks.new
tracker.valid_root_for_height?('abcd...', 800_000)

@example With API key

tracker = BSV::Transaction::ChainTrackers::Chaintracks.new(api_key: 'my-key')
tracker.current_height

Public Class Methods

default(testnet: = false, **opts)

Returns a Chaintracks instance using the GorillaPool provider default. - @param testnet [Boolean] when true, uses the testnet endpoint - @param opts [Hash] forwarded to the underlying protocol (e.g. +api_key:+, +http_client:+) - @return [Chaintracks]

Public Instance Methods

current_height()

Return the current blockchain height. - @raise [BSV::Network::ChainProviderError] on network or API error - @return [Integer]

initialize(url: = nil, api_key: = nil, http_client: = nil, protocol: = nil)

  • @param url [String, nil] base URL (legacy compat — prefer .default or protocol:)
  • @param api_key [String, nil] optional Bearer API key
  • @param http_client [#request, nil] injectable HTTP client for testing
  • @param protocol [BSV::Network::Protocols::Chaintracks, nil] pre-configured protocol
  • @return [Chaintracks] a new instance of Chaintracks

valid_root_for_height?(root, height)

Verify that a merkle root is valid for the given block height. - @param root [String] merkle root as a hex string - @param height [Integer] block height - @raise [BSV::Network::ChainProviderError] on network or API error - @return [Boolean]