--- title: Multiple Indy Network Support --- # ArgParse Config * `--genesis-transactions-list` Load YAML configuration for connecting to multiple HyperLedger Indy ledgers * YAML config file ``` - id: sovrinMain is_production: true genesis_transactions: reqSignature: {} txn: data: data: alias: Node1 blskey: >- 4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba blskey_pop: >- RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1 client_ip: 192.168.65.3 client_port: 9702 node_ip: 192.168.65.3 node_port: 9701 services: - VALIDATOR dest: Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv metadata: from: Th7MpTaRZVRYnPiabds81Y type: '0' txnMetadata: seqNo: 1 txnId: fea82e10e894419fe2bea7d96296a6d46f50f93f9eeda954ec461b2ed2950b62 ver: '1' - id: sovrinStaging is_production: true genesis_file: /home/indy/ledger/sandbox/pool_transactions_genesis - id: sovrinTest is_production: false genesis_url: 'http://localhost:9000/genesis' ``` --- # Changes * If `--genesis-transactions-list` is passed, it loads multiple genesis_transactions and assign it to `settings["ledger.ledger_config_list"]` It contains a list of configurations like below: ``` { "id": ..., "is_production": True, "genesis_transactions": ..., } ``` * If `ledger.ledger_config_list` is found in `context.settings` then ledger is not confugired in the `profile`. Instead, multiple ledgers are configured and binded with `BaseMultipleLedgerManager` using `MultiLedgerManagerProvider` in `Conductor` and `Provision`. * `BaseMultipleLedgerManager` is inherited to create `MultiIndyVDRLedgerManager` and `MultiIndySDKLedgerManager` ``` class BaseMultipleLedgerManager(ABC): """Base class for handling multiple ledger support.""" def __init__(self, profile: Profile): """Initialize Multiple Ledger Manager.""" super().__init__() self._profile = profile @abstractmethod async def get_write_ledger(self) -> T: """Return write ledger.""" @abstractmethod async def set_write_ledger(self, ledger_id: str = None) -> T: """Set a ledger as write ledger and update BaseLedger.""" @abstractmethod async def update_profile_context(self, ledger: T): """Update BaseLedger and Verifier in context.""" @abstractmethod async def reset_write_ledger(self) -> T: """Reset the assigned write_ledger and return new write ledger.""" @abstractmethod async def update_ledger_config(self, ledger_config_list: List): """Update production and non_production ledgers.""" @abstractmethod async def get_ledger_instance_by_did(self, did: str) -> Optional[T]: """Return ledger_instance with DID, if present.""" ``` * Like AFJ, `get_ledger_instance_by_did` is called when executing Read request [CRED_DEF, SCHEMA, ATTRIB(did endpoint), REVOC_REG] by extracting the DID from the IDs. It submits `GET_NYM` from different configured ledgers and returns the applicable/target ledger. This ledger is then used to submit the original GET request.