← Back to all products
$29
Crypto Payment Handler
Cryptocurrency payment handler with wallet verification, transaction monitoring, and conversion.
JSONMarkdownPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 9 files
crypto-payment-handler/
├── LICENSE
├── README.md
├── examples/
│ └── payment_config.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_cli-reference.md
│ └── 03_configuration.md
├── index.html
└── src/
└── crypto_payment_handler.py
📖 Documentation Preview README excerpt
Crypto Payment Handler
Part of the Payment Stack by CodeVault
A local cryptocurrency payment processing simulator: wallet address validation, transaction monitoring, multi-chain support, and exchange rate locking. Test your crypto payment flow without touching a real blockchain.
Features
- Multi-chain support: Bitcoin, Ethereum, Solana, Polygon
- Wallet address validation with regex patterns per chain
- EIP-55 checksum verification for Ethereum addresses
- Exchange rate locking at payment creation time
- Payment lifecycle: pending → detected → confirming → confirmed
- Over/underpayment detection with configurable tolerance
- Simulated transaction confirmation tracking
- Mock receiving address generation per chain
- JSON file-based persistence for all payment data
- Python stdlib only — zero dependencies
Quick Start
# Run the full demo (address validation, payment creation, confirmation)
python src/crypto_payment_handler.py --action demo
# Validate a wallet address
python src/crypto_payment_handler.py --action validate-address \
--address 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chain eth
# Create a $99.99 Bitcoin payment
python src/crypto_payment_handler.py --action create-payment --amount 99.99 --chain btc
# Check current exchange rates
python src/crypto_payment_handler.py --action rates
# Check payment status
python src/crypto_payment_handler.py --action check-payment --payment-id pay_abc123
# Simulate a transaction for testing
python src/crypto_payment_handler.py --action simulate-tx --payment-id pay_abc123
CLI Reference
| Flag | Description |
|---|---|
--action, -a | Action to perform (required) |
--address | Wallet address to validate |
--chain | Blockchain: btc, eth, sol, matic (default: btc) |
--amount | Payment amount in fiat currency |
--currency | Fiat currency code (default: usd) |
--payment-id | Payment ID for status check or simulation |
--data-dir | Data storage directory (default: ./crypto_data) |
--verbose, -v | Enable debug logging |
Supported Chains
| Chain | Symbol | Confirmations | Block Time |
|---|---|---|---|
| Bitcoin | BTC | 6 | ~10 min |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/crypto_payment_handler.py
#!/usr/bin/env python3
"""
Crypto Payment Handler — Payment Stack by DataNest
A local crypto payment processing simulator: wallet address validation,
transaction monitoring, multi-chain support, payment confirmation tracking,
and exchange rate simulation. Demonstrates the patterns needed to accept
cryptocurrency payments without requiring any blockchain API keys.
Why this exists:
Accepting crypto payments means dealing with address formats that vary
per chain, confirmation times that range from seconds to hours, exchange
rate volatility, and transaction states that aren't like credit cards.
This tool implements all that logic locally so you can build and test
your crypto payment flow before connecting to real blockchain APIs.
Usage:
python crypto_payment_handler.py --action validate-address --address 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chain eth
python crypto_payment_handler.py --action create-payment --amount 99.99 --currency usd --chain btc
python crypto_payment_handler.py --action check-payment --payment-id pay_abc123
python crypto_payment_handler.py --action demo
License: MIT
"""
from __future__ import annotations
import argparse
import hashlib
import json
import logging
import re
import sys
import time
import uuid
from dataclasses import dataclass, field, asdict
from datetime import datetime, timezone
from enum import Enum
from pathlib import Path
from typing import Any, Optional
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
# Supported blockchain networks and their properties
CHAIN_CONFIG: dict[str, dict[str, Any]] = {
"btc": {
"name": "Bitcoin",
"symbol": "BTC",
# ... 656 more lines ...