trufflesuite / ganache

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
2.62k stars 679 forks source link

how to save the blockchain when using cli #4560

Open Yunx1aoyuj1 opened 9 months ago

Yunx1aoyuj1 commented 9 months ago

nuaa123456@raspberrypi:~/ganache_workshop$ ./start.sh Ganache CLI v6.12.2 (ganache-core: 2.13.2)

Available Accounts

(0) 0x4ED0773349E7ab16c69178d6E9a994D204716bc5 (100 ETH) (1) 0x918A565359eEF5128DDa0B9fa4bb7E5564578122 (100 ETH) (2) 0xA610c5b8b1f909D5D5265C1144D47f238E67b48a (100 ETH) (3) 0xd2c0302E7457650a3fBa09dBBE445b047B0b401e (100 ETH) (4) 0x8cA52E3903b17E2eF3c988e6F463Ce766FFA156f (100 ETH) (5) 0x1d7B7691B48b6a531a7b863e9115fB5887ae2b99 (100 ETH) (6) 0xbc35f116E2293FcE82A457562Ee6f3C2B27F8045 (100 ETH) (7) 0x8111e7fd38eD4fE26ea23Fa804dc6ab3b9d089c5 (100 ETH) (8) 0xc8CE9d5829Da033aA135dCd8db4F468ee67646e7 (100 ETH) (9) 0xD1e2D3adC084128660B26A6Cf1fD1386C207CA01 (100 ETH)

Private Keys

(0) 0xe9a725b837b68944b29149737c17c64a20e2294df0e6c804da335cd9b5f5a9c3 (1) 0x27c8acfd881541ddcb878dc5cb9a2e3107d9a468e722922371d9c978ba25956f (2) 0x733a5eb63f066bf34ffe9e1b467b57df48cd5250e503587e137e3fb78f180fa7 (3) 0x20919f2c3a9e75697999a93c3a9bc4a4da22c97013cdf26cac1780974f76195b (4) 0x8c1932fa44e57f16676bfa53d373b11e30fa6552d209d6f994178248295ef578 (5) 0x522ec959d3e579be62d7abc3d7c515f1961fdc82e8cc35e50889b2842f610fbd (6) 0xf383d8f9eb4d10de0c4d2a01142b7bd252ea50fb453eda79903751ceb46ee28c (7) 0xf2ab7dce60cc20eaaa7dc15c2cbf7edfd68e44a3257965984a00c8309593ccb3 (8) 0xb954243187c515d39f06040130295de18306063047b391054190d6b26230fbb2 (9) 0x9b4ee2e8236ba68f837ff88dffc6168c7a13438310d90d3558c153fe8ae0a066

HD Wallet

Mnemonic: guide bird must dress boil must key family picnic grocery hero black Base HD Path: m/44'/60'/0'/0/{account_index}

Gas Price

20000000000

Gas Limit

6721975

Call Gas Limit

9007199254740991

Listening on 0.0.0.0:7545 ^Cnuaa123456@raspberrypi:~/ganache_workshop$ ./start.sh Ganache CLI v6.12.2 (ganache-core: 2.13.2)

Available Accounts

(0) 0x1c4245E7E743ebA802d8E9CBb662507DE0dC2afb (100 ETH) (1) 0xd9D088e879aFd9Cc5A31a4E9BA8f48a76Cf9CE0B (100 ETH) (2) 0xb3c6545af975Ee411747e061b4B07f59A5537B95 (100 ETH) (3) 0x36F440E4078103146B2412C43c8501BD86D41166 (100 ETH) (4) 0x270ee745fBFbe59F0577B5263312931FABa36033 (100 ETH) (5) 0xbfAB54c89fB0560e7f1e2321b62e64b2aa30cf8f (100 ETH) (6) 0x0811FeF1fa62FFCEa1A6276102E64BB459867df9 (100 ETH) (7) 0x409c350AA178FF46E07bBff7bbcd99CE5E0a215E (100 ETH) (8) 0xBBe68895424A55C8cb268aC51a6C003517d4001F (100 ETH) (9) 0xB9e9ceeD10AD28C7CC0Dc598Dcad652DBa9b77Fc (100 ETH)

Private Keys

(0) 0x9f1003e11f06a595abbc2c65a1802930de7f8cc32b8135c0aa5a54e6c2e006f5 (1) 0xb0f9c61746bf2e2292d161fb53af22ecbe4a4e5296cbd8365fc1c0689b1d4c95 (2) 0x1cff9fbe0aed677032bf4b5f476228e1bff20c7bf1a6ea37dc7762b5e4dcae80 (3) 0x5b0c6ef6bd861c027f39f8255c67d5c1a530b17867d05c7076f83568e17bb6f4 (4) 0xa622cd7f471914ce7b9b58f269963dfeb699944479a10f5ac5ae2b6d61327ce6 (5) 0xa711eb4f54de68f375831e0cf90a260d64378ef658909bf69c7bce7720ae642d (6) 0x4b9d25398f2c643c766bdd66bceb511f39440f78321e54131af5a8403ad65c15 (7) 0x120debb6a56bf4fc85e9b72ae8e1588296088e015fd8784ab0c66f298012bee6 (8) 0x7cb405e1c9a108beca5c30a041c94d886ff907b508a773db1772a8d937b19f27 (9) 0x74ed82ddad68d7d3dd7e814dd0dd1d9d2011f9e8a378d8dae1a463688bf38858

HD Wallet

Mnemonic: suffer flower collect rack card between mention earn present master tide picture Base HD Path: m/44'/60'/0'/0/{account_index}

Gas Price

20000000000

Gas Limit

6721975

Call Gas Limit

9007199254740991

Listening on 0.0.0.0:7545

the code in start.sh is ganache-cli --host 0.0.0.0 --port 7545 --db /home/nuaa123456/ganache_workshop/ganache_data

davidmurdoch commented 9 months ago

The ganache-cli has is deprecated. Use the ganache package instead. That said, ganache is no longer maintained.

In both packages the --db option saves the blockchain state.

111Seven commented 8 months ago

When I create the database using ganache/ganache-cli, why my database contains only these files: 000003.txt, CURRENT, LOCK, LOG, MANIFEST-000002.....this behavior is very recent, before this..I used to get several files.....!blockHashes!0x.., !blockLogs!0 and so on...Am I doing something wrong while creating the database... I am using the command: ganache -h 127.0.0.1 -0 7545 -m "my mnemonic" --db path/to/db --hardfork london

davidmurdoch commented 8 months ago

That change happened in Ganache v7.0.0 back in Jan 20, 2022.

111Seven commented 8 months ago

oh, thank you for the response. Is it possible to create the database in the old style? If not, is there a way to make the text file in the newer version readable? Once again I appreciate your time..

davidmurdoch commented 8 months ago

Is it possible to create the database in the old style?

No

If not, is there a way to make the text file in the newer version readable?

It's a binary format now. Its only readable by Ganache. If you want to try to read it yourself you could use a leveldb reader like https://fastonosql.com/. But even then the data is packed tightly so it won't be meaningful without proper deserialization (which is built into Ganache).

Your best way forward would be to scrape the DB by calling Ganache's JSON-RPC methods.

111Seven commented 8 months ago

Okay, thank you for the information!