<blockquote>
<p>Am I able to save to local storage the privateKey object generated with 'new bitcore.PrivateKey()'</p>
</blockquote>
<p>&quot;Able&quot; vs &quot;should&quot;.  Yes you are able to save whatever you want to localStorage including the private key in string format or if an object use JSON.stringify(). It is never wise to store private keys on an internet connected machine. The localStorage data can only been read by the domain that saved the data, so it does have some security, but that's not much. It's essentially just cookie data saved on the users machine, unencrypted. So this approach might be useful when developing wallet concepts or personal projects, but definitely not kosher for production level.</p>

CC BY-SA 4.0
2021-08-10T04:29:25.530Z
How do spv wallets such as Coinbase, BitPay or Bitcoin_com persist the wallet info? I can't imagine they send the private keys over the wire to a db. Besides saving it to localStorage (asyncStorage on mobile), what over options are there?
Hyetigran
CC BY-SA 4.0
2021-08-10T14:50:40.570Z
Those are all custodial wallets where the provider keeps the keys on their server(s), they are not storing them in the users browser localStorage. I have built some wallet projects myself that store keys in localStorage, works great, haven't had an issue, but these are just fun personal projects.
m1xolyd1an
CC BY-SA 4.0
2021-08-10T16:29:51.170Z
That's insane if true. A quick google search says that coinbase wallet is non-custodial and does not keep nor can restore your seed if lost. I've quickly looked at edge wallet repo on github and from initial glance it doesn't look like they store seed upon wallet creation. Which wallets are non-custodial then and how do devs go about keeping seeds off servers but also safe?
Hyetigran
CC BY-SA 4.0
2021-08-10T01:32:25.420Z
2021-08-10T01:47:08.507Z
2021-08-10T01:47:08.507Z
m1xolyd1an
<p>I'm working on an SPV wallet using bitpay's bitcore lib package.</p>
<p>Am I able to save to local storage the privateKey object generated with 'new bitcore.PrivateKey()'</p>
<p>Or should I be converting it to WIF before setting it to local storage? Are there any drawbacks or advantages of doing it one way over the other?</p>

<wallet><bitcore>
Saving privateKey client side to local storage
Hyetigran
# Saving privateKey client side to local storage

(Asked by: username_0 on 2021-08-09)

I'm working on an SPV wallet using bitpay's bitcore lib package.

Am I able to save to local storage the privateKey object generated with 'new bitcore.PrivateKey()'

Or should I be converting it to WIF before setting it to local storage? Are there any drawbacks or advantages of doing it one way over the other?

**Tags:** wallet, bitcore


---

## 1 answers

### Answer by username_1 on 2021-08-10. Score: 2

> Am I able to save to local storage the privateKey object generated with 'new bitcore.PrivateKey()'

"Able" vs "should". Yes you are able to save whatever you want to localStorage including the private key in string format or if an object use JSON.stringify(). It is never wise to store private keys on an internet connected machine. The localStorage data can only been read by the domain that saved the data, so it does have some security, but that's not much. It's essentially just cookie data saved on the users machine, unencrypted. So this approach might be useful when developing wallet concepts or personal projects, but definitely not kosher for production level.

> **Comments:**
> **username_0**: How do spv wallets such as Coinbase, BitPay or Bitcoin_com persist the wallet info? I can't imagine they send the private keys over the wire to a db. Besides saving it to localStorage (asyncStorage on mobile), what over options are there?  
> **username_1**: Those are all custodial wallets where the provider keeps the keys on their server(s), they are not storing them in the users browser localStorage. I have built some wallet projects myself that store keys in localStorage, works great, haven't had an issue, but these are just fun personal projects.  
> **username_0**: That's insane if true. A quick google search says that coinbase wallet is non-custodial and does not keep nor can restore your seed if lost. I've quickly looked at edge wallet repo on github and from initial glance it doesn't look like they store seed upon wallet creation. Which wallets are non-custodial then and how do devs go about keeping seeds off servers but also safe?  

---

