Importing a Wallet

You can get the WIF, on your wallet, Poltergeist or Ecto.

Import Wallet

Small example of how to get the address from the WIF.

This is used to sign transaction, that's why you need this if you're running your backend service.

const { Address, PhantasmaKeys } = require('phantasma-ts');
const wif = "";
const wallet = PhantasmaKeys.fromWIF(wif);

const addr = wallet.Address; // Get the Address.

Importing a Wallet from a private key

Small example of how to import a wallet from a private key.

const { Address, PhantasmaKeys, getWifFromPrivateKey} = require('phantasma-ts');
const privateKey = "";
let wif = getWifFromPrivateKey(privateKey);
const wallet = PhantasmaKeys.fromWIF(wif);

const addr = wallet.Address; // Get the Address.

You can also get the private key from the WIF

const { Address, PhantasmaKeys, getPrivateKeyFromWif } = require('phantasma-ts');
const wif = "";
const privKey = getPrivateKeyFromWif(wif);

Last updated