@prathammahajan/blockchain-integration
Version:
🚀 Comprehensive blockchain integration suite with multi-chain cryptocurrency support, NFT marketplace, smart contracts, DeFi protocols, and enterprise-grade wallet management
71 lines (61 loc) • 1.79 kB
JavaScript
const BlockchainEngine = require('../src/index');
async function basicCryptoExample() {
try {
// Initialize blockchain engine
const blockchain = new BlockchainEngine({
networks: {
ethereum: {
enabled: false,
rpc: 'https://mainnet.infura.io',
chainId: 1
},
bitcoin: {
enabled: false,
rpc: 'https://blockstream.info',
network: 'mainnet'
}
},
wallet: {
enabled: true,
encryption: false
},
nft: {
enabled: false
},
smartContracts: {
enabled: false
},
defi: {
enabled: false
},
security: {
enabled: false
}
});
// Wait for initialization
await new Promise(resolve => {
blockchain.on('initialized', resolve);
});
console.log('✅ Blockchain Engine initialized');
// Create a wallet
const wallet = await blockchain.createWallet('hd');
console.log('✅ Wallet created:', wallet.address);
// Get wallet balance (skip if networks are disabled)
try {
const balance = await blockchain.getWalletBalance(wallet.walletId, 'ethereum');
console.log('✅ Wallet balance:', balance);
} catch (error) {
console.log('⚠️ Wallet balance check skipped (networks disabled):', error.message);
}
// Get system status
const status = await blockchain.getSystemStatus();
console.log('✅ System status:', status);
// Shutdown
await blockchain.shutdown();
console.log('✅ Blockchain Engine shutdown');
} catch (error) {
console.error('❌ Error:', error.message);
}
}
// Run the example
basicCryptoExample();