如何在企业 corda 节点上完全卸载 cordapp?

How do I fully uninstall a cordapp on an enterprise corda node?

我正在寻找有关如何从企业 corda 节点完全卸载 cordapp 的信息。

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.

我知道这会阻止将来访问该 cordapp,但它不会从保管库中删除与该 cordapp 关联的事务,也不会回滚与 cordapp 中定义的任何自定义模式关联的迁移.

我正在专门寻找最佳实践来消除与 cordapp 相关的所有内容 我已经从 cordapps 文件夹中删除了相关的 jar。

我认为不存在正式的详细手册,但一个好的开始是:

  1. these steps.
  2. 之后删除有问题的 CorDapp
  3. 使用保管库回收器删除已消耗的状态(观看 here)。
    我在网上找不到回收商;联系R3,他们应该有 (如果是在线发表,请加评论link)。

听起来您的目标是完全卸载 Cordapp 并删除使用该 Cordapp 时发生的所有交易。卸载 Cordapp 相对简单,但清理历史交易需要精确的数据库管理。

以下仅应作为粗略指南,应谨慎确定适用于您的应用程序 Cordapp 的卸载过程。此过程会因一些因素而异。

首先:你部署到什么类型的Corda网络?如果您控制所有节点,您可以 运行 在所有节点上执行相同的卸载过程,交易将从网络中完全删除。如果您控制所有节点,那么交易将继续存在于其他 Corda 节点上。

如果交易仍然存在于其他节点上,这意味着 asset/data 在网络中仍然处于活动状态。这也意味着,如果卸载 cordapp 的节点是最近未花费输出的必需签名者,则链将被卡住,因为卸载的节点无法再签名更新。您应该确保被卸载的节点不是任何未花费交易输出的所有者。

在卸载过程中,您需要具有数据库的管理权限。 Corda 将所有交易记录在以 NODE_ 开头的表中,并且需要删除这些表中的记录。例如 NODE_TRANSACTIONS 包含所有交易的序列化记录。您需要确保所有与交易相关的数据也被删除。 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.

其他想法:

  • 如果您安装了多个 Cordapps 并保留其中的一些,您还需要确定哪些交易来自哪个 Cordapp,以保持活动交易。
  • 如果您有要卸载的 Cordapp 的自定义模式,您可以删除其以 VAULT_ 开头的表。这些表更安全地删除,因为它们用于报告目的并且不被 Corda 使用。