Wallet Management

πŸ” Wallet Management

The ToroForge Node.js SDK offers complete tools for managing user wallets on the Toronet blockchain β€” including creation, import, name registration (TNS), password verification, and key access.


πŸ“˜ What You Can Do

  • Create a new Toronet wallet

  • Assign a Toronet Naming System (TNS) name

  • Import an existing wallet using a private key

  • Verify wallet password integrity

  • Retrieve wallet keys securely


🧱 Features & Usage


βœ… Create a New Wallet

Generate a new wallet address by providing a secure password.

import { createWallet } from 'torosdk';

const walletAddress = await createWallet({
  password: 'securePassword123',
});

Returns a Toronet-compatible wallet address.


🧠 Assign a TNS (Toronet Name)

Once a wallet is created, you can register a human-readable name for the address.

import { setTNSName } from 'torosdk';

await setTNSName({
  address: '0xWalletAddress',
  password: 'securePassword123',
  username: 'exampleName',
});

Names are unique and can be used across the Toronet ecosystem.


πŸ” Import Wallet From Private Key

If a user already has a private key, import it into the SDK with a new password.

import { importWalletFromPrivateKeyAndPassword } from 'torosdk';

const address = await importWalletFromPrivateKeyAndPassword({
  pvkey: 'yourPrivateKeyHere',
  password: 'newWalletPassword',
});

πŸ”’ Verify Wallet Password

Check whether a given password is valid for a Toronet address.

import { verifyWalletPassword } from 'torosdk';

const isValid = await verifyWalletPassword({
  address: '0xWalletAddress',
  password: 'testPassword',
});

Returns true or false.


πŸ”‘ Retrieve Wallet Key

Use this only when absolutely necessary (e.g. for backup or migrations):

import { getWalletKey } from 'torosdk';

const keyInfo = await getWalletKey({
  address: '0xWalletAddress',
});
console.log(keyInfo); // { pubkey, privkey }

⚠️ Always store keys securely. Never expose them on the frontend.


🧩 Best Practices

  • Always encrypt passwords in transit and storage.

  • Use environment variables for admin credentials when working with wallet APIs that require authorization.

  • Avoid calling getWalletKey() on the client side.



Last updated