Wallet
📖 Wallet Module
The wallet
module in the ono-web package provides utilities to generate and manage ONO wallets using BIP39 mnemonics and HD (Hierarchical Deterministic) key derivation.
📦 Importing
To use the wallet module, import it as follows:
🚀 Functions
1. wallet.newWalletData()
wallet.newWalletData()
Generates a new wallet with a mnemonic phrase and a seed.
✅ Returns
Promise<WalletData>
— an object containing:mnemonic
: The generated mnemonic phrase (BIP39).seed
: The seed derived from the mnemonic (hex string).
📝 Example
2. wallet.walletDataFromMnemonic(mnemonic)
wallet.walletDataFromMnemonic(mnemonic)
Generates a wallet seed from an existing mnemonic phrase.
📥 Parameters
mnemonic
string
A valid BIP39 mnemonic phrase
✅ Returns
Promise<WalletData>
— an object containing:mnemonic
: The input mnemonic phrase.seed
: The derived seed (hex string).
📝 Example
3. wallet.hdWallet(seed)
wallet.hdWallet(seed)
Creates an HD wallet (Hierarchical Deterministic Wallet) from a seed.
📥 Parameters
seed
string
Seed in hexadecimal format
✅ Returns
HDKey
— an HD wallet object that can be used to derive key pairs.
📝 Example
4. wallet.generateKeyPair(hdWallet, index)
wallet.generateKeyPair(hdWallet, index)
Generates a key pair (private/public key) from an HD wallet at a specific index using the ONO HD path m/44'/2909'/0'/0/index
.
📥 Parameters
hdWallet
HDKey
An HD wallet object
index
number
The index to derive the key at
✅ Returns
HDKey
— a key pair (containspublicKey
andprivateKey
).
📝 Example
📚 Types
WalletData
WalletData
mnemonic
: BIP39 mnemonic phrase.seed
: Hexadecimal string derived from mnemonic.
⚙️ HD Path
The ONO blockchain uses the following HD derivation path:
2909
— Coin type index reserved for ONO.index
— Allows multiple accounts/addresses under the same seed.
💡 Usage Example (Full Flow)
🚨 Notes
Always back up your mnemonic phrase securely. It is the only way to recover your wallet.
Never share your private key; anyone with access to it can control your funds.
For forging ONO coins, remember to burn at least 100 ONO coins from the wallet address you plan to use.
Last updated