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.
π Related Sections
Last updated