Skip to content

tanishchugh01/blockchain-wallets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blockchain-wallets

A Node.js CLI tool for managing Bitcoin wallets using BIP39 mnemonics and BlockCypher API.

Features

  • Create Wallet - Generate new Bitcoin addresses
  • Import Wallet - Import wallets from BIP39 mnemonic phrases
  • List Wallets - View all stored wallets
  • Check Balance - Get wallet balance from blockchain
  • Transaction History - Fetch wallet transactions
  • Get Unused Address - Find addresses available for receiving funds

Tech Stack

  • Node.js (ES6 Modules)
  • bitcore-lib (Bitcoin cryptography)
  • bitcore-mnemonic (BIP39 support)
  • axios (HTTP client)
  • BlockCypher API (Bitcoin testnet)

Installation

git clone https://github.com/tanishchugh01/blockchain-wallets.git
cd blockchain-wallets
npm install

Setup

Create a .env file with your BlockCypher token:

BLOCK_CYPHER_TOKEN=your_token_here

Get a free token at blockcypher.com

Usage

npm start

Runs a demo showing all features working with actual blockchain data.

Project Structure

src/
├── index.js              # Main demo
├── api/                  # 6 wallet features
│   ├── createWallet.js
│   ├── importWallet.js
│   ├── listAllWallets.js
│   ├── getWalletBalance.js
│   ├── getWalletTransactions.js
│   ├── getUnusedAddress.js
│   └── index.js
├── configs/              # Configuration
│   ├── blockCypher.js
│   └── CONSTANTS.js
└── methods/              # Utilities
    ├── deriveAddressFromMnemonic.js
    ├── getAddressBalance.js
    ├── getWalletInfo.js
    ├── loadWallets.js
    └── saveWallets.js

Implementation

BIP39 Mnemonic Support

  • Validates mnemonic phrases using bitcore-mnemonic
  • Derives addresses using BIP44 standard (m/0'/0/0)
  • Supports 12, 15, 18, 21, and 24-word mnemonics

Bitcoin Address Generation

  • Creates testnet addresses (prefix 'm' or 'n')
  • Uses BlockCypher API for address generation
  • Stores address metadata locally

Local Storage

  • Wallets stored in storage/wallets.json
  • Simple JSON persistence
  • Auto-creates storage directory

API Integration

  • BlockCypher API for blockchain queries
  • Bitcoin testnet endpoint: https://api.blockcypher.com/v1/btc/test3
  • Token-based authentication

Error Handling

  • Mnemonic validation
  • Wallet existence checks
  • Graceful API error handling

Demo Output

========================================
  Bitcoin Wallet Management System
========================================

3️⃣  Importing wallet from BIP39 mnemonic...
✅ Wallet Imported: TestMnemonic
   Address: n28VbW7cyn2Bj9b7iCH6U34t58jzsiuEig

4️⃣  Listing all wallets...
✅ Total Wallets: 1
   1. TestMnemonic (n28VbW7cyn2Bj9b7iCH6U34t58jzsiuEig)

5️⃣  Checking wallet balance...
Balance: 0 satoshi

6️⃣  Fetching wallet transactions...
Transactions of TestMnemonic:
Transaction 1:
   Confirmations: 3574879
   Value: 32443500 satoshi
   Time: 29/10/2017, 12:35:24 am

7️⃣  Getting unused address...
Unused Address: n28VbW7cyn2Bj9b7iCH6U34t58jzsiuEig

========================================
  All tests completed successfully!
========================================

API Endpoints

Endpoint Method Purpose
/addrs POST Create new address
/wallets POST Create wallet
/addrs/{address}/balance GET Get address balance
/addrs/{address}/full GET Get address transactions

Security

  • ✅ Private keys never stored locally
  • ✅ BlockCypher token in .env (not committed)
  • ✅ Bitcoin testnet only (no real funds)
  • ✅ Input validation on mnemonics

About

A Node.js CLI tool for managing Bitcoin wallets using BIP39 mnemonics and BlockCypher API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors