cashscript_py.network.electrum_network_provider module

Electrum/Fulcrum-based network provider for BCH.

class ElectrumNetworkProvider(network: Network = Network.MAINNET)[source]

Bases: NetworkProvider

NetworkProvider backed by bitcash FulcrumProtocolAPI.

Connects to specific servers per network and provides UTXO queries, block height, raw transaction fetching, and broadcasting.

async get_block_height() int[source]

Return the current block height.

Raises:
async get_raw_transaction(txid: str) str[source]

Retrieve the raw transaction hex for a txid.

Parameters:

txid – Transaction ID (hex).

Returns:

Raw transaction hex.

Raises:
async get_utxos(address: str) list[Utxo][source]

Fetch UTXOs for a CashAddress.

Parameters:

address – CashAddress string.

Returns:

List of Utxo objects.

Raises:
property network: Network

Return the configured network.

async send_raw_transaction(tx_hex: str) str[source]

Broadcast a raw transaction to the network.

Parameters:

tx_hex – Hex-encoded transaction.

Returns:

Transaction ID computed for the broadcast transaction.

Raises:

BroadcastFailed – If the transaction was not accepted by the network.