Context
src/wallet/mod.rs exposes Wallet::generate() and Wallet::from_private_key(&str), but has no BIP-39 mnemonic or BIP-44 derivation-path support. Any agent operator reaching for a standard m/44'/60'/0'/0/i path (what MetaMask, Rabby, ledgers etc. emit) can't use arka today without hand-deriving first. Adding BIP-44 support is self-contained and contributor-friendly.
Scope
- Add a
bip39 + coins-bip32 (or alloy's mnemonic feature) dependency to Cargo.toml.
- Add to
src/wallet/mod.rs:
Wallet::from_mnemonic(phrase: &str, index: u32) -> Result<Self> — derives m/44'/60'/0'/0/{index}.
Wallet::from_mnemonic_with_path(phrase: &str, path: &str) -> Result<Self> — arbitrary derivation path.
- Add a
wallet::bip44 submodule (or inline) with golden test vectors from the official BIP-44 spec. Use at least two vectors so regression against the derivation logic is obvious:
- Mnemonic:
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about — path m/44'/60'/0'/0/0 → address 0x9858EfFD232B4033E47d90003D41EC34EcaEda94.
- Mnemonic:
test test test test test test test test test test test junk (Foundry's default) — path m/44'/60'/0'/0/0 → address 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266.
- Tests should be deterministic — no network.
Acceptance criteria
cargo test wallet::bip44 passes with at least 2 golden vectors.
cargo clippy clean.
- Rustdoc example on
from_mnemonic showing how to derive wallet index 0.
examples/multi_chain.rs doesn't need changes; add a new examples/mnemonic_wallets.rs that derives 3 wallets from a test mnemonic and prints addresses.
Estimated effort
S (3–5 hours) — the derivation logic is a handful of lines; most of the work is picking the right crate and writing the vectors.
Reference: see PR #4 for the cargo test / CI conventions used in this repo.
— kcolbchain / Abhishek Krishna
Context
src/wallet/mod.rsexposesWallet::generate()andWallet::from_private_key(&str), but has no BIP-39 mnemonic or BIP-44 derivation-path support. Any agent operator reaching for a standardm/44'/60'/0'/0/ipath (what MetaMask, Rabby, ledgers etc. emit) can't use arka today without hand-deriving first. Adding BIP-44 support is self-contained and contributor-friendly.Scope
bip39+coins-bip32(or alloy's mnemonic feature) dependency toCargo.toml.src/wallet/mod.rs:Wallet::from_mnemonic(phrase: &str, index: u32) -> Result<Self>— derivesm/44'/60'/0'/0/{index}.Wallet::from_mnemonic_with_path(phrase: &str, path: &str) -> Result<Self>— arbitrary derivation path.wallet::bip44submodule (or inline) with golden test vectors from the official BIP-44 spec. Use at least two vectors so regression against the derivation logic is obvious:abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about— pathm/44'/60'/0'/0/0→ address0x9858EfFD232B4033E47d90003D41EC34EcaEda94.test test test test test test test test test test test junk(Foundry's default) — pathm/44'/60'/0'/0/0→ address0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266.Acceptance criteria
cargo test wallet::bip44passes with at least 2 golden vectors.cargo clippyclean.from_mnemonicshowing how to derive wallet index 0.examples/multi_chain.rsdoesn't need changes; add a newexamples/mnemonic_wallets.rsthat derives 3 wallets from a test mnemonic and prints addresses.Estimated effort
S (3–5 hours) — the derivation logic is a handful of lines; most of the work is picking the right crate and writing the vectors.
Reference: see PR #4 for the
cargo test/ CI conventions used in this repo.— kcolbchain / Abhishek Krishna