Skip to main content

What is a software wallet?

U
Written by UKey Wallet

Software wallets use random numbers to generate Main private key.

Then, pass Deterministic and irreversible algorithm, it can derive an unlimited number of sub private key.

Why do we need deterministic and irreversible algorithms?
because certainty means that all child private key can always be generated from the same main private key, while Irreversible Meaning the master private key cannot be reconstructed from any child private key.

that's why it's called Hierarchical Deterministic (HD) Wallet. The derivation structure of private key is similar to a tree: a parent key can derive multiple child keys, each child key can derive multiple grandchild keys, and this process can continue indefinitely.

When creating an HD wallet or backup wallet for the first time, it will generate seed phrase. seed phrase consists of a set of English words in sequence. This sequence will be used to generate seeds, and then generate all private key in the wallet from the seed. In other words, seed phrase is the wallet backup, which can be used in the restore wallet; and the seed corresponds to the original random number behind the deterministic wallet.

One of the great advantages of HD wallet is that it only requires Mainpublic key can generate any number of subpublic key. That is, new public addresses can be created from the main public key without accessing the main private key or sub-private key. However, these generated addresses are ultimately controlled by the main private key.

Of course, there are risks with this design. If seed phrase is exposed, it essentially exposes all private key. Once this happens, the security of the digital assets in the wallet is effectively lost.

Why do you need so many private key?

Why do users need so much private key? This can be achieved through Bitcoin transactions change mechanism to understand.

Bitcoin trading is a input and output The data structure also contains the script information needed to transfer the value from the source (input) to the destination address (output).

To understand Bitcoin's inputs and outputs, you first need to understand UTXO(Unspent transaction output). UTXO is the basic unit of Bitcoin transactions and represents transaction output that has not yet been spent. A single Bitcoin may actually be distributed as a UTXO across multiple transactions and multiple blocks. Bitcoin does not have a centrally recorded simple account balance; instead, on-chain has only decentralized UTXOs, controlled by their respective owners.

A UTXO can represent any amount of value, but once created, it is indivisible, just like a physical coin cannot be split in half. If the value of the UTXO is greater than the amount required for the transaction, the entire UTXO must still be spent and the excess will be returned as change.

For example, let's say you have a UTXO worth 20 units and want to pay 1 unit. The transaction must consume a full 20 units of UTXO and create two outputs: one that sends 1 unit to the recipient, and another that sends 19 units back to your wallet as change. Therefore, most Bitcoin transactions generate change.

This leads to another question: should the change be sent back to the original address, or to a newly generated address?

When Satoshi Nakamoto designed Bitcoin, he introduced Change address mechanism: Typically a new address is created to receive change for each transaction. Doing so helps protect user privacy and mitigates some security risks.

In real life, this is similar to opening multiple bank accounts under different names and identities at different banks. Even if someone could observe the flow of funds in each account, they would have a difficult time tracing all the funds back to the true owner of the digital asset. This is part of the reason for Bitcoin's relative anonymity.

This is why wallet users need large amounts of private key. Since public key and private key always exist in pairs, and each transaction may generate a new change address, storing the private key corresponding to these addresses of backup one by one will bring high management costs. The HD wallet solves this problem by deriving any number of sub-public key and sub-private key from one root key and significantly improves the usability of digital wallets.

Did this answer your question?