CryptoKosh – A Web3 Cryptocurrency Wallet Project!
CryptoKosh (referring to a "vault" in Hindi) is a React functional component designed to generate and manage cryptocurrency wallets. It supports both the generation of new wallets and the entry of existing recovery phrases. It displays generated private and public keys, provides functionality to copy them to the clipboard, and includes features for showing or hiding sensitive information.
Ensure you have Node.js and npm installed on your machine.
Clone the repository or add the component to your existing React project.
Install the required dependencies:
npm install tweetnacl bip39 ed25519-hd-key @solana/web3.js sonner lucide-react
Import and use the WalletGenerator
component in your project.
mnemonicWords
: Stores the words of the recovery phrase, initialized from localStorage
if previously saved.
const [mnemonicWords, setMnemonicWords] = useState<string[]>(() => {
const savedMnemonic = localStorage.getItem('mnemonicWords');
return savedMnemonic ? JSON.parse(savedMnemonic) : [];
});
mnemonicWordsInput
: Manages the input for the mnemonic recovery phrase.
const [mnemonicWordsInput, setMnemonicWordsInput] = useState<string>(() => localStorage.getItem('mnemonicWordsInput') || '');
wallets
: Stores generated wallets, initialized from localStorage
if previously saved.
const [wallets, setWallets] = useState<Wallet[]>(() => {
const savedWallets = localStorage.getItem('wallets');
return savedWallets ? JSON.parse(savedWallets) : [];
});
blockchain
: Stores the selected blockchain for wallet generation.
const [blockchain, setBlockchain] = useState<string>(() => localStorage.getItem('blockchain') || '');
isCopied
: Tracks whether the key information has been copied to the clipboard.
const [isCopied, setIsCopied] = useState(false);
showPrivateKey
: Toggles the visibility of private keys for security purposes.
const [showPrivateKey, setShowPrivateKey] = useState(false);
Feel free to submit issues or pull requests. Contributions are always welcome!
This project is licensed under the MIT License.