validator

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

multichain-memo-address-validator

Zero-dependency Go library for validating cryptocurrency address formats and Memo / Destination Tag rules across major blockchain networks (Bitcoin, Ethereum, Base, Arbitrum, BNB Chain, Polygon, Solana, Tron, XRP Ledger, Stellar, TON, and Litecoin).

Why Validate Network & Memo Rules Before Sending?

Cross-chain and same-chain crypto swaps frequently fail or require manual recovery when a sender:

  1. Sends funds on the wrong network (for example, confusing 0x addresses across Ethereum, Base, Arbitrum, or BNB Chain, or sending ERC20 instead of TRC20).
  2. Omits a required XRP Destination Tag, Stellar Memo, or TON Comment when sending to an exchange deposit address.

For complete operational guides on non-custodial deposit-address swaps:

Installation

go get github.com/naonao7k7k-cloud/multichain-memo-address-validator@v1.0.0

Quick Start

package main

import (
	"fmt"
	validator "github.com/naonao7k7k-cloud/multichain-memo-address-validator"
)

func main() {
	res := validator.ValidateAddress(validator.NetworkXRP, "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe")
	fmt.Println("Valid:", res.Valid, "MemoOptional:", res.MemoOptional)

	if err := validator.ValidateMemo(validator.NetworkXRP, "123456"); err != nil {
		fmt.Println("Invalid Destination Tag:", err)
	}
}

License

MIT License.

Documentation

Overview

Package validator provides zero-dependency format and Memo/Destination Tag validation for cryptocurrency addresses across major blockchain networks.

Supported network families include Bitcoin (Bech32/Bech32m and Base58), EVM-compatible networks (Ethereum, Base, Arbitrum, BNB Chain, Polygon), Solana, Tron, XRP Ledger, Stellar, TON, and Litecoin.

For practical cross-chain transfer rules, wrong-network prevention, and Memo/Destination Tag handling, see:

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedNetwork = errors.New("unsupported network")

ErrUnsupportedNetwork is returned when a network identifier is not recognized.

Functions

func SupportsMemo

func SupportsMemo(net Network) bool

SupportsMemo reports whether the given network uses a Memo, Destination Tag, or Comment for custodial or exchange deposits.

func ValidateMemo

func ValidateMemo(net Network, memo string) error

ValidateMemo checks whether memo is structurally valid for net. An empty memo is accepted because self-custody wallets typically do not require one.

Types

type Network

type Network string

Network identifies a blockchain network family for address validation.

const (
	NetworkBitcoin  Network = "bitcoin"
	NetworkEthereum Network = "ethereum"
	NetworkBase     Network = "base"
	NetworkArbitrum Network = "arbitrum"
	NetworkBNB      Network = "bnb"
	NetworkPolygon  Network = "polygon"
	NetworkSolana   Network = "solana"
	NetworkTron     Network = "tron"
	NetworkXRP      Network = "xrp"
	NetworkStellar  Network = "stellar"
	NetworkTON      Network = "ton"
	NetworkLitecoin Network = "litecoin"
)

type ValidationResult

type ValidationResult struct {
	Valid        bool
	Network      Network
	Address      string
	MemoOptional bool
	MemoNote     string
	Error        string
}

ValidationResult describes the outcome of validating an address and optional memo/tag.

func ValidateAddress

func ValidateAddress(net Network, addr string) ValidationResult

ValidateAddress checks whether addr matches the expected address format for net.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL