Created
August 24, 2022 12:28
-
-
Save FounderDAO/0fb2e007e3720f8cb6d838c61cf8bea4 to your computer and use it in GitHub Desktop.
GENARATE WALLET COSMOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { encodeSecp256k1Pubkey, Secp256k1HdWallet } from "@cosmjs/amino"; | |
| import { Bip39, Random } from "@cosmjs/crypto"; | |
| const mnemonic = Bip39.encode(Random.getBytes(16)).toString(); | |
| const wallet = await Secp256k1HdWallet.fromMnemonic(mnemonic); | |
| const [{ address, pubkey }] = await wallet.getAccounts(); | |
| console.info("mnemonic:", mnemonic); | |
| console.info("pubkey:", encodeSecp256k1Pubkey(pubkey)); | |
| console.info("address:", address); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment