Guest User

ethereum wallet creation protip

a guest
Aug 31st, 2018
471
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rbval [2:01 PM]
  2. Hi, I have a use case where I want to automate the creation of wallet accounts for our users. However the Personal API to my understanding is disabled on quiknode. Has anyone else experimented if you can use build / sign / sendRaw pattern to create new wallet accounts on quiknode. Ideally that would return the wallet address?
  3.  
  4. haxsyn [2:09 PM]
  5. correct — we don’t allow personal wallet functions on the nodes themselves because a) security and b) nodes are not static (all data is erased on rebuild or shutdown).
  6. what are some best practices for creating wallets @here?
  7.  
  8. Micah [2:11 PM]
  9. @rbval There are a bunch of libraries out there to create wallets.
  10. I personally use `ethers`: https://www.npmjs.com/package/ethers
  11. npm
  12. ethers
  13. Ethereum wallet library.
  14.  
  15. rbval [2:12 PM]
  16. I’ve been using web3.py if you mean that. They have `eth.newAccount(passphrase)` but it requires access to the node
  17.  
  18. Micah [2:12 PM]
  19. You really shouldn't be doing that.
  20. In the early days of Ethereum, the node (Geth/Parity) was _also_ the keystore. People later realized this was a really bad idea.
  21. Really, those methods should all be removed from the RPC.
  22. I would be relatively surprised if web3 doesn't have a method you can call to create a new wallet without a node.
  23.  
  24. rbval [2:14 PM]
  25. Well there’s the build / sign / sendRaw pattern you can use on web3
  26.  
  27. Micah [2:14 PM]
  28. `ethers.Wallet.createRandom()` is actually what you want with `ethers` library.
  29.  
  30. rbval [2:14 PM]
  31. We’ve been using that for many things, I guess you can use that for this one as well
  32.  
  33. Micah [2:14 PM]
  34. That pattern is good. You should not be using the ethereum node you are talking to to do signing.
  35.  
  36. rbval [2:14 PM]
  37. https://web3py.readthedocs.io/en/stable/web3.eth.account.html
  38.  
  39. Micah [2:15 PM]
  40. You should have a signing tool do the signing, and the Ethereum node is just used to submit transactions.
  41.  
  42. rbval [2:15 PM]
  43. yea
  44.  
  45. Micah [2:15 PM]
  46. If you prefer Python, there are wallet/signing libraries for Python you can use.
  47. I'm not personally familiar with them, but I know they exist because I have worked with people in the past who preferred Python.
  48.  
  49. rbval [2:16 PM]
  50. any good ones you know?
  51. Okay
  52.  
  53. Micah [2:17 PM]
  54. If you don't mind switching over to NodeJS I'm quite happy with `ethers`.
  55.  
  56. rbval [2:18 PM]
  57. We might create a separate microservice out of that
  58. To suit our needs
  59. Thanks @Micah!
  60.  
  61. Micah [2:19 PM]
  62. https://docs.ethers.io/ethers.js/html/api-wallet.html#creating-instances if you decide to go that route.
  63. Would probably only take a couple minutes to create a microservice where you could submit a GET request to some endpoint and it would just send back a new random private key each time.
  64. I actually wrote a service a while back that would sign things for me...
  65. You did an HTTP POST with a transaction and it would return a signed transaction if it had the key.
  66.  
  67. rbval [2:21 PM]
  68. it’s actually this one I think: https://github.com/ethereum/eth-account
  69.  
  70. Micah [2:23 PM]
  71. That will probably do the trick.
  72.  
  73. haxsyn [2:37 PM]
  74. you guys rock!
  75. thanks @rbval for reaching out, and @Micah as always with proper wisdom!
RAW Paste Data