1
votes

I'm looking for information on how to fully uninstall a cordapp from an enterprise corda node.

According to the docs:

Remove a CorDapp Once you remove a contracts or flows CorDapp from your node, you will no longer be able to use the related states or flows. Note though, that a deleted contracts CorDapp may still be present in the attachments store, and may be downloaded again from another node as part of the verification of a transaction history.

To remove a CorDapp from your node:

Make sure that there are no running flows that use the to-be-deleted CorDapp, by draining your node. If the flow on your node is a result of responding to a flow from another node, the initator flow must be killed as well. Otherwise it will be stuck waiting for your node's response. Stop the Corda runtime of your node. Remove the CorDapp's jar file from the cordapps folder. Start the node.

I understand that this will prevent that cordapp from being accessible in the future, but it does not remove transactions associated with that cordapp from the vault and also does not roll back the migrations associated with any custom schemas defined within the cordapp.

I am specifically looking for best practices blow away anything and everything associated with a cordapp after I have removed the relevant jars from the cordapps folder.

2

2 Answers

1
votes

I don't think an official detailed manual exists, but a good start would be to:

  1. Remove the CorDapp in question following these steps.
  2. Remove the consumed states using the vault recycler (watch here).
    I couldn't find the recycler online; contact R3, they should have it (if it's published online, please add a comment with a link to it).
1
votes

It sounds like your goal is to completely uninstall a Cordapp and remove all transactions which occurred from using that Cordapp. Uninstalling a Cordapp is relatively straight forward but cleaning up historical transactions requires precise database administration.

The following should only be taken as rough guidelines and care should be taken to determine an uninstall process which works for your application Cordapp. This process will vary depending on a few factors.

First of all: what type of Corda network you have deployed to? If you control all nodes you can run the same uninstall process on all nodes and the transactions will be fully removed from the network. If you do not control all nodes then the transactions will continue to exist on other Corda nodes.

If the transactions still exist on other nodes that means the asset/data is still active within the network. It also means that if the node which uninstalled the cordapp was a required signer on the most recent unspent output the chain will be stuck as the uninstalled node can no longer sign for updates. You should ensure that the node being uninstalled is not the owner of any unspent transaction outputs.

During the uninstall process you will need to have administrative access to the database. Corda records all transactions in tables that begin with NODE_ and records from these tables will need to be deleted. For example NODE_TRANSACTIONS contains the serialized records of all transactions. You would need to ensure that all related data to the transactions is also deleted. https://docs.corda.net/docs/corda-os/4.5/node-database-tables.html#vault-tables

DANGER NODE_ tables are considered internal to Corda and were not intended to be modified by developers. Before deleting any data take backups, test and fully understand the implications of the data being deleted. If you have a contact at R3 please speak with them to validate any steps taken.

Additional thoughts:

  • If you have multiple Cordapps installed and are keeping some of them you will also need to determine which transactions are from which Cordapp to keep active transactions.
  • If you have custom schemas for the Cordapp being uninstalled you can delete its tables which will begin with VAULT_. These tables are safer to delete as they are for reporting purposes and are not used by Corda.