1

I was writing and testing some contracts using Remix. I worked just fine, but for some reasons the sol files didn’t load up today. I tried to search it in my local storage but could not find them. Can anyone help out? Thanks

3
  • If you have deployed the contract, check that blockchain. or maybe a local chain. You can also check IPFS through remix Jan 1, 2021 at 11:49
  • have you recently deleted your browser's local storage?
    – Masoud jt
    Jan 1, 2021 at 12:14
  • I deployed to kovan testnet but didn’t upload the codes for verification. I don’t think I deleted my browser local storage. I used localStorage.key() and getItem() functions but could not find it. Are there other ways to find the file from local storage?
    – Terrance
    Jan 1, 2021 at 21:12

1 Answer 1

1

Remix stores your code but not in plaintext. If you can't find your code, I may ask you what browser you've used and if you have adblock & anti trackers that clean your storage once in a while. Alternatively, maybe it's just a bug.

If you used Chrome we can find out about the solution fast. Open the Chrome Developer Tools by pressing F12 on Remix page, then open the Application tab, then under Local Storage you'll find a list of the key:value pairs which are stored for that page.

The keys will be like this: eb54436a-5290-4eba-ab29-41739f9a77a0 and their values a big string.

Now let's try to see if your files are locally and not loaded by mistake. Keep the list of your keys:value pairs open because we will go back to this.

For the purpose of backing up the data manually, the key:values are stored as a database under a user's profile data, for example %LocalAppData%\Google\Chrome\User Data\Default\Local Storage\leveldb. (mine is in AppData > Local > Google > Chrome ...).

Here you should see some LDB Files and a Text Document. Open the Text Document using notepad and do a search for remix.ethereum.org. After every match you find, you will see that after it you may find a key. Check out if you match all the keys and any unmatched keys you don't have.

If you find a key you don't have in your browser local storage, copy the key and its value and place them manually.

Warning: If this doesn't fix your problem you need advanced digital forensic techniques. They are not easy to provide inside a stack overflow comment.

3
  • @Lulian I got into Chrome local file >leveldb and tried to open Text Document on notepad, it didn’t show up as text file but with some weird characters. Is the file contaminated? I then opened a new sol file with some simple codes in Remix and it seems not stored in a key:value pair. What went wrong? Thanks
    – Terrance
    Jan 2, 2021 at 4:27
  • Hmmm very interesting. You may try to look for Remix instances inside the LDB files. Regarding opening new sole file, they are stored in a key:value pair in the local storage. You are either not looking in the right place or you're not noticing the changes. Your key stays the same, your value may change. Quick question, was the code difficult to implement and took you plenty of time?
    – Iulian
    Jan 2, 2021 at 14:50
  • My file has over 500 lines of codes and I don’t think it’s difficult to implement them. Still can’t figure out ldb staff. I can send you some screenshots if you can reply to my email: [email protected]. Thanks Lulian.
    – Terrance
    Jan 2, 2021 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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