Electrum Network Provider

CashScript-Py needs to connect to the BCH network to perform certain operations, like retrieving UTXOs or broadcasting transactions. The recommended provider is the ElectrumNetworkProvider.

The Python implementation is backed by bitcash’s FulcrumProtocolAPI and connects to a single configured server per network (no fallback logic and no SPV proof validation).

Creating an ElectrumNetworkProvider

Constructor

Both the network parameter and server selection default to mainnet.

from cashscript_py import ElectrumNetworkProvider

provider = ElectrumNetworkProvider("mainnet")

CashScript-Py supports these networks via the Electrum provider:

  • Network.MAINNET

  • Network.CHIPNET

  • Network.TESTNET3

  • Network.TESTNET4

Unlike the upstream TypeScript SDK, the current Python provider does not (yet) expose:

  • custom hostname/electrum client configuration

  • manual connection management (connect/disconnect)

  • arbitrary electrum protocol requests (performRequest)

ElectrumNetworkProvider methods

The provider implements the standard NetworkProvider interface:

  • await provider.get_utxos(address)

  • await provider.get_block_height()

  • await provider.get_raw_transaction(txid)

  • await provider.send_raw_transaction(tx_hex)

Errors

Errors are wrapped into:

  • RequestFailed

  • UnexpectedResponse

  • BroadcastFailed