CbfBuilder

Build a BIP 157/158 light client to fetch transactions for a Wallet.

Options:

  • List of Peer: Bitcoin full-nodes for the light client to connect to. May be empty.

  • connections: The number of connections for the light client to maintain.

  • scan_type: Sync, recover, or start a new wallet. For more information see `ScanType`.

  • data_dir: Optional directory to store block headers and peers.

A note on recovering wallets. Developers should allow users to provide an approximate recovery height and an estimated number of transactions for the wallet. When determining how many scripts to check filters for, the Wallet lookahead value will be used. To ensure all transactions are recovered, the lookahead should be roughly the number of transactions in the wallet history.

Constructors

Link copied to clipboard
constructor(pointer: Pointer)
constructor(noPointer: NoPointer)

This constructor can be used to instantiate a fake object. Only used for tests. Any attempt to actually use an object constructed this way will fail as there is no connected Rust object.

constructor()

Start a new `CbfBuilder`

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun build(wallet: Wallet): CbfComponents

Construct a `CbfComponents` for a `Wallet`.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun connections(connections: UByte): CbfBuilder

The number of connections for the light client to maintain. Default is two.

Link copied to clipboard
open override fun dataDir(dataDir: String): CbfBuilder

Directory to store block headers and peers. If none is provided, the current working directory will be used.

Link copied to clipboard
open override fun destroy()
Link copied to clipboard
open override fun dnsResolver(dnsResolver: IpAddress): CbfBuilder

Configure a custom DNS resolver when querying DNS seeds. Default is 1.1.1.1 managed by CloudFlare.

Link copied to clipboard
open override fun logLevel(logLevel: LogLevel): CbfBuilder

Set the log level for the node. Production applications may want to omit Debug messages to avoid heap allocations.

Link copied to clipboard
open override fun peers(peers: List<Peer>): CbfBuilder

Bitcoin full-nodes to attempt a connection with.

Link copied to clipboard
open override fun scanType(scanType: ScanType): CbfBuilder

Select between syncing, recovering, or scanning for new wallets.

Link copied to clipboard
fun uniffiClonePointer(): Pointer