Skip to content

Support to HD key generation using BIP-44#321

Open
maneeSHA-256 wants to merge 5 commits intodevelopmentfrom
maneesha/HDwallet
Open

Support to HD key generation using BIP-44#321
maneeSHA-256 wants to merge 5 commits intodevelopmentfrom
maneesha/HDwallet

Conversation

@maneeSHA-256
Copy link
Copy Markdown
Contributor

@maneeSHA-256 maneeSHA-256 commented Apr 30, 2025

Hierarchical deterministic wallets (HD wallets) provide a convenient way to manage multiple addresses and private keys from a single master seed. HD wallets use a tree structure where parent keys can produce children keys infinitely, allowing for organized transactions by type or entity. They offer the advantage of creating public keys without accessing corresponding private keys, enhancing security.

Rubix already supports BIP-32 and BIP-39. It is time to introduce BIP-44 in Rubix so that RBTs can be easily handled in any HD wallet.

BIP 44 - builds upon BIP 32 by providing a specific organizational structure for multi-account wallets, allowing users to manage different cryptocurrency accounts within the same wallet while maintaining a hierarchical deterministic structure. It introduces the concept of ‘account levels’ and ‘purpose levels’ to create a hierarchical structure for keys. Each account has its own subtree, allowing for better organization and separation of funds.

The derivation path used in BIP44 follows this structure: m / purpose' / coin_type' / account' / change / address_index
Each element in the path has a specific meaning:

m: This is the master node and represents the root of your HD wallet.

purpose: Always set to 44' for BIP44 compliant wallets.

coin_type: Specifies the type of cryptocurrency. Each cryptocurrency has a specific number assigned, such as 0' for Bitcoin and 60' for Ethereum. For Rubix, it is 1001 for Mainnet DIDs and 1002 for Testnet DIDs.

account: A BIP44 wallet can have multiple accounts, and this number represents each unique account.

change: This is either 0 for external (receiving) addresses or 1 for internal (change) addresses.

address_index: Represents the individual addresses generated under each account.
Using the BIP44 protocol, users can manage multiple coins, accounts, and addresses under a single master seed, created using the BIP39 protocol.

This brings us some extra flags for DID creation. For example,
./rubixgoplatform createdid -didType 4 -mnemonicKeyFile /mnemonic/file/path/ -accountType 1 -changeAddr 0 -addrIndex 2 -port 20000

@maneeSHA-256 maneeSHA-256 linked an issue Apr 30, 2025 that may be closed by this pull request
@maneeSHA-256 maneeSHA-256 marked this pull request as ready for review May 2, 2025 09:48
@maneeSHA-256 maneeSHA-256 self-assigned this May 6, 2025
@maneeSHA-256 maneeSHA-256 requested a review from thewebchap May 12, 2025 08:05
@thewebchap
Copy link
Copy Markdown
Member

./rubixgoplatform createdid -didType 4 -accountType 1 -changeAddr 0 -addrIndex 2 -port 20000 . Is this supposed to give deterministic did everytime I call?

@maneeSHA-256
Copy link
Copy Markdown
Contributor Author

./rubixgoplatform createdid -didType 4 -accountType 1 -changeAddr 0 -addrIndex 2 -port 20000 . Is this supposed to give deterministic did everytime I call?

Yes, a specific path should return deterministic key pair and thus deterministic did everytime.

@maneeSHA-256
Copy link
Copy Markdown
Contributor Author

./rubixgoplatform createdid -didType 4 -accountType 1 -changeAddr 0 -addrIndex 2 -port 20000 . Is this supposed to give deterministic did everytime I call?

Yes, a specific path should return deterministic key pair and thus deterministic did everytime.

I'm sorry, No, this won't give deterministic did. We have to pass the mnemonic file path to get deterministic did. Without passing the mnemonic, it will generate new mnemonic everytime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support to HD Wallet

2 participants