Generate Private Key
Derive the private key of a Tezos wallet from its mnemonic with generatePrivateKeyFromMnemonic() in the Tezos Wallet Provider.
Creating a private key is creating a unique and secret key that belongs to you. This key is crucial for accessing and controlling your funds.
The Tezos Wallet Provider derives one private key per mnemonic and takes no index argument. It uses the derivation path m/44'/1729'/0'/0' unless you pass a different path as the second argument. To create the mnemonic first, see Generate a Tezos mnemonic phrase. To derive the matching address, see Generate a Tezos address from a private key.
// Import the necessary library and initialize the SDK
import { TezosWalletProvider } from '@tatumio/tezos-wallet-provider';
import { TatumSDK, Network, Tezos } from '@tatumio/tatum';
const tatumSdk = await TatumSDK.init<Tezos>({network: Network.TEZOS,
configureWalletProviders: [TezosWalletProvider],
});
const mnemonic = '{YOUR_MNEMONIC}'; // The mnemonic from Generate Mnemonic
// Generate Private Key from Mnemonic
const privateKey = await tatumSdk.walletProvider
.use(TezosWalletProvider)
.generatePrivateKeyFromMnemonic(mnemonic);
console.log(privateKey); // This will print the generated private key
await tatumSdk.destroy();// Import the necessary library and initialize the SDK
import { TezosWalletProvider } from '@tatumio/tezos-wallet-provider';
import { TatumSDK, Network } from '@tatumio/tatum';
const tatumSdk = await TatumSDK.init({network: Network.TEZOS,
configureWalletProviders: [TezosWalletProvider],
});
const mnemonic = '{YOUR_MNEMONIC}'; // The mnemonic from Generate Mnemonic
// Generate Private Key from Mnemonic
const privateKey = await tatumSdk.walletProvider
.use(TezosWalletProvider)
.generatePrivateKeyFromMnemonic(mnemonic);
console.log(privateKey); // This will print the generated private key
await tatumSdk.destroy();Updated 6 days ago
Did this page help you?