Skip to content

Beldex-Coin/beldex-java-address-validator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beldex Address Validator (Java)

A lightweight JavaScript library to validate Beldex addresses, support for Mainnet, Testnet, and Devnet.

Features

  • Validate Beldex standard addresses, subaddresses, and integrated addresses.
  • Detect network type (Mainnet, Testnet, Devnet).
  • Checksum verification using Keccak-256.
  • Base58 decoding.

Installation

You can use this library in two ways:

  1. Maven Project
  2. Normal Java Project (without Maven)

1. Using in a Maven Project

Step 1 — Clone the validator repository

git clone https://github.com/Beldex-Coin/java-address-validator.git

Enter the project folder:

cd java-address-validator

Install the library locally

Run:

mvn clean install

This will compile the project and install the library into the local Maven repository:

~/.m2/repository

Specifically:

~/.m2/repository/com/beldex/java-address-validator/1.0-SNAPSHOT/

Step 3 — Add dependency in your project

In the other Maven project, add this to pom.xml:

<dependency>
    <groupId>com.beldex</groupId>
    <artifactId>java-address-validator</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Maven will now load the library from the local repository.

Step 4 — Use the validator in Java

import com.beldex.AddressValidator;
import java.util.Map;

public class Main {

    public static void main(String[] args) {

        String address = "YOUR_BELDEX_ADDRESS";

        Map<String, String> result =
                AddressValidator.ValidateBeldexAddress(address);

        System.out.println(result);
    }
}

Important Note

mvn install is only required once. After installing, any Maven project on that machine can use the dependency.

2. Using in a Normal Java Project (Without Maven)

You can also use the Beldex Address Validator in a standard Java project without using Maven.

Step 1 — Download or copy the JAR

Download the latest JAR file from the GitHub Releases page:

https://github.com/Beldex-Coin/java-address-validator/releases

Download

java-address-validator-1.0-SNAPSHOT.jar

or Build the validator library:

mvn clean package  

The compiled JAR will be generated at:

target/java-address-validator-1.0-SNAPSHOT.jar

Copy this JAR into your project (for example inside a lib folder).

Example project structure:

sample-java-project
│
├── lib
│   └── java-address-validator-1.0-SNAPSHOT.jar
│
└── src
    └── Main.java

Step 2 — Write Java Code

import com.beldex.AddressValidator;
import java.util.Map;

public class Main {

    public static void main(String[] args) {

        String address = "YOUR_BELDEX_ADDRESS";

        Map<String, String> result =
                AddressValidator.ValidateBeldexAddress(address);

        if ("true".equals(result.get("valid"))) {

            System.out.println("Address is valid");
            System.out.println("Network: " + result.get("network"));
            System.out.println("Type: " + result.get("type"));

        } else {

            System.out.println("Address is invalid");
            System.out.println("Reason: " + result.get("reason"));
        }
    }
}

Step 3 — Compile the Program

Navigate to the src directory and compile:

javac -cp /lib/java-address-validator-1.0-SNAPSHOT.jar src/Main.java

Step 4 — Run the Program

Run the program with the library in the classpath:

java -cp ".:/lib/java-address-validator-1.0-SNAPSHOT.jar" src/Main

Example Output

Valid address:

Address is valid
Network: mainnet
Type: standard

Invalid address:

Address is invalid
Reason: Invalid checksum

Supported Address Types

  • Standard Address: The primary address for a wallet.
  • Subaddress: Generated addresses for receiving payments without revealing the primary address.
  • Integrated Address: A standard address bundled with a payment ID.

Technical Details

Beldex addresses use a Monero-style encoding:

  1. Prefix: A network-specific byte indicating the address type.
  2. Public Spend Key: 32 bytes.
  3. Public View Key: 32 bytes.
  4. Checksum: 4 bytes (Hash of the above data).

The entire package is encoded using Beldex's modified Base58 format.

Requirements

  • Java 17
  • Maven 3+
  • Address Validator JAR file

License

GPL-3.0 license

About

This provides a Java-based utility to validate beldex wallet addresses.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%