How to destroy (erase, delete) all multichain files by api ?

+3 votes
Hello,

There's my scenario: I have two docker containers, one with python/flask api and the other with the multichain, just to keep things separate.

I need to destroy and recreate (it's a demo) the multichain using the api python /flask.

I can stop the multichain easily, but when I get to delete all the files in the multichain folder I suddenly realized that the multichain is in another container, the multichain container, so I can't delete files and folders from the python/flask container.

So I was just wondering if there's some magic multichain api command that let me destroy completely the folder.

Just writing this I realized also that then I need to recreate the multichain by multichain API, and also this would be impossible if everything will be destroyed ....

So maybe better destroy just the stream.

However, just out of curiosity, there's some magic multichain api command that let me destroy everything ?

Thank you.
asked Apr 1 by Gianni

2 Answers

+2 votes

To destroy an entire MultiChain instance, stop the node, then delete its subdirectory from the .multichain directory (assuming Linux). Or if you use offchain stream items in MultiChain 2.0 then you can also purge all of the offchain data by passing a parameter to the unsubscribe API command.

answered Apr 1 by MultiChain
+2 votes

As far as I understand your question, I would say that in order to destroy/delete a multichain (block chain) completely, you are going to have to destroy it's CLI or API as well. So, technically you can't do that using an API as you want to delete everything, including the API.

The only option in my knowledge is to run (in Linux):

rm -rf ~/.multichain/<chain-name>

answered Apr 2 by mirabdulHaseeb
Thank you @MultiChain and @mirabdulHaseeb fo ryour kind reply, I can't delete directly the folder because the python api and the multichain are in a different containers and I don't know a way to delete a file from a container to another container. So as far I know, I have two alternatives, once that the multichain doesn't provide an easy api command:
1. Merge the python api and the multichain in one container, so every problems magically disappear
2. Build a mini python api on the multichain container to get only the delete and recreate multichain command
Both are not perfect: 1. because I would like to keep things separate for security purposes, 2. because I need to install python, flask and open ports and api on the multichain container and this could anyway open an highway to hackers.

But for now I think I have no others solutions.

Thanks for your help.
...