A TypeScript library for creating and managing Bitcoin, Ethereum, Binance Smart Chain (BSC), Polygon, Dash, Litecoin, and Dogecoin wallets in React Native applications. This library provides a unified interface for handling different cryptocurrency wallets while following BIP standards for key derivation and address generation.
- BIP39 mnemonic generation and import
- BIP32/44 HD wallet support
- Bitcoin wallet functionality (Legacy and SegWit addresses)
- Ethereum wallet functionality
- Binance Smart Chain (BSC) wallet functionality
- Polygon wallet functionality
- Dash wallet functionality
- Litecoin wallet functionality
- Dogecoin wallet functionality
- TypeScript support
- Comprehensive test coverage
npm install react-native-multi-crypto-wallet
This package requires the following peer dependencies:
{
"bip32": "^3.0.1",
"bip39": "^3.0.4",
"bitcoinjs-lib": "^6.1.0",
"ethers": "^6.0.0",
"ethereumjs-util": "^7.1.5",
"tiny-secp256k1": "^2.2.1"
}
import { BitcoinWallet, CryptoNetwork } from 'react-native-multi-crypto-wallet';
// Create a new Bitcoin wallet
const bitcoinWallet = new BitcoinWallet({
network: CryptoNetwork.BITCOIN_TESTNET // or BITCOIN_MAINNET
});
// Generate a new mnemonic
const mnemonic = bitcoinWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Get wallet address
const address = bitcoinWallet.getAddress();
console.log('Bitcoin Address:', address);
// Get private key
const privateKey = bitcoinWallet.getPrivateKey();
console.log('Private Key:', privateKey);
// Get public key
const publicKey = bitcoinWallet.getPublicKey();
console.log('Public Key:', publicKey);
// Import existing wallet from mnemonic
const importedWallet = new BitcoinWallet({
network: CryptoNetwork.BITCOIN_TESTNET,
mnemonic: 'your twelve word mnemonic phrase here'
});
import { EthereumWallet, CryptoNetwork } from 'react-native-multi-crypto-wallet';
// Create a new Ethereum wallet
const ethereumWallet = new EthereumWallet(CryptoNetwork.ETHEREUM_GOERLI); // or ETHEREUM_MAINNET, ETHEREUM_SEPOLIA
// Generate a new mnemonic
const mnemonic = ethereumWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Get Ethereum address
const address = ethereumWallet.getAddress();
console.log('Ethereum Address:', address);
// Get private key
const privateKey = ethereumWallet.getPrivateKey();
console.log('Private Key:', privateKey);
// Get public key
const publicKey = ethereumWallet.getPublicKey();
console.log('Public Key:', publicKey);
// Check balance
const balance = await ethereumWallet.getBalance();
console.log('Balance:', balance, 'ETH');
// Import existing wallet from mnemonic
const importedEthWallet = new EthereumWallet({CryptoNetwork.ETHEREUM_GOERLI,
mnemonic: 'your twelve word mnemonic phrase here'
});
// Sign a transaction
const transaction = {
to: "0x1234...",
value: ethers.parseEther("0.1"),
gasLimit: "21000",
};
const signedTx = await ethereumWallet.signTransaction(transaction);
import { BNBWallet, CryptoNetwork } from 'react-native-multi-crypto-wallet';
// Create a new BNB wallet
const bnbWallet = new BNBWallet({
network: CryptoNetwork.BSC_MAINNET // or BSC_TESTNET
});
// Generate a new mnemonic
const mnemonic = bnbWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Get BNB address
const address = bnbWallet.getAddress();
console.log('BNB Address:', address);
// Import existing wallet from mnemonic
const importedBnbWallet = new BNBWallet({
network: CryptoNetwork.BSC_MAINNET,
mnemonic: 'your twelve word mnemonic phrase here'
});
// Check balance
const balance = await bnbWallet.getBalance();
console.log('Balance:', balance, 'BNB');
import { PolygonWallet, CryptoNetwork } from 'react-native-multi-crypto-wallet';
// Create a new Polygon wallet
const polygonWallet = new PolygonWallet({
network: CryptoNetwork.POLYGON_MAINNET // or POLYGON_MUMBAI
});
// Generate a new mnemonic
const mnemonic = polygonWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Get MATIC address
const address = polygonWallet.getAddress();
console.log('Polygon Address:', address);
// Import existing wallet from mnemonic
const importedPolygonWallet = new PolygonWallet({
network: CryptoNetwork.POLYGON_MAINNET,
mnemonic: 'your twelve word mnemonic phrase here'
});
// Check balance
const balance = await polygonWallet.getBalance();
console.log('Balance:', balance, 'MATIC');
import { DashWallet, CryptoNetwork } from 'react-native-multi-crypto-wallet';
// Create a new Dash wallet
const dashWallet = new DashWallet({
network: CryptoNetwork.DASH_MAINNET // or DASH_TESTNET
});
// Generate a new mnemonic
const mnemonic = dashWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Get Dash address
const address = dashWallet.getAddress();
console.log('Dash Address:', address);
// Import existing wallet from mnemonic
const importedDashWallet = new DashWallet({
network: CryptoNetwork.DASH_MAINNET,
mnemonic: 'your twelve word mnemonic phrase here'
});
import { LitecoinWallet, CryptoNetwork } from 'react-native-multi-crypto-wallet';
// Create a new Litecoin wallet
const ltcWallet = new LitecoinWallet({
network: CryptoNetwork.LITECOIN_MAINNET // or LITECOIN_TESTNET
});
// Generate a new mnemonic
const mnemonic = ltcWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Get Litecoin address
const address = ltcWallet.getAddress();
console.log('Litecoin Address:', address);
// Import existing wallet from mnemonic
const importedLtcWallet = new LitecoinWallet({
network: CryptoNetwork.LITECOIN_MAINNET,
mnemonic: 'your twelve word mnemonic phrase here'
});
import { DogecoinWallet, CryptoNetwork } from 'react-native-multi-crypto-wallet';
// Create a new Dogecoin wallet
const dogeWallet = new DogecoinWallet({
network: CryptoNetwork.DOGECOIN_MAINNET // or DOGECOIN_TESTNET
});
// Generate a new mnemonic
const mnemonic = dogeWallet.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Get Dogecoin address
const address = dogeWallet.getAddress();
console.log('Dogecoin Address:', address);
// Import existing wallet from mnemonic
const importedDogeWallet = new DogecoinWallet({
network: CryptoNetwork.DOGECOIN_MAINNET,
mnemonic: 'your twelve word mnemonic phrase here'
});
-
CryptoNetwork.BITCOIN_MAINNET
: Bitcoin Mainnet -
CryptoNetwork.BITCOIN_TESTNET
: Bitcoin Testnet
-
CryptoNetwork.ETHEREUM_MAINNET
: Ethereum Mainnet -
CryptoNetwork.ETHEREUM_GOERLI
: Goerli Testnet -
CryptoNetwork.ETHEREUM_SEPOLIA
: Sepolia Testnet
-
CryptoNetwork.BSC_MAINNET
: BSC Mainnet -
CryptoNetwork.BSC_TESTNET
: BSC Testnet
-
CryptoNetwork.POLYGON_MAINNET
: Polygon Mainnet -
CryptoNetwork.POLYGON_MUMBAI
: Polygon Mumbai Testnet
-
CryptoNetwork.DASH_MAINNET
: Dash Mainnet -
CryptoNetwork.DASH_TESTNET
: Dash Testnet
-
CryptoNetwork.LITECOIN_MAINNET
: Litecoin Mainnet -
CryptoNetwork.LITECOIN_TESTNET
: Litecoin Testnet
-
CryptoNetwork.DOGECOIN_MAINNET
: Dogecoin Mainnet -
CryptoNetwork.DOGECOIN_TESTNET
: Dogecoin Testnet
- Never store mnemonics or private keys in plain text
- Use secure storage solutions for sensitive data
- Always validate user input
- Consider using hardware wallets for large amounts
npm test
npm run build
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.