src/main/java/com/hedera/hashgraph/identity/hcs/HcsIdentityNetworkBuilder.java
/**
   * Creates a new identity network for the given appnet.
   * This will initialize an address book file on Hedera File Service.
   * Then DID and VC topics on Hedera network will be created unless already existing topics are provided.
   *
   * @param client Hedera client
   * @return The new identity network.
   * @throws ReceiptStatusException  in the event the receipt contains an error
   * @throws PrecheckStatusException in the event the transaction isn't validated by the network
   * @throws TimeoutException        in the event the client fails to communicate with the network in a timely fashion
   */
Creates a new identity network for the given appnet.
This will initialize an address book file on Hedera File Service.
Then DID and VC topics on Hedera network will be created unless already existing topics are provided.

@param client Hedera client
@return The new identity network.
@throws ReceiptStatusException  in the event the receipt contains an error
@throws PrecheckStatusException in the event the transaction isn't validated by the network
@throws TimeoutException        in the event the client fails to communicate with the network in a timely fashion
Creates a new identity network for the given appnet . This will initialize an address book file on Hedera File Service . Then DID and VC topics on Hedera network will be created unless already existing topics are provided . @param client Hedera client @return The new identity network . @throws ReceiptStatusException in the event the receipt contains an error @throws PrecheckStatusException in the event the transaction isn ' t validated by the network @throws TimeoutException in the event the client fails to communicate with the network in a timely fashion
public HcsIdentityNetwork execute(final Client client)
          throws ReceiptStatusException, PrecheckStatusException, TimeoutException {
    TopicCreateTransaction didTopicCreateTransaction = new TopicCreateTransaction()
            .setMaxTransactionFee(maxTransactionFee)
            .setTopicMemo(didTopicMemo);
    if (publicKey != null) {
      didTopicCreateTransaction.setAdminKey(publicKey);
    }
    TransactionResponse didTxId = didTopicCreateTransaction
            .execute(client);
    TopicId didTopicId = didTxId.getReceipt(client).topicId;
    TopicCreateTransaction vcTopicCreateTransaction = new TopicCreateTransaction()
            .setMaxTransactionFee(maxTransactionFee)
            .setTopicMemo(vcTopicMemo);
    if (publicKey != null) {
      vcTopicCreateTransaction.setAdminKey(publicKey);
    }
    TransactionResponse vcTxId = vcTopicCreateTransaction.execute(client);
    TopicId vcTopicId = vcTxId.getReceipt(client).topicId;
    AddressBook addressBook = AddressBook
            .create(appnetName, didTopicId.toString(), vcTopicId.toString(), didServers);
    FileCreateTransaction fileCreateTx = new FileCreateTransaction()
            .setContents(addressBook.toJson().getBytes(Charsets.UTF_8));
    TransactionResponse response = fileCreateTx.execute(client);
    TransactionReceipt receipt = response.getReceipt(client);
    FileId fileId = receipt.fileId;
    addressBook.setFileId(fileId);
    return HcsIdentityNetwork.fromAddressBook(network, addressBook);
  }
public HcsIdentityNetwork execute ( final Client client ) throws ReceiptStatusException , PrecheckStatusException , TimeoutException { TopicCreateTransaction didTopicCreateTransaction = new TopicCreateTransaction ( ) . setMaxTransactionFee ( maxTransactionFee ) . setTopicMemo ( didTopicMemo ) ; if ( publicKey != null ) { didTopicCreateTransaction . setAdminKey ( publicKey ) ; } TransactionResponse didTxId = didTopicCreateTransaction . execute ( client ) ; TopicId didTopicId = didTxId . getReceipt ( client ) . topicId ; TopicCreateTransaction vcTopicCreateTransaction = new TopicCreateTransaction ( ) . setMaxTransactionFee ( maxTransactionFee ) . setTopicMemo ( vcTopicMemo ) ; if ( publicKey != null ) { vcTopicCreateTransaction . setAdminKey ( publicKey ) ; } TransactionResponse vcTxId = vcTopicCreateTransaction . execute ( client ) ; TopicId vcTopicId = vcTxId . getReceipt ( client ) . topicId ; AddressBook addressBook = AddressBook . create ( appnetName , didTopicId . toString ( ) , vcTopicId . toString ( ) , didServers ) ; FileCreateTransaction fileCreateTx = new FileCreateTransaction ( ) . setContents ( addressBook . toJson ( ) . getBytes ( Charsets . UTF_8 ) ) ; TransactionResponse response = fileCreateTx . execute ( client ) ; TransactionReceipt receipt = response . getReceipt ( client ) ; FileId fileId = receipt . fileId ; addressBook . setFileId ( fileId ) ; return HcsIdentityNetwork . fromAddressBook ( network , addressBook ) ; }
Creates a new identity network for the given appnet.
Creates a new identity network for the given appnet .