Wallet (public and private keys) are in memory only. Even worst, they are generated on init of the Token.MyWalletgen_server. This is really bad because if/when the gen_server crashes, new keys are generated and all coins are lost !
[x] So we should first generate a wallet in the application.ex module and pass it to the gen_server from here. This would prevent a crash to generate a new wallet
[ ] we want to persist public keys and private keys in a file ~/.coincoin_keys. On startup if this file exist and keys can be read from it, we use these keys, otherwise we generate the keys and create this file. This must be implemented at the MyWallet module level and not the Wallet module level.
[ ] document key persistence and how to make it work with docker
Wallet (public and private keys) are in memory only. Even worst, they are generated on
init
of theToken.MyWallet
gen_server
. This is really bad because if/when the gen_server crashes, new keys are generated and all coins are lost !application.ex
module and pass it to thegen_server
from here. This would prevent a crash to generate a new wallet~/.coincoin_keys
. On startup if this file exist and keys can be read from it, we use these keys, otherwise we generate the keys and create this file. This must be implemented at theMyWallet
module level and not theWallet
module level.