How does wallets such as metamask and trust wallet work? Dissecting the system architecture and everything that is involved in the creation of a Blockchain wallet infrastructure.
- UI and Cross-Platform Availability
- Wallet Creation and Management
- Transaction Management
- Blockchain Interaction
- Security and Privacy
- Network and Token Support
- Extensions and Integration
-
When user signs up on UI, wallet is created. Key generation and storage for user occurs. This is done with ECDSA cryptography on Ethereum blockchain, but a client like Geth can handle that.
-
Like Metamask and co, generate a seed phrase (maybe 12 or 24 word mnemonic seed phrase). To avoid collision and to enable the ability to retrieve it if it is forgotten, then derive it using the user's private key or password, using BIP39 standards.
-
Encrypt the seed phrase using AES-256-CBC. Store in the platform of choice. I don't think it's safe to store in the mobile application. Ask Seb Hendrix about this.
-
Should be easy to use a real Ethereum address and a client like Geth to create transactions.
-
Transactions have 3 parts on Ethereum:
- initialize the txn
- sign the txn
- broadcast the txn on Ethereum
-
Implement using Geth client.
-
Find link from Infura, maybe. I believe a project of this scale should run a full node locally to have a level of control etc.
-
To interact with dApps (technically just smart contracts on the network), requires more thinking.
- Not including the user's name, email, password, etc in the transaction process. Kind of pseudonymous.
- Metro mentioned a one-way encryption algorithm (PK something). Research and implement it for platform storage of the private key. Implement HashAndCompareHash function to be used during login.
- Multi-network support would be wild, but just a repetition of this process above. Get a client, get a node, interface with it.
- Token management can work same way as Metamask. Ask for token details and the network it belongs to. Fetch it from the network, and it should work. Creating User addresses would probably depend on the network.
- Wallets can be integrated into other dApps, exchanges, etc. Would be solved easily if the wallet is a dApp or a local application.