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.
- Identify wallet address types (e.g., Bitcoin, Ethereum, etc.).
- Validate wallet address format and checksum.
- Extensible to support additional cryptocurrencies.
- .NET Framework or .NET Core SDK
Org.BouncyCastle
NuGet package (for Ethereum and Monero checksum calculations)
- Create a new project or open your existing one.
- Add the library (
CryptoWalletValidator.dll
) as a reference to your project. - Install the required dependency using NuGet:
dotnet add package BouncyCastle
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}");
}
}
For the input wallet address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
:
Wallet Type: Bitcoin
- Bitcoin (BTC)
- Validates Base58 format and checksum.
- Ethereum (ETH)
- Validates hexadecimal format and EIP-55 checksum.
- Ripple (XRP)
- Validates Base58 format and checksum.
- Monero (XMR)
- Validates Base58 format and checksum using Keccak.
- Dash (DASH)
- Validates Base58 format and checksum.
- ZCash (ZEC)
- Validates Base58 format and checksum.
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".
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.
- Open the project in Visual Studio or another IDE.
- Build the project as a Class Library.
- The output
.dll
file will be located in thebin
directory of your project.
Feel free to fork the repository and add support for additional cryptocurrencies or improve existing functionality. Submit a pull request with your changes.
This library is released under the MIT License.