Class CryptoJDK.Address
java.lang.Object
com.barbantfintech.tools.common.cryptojdk.CryptoJDK.Address
- Enclosing class:
CryptoJDK
Handles operations related to generating and manipulating blockchain addresses for various networks and address types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
generate
(@NonNull Network network, @NonNull AddressType addrType, @NonNull String xPub, @NonNull Integer derivationIndex) Generates a blockchain address for receiving coins.static String
getFromPrivateKey
(@NonNull Network network, @NonNull AddressType addrType, @NonNull String privateKey) Extracts a blockchain address from its private key.static boolean
Validates a blockchain address for receiving coins.static Collection
<Network> Validates a blockchain address for receiving coins across multiple networks.
-
Constructor Details
-
Address
public Address()
-
-
Method Details
-
generate
public static String generate(@NonNull @NonNull Network network, @NonNull @NonNull AddressType addrType, @NonNull @NonNull String xPub, @NonNull @NonNull Integer derivationIndex) throws CryptoJDKException Generates a blockchain address for receiving coins.- Parameters:
network
- The network for which the address is being generated (e.g., Bitcoin, Ethereum).addrType
- The type of address being generated (e.g., legacy, SegWit).xPub
- The extended public key (xPub) to generate the address from.derivationIndex
- The derivation index used to generate the address.- Returns:
- The generated address for receiving coins.
- Throws:
CryptoJDKException
- If the method parameters are invalid or internal validation of the generated result fails.
-
validate
Validates a blockchain address for receiving coins.- Parameters:
network
- The network for which the address should be validated.address
- The blockchain address to be validated.- Returns:
true
if the address is valid for the specified network;false
otherwise.
-
validate
Validates a blockchain address for receiving coins across multiple networks.- Parameters:
address
- The blockchain address to be validated.- Returns:
- A collection of networks for which the address is valid. If the address is not valid at all, the resulting collection will be empty.
-
getFromPrivateKey
public static String getFromPrivateKey(@NonNull @NonNull Network network, @NonNull @NonNull AddressType addrType, @NonNull @NonNull String privateKey) throws CryptoJDKException Extracts a blockchain address from its private key.- Parameters:
network
- The network for which the address is being extracted.addrType
- The type of address to be extracted (e.g., legacy, SegWit).privateKey
- The private key from which the address is to be derived.- Returns:
- The blockchain address derived from the provided private key.
- Throws:
CryptoJDKException
- If the network is not supported or the private key is invalid.
-