@Override
 public AppropriationTransactionRecord getTransaction(
     DigitalAssetMetadata digitalAssetMetadata,
     String assetIssuerWalletPublicKey,
     String bitcoinWalletPublicKey)
     throws RecordsNotFoundException, CantLoadAssetAppropriationTransactionListException {
   String context =
       "Asset: "
           + digitalAssetMetadata
           + " - User Wallet: "
           + assetIssuerWalletPublicKey
           + " - BTC Wallet: "
           + bitcoinWalletPublicKey;
   try {
     IssuerAppropriationDAO dao =
         new IssuerAppropriationDAO(pluginDatabaseSystem, pluginId, assetVault);
     return dao.getTransaction(
         digitalAssetMetadata.getDigitalAsset(),
         assetIssuerWalletPublicKey,
         bitcoinWalletPublicKey);
   } catch (RecordsNotFoundException
       | CantLoadAssetAppropriationTransactionListException
           e) { // If I don't catch these two they'll be elapsed by the exception catch block.
     throw e;
   } catch (Exception e) {
     throw new CantLoadAssetAppropriationTransactionListException(context, e);
   }
 }
  /**
   * This method starts the appropriation flow. Saves the information in the database and store the
   * asset in the file system.
   *
   * @param digitalAssetMetadata the asset to be appropriated
   * @param assetIssuerWalletPublicKey the public key from the asset user wallet where this asset
   *     will be debited.
   * @param bitcoinWalletPublicKey the bitcoin wallet public key where the bitcoins will be sent.
   * @throws CantExecuteAppropriationTransactionException in case something bad happen and the
   *     appropriation flow can't start.
   * @throws TransactionAlreadyStartedException in case for some reason you try to appropriate the
   *     same asset twice.
   */
  @Override
  public void appropriateAsset(
      DigitalAssetMetadata digitalAssetMetadata,
      String assetIssuerWalletPublicKey,
      String bitcoinWalletPublicKey,
      BlockchainNetworkType networkType)
      throws CantExecuteAppropriationTransactionException, TransactionAlreadyStartedException {
    String context =
        "Asset: "
            + digitalAssetMetadata
            + " - User Wallet: "
            + assetIssuerWalletPublicKey
            + " - BTC Wallet: "
            + bitcoinWalletPublicKey
            + " - Network: "
            + networkType;

    try {
      IssuerAppropriationDAO dao =
          new IssuerAppropriationDAO(pluginDatabaseSystem, pluginId, assetVault);
      String transactionId =
          dao.startAppropriation(
              digitalAssetMetadata,
              assetIssuerWalletPublicKey,
              bitcoinWalletPublicKey,
              networkType);
    } catch (TransactionAlreadyStartedException | CantExecuteAppropriationTransactionException e) {
      throw e;
    } catch (Exception e) {
      throw new CantExecuteAppropriationTransactionException(context, e);
    }
  }
 /**
  * Querys all the transactions associated for an bitcoin wallet public key.
  *
  * @param bitcoinWalletPublicKey The bitcoin wallet public key.
  * @return {@link List} instance filled with all the transactions associated or an empty list if
  *     there were none.
  * @throws CantLoadAssetAppropriationTransactionListException
  */
 @Override
 public List<AppropriationTransactionRecord> getTransactionsForBitcoinWallet(
     String bitcoinWalletPublicKey) throws CantLoadAssetAppropriationTransactionListException {
   String context = "BitcoinWallet: " + bitcoinWalletPublicKey;
   try {
     IssuerAppropriationDAO dao =
         new IssuerAppropriationDAO(pluginDatabaseSystem, pluginId, assetVault);
     return dao.getTransactionsForBitcoinWallet(bitcoinWalletPublicKey);
   } catch (
       CantLoadAssetAppropriationTransactionListException
           e) { // If I don't catch this exception it'll be elapsed by the exception catch block.
     throw e;
   } catch (Exception e) {
     throw new CantLoadAssetAppropriationTransactionListException(context, e);
   }
 }
 @Override
 public List<AppropriationTransactionRecord> getTransactionsForStatus(AppropriationStatus status)
     throws CantLoadAssetAppropriationTransactionListException {
   String context = "Status: " + status.getCode();
   try {
     IssuerAppropriationDAO dao =
         new IssuerAppropriationDAO(pluginDatabaseSystem, pluginId, assetVault);
     return dao.getTransactionsForStatus(status);
   } catch (
       CantLoadAssetAppropriationTransactionListException
           e) { // If I don't catch this exception it'll be elapsed by the exception catch block.
     throw e;
   } catch (Exception e) {
     throw new CantLoadAssetAppropriationTransactionListException(context, e);
   }
 }
 /**
  * After the bitcoins for this appropriation are sent, a genesis address is generated by the asset
  * vault that is associated with this transaction, you can track all the other values searching
  * with this public key.
  *
  * @param genesisTransaction the public key generated by the asset vault.
  * @return instance of {@link AppropriationTransactionRecord}
  * @throws RecordsNotFoundException
  * @throws CantLoadAssetAppropriationTransactionListException
  */
 @Override
 public AppropriationTransactionRecord getTransaction(String genesisTransaction)
     throws RecordsNotFoundException, CantLoadAssetAppropriationTransactionListException {
   String context = "Genesis Transaction: " + genesisTransaction;
   try {
     IssuerAppropriationDAO dao =
         new IssuerAppropriationDAO(pluginDatabaseSystem, pluginId, assetVault);
     return dao.getTransaction(genesisTransaction);
   } catch (RecordsNotFoundException
       | CantLoadAssetAppropriationTransactionListException
           e) { // If I don't catch these two they'll be elapsed by the exception catch block.
     throw e;
   } catch (Exception e) {
     throw new CantLoadAssetAppropriationTransactionListException(context, e);
   }
 }