Things you should know about financial security in the Web3 era: Token/private key/wallet (account)

imgare-cover

There are countless cryptocurrency wallets, and the key difference between them is how the private key is kept. This article focuses on the private key management mechanism and technology used in decentralized wallets like KryptoGO Wallet.

Non-Deterministic Wallets

Generate a random number string as the private key. (by cryptographically secure pseudo-random number generator) The public key has nothing to do with the private key, but when there are multiple private keys, they must be backed up, exported, and imported one by one, which is extremely cumbersome.

In practice, this type of wallet is relatively rare.

Hierarchical Deterministic Wallets (HD Wallet)

The opposite concept of non-deterministic wallet. The HD wallet derives multiple public and private key pairs from the original seed phrase, so it only requires easily written seed phrases when backing up and importing the wallet. The concept was proposed by BIP32 (Bitcoin Improvement Proposals), BIP39 solves the problem of the difficulty to transcribe and memorize seed phrases, and BIP44 standardizes the path specification of each coin to reach industry consensus.

The combination of BIP32, BIP39, and BIP44 is the current industry mainstream decentralized hierarchical wallet approach. This feature is suitable for collection services, such as store collection, creating a public key for each user to receive payments, and also allowing users to give other users airdrops, etc.

BIP39: Making the seed phrase readable

The main description of seed phrase code and the implementation of seed phrase. It consists of two parts:

  1. Generate a seed phrase and convert it into a binary seed.
  2. Seeds can later be used to generate deterministic wallets using BIP-032 or similar methods.

Seed phrases are more friendly for human compared to processing the original binary or hexadecimal numbers of the wallet seeds. It can be written down or even be memorized by people with good memory. BIP39 generates numbers by transcoding irregular strings of numbers that are difficult to remember, splitting them, and mapping them in a single word list to generate seed phrases that can be read by humans to transfer computer-generated randomness.

BIP32: The Foundational Standard for Hierarchical wallets

Wallets can be partially or fully shared with other systems, with every system is able to send and receive independently. The purpose of this specification is to set a hierarchical wallet standard that can be exchanged between non-customers. Any pair of private keys can be derived through a common seed, and the private key derivation uses an irreversible algorithm that can only be derived from higher levels to lower levels. HD wallet can generate a large number of public keys using elliptic curve cryptography without the need for private keys.

0*Re2k73xP9bcQXm6K.png

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

BIP44: Indexing Method for Defining Derived Addresses

The secret key derived through this hierarchy (tree structure) is usually expressed by the route, with slash (/) between each level, and the start of the private key derived from the primary private key is prefixed with an “m”.

m / purpose'/ coin_type'/ account'/ change / address_index

  1. purpose: BIP number, “44” for BIP44
  2. coin_type: coin type, 60 for Ethereum
  3. account: index of the account, starting from 0
  4. change: 0 for external chains, 1 for internal chains
  5. address_index: address index, starting from 0

External Wallet Address Generation Process

Take the following seed phrases for example, the process of generating from seed phrases to the final wallet address that users see is as follows: 

rose rocket invest real refuse margin festival danger anger border idle brown

1*Z1rsRKUgD_mvtK_Ltb-9Kw.png

From seed phrases to wallet address

The efficacy test could be done by Mnemonic Code Converter:

1*cehZ5jx7yMUv_-vLoZ4rJg.png

Account Model for KryptoGO Wallet

Our unique account model is a one-to-one matching of phone numbers and seed phrases, and derives multiple chains of wallet addresses. Therefore, it allows us to check who the transferer is and where the funds source is from, providing the best gatekeeper for the user’s assets.

1*4TKfQQgw2S0tRYf3Tx1eaw.png

KryptoGO Wallet’s Account Model