Metamask: Why does the BIP44 derivation path generate the same address in MetaMask as the Ledger Live derivation path?

Understanding the ways of performance to Metamascus: Comparison of Live and Bip44 Book

As a user of the popular Crypto Cash Cash, you have probably noticed that he generates the same address for the Ledger Live and Bip44 (Bip44) performance paths. But why is this the case? In this article, we will explore the metamascus Codebase to understand what is happening behind the scenes.

Performance Trails

In cryptocurrency wallets, performance paths are used to coden the user’s private key in multiple addresses. The most common way of performance is BIP44 (proposal to improve bitcoin 44), which divides private keys into six children: M/44 '/60'/0/, M/44 '/61'/1/1/1 /1/1/1/1/1/1/1/1*/1etc. These children's addresses can then be combined to create one address.

Ledger Live and Metamascus wallet have different trails of performances, as shown in the code clip below:

Javascript

Const Ledger_live_path = M/44 '/60'/0 '/0/0;

Const Bip44_Path = M/44 '/...

Notice thatBIP44_PATHuses a different prefix ( m/) and a slightly different structure for children's addresses.

Metamascus code

Metamask: Why does the BIP44 derivation path generate the same address in MetaMask as the Ledger Live derivation path?

We can see in the metamascus Codebase how the trails of the derivatives are coded to the address:

Javascript

Const Geneateaddress = (Road) => {

Const [Address] = Path.split (‘/’);

Return $ {Address}/$ {Getchildren (address)};

};

Const Getchildren = (Address) => {

// For the sake of simplicity, assume that this function stands out for the child’s address with BIP44 trails

// In reality would include the breakdown of BIP44 output and draw individual component addresses

Const children = [];

for (let i = 1; i

children.push (address.substring (i, i + 8));

Iche

restore children;

};

`

This "Getchildren" function is moving BIP44 as an entrance and returns a series of children's addresses. These children's addresses are then encoded into the final address.

Why the same way of performance in both wallets

Now that we understand how the performance trails work, to see why metamas generates the same address for the Ledger Live and Bip44 performance paths:

In the function ofGennessaaddresswe simply move BIP44 path as an entrance and divide it into individual addresses using the character/. Then let’s connect these children’s addresses to form a final address.

The key insight is here that when encoding Bip44 trails, we can treat each address of the child independently. In other words, if we have “M/44 ‘/60’/0 ‘/0’ BIP44 time, it is equivalent to have one address with four parts:M/44 '/60'/ 0/.

In the metamascus Codebase, we do not explicitly not encode every address of the child into an individual address. Instead, we treat the whole path of the performance as a whole and connect the resulting addresses.

As a result, both Ledger Live and Bip44 performance paths eventually generate the same address to metamas. This could initially seem counter -attack, but this is actually a consequence of the way the metamascus manages the encoding of BIP44 trails into addresses.

Conclusion

Understanding the base of the metamascus codes can help you understand how the wallet generates addresses for both living and BIP44 paths of derivation. Recognizing differences in BIP44_PATH ILedder_live_path, we can see that implementation is metamas really equivalent, although it uses different prefix and structure.

In the future, when you work with metamas or other wallets, you will be able to appreciate the basic mechanics that make these wallets work unnoticed.

Leave a Reply

Your email address will not be published. Required fields are marked *