BlockchainCommons / GordianSeedTool-iOS

Cryptographic Seed Manager for iOS
Other
36 stars 8 forks source link

FEATURE REQUEST: Export encrypted Ethereurm keystore wallet json text & file #135

Open ChristopherA opened 2 years ago

ChristopherA commented 2 years ago

In an Ethereum ecosystem-centric release of Gordian Seed Tool, it should export what is known an Ethereum wallet "keystore" file, which is a single derived hd-key for a single account (typically m/44'/60'/0'/0 for the first Ethereum wallet account), that is encrypted on disk and save as JSON text saved with a .UTC filetype.

Though Ethereum wallet keystores are not well supported in their creation (mostly generated by the Ethereum Geth Client, and the MEW (MyEthereumWallet.com) wallet), they are reasonably well supported for import (Metamask and many more).

We want to support Keystores as they help enforce key separation. Most ETH wallets want the full seed so that they can generate all accounts for all coins, but that isn't as safe as only providing a single derivation (for instance, an account only for holding ERC-721 NFTs). This key separation isn't ideal, but a start that works with existing wallets in the ETH ecosystem.

As a reference, our "ffa11a8 - 604b93f2 - 128-bit Seed Public Test Vector (Yinmn Blue)", in BIP39 words is:

fly mule excess resource treat plunge nose soda reflect adult ramp planet

…and saving the keystore with the password "password", the default files generated by the MyEtherWallet.com & MEW Chrome Extension are:

Reference Yinmn Blue Keystore UTC Files.zip

and the JSON inside is:

{"version":3,"id":"bd9e9721-a550-4684-a327-e113a3676aae","address":"557525d043656e9385d8efaa9cd4a3aeade01168","crypto":{"ciphertext":"dffd2024ca1fdf78616fd1a9f55d09e2ba990e142c3b25d62b5305b19ba0e42e","cipherparams":{"iv":"d29d67b60926cdb55402d798474d2210"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"c1252943cbed044097fcfbb0796bb422f571eb6512d780291a22c92379851fed","n":131072,"r":8,"p":1},"mac":"d7494f0d3c039f29a762b929ea087377114ef1889acdc6460b19e7c6d08ffb25"}}

Or prettified:

{
  "version": 3,
  "id": "bd9e9721-a550-4684-a327-e113a3676aae",
  "address": "557525d043656e9385d8efaa9cd4a3aeade01168",
  "crypto": {
    "ciphertext": "dffd2024ca1fdf78616fd1a9f55d09e2ba990e142c3b25d62b5305b19ba0e42e",
    "cipherparams": {
      "iv": "d29d67b60926cdb55402d798474d2210"
    },
    "cipher": "aes-128-ctr",
    "kdf": "scrypt",
    "kdfparams": {
      "dklen": 32,
      "salt": "c1252943cbed044097fcfbb0796bb422f571eb6512d780291a22c92379851fed",
      "n": 131072,
      "r": 8,
      "p": 1
    },
    "mac": "d7494f0d3c039f29a762b929ea087377114ef1889acdc6460b19e7c6d08ffb25"
  }
}

Here are some links about keystores:

For reference, here are the first 5 ETH account paths for Yimn Blue:

#0
0x557525d043656e9385D8EFAA9Cd4a3aeAdE01168

#1
0xc11922071b93B306866e79914C7cdA610b896D26

#2
0x642A049CD438e1B3Cffd4462128CD4ca3d91c00a

#3
0x1C46E9ceeDF0699887286E1D0cFC60B9146233A3

#4 
0xa24b1107350FE2F2051b1fF0071A0BDBcb34cBcf
image

Here are the derivation paths that MyEtherWallet supports (we should only support the top 5 or 10 or 20 top market cap or transaction cap ones)

[m/44'/60'/0'/0 - Ethereum]()
[m/44'/61'/0'/0 - Ethereum Classic]()
[m/44'/1'/0'/0 - Ropsten Testnet]()
[m/44'/60'/0' - Ledger]()
[m/0'/0'/0' - SingularDTV]()
[m/44'/40'/0'/0 - Expanse]()
[m/44'/108'/0'/0 - Ubiq]()
[m/44'/163'/0'/0 - Ellaism]()
[m/44'/1987'/0'/0 - EtherGem]()
[m/44'/820'/0'/0 - Callisto]()
[m/44'/1128'/0'/0 - Ethereum Social]()
[m/44'/184'/0'/0 - Musicoin]()
[m/44'/6060'/0'/0 - GoChain]()
[m/44'/2018'/0'/0 - EOS Classic]()
[m/44'/200625'/0'/0 - Akroma]()
[m/44'/31102'/0'/0 - EtherSocial Network]()
[m/44'/164'/0'/0 - PIRL]()
[m/44'/1313114'/0'/0 - Ether-1]()
[m/44'/1620'/0'/0 - Atheios]()
[m/44'/889'/0'/0 - TomoChain]()
[m/44'/76'/0'/0 - Mix Blockchain]()
[m/44'/1171337'/0'/0 - Iolite]()
[m/44'/137'/0'/0 - RSK Mainnet]()
[m/44'/37310'/0'/0 - RSK Testnet]()
[m/44'/1001'/0'/0 - ThunderCore]()
[m/44'/997'/0'/0 - Solidum]()
[m/44'/916'/0'/0 - Metadium]()
[m/44'/237'/0'/0 - DEXON Network]()
[m/44'/60'/0' - Lightstreams Network]()
[m/44'/227'/0'/0 - MintMe.com Coin]()
[m/44'/466'/0'/0 - EtherCore]()
[m/44'/60' - Avax C-chain]()