// ใช้ NestJS สำหรับ Backend ที่ปลอดภัย # ติดตั้ง NestJS npm i -g @nestjs/cli nest new bitcoin-wallet # ติดตั้ง dependencies npm install bitcoinjs-lib bip39 @nestjs/passport axios # สร้างไฟล์ .env ENCRYPTION_KEY=supersecretkey123 BLOCKCHAIN_API_KEY=test_api_key # รันเซิร์ฟเวอร์ npm run start:dev import { Controller, Post, Body, UseGuards } from '@nestjs/common'; import { BlockchainService } from './blockchain.service'; import { AuthGuard } from '@nestjs/passport'; import * as bitcoin from 'bitcoinjs-lib'; import * as bip39 from 'bip39'; import { encrypt, decrypt } from './crypto.util'; // ไฟล์: blockchain.service.ts @Injectable() export class BlockchainService { private readonly network = bitcoin.networks.testnet; // ใช้ testnet สำหรับการทดสอบ constructor( @InjectRepository(WalletRepository) private walletRepository: WalletRepository, private readonly httpService: HttpService ) {} // สร้าง Wallet ใหม่ด้วย HD Wall...
ความคิดเห็น
แสดงความคิดเห็น