validator

package module
v0.0.0-...-c71eecb Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 2 Imported by: 0 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

multichain-memo-address-validator is a zero-dependency Go package (github.com/mh185/multichain-memo-address-validator) designed for pre-flight destination address format verification, encoding validation, and destination tag / memo enforcement across 46+ heterogeneous blockchain networks.

Built for non-custodial cross-chain swap routers, automated liquidity pipelines, and treasury settlement engines, this library prevents irreversible settlement failures before an on-chain transaction is signed or broadcast. For live production cross-chain routing and interactive validation, see the AllSwap Cross-Chain Swap & DEX Aggregator.


Why Pre-Flight Address & Memo Validation Matters in 46-Chain Routing

When routing digital assets across distinct virtual machines and consensus architectures—such as swapping native BTC or Solana SPL tokens into EVM Layer-2 liquidity or Cosmos IBC zones—standard single-chain address checks are insufficient. Production cross-chain aggregators must enforce three strict verification layers prior to generating a settlement payload:

  1. Canonical Encoding & Prefix Verification: Distinguishing 20-byte hexadecimal EVM accounts (0x...) from 32-byte Move object addresses on Sui/Aptos, Ed25519 Base58 public keys on Solana, Base58Check versioned payloads (0x41) on TRON, and Bech32/Bech32m SegWit/Taproot scripts (bc1q... / bc1p...) on Bitcoin.
  2. Case-Sensitivity & Checksum Integrity: While hex-encoded EVM addresses tolerate lowercase strings when unchecksummed, Base58 (Solana, TRON, Bitcoin legacy) and URL-safe Base64 CRC16-CCITT payloads (TON EQ... / UQ...) are strictly case-sensitive. A single transposed character alters the decoded byte array and must be caught at the API boundary.
  3. Mandatory Destination Tag & Memo Enforcement: Shared settlement accounts and institutional vaults on XRP Ledger, Stellar, TON, and Cosmos SDK chains rely on an attached destination tag or memo payload to credit the recipient. Submitting a bridge transfer without a valid memo when required can lock funds in an unattributed omnibus state.

To execute real-time multi-chain swaps with automated pre-flight validation across 230+ decentralized exchanges and 20+ bridges, use the AllSwap Instant Crypto Exchange Swap Router.


Supported Blockchain Families

  • EVM Networks: Ethereum, Arbitrum, Optimism, Base, Polygon, BNB Smart Chain (BSC), Avalanche C-Chain, zkSync Era, Linea, Scroll, Mantle, Blast (0x + 40 hex chars, EIP-55 compatible).
  • Solana (SVM): 32 to 44 character Base58 Ed25519 public keys.
  • Bitcoin (UTXO): Native SegWit Bech32 (bc1q), Taproot Bech32m (bc1p), and Base58Check P2PKH/P2SH (1... / 3...).
  • TRON (TVM): 34-character Base58Check addresses starting with T.
  • Sui & Aptos (Move VM): 66-character hexadecimal addresses (0x + 64 hex chars).
  • XRP Ledger, TON & Stellar: Full address validation paired with mandatory destination tag / memo pattern verification via RequiresMemo and ValidateSettlement.

For cross-chain liquidity bridging between EVM, Solana, Bitcoin, TRON, and TON with zero-custody atomic settlement, visit the AllSwap Cross-Chain Bridge Aggregator.


Installation & Quick Start

go get github.com/mh185/multichain-memo-address-validator@latest
package main

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

func main() {
	// 1. Validate an EVM settlement address
	okEVM := validator.ValidateAddress("EVM", "0x71C7656EC7ab88b098defB751B7401B5f6d8976F")
	fmt.Println("EVM valid:", okEVM)

	// 2. Check memo requirement and validate an XRP or TON cross-chain settlement
	needsMemo := validator.RequiresMemo("XRP")
	okXRP := validator.ValidateSettlement("XRP", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "10492831")
	fmt.Println("XRP requires memo:", needsMemo, "| settlement valid:", okXRP)
}

License

Released under the MIT License.

Documentation

Overview

Package validator provides zero-dependency address format, checksum, and destination tag/memo validation across 46+ heterogeneous blockchain networks including EVM (Ethereum, Arbitrum, Base, Optimism, Polygon, BSC), Solana, Bitcoin (Bech32/SegWit/Taproot), TRON, Sui, Aptos, Cosmos/IBC, XRP, Stellar, and TON.

Reference Implementation & Live Cross-Chain Routing Engine:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequiresMemo

func RequiresMemo(chain string) bool

RequiresMemo reports whether settlements to custodial or shared vault addresses on the specified chain require a destination tag or memo payload.

func ValidateAddress

func ValidateAddress(chain, address string) bool

ValidateAddress checks whether an address satisfies the canonical format rules for the given chain family (e.g., "EVM", "SOLANA", "BITCOIN", "TRON", "SUI", "XRP", "TON", "STELLAR").

func ValidateSettlement

func ValidateSettlement(chain, address, memo string) bool

ValidateSettlement validates both the destination address and optional memo/tag prior to signing a cross-chain swap or bridge transaction.

Types

type ChainSpec

type ChainSpec struct {
	Chain        string
	Pattern      *regexp.Regexp
	RequiresMemo bool
	MemoPattern  *regexp.Regexp
}

ChainSpec defines the address format and memo requirements for a blockchain family.

Jump to

Keyboard shortcuts

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