Get Private Key, Address, and Mnemonic
Call getWallet() on the Tezos Wallet Provider to generate a 24-word Tezos mnemonic and get its private key and address in one step.
This function allows you to obtain the private key, address, and mnemonic using the TezosWalletProvider from the Tatum SDK. getWallet() generates a new 24-word mnemonic and derives the private key and address from it. To generate only the mnemonic, see Generate a Tezos mnemonic phrase.
// Import necessary libraries
import { TezosWalletProvider } from '@tatumio/tezos-wallet-provider';
import { TatumSDK, Network, Tezos } from '@tatumio/tatum';
// Initialize the SDK for Tezos
const tatumSdk = await TatumSDK.init<Tezos>({network: Network.TEZOS,
configureWalletProviders: [TezosWalletProvider],
});
// Get private key, address and mnemonic
const { privateKey, address, mnemonic } = await tatumSdk.walletProvider
.use(TezosWalletProvider)
.getWallet();
// Output the retrieved data
console.log(privateKey); // Prints the private key
console.log(address); // Prints the address
console.log(mnemonic); // Prints the mnemonic
await tatumSdk.destroy();// Import necessary libraries
import { TezosWalletProvider } from '@tatumio/tezos-wallet-provider';
import { TatumSDK, Network } from '@tatumio/tatum';
// Initialize the SDK for Tezos
const tatumSdk = await TatumSDK.init({network: Network.TEZOS,
configureWalletProviders: [TezosWalletProvider],
});
// Get private key, address and mnemonic
const { privateKey, address, mnemonic } = await tatumSdk.walletProvider
.use(TezosWalletProvider)
.getWallet();
// Output the retrieved data
console.log(privateKey); // Prints the private key
console.log(address); // Prints the address
console.log(mnemonic); // Prints the mnemonic
await tatumSdk.destroy();Updated 4 days ago
Did this page help you?