0

I am presently developing a Dapp and I am now trying to deploy it on cloud. So what I do is create an EC2 instance and drop all my code there. Then I install ganache-cli there and before on my local machine I used ganache GUI and here in GUI there is an option to create a workspace so that I don't lose my data on blockchain if my system restarts at any point in time but in the case of ganache-cli everytime it starts it creates new accounts and emulates a whole new network. So how do I proceed with this?

1

Ganache is a development and testing framework - fast and easy to set up and fast transaction blocks. Generally, it is preferable to start with an empty blockchain and rehearse the migration and initialization processes every time, for more most dev/test cases.

Ganache is not useful for production because there is no consensus. It's just your server going through the motions of pretending it's Ethereum. For this reason, it cannot connect to the real blockchain and never will.

Two nuanced cases spring to mind.

  • Ganache can persist the state for next time.
  • Ganache can initialize from a live blockchain and "fork." This is especially useful for production dApps with upgradable patterns. A developer can initialize with the live state (all user data, etc.), then fork with Ganache, rehearse an upgrade and run regression tests on the proposed upgrade.

Admittedly, I don't use the persisted state option very often for the reasons outlined above, but I think what you are looking for is:

--db: Specify a path to a directory to save the chain database. If a database already exists, ganache-cli will initialize that chain instead of creating a new one.

https://github.com/trufflesuite/ganache-cli

Hope it helps.

  • 1
    Yeah! you are absolutely correct and yes your answer is perfect for my problem. Thanks. – vteja711 Jan 9 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.