Connect to a network
To start interacting with a blockchain, you first need to establish a connection to a network node. You can use LedgerClient
as a client object which takes a NetworkConfig
as an argument.
from cosmpy.aerial.client import LedgerClient, NetworkConfig
ledger_client = LedgerClient(NetworkConfig.fetch_mainnet())
For convenience, some networks' configurations are provided automatically. For example, NetworkConfig.fetch_mainnet()
is the configuration for the Fetch ledger. If you want to target other chains, you can customise NetworkConfig
as shown in the example below: