Closed io12 closed 3 years ago
@io12 PRs welcome! It's also possible to extend Web3
with custom Namespace
implementations (see here).
Oh, apparently create
is secp256k1::SecretKey::new
and privateKeyToAccount
is signing::secret_key_address
.
@io12 Is there any way to recover an account from mnemonic words as the web3js does?
const web3 = new Web3(provider);
let prikey = utils.getUserWallet(sponsorMnemonic, provider).privateKey;
const accountFrom = {
privateKey: prikey,
};
let signer = web3.eth.accounts.privateKeyToAccount(prikey);
web3.eth.accounts.wallet.add(signer);
Is there any way to recover an account from mnemonic words as the web3js does?
@songtianyi It looks like the bip32 crate can do this, but I haven't tried it.
Is there any way to recover an account from mnemonic words as the web3js does?
@songtianyi It looks like the bip32 crate can do this, but I haven't tried it.
the bip32 doc says
[Limitations and further work](https://docs.rs/bip32/latest/bip32/#limitations-and-further-work)
Only 24-word BIP39 mnemonics are supported
BIP43, BIP44, BIP49, BIP84 not yet properly supported
There are some functions in the
web3.eth.accounts
namespace of web3.js that could be useful in rust-web3 for account creation. For example,create
andprivateKeyToAccount
.