CryptoWalletValidator 1.0.0

dotnet add package CryptoWalletValidator --version 1.0.0
                    
NuGet\Install-Package CryptoWalletValidator -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CryptoWalletValidator" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CryptoWalletValidator" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CryptoWalletValidator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CryptoWalletValidator --version 1.0.0
                    
#r "nuget: CryptoWalletValidator, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CryptoWalletValidator@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CryptoWalletValidator&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CryptoWalletValidator&version=1.0.0
                    
Install as a Cake Tool

Crypto Wallet Validator Library

CryptoWalletValidator is a lightweight C# library designed to validate and identify the type of cryptocurrency wallet address based on a given string. It currently supports popular cryptocurrencies like Bitcoin, Ethereum, Ripple, Monero, Dash, and ZCash.

Features

  • Identify wallet address types (e.g., Bitcoin, Ethereum, etc.).
  • Validate wallet address format and checksum.
  • Extensible to support additional cryptocurrencies.

Getting Started

Prerequisites

  • .NET Framework or .NET Core SDK
  • Org.BouncyCastle NuGet package (for Ethereum and Monero checksum calculations)

Installation

  1. Create a new project or open your existing one.
  2. Add the library (CryptoWalletValidator.dll) as a reference to your project.
  3. Install the required dependency using NuGet:
    dotnet add package BouncyCastle
    

Usage

To use the CryptoWalletValidator, import the namespace and call the GuessAndValidateWalletType method with a wallet address string.

using CryptoWalletValidator;

class Program
{
    static void Main(string[] args)
    {
        string walletAddress = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"; // Example Bitcoin address
        string walletType = Validator.GuessAndValidateWalletType(walletAddress);

        Console.WriteLine($"Wallet Type: {walletType}");
    }
}

Example Output

For the input wallet address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa:

Wallet Type: Bitcoin

Supported Cryptocurrencies

  1. Bitcoin (BTC)
    • Validates Base58 format and checksum.
  2. Ethereum (ETH)
    • Validates hexadecimal format and EIP-55 checksum.
  3. Ripple (XRP)
    • Validates Base58 format and checksum.
  4. Monero (XMR)
    • Validates Base58 format and checksum using Keccak.
  5. Dash (DASH)
    • Validates Base58 format and checksum.
  6. ZCash (ZEC)
    • Validates Base58 format and checksum.

Function Overview

GuessAndValidateWalletType(string address)

Identifies and validates the type of wallet address.

  • Input: A string representing the wallet address.
  • Output: A string representing the type of wallet (e.g., "Bitcoin", "Ethereum") or "Unknown or Invalid Address".

Internal Utility Functions

  • IsValidAddress: Checks if the address matches a specific regex pattern.
  • VerifyChecksum: Decodes the address and validates its checksum.
  • Base58Decode: Decodes Base58-encoded strings.
  • CalculateDoubleSHA256Checksum: Computes a double SHA-256 checksum.
  • CalculateKeccakChecksum: Computes a Keccak-256 checksum (used by Monero).
  • VerifyEthereumChecksum: Validates Ethereum EIP-55 checksum.

Building the Library

  1. Open the project in Visual Studio or another IDE.
  2. Build the project as a Class Library.
  3. The output .dll file will be located in the bin directory of your project.

Contributing

Feel free to fork the repository and add support for additional cryptocurrencies or improve existing functionality. Submit a pull request with your changes.

License

This library is released under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 179 1/23/2025