This commit is contained in:
woodser 2021-05-04 20:20:01 -04:00
commit 8a38081c04
2800 changed files with 344130 additions and 0 deletions

View file

@ -0,0 +1,62 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
import static org.apache.commons.lang3.Validate.notBlank;
import static org.apache.commons.lang3.Validate.notNull;
/**
* Abstract base class for {@link Asset} implementations. Most implementations should not
* extend this class directly, but should rather extend {@link Coin}, {@link Token} or one
* of their subtypes.
*
* @author Chris Beams
* @since 0.7.0
*/
public abstract class AbstractAsset implements Asset {
private final String name;
private final String tickerSymbol;
private final AddressValidator addressValidator;
public AbstractAsset(String name, String tickerSymbol, AddressValidator addressValidator) {
this.name = notBlank(name);
this.tickerSymbol = notBlank(tickerSymbol);
this.addressValidator = notNull(addressValidator);
}
@Override
public final String getName() {
return name;
}
@Override
public final String getTickerSymbol() {
return tickerSymbol;
}
@Override
public final AddressValidationResult validateAddress(String address) {
return addressValidator.validate(address);
}
@Override
public String toString() {
return getClass().getName();
}
}

View file

@ -0,0 +1,73 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* Value object representing the result of validating an {@link Asset} address. Various
* factory methods are provided for typical use cases.
*
* @author Chris Beams
* @since 0.7.0
* @see Asset#validateAddress(String)
*/
public class AddressValidationResult {
private static final AddressValidationResult VALID_ADDRESS = new AddressValidationResult(true, "", "");
private final boolean isValid;
private final String message;
private final String i18nKey;
private AddressValidationResult(boolean isValid, String message, String i18nKey) {
this.isValid = isValid;
this.message = message;
this.i18nKey = i18nKey;
}
public boolean isValid() {
return isValid;
}
public String getI18nKey() {
return i18nKey;
}
public String getMessage() {
return message;
}
public static AddressValidationResult validAddress() {
return VALID_ADDRESS;
}
public static AddressValidationResult invalidAddress(Throwable cause) {
return invalidAddress(cause.getMessage());
}
public static AddressValidationResult invalidAddress(String cause) {
return invalidAddress(cause, "validation.altcoin.invalidAddress");
}
public static AddressValidationResult invalidAddress(String cause, String i18nKey) {
return new AddressValidationResult(false, cause, i18nKey);
}
public static AddressValidationResult invalidStructure() {
return invalidAddress("", "validation.altcoin.wrongStructure");
}
}

View file

@ -0,0 +1,29 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* An {@link Asset} address validation function.
*
* @author Chris Beams
* @since 0.7.0
*/
public interface AddressValidator {
AddressValidationResult validate(String address);
}

View file

@ -0,0 +1,25 @@
package bisq.asset;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* When a new PaymentAccount is created for given asset, this annotation tells UI to show user a disclaimer message
* with requirements needed to be fulfilled when conducting trade given payment method.
*
* I.e. in case of Monero user must use official Monero GUI wallet or Monero CLI wallet with certain options enabled,
* user needs to keep tx private key, tx hash, recipient's address, etc.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface AltCoinAccountDisclaimer {
/**
* Translation key of the message to show, i.e. "account.altcoin.popup.xmr.msg"
* @return translation key
*/
String value();
}

View file

@ -0,0 +1,46 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* Interface representing a given ("crypto") asset in its most abstract form, having a
* {@link #getName() name}, eg "Bitcoin", a {@link #getTickerSymbol() ticker symbol},
* eg "BTC", and an address validation function. Together, these properties represent
* the minimum information and functionality required to register and trade an asset on
* the Bisq network.
* <p>
* Implementations typically extend either the {@link Coin} or {@link Token} base
* classes, and must be registered in the {@code META-INF/services/bisq.asset.Asset} file
* in order to be available in the {@link AssetRegistry} at runtime.
*
* @author Chris Beams
* @since 0.7.0
* @see AbstractAsset
* @see Coin
* @see Token
* @see Erc20Token
* @see AssetRegistry
*/
public interface Asset {
String getName();
String getTickerSymbol();
AddressValidationResult validateAddress(String address);
}

View file

@ -0,0 +1,46 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
import java.util.stream.Stream;
/**
* Provides {@link Stream}-based access to {@link Asset} implementations registered in
* the {@code META-INF/services/bisq.asset.Asset} provider-configuration file.
*
* @author Chris Beams
* @since 0.7.0
* @see ServiceLoader
*/
public class AssetRegistry {
private static final List<Asset> registeredAssets = new ArrayList<>();
static {
for (Asset asset : ServiceLoader.load(Asset.class)) {
registeredAssets.add(asset);
}
}
public Stream<Asset> stream() {
return registeredAssets.stream();
}
}

View file

@ -0,0 +1,54 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.LegacyAddress;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
/**
* {@link AddressValidator} for Base58-encoded addresses.
*
* @author Chris Beams
* @since 0.7.0
* @see org.bitcoinj.core.LegacyAddress#fromBase58(NetworkParameters, String)
*/
public class Base58AddressValidator implements AddressValidator {
private final NetworkParameters networkParameters;
public Base58AddressValidator() {
this(MainNetParams.get());
}
public Base58AddressValidator(NetworkParameters networkParameters) {
this.networkParameters = networkParameters;
}
@Override
public AddressValidationResult validate(String address) {
try {
LegacyAddress.fromBase58(networkParameters, address);
} catch (AddressFormatException ex) {
return AddressValidationResult.invalidAddress(ex);
}
return AddressValidationResult.validAddress();
}
}

View file

@ -0,0 +1,52 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
/**
* {@link AddressValidator} for Bitcoin addresses.
*
* @author Oscar Guindzberg
*/
public class BitcoinAddressValidator implements AddressValidator {
private final NetworkParameters networkParameters;
public BitcoinAddressValidator() {
this(MainNetParams.get());
}
public BitcoinAddressValidator(NetworkParameters networkParameters) {
this.networkParameters = networkParameters;
}
@Override
public AddressValidationResult validate(String address) {
try {
Address.fromString(networkParameters, address);
} catch (AddressFormatException ex) {
return AddressValidationResult.invalidAddress(ex);
}
return AddressValidationResult.validAddress();
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* Abstract base class for {@link Asset}s with their own dedicated blockchain, such as
* {@link bisq.asset.coins.Bitcoin} itself or one of its many derivatives, competitors and
* alternatives, often called "altcoins", such as {@link bisq.asset.coins.Litecoin},
* {@link bisq.asset.coins.Ether}, {@link bisq.asset.coins.Monero} and
* {@link bisq.asset.coins.Zcash}.
* <p>
* In addition to the usual {@code Asset} properties, a {@code Coin} maintains information
* about which {@link Network} it may be used on. By default, coins are constructed with
* the assumption they are for use on that coin's "main network", or "main blockchain",
* i.e. that they are "real" coins for use in a production environment. In testing
* scenarios, however, a coin may be constructed for use only on "testnet" or "regtest"
* networks.
*
* @author Chris Beams
* @since 0.7.0
*/
public abstract class Coin extends AbstractAsset {
public enum Network { MAINNET, TESTNET, REGTEST }
private final Network network;
public Coin(String name, String tickerSymbol, AddressValidator addressValidator) {
this(name, tickerSymbol, addressValidator, Network.MAINNET);
}
public Coin(String name, String tickerSymbol, AddressValidator addressValidator, Network network) {
super(name, tickerSymbol, addressValidator);
this.network = network;
}
public Network getNetwork() {
return network;
}
}

View file

@ -0,0 +1,53 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* {@link AddressValidator} for Base58-encoded Cryptonote addresses.
*
* @author Xiphon
*/
public class CryptoNoteAddressValidator implements AddressValidator {
private final long[] validPrefixes;
private final boolean validateChecksum;
public CryptoNoteAddressValidator(boolean validateChecksum, long... validPrefixes) {
this.validPrefixes = validPrefixes;
this.validateChecksum = validateChecksum;
}
public CryptoNoteAddressValidator(long... validPrefixes) {
this(true, validPrefixes);
}
@Override
public AddressValidationResult validate(String address) {
try {
long prefix = CryptoNoteUtils.MoneroBase58.decodeAddress(address, this.validateChecksum);
for (long validPrefix : this.validPrefixes) {
if (prefix == validPrefix) {
return AddressValidationResult.validAddress();
}
}
return AddressValidationResult.invalidAddress(String.format("invalid address prefix %x", prefix));
} catch (Exception e) {
return AddressValidationResult.invalidStructure();
}
}
}

View file

@ -0,0 +1,269 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
import org.bitcoinj.core.Utils;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Map;
public class CryptoNoteUtils {
public static String getRawSpendKeyAndViewKey(String address) throws CryptoNoteUtils.CryptoNoteException {
try {
// See https://monerodocs.org/public-address/standard-address/
byte[] decoded = CryptoNoteUtils.MoneroBase58.decode(address);
// Standard addresses are of length 69 and addresses with integrated payment ID of length 77.
if (decoded.length <= 65) {
throw new CryptoNoteUtils.CryptoNoteException("The address we received is too short. address=" + address);
}
// If the length is not as expected but still can be truncated we log an error and continue.
if (decoded.length != 69 && decoded.length != 77) {
System.out.println("The address we received is not in the expected format. address=" + address);
}
// We remove the network type byte, the checksum (4 bytes) and optionally the payment ID (8 bytes if present)
// So extract the 64 bytes after the first byte, which are the 32 byte public spend key + the 32 byte public view key
byte[] slice = Arrays.copyOfRange(decoded, 1, 65);
return Utils.HEX.encode(slice);
} catch (CryptoNoteUtils.CryptoNoteException e) {
throw new CryptoNoteUtils.CryptoNoteException(e);
}
}
public static class CryptoNoteException extends Exception {
CryptoNoteException(String msg) {
super(msg);
}
public CryptoNoteException(CryptoNoteException exception) {
super(exception);
}
}
static class Keccak {
private static final int BLOCK_SIZE = 136;
private static final int LONGS_PER_BLOCK = BLOCK_SIZE / 8;
private static final int KECCAK_ROUNDS = 24;
private static final long[] KECCAKF_RNDC = {
0x0000000000000001L, 0x0000000000008082L, 0x800000000000808aL,
0x8000000080008000L, 0x000000000000808bL, 0x0000000080000001L,
0x8000000080008081L, 0x8000000000008009L, 0x000000000000008aL,
0x0000000000000088L, 0x0000000080008009L, 0x000000008000000aL,
0x000000008000808bL, 0x800000000000008bL, 0x8000000000008089L,
0x8000000000008003L, 0x8000000000008002L, 0x8000000000000080L,
0x000000000000800aL, 0x800000008000000aL, 0x8000000080008081L,
0x8000000000008080L, 0x0000000080000001L, 0x8000000080008008L
};
private static final int[] KECCAKF_ROTC = {
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14,
27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44
};
private static final int[] KECCAKF_PILN = {
10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4,
15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1
};
private static long rotateLeft(long value, int shift) {
return (value << shift) | (value >>> (64 - shift));
}
private static void keccakf(long[] st, int rounds) {
long[] bc = new long[5];
for (int round = 0; round < rounds; ++round) {
for (int i = 0; i < 5; ++i) {
bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20];
}
for (int i = 0; i < 5; i++) {
long t = bc[(i + 4) % 5] ^ rotateLeft(bc[(i + 1) % 5], 1);
for (int j = 0; j < 25; j += 5) {
st[j + i] ^= t;
}
}
long t = st[1];
for (int i = 0; i < 24; ++i) {
int j = KECCAKF_PILN[i];
bc[0] = st[j];
st[j] = rotateLeft(t, KECCAKF_ROTC[i]);
t = bc[0];
}
for (int j = 0; j < 25; j += 5) {
for (int i = 0; i < 5; i++) {
bc[i] = st[j + i];
}
for (int i = 0; i < 5; i++) {
st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5];
}
}
st[0] ^= KECCAKF_RNDC[round];
}
}
static ByteBuffer keccak1600(ByteBuffer input) {
input.order(ByteOrder.LITTLE_ENDIAN);
int fullBlocks = input.remaining() / BLOCK_SIZE;
long[] st = new long[25];
for (int block = 0; block < fullBlocks; ++block) {
for (int index = 0; index < LONGS_PER_BLOCK; ++index) {
st[index] ^= input.getLong();
}
keccakf(st, KECCAK_ROUNDS);
}
ByteBuffer lastBlock = ByteBuffer.allocate(144).order(ByteOrder.LITTLE_ENDIAN);
lastBlock.put(input);
lastBlock.put((byte) 1);
int paddingOffset = BLOCK_SIZE - 1;
lastBlock.put(paddingOffset, (byte) (lastBlock.get(paddingOffset) | 0x80));
lastBlock.rewind();
for (int index = 0; index < LONGS_PER_BLOCK; ++index) {
st[index] ^= lastBlock.getLong();
}
keccakf(st, KECCAK_ROUNDS);
ByteBuffer result = ByteBuffer.allocate(32);
result.slice().order(ByteOrder.LITTLE_ENDIAN).asLongBuffer().put(st, 0, 4);
return result;
}
}
static class MoneroBase58 {
private static final String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
private static final BigInteger ALPHABET_SIZE = BigInteger.valueOf(ALPHABET.length());
private static final int FULL_DECODED_BLOCK_SIZE = 8;
private static final int FULL_ENCODED_BLOCK_SIZE = 11;
private static final BigInteger UINT64_MAX = new BigInteger("18446744073709551615");
private static final Map<Integer, Integer> DECODED_CHUNK_LENGTH = Map.of(2, 1,
3, 2,
5, 3,
6, 4,
7, 5,
9, 6,
10, 7,
11, 8);
private static void decodeChunk(String input,
int inputOffset,
int inputLength,
byte[] decoded,
int decodedOffset,
int decodedLength) throws CryptoNoteException {
BigInteger result = BigInteger.ZERO;
BigInteger order = BigInteger.ONE;
for (int index = inputOffset + inputLength; index != inputOffset; order = order.multiply(ALPHABET_SIZE)) {
char character = input.charAt(--index);
int digit = ALPHABET.indexOf(character);
if (digit == -1) {
throw new CryptoNoteException("invalid character " + character);
}
result = result.add(order.multiply(BigInteger.valueOf(digit)));
if (result.compareTo(UINT64_MAX) > 0) {
throw new CryptoNoteException("64-bit unsigned integer overflow " + result.toString());
}
}
BigInteger maxCapacity = BigInteger.ONE.shiftLeft(8 * decodedLength);
if (result.compareTo(maxCapacity) >= 0) {
throw new CryptoNoteException("capacity overflow " + result.toString());
}
for (int index = decodedOffset + decodedLength; index != decodedOffset; result = result.shiftRight(8)) {
decoded[--index] = result.byteValue();
}
}
public static byte[] decode(String input) throws CryptoNoteException {
if (input.length() == 0) {
return new byte[0];
}
int chunks = input.length() / FULL_ENCODED_BLOCK_SIZE;
int lastEncodedSize = input.length() % FULL_ENCODED_BLOCK_SIZE;
int lastChunkSize = lastEncodedSize > 0 ? DECODED_CHUNK_LENGTH.get(lastEncodedSize) : 0;
byte[] result = new byte[chunks * FULL_DECODED_BLOCK_SIZE + lastChunkSize];
int inputOffset = 0;
int resultOffset = 0;
for (int chunk = 0; chunk < chunks; ++chunk,
inputOffset += FULL_ENCODED_BLOCK_SIZE,
resultOffset += FULL_DECODED_BLOCK_SIZE) {
decodeChunk(input, inputOffset, FULL_ENCODED_BLOCK_SIZE, result, resultOffset, FULL_DECODED_BLOCK_SIZE);
}
if (lastChunkSize > 0) {
decodeChunk(input, inputOffset, lastEncodedSize, result, resultOffset, lastChunkSize);
}
return result;
}
private static long readVarInt(ByteBuffer buffer) {
long result = 0;
for (int shift = 0; ; shift += 7) {
byte current = buffer.get();
result += (current & 0x7fL) << shift;
if ((current & 0x80L) == 0) {
break;
}
}
return result;
}
static long decodeAddress(String address, boolean validateChecksum) throws CryptoNoteException {
byte[] decoded = decode(address);
int checksumSize = 4;
if (decoded.length < checksumSize) {
throw new CryptoNoteException("invalid length");
}
ByteBuffer decodedAddress = ByteBuffer.wrap(decoded, 0, decoded.length - checksumSize);
long prefix = readVarInt(decodedAddress.slice());
if (!validateChecksum) {
return prefix;
}
ByteBuffer fastHash = Keccak.keccak1600(decodedAddress.slice());
int checksum = fastHash.getInt();
int expected = ByteBuffer.wrap(decoded, decoded.length - checksumSize, checksumSize).getInt();
if (checksum != expected) {
throw new CryptoNoteException(String.format("invalid checksum %08X, expected %08X", checksum, expected));
}
return prefix;
}
}
}

View file

@ -0,0 +1,33 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* Abstract base class for Ethereum-based {@link Token}s that implement the
* <a href="https://theethereum.wiki/w/index.php/ERC20_Token_Standard">ERC-20 Token
* Standard</a>.
*
* @author Chris Beams
* @since 0.7.0
*/
public abstract class Erc20Token extends Token {
public Erc20Token(String name, String tickerSymbol) {
super(name, tickerSymbol, new EtherAddressValidator());
}
}

View file

@ -0,0 +1,40 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* Validates an Ethereum address using the regular expression on record in the
* <a href="https://github.com/ethereum/web3.js/blob/bd6a890/lib/utils/utils.js#L405">
* ethereum/web3.js</a> project. Note that this implementation is widely used, not just
* for actual {@link bisq.asset.coins.Ether} address validation, but also for
* {@link Erc20Token} implementations and other Ethereum-based {@link Asset}
* implementations.
*
* @author Chris Beams
* @since 0.7.0
*/
public class EtherAddressValidator extends RegexAddressValidator {
public EtherAddressValidator() {
super("^(0x)?[0-9a-fA-F]{40}$");
}
public EtherAddressValidator(String errorMessageI18nKey) {
super("^(0x)?[0-9a-fA-F]{40}$", errorMessageI18nKey);
}
}

View file

@ -0,0 +1,102 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* We only support the grinbox format as it is currently the only tool which offers a validation options of sender.
* Beside that is the IP:port format very insecure with MITM attacks.
*
* Here is the information from a conversation with the Grinbox developer regarding the Grinbox address format.
*
A Grinbox address is of the format: grinbox://<key>@domain.com:port where everything besides <key> is optional.
If no domain is specified, the default relay grinbox.io will be used.
The <key> is a base58check encoded value (like in Bitcoin). For Grin mainnet, the first 2 bytes will be [1, 11] and
the following 33 bytes should be a valid secp256k1 compressed public key.
Some examples of valid addresses are:
gVvRNiuopubvxPrs1BzJdQjVdFAxmkLzMqiVJzUZ7ubznhdtNTGB
gVvUcSafSTD3YTSqgNf9ojEYWkz3zMZNfsjdpdb9en5mxc6gmja6
gVvk7rLBg3r3qoWYL3VsREnBbooT7nynxx5HtDvUWCJUaNCnddvY
grinbox://gVtWzX5NTLCBkyNV19QVdnLXue13heAVRD36sfkGD6xpqy7k7e4a
gVw9TWimGFXRjoDXWhWxeNQbu84ZpLkvnenkKvA5aJeDo31eM5tC@somerelay.com
grinbox://gVwjSsYW5vvHpK4AunJ5piKhhQTV6V3Jb818Uqs6PdC3SsB36AsA@somerelay.com:1220
Some examples of invalid addresses are:
gVuBJDKcWkhueMfBLAbFwV4ax55YXPeinWXdRME1Zi3eiC6sFNye (invalid checksum)
geWGCMQjxZMHG3EtTaRbR7rH9rE4DsmLfpm1iiZEa7HFKjjkgpf2 (wrong version bytes)
gVvddC2jYAfxTxnikcbTEQKLjhJZpqpBg39tXkwAKnD2Pys2mWiK (invalid public key)
We only add the basic validation without checksum, version byte and pubkey validation as that would require much more
effort. Any Grin developer is welcome to add that though!
*/
public class GrinAddressValidator implements AddressValidator {
// A Grin Wallet URL (address is not the correct term) can be in the form IP:port or a grinbox format.
// The grinbox has the format grinbox://<key>@domain.com:port where everything beside the key is optional.
// Regex for IP validation borrowed from https://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
private static final String PORT = "((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4}))$";
private static final String DOMAIN = "[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\\.[a-zA-Z]{2,}$";
private static final String KEY = "[a-km-zA-HJ-NP-Z1-9]{52}$";
public GrinAddressValidator() {
}
@Override
public AddressValidationResult validate(String address) {
if (address == null || address.length() == 0)
return AddressValidationResult.invalidAddress("Address may not be empty (only Grinbox format is supported)");
// We only support grinbox address
String key;
String domain = null;
String port = null;
address = address.replace("grinbox://", "");
if (address.contains("@")) {
String[] keyAndDomain = address.split("@");
key = keyAndDomain[0];
if (keyAndDomain.length > 1) {
domain = keyAndDomain[1];
if (domain.contains(":")) {
String[] domainAndPort = domain.split(":");
domain = domainAndPort[0];
if (domainAndPort.length > 1)
port = domainAndPort[1];
}
}
} else {
key = address;
}
if (!key.matches("^" + KEY))
return AddressValidationResult.invalidAddress("Invalid key (only Grinbox format is supported)");
if (domain != null && !domain.matches("^" + DOMAIN))
return AddressValidationResult.invalidAddress("Invalid domain (only Grinbox format is supported)");
if (port != null && !port.matches("^" + PORT))
return AddressValidationResult.invalidAddress("Invalid port (only Grinbox format is supported)");
return AddressValidationResult.validAddress();
}
}

View file

@ -0,0 +1,8 @@
package bisq.asset;
import java.util.ResourceBundle;
public class I18n {
public static ResourceBundle DISPLAY_STRINGS = ResourceBundle.getBundle("i18n.displayStrings-assets");
}

View file

@ -0,0 +1,9 @@
package bisq.asset;
public class LiquidBitcoinAddressValidator extends RegexAddressValidator {
static private final String REGEX = "^([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,87}|[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,87})$";
public LiquidBitcoinAddressValidator() {
super(REGEX, "validation.altcoin.liquidBitcoin.invalidAddress");
}
}

View file

@ -0,0 +1,83 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
import org.bitcoinj.core.BitcoinSerializer;
import org.bitcoinj.core.Block;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.StoredBlock;
import org.bitcoinj.core.VerificationException;
import org.bitcoinj.store.BlockStore;
import org.bitcoinj.utils.MonetaryFormat;
/**
* Convenient abstract {@link NetworkParameters} base class providing no-op
* implementations of all methods that are not required for address validation
* purposes.
*
* @author Chris Beams
* @since 0.7.0
*/
public abstract class NetworkParametersAdapter extends NetworkParameters {
@Override
public String getPaymentProtocolId() {
return PAYMENT_PROTOCOL_ID_MAINNET;
}
@Override
public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore)
throws VerificationException {
}
@Override
public Coin getMaxMoney() {
return null;
}
@Override
public Coin getMinNonDustOutput() {
return null;
}
@Override
public MonetaryFormat getMonetaryFormat() {
return null;
}
@Override
public String getUriScheme() {
return null;
}
@Override
public boolean hasMaxMoney() {
return false;
}
@Override
public BitcoinSerializer getSerializer(boolean parseRetain) {
return null;
}
@Override
public int getProtocolVersionNum(ProtocolVersion version) {
return 0;
}
}

View file

@ -0,0 +1,52 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
import java.util.Comparator;
public class PrintTool {
public static void main(String[] args) {
// Prints out all coins in the format used in the FAQ webpage.
// Run that and copy paste the result to the FAQ webpage at new releases.
StringBuilder sb = new StringBuilder();
new AssetRegistry().stream()
.sorted(Comparator.comparing(o -> o.getName().toLowerCase()))
.filter(e -> !e.getTickerSymbol().equals("BSQ")) // BSQ is not out yet...
.filter(e -> !e.getTickerSymbol().equals("BTC"))
.map(e -> new Pair(e.getName(), e.getTickerSymbol())) // We want to get rid of duplicated entries for regtest/testnet...
.distinct()
.forEach(e -> sb.append("<li>&#8220;")
.append(e.right)
.append("&#8221;, &#8220;")
.append(e.left)
.append("&#8221;</li>")
.append("\n"));
System.out.println(sb.toString());
}
private static class Pair {
final String left;
final String right;
Pair(String left, String right) {
this.left = left;
this.right = right;
}
}
}

View file

@ -0,0 +1,48 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* Validates an {@link Asset} address against a given regular expression.
*
* @author Chris Beams
* @since 0.7.0
*/
public class RegexAddressValidator implements AddressValidator {
private final String regex;
private final String errorMessageI18nKey;
public RegexAddressValidator(String regex) {
this(regex, null);
}
public RegexAddressValidator(String regex, String errorMessageI18nKey) {
this.regex = regex;
this.errorMessageI18nKey = errorMessageI18nKey;
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches(regex))
if (errorMessageI18nKey == null) return AddressValidationResult.invalidStructure();
else return AddressValidationResult.invalidAddress("", errorMessageI18nKey);
return AddressValidationResult.validAddress();
}
}

View file

@ -0,0 +1,37 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset;
/**
* Abstract base class for {@link Asset}s that do not have their own dedicated blockchain,
* but are rather based on or derived from another blockchain. Contrast with {@link Coin}.
* Note that this is essentially a "marker" base class in the sense that it (currently)
* exposes no additional information or functionality beyond that found in
* {@link AbstractAsset}, but it is nevertheless useful in distinguishing between major
* different {@code Asset} types.
*
* @author Chris Beams
* @since 0.7.0
* @see Erc20Token
*/
public abstract class Token extends AbstractAsset {
public Token(String name, String tickerSymbol, AddressValidator addressValidator) {
super(name, tickerSymbol, addressValidator);
}
}

View file

@ -0,0 +1,38 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Actinium extends Coin {
public Actinium() {
super("Actinium", "ACM", new Base58AddressValidator(new ActiniumParams()));
}
public static class ActiniumParams extends NetworkParametersAdapter {
public ActiniumParams() {
addressHeader = 53;
p2shHeader = 55;
}
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Adeptio extends Coin {
public Adeptio() {
super("Adeptio", "ADE", new AdeptioAddressValidator());
}
public static class AdeptioAddressValidator extends Base58AddressValidator {
public AdeptioAddressValidator() {
super(new AdeptioParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[A][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class AdeptioParams extends NetworkParametersAdapter {
public AdeptioParams() {
addressHeader = 23;
p2shHeader = 16;
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
public class Aeon extends Coin {
public Aeon() {
super("Aeon", "AEON", new CryptoNoteAddressValidator(0xB2, 0x06B8));
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Amitycoin extends Coin {
public Amitycoin() {
super("Amitycoin", "AMIT", new RegexAddressValidator("^amit[1-9A-Za-z^OIl]{94}"));
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Animecoin extends Coin {
public Animecoin() {
super("Animecoin", "ANI", new Base58AddressValidator(new AnimecoinMainNetParams()));
}
public static class AnimecoinMainNetParams extends NetworkParametersAdapter {
public AnimecoinMainNetParams() {
this.addressHeader = 23;
this.p2shHeader = 9;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.arq.msg")
public class Arqma extends Coin {
public Arqma() {
super("Arqma", "ARQ", new CryptoNoteAddressValidator(0x2cca, 0x6847));
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Askcoin extends Coin {
public Askcoin() {
super("Askcoin", "ASK", new RegexAddressValidator("^[1-9][0-9]{0,11}"));
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Australiacash extends Coin {
public Australiacash() {
super("Australiacash", "AUS", new Base58AddressValidator(new AustraliacashParams()));
}
public static class AustraliacashParams extends NetworkParametersAdapter {
public AustraliacashParams() {
addressHeader = 23;
p2shHeader = 5;
}
}
}

View file

@ -0,0 +1,76 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.RegTestParams;
import org.bitcoinj.params.TestNet3Params;
public class BSQ extends Coin {
public BSQ(Network network, NetworkParameters networkParameters) {
super("BSQ", "BSQ", new BSQAddressValidator(networkParameters), network);
}
public static class Mainnet extends BSQ {
public Mainnet() {
super(Network.MAINNET, MainNetParams.get());
}
}
public static class Testnet extends BSQ {
public Testnet() {
super(Network.TESTNET, TestNet3Params.get());
}
}
public static class Regtest extends BSQ {
public Regtest() {
super(Network.REGTEST, RegTestParams.get());
}
}
public static class BSQAddressValidator extends Base58AddressValidator {
public BSQAddressValidator(NetworkParameters networkParameters) {
super(networkParameters);
}
@Override
public AddressValidationResult validate(String address) {
if (!address.startsWith("B"))
return AddressValidationResult.invalidAddress("BSQ address must start with 'B'");
String addressAsBtc = address.substring(1, address.length());
return super.validate(addressAsBtc);
}
}
}

View file

@ -0,0 +1,39 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
/**
* Here is info from a Beam developer regarding validation.
*
* Well, unfortunately the range length is quite large. The BbsChannel is 64 bit = 8 bytes, the pubkey is 32 bytes.
* So, the length may be up to 80 chars. The minimum length "theoretically" can also drop to a small length, if the
* channel==0, and the pubkey starts with many zeroes (very unlikely, but possible). So, besides being up to 80 chars
* lower-case hex there's not much can be tested. A more robust test would also check if the pubkey is indeed valid,
* but it's a more complex test, requiring cryptographic code.
*
*/
@AltCoinAccountDisclaimer("account.altcoin.popup.beam.msg")
public class Beam extends Coin {
public Beam() {
super("Beam", "BEAM", new RegexAddressValidator("^([0-9a-f]{1,80})$"));
}
}

View file

@ -0,0 +1,29 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class BitDaric extends Coin {
public BitDaric() {
super("BitDaric", "DARX", new RegexAddressValidator("^[R][a-km-zA-HJ-NP-Z1-9]{25,34}$"));
}
}

View file

@ -0,0 +1,57 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.BitcoinAddressValidator;
import bisq.asset.Coin;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.RegTestParams;
import org.bitcoinj.params.TestNet3Params;
public abstract class Bitcoin extends Coin {
public Bitcoin(Network network, NetworkParameters networkParameters) {
super("Bitcoin", "BTC", new BitcoinAddressValidator(networkParameters), network);
}
public static class Mainnet extends Bitcoin {
public Mainnet() {
super(Network.MAINNET, MainNetParams.get());
}
}
public static class Testnet extends Bitcoin {
public Testnet() {
super(Network.TESTNET, TestNet3Params.get());
}
}
public static class Regtest extends Bitcoin {
public Regtest() {
super(Network.REGTEST, RegTestParams.get());
}
}
}

View file

@ -0,0 +1,38 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class BitcoinRhodium extends Coin {
public BitcoinRhodium() {
super("Bitcoin Rhodium", "XRC", new Base58AddressValidator(new BitcoinRhodiumParams()));
}
public static class BitcoinRhodiumParams extends NetworkParametersAdapter {
public BitcoinRhodiumParams() {
addressHeader = 61;
p2shHeader = 123;
}
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Bitmark extends Coin {
public static class BitmarkParams extends NetworkParametersAdapter {
public BitmarkParams() {
addressHeader = 85;
p2shHeader = 5;
}
}
public Bitmark() {
super("Bitmark", "BTM", new Base58AddressValidator(new BitmarkParams()));
}
}

View file

@ -0,0 +1,29 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Bitzec extends Coin {
public Bitzec() {
super("Bitzec", "BZC", new RegexAddressValidator("^t.*", "validation.altcoin.zAddressesNotSupported"));
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.blur.msg")
public class Blur extends Coin {
public Blur() {
super("Blur", "BLUR", new CryptoNoteAddressValidator(0x1e4d, 0x2195));
}
}

View file

@ -0,0 +1,33 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.blk-burnt.msg")
public class BurntBlackCoin extends Coin {
public static final short PAYLOAD_LIMIT = 15000;
public BurntBlackCoin() {
super("Burnt BlackCoin",
"BLK-BURNT",
new RegexAddressValidator(String.format("(?:[0-9a-z]{2}?){1,%d}+", 2 * PAYLOAD_LIMIT)));
}
}

View file

@ -0,0 +1,29 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class CRowdCLassic extends Coin {
public CRowdCLassic() {
super("CRowdCLassic", "CRCL", new RegexAddressValidator("^[C][a-zA-Z0-9]{33}$"));
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class CTSCoin extends Coin {
public CTSCoin() {
super("CTSCoin", "CTSC", new Base58AddressValidator(new CtscMainNetParams()));
}
public static class CtscMainNetParams extends NetworkParametersAdapter {
public CtscMainNetParams() {
this.addressHeader = 66;
this.p2shHeader = 16;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.cash2.msg")
public class Cash2 extends Coin {
public Cash2() {
super("Cash2", "CASH2", new CryptoNoteAddressValidator(false, 0x6));
}
}

View file

@ -0,0 +1,38 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Chaucha extends Coin {
public Chaucha() {
super("Chaucha", "CHA", new Base58AddressValidator(new ChauchaParams()));
}
public static class ChauchaParams extends NetworkParametersAdapter {
public ChauchaParams() {
addressHeader = 88;
p2shHeader = 50;
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class CloakCoin extends Coin {
public CloakCoin() {
super("CloakCoin", "CLOAK", new RegexAddressValidator("^[B|C][a-km-zA-HJ-NP-Z1-9]{33}|^smY[a-km-zA-HJ-NP-Z1-9]{99}$"));
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.I18n;
import bisq.asset.RegexAddressValidator;
public class Counterparty extends Coin {
public Counterparty() {
super("Counterparty", "XCP", new XcpAddressValidator());
}
public static class XcpAddressValidator extends RegexAddressValidator {
public XcpAddressValidator() {
super("^[1][a-zA-Z0-9]{33}", I18n.DISPLAY_STRINGS.getString("account.altcoin.popup.validation.XCP"));
}
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Credits extends Coin {
public Credits() {
super("Credits", "CRDS", new CreditsAddressValidator());
}
public static class CreditsAddressValidator extends Base58AddressValidator {
public CreditsAddressValidator() {
super(new CreditsParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[C][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class CreditsParams extends NetworkParametersAdapter {
public CreditsParams() {
addressHeader = 28;
p2shHeader = 5;
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Croat extends Coin {
public Croat() {
super("Croat", "CROAT", new RegexAddressValidator("^C[1-9A-HJ-NP-Za-km-z]{94}"));
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class DSTRA extends Coin {
public DSTRA() {
super("DSTRA", "DST", new DSTRAAddressValidator());
}
public static class DSTRAAddressValidator extends Base58AddressValidator {
public DSTRAAddressValidator() {
super(new DSTRAParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class DSTRAParams extends NetworkParametersAdapter {
public DSTRAParams() {
addressHeader = 30;
p2shHeader = 33;
}
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class DarkPay extends Coin {
public DarkPay() {
super("DarkPay", "D4RK", new Base58AddressValidator(new DarkPayMainNetParams()));
}
public static class DarkPayMainNetParams extends NetworkParametersAdapter {
public DarkPayMainNetParams() {
this.addressHeader = 31;
this.p2shHeader = 60;
}
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Dash extends Coin {
public Dash() {
super("Dash", "DASH", new Base58AddressValidator(new DashMainNetParams()), Network.MAINNET);
}
public static class DashMainNetParams extends NetworkParametersAdapter {
public DashMainNetParams() {
this.addressHeader = 76;
this.p2shHeader = 16;
}
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.I18n;
import bisq.asset.RegexAddressValidator;
public class Decred extends Coin {
public Decred() {
super("Decred", "DCR", new DcrAddressValidator());
}
public static class DcrAddressValidator extends RegexAddressValidator {
public DcrAddressValidator() {
super("^[Dk|Ds|De|DS|Dc|Pm][a-zA-Z0-9]{24,34}", I18n.DISPLAY_STRINGS.getString("account.altcoin.popup.validation.DCR"));
}
}
}

View file

@ -0,0 +1,53 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class DeepOnion extends Coin {
public DeepOnion() {
super("DeepOnion", "ONION", new DeepOnionAddressValidator());
}
public static class DeepOnionAddressValidator extends Base58AddressValidator {
public DeepOnionAddressValidator() {
super(new DeepOnionParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class DeepOnionParams extends NetworkParametersAdapter {
public DeepOnionParams() {
super();
addressHeader = 31;
p2shHeader = 78;
}
}
}

View file

@ -0,0 +1,56 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Dextro extends Coin {
public Dextro() {
super("Dextro", "DXO", new Base58AddressValidator(new DextroParams()));
}
public static class DextroAddressValidator extends Base58AddressValidator {
public DextroAddressValidator() {
super(new DextroParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class DextroParams extends NetworkParametersAdapter {
public DextroParams() {
super();
addressHeader = 30;
p2shHeader = 90;
}
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Dogecoin extends Coin {
public Dogecoin() {
super("Dogecoin", "DOGE", new Base58AddressValidator(new DogecoinMainNetParams()), Network.MAINNET);
}
public static class DogecoinMainNetParams extends NetworkParametersAdapter {
public DogecoinMainNetParams() {
this.addressHeader = 30;
this.p2shHeader = 22;
}
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Doichain extends Coin {
public Doichain() {
super("Doichain", "DOI", new Base58AddressValidator(new DoichainParams()));
}
public static class DoichainParams extends NetworkParametersAdapter {
public DoichainParams() {
addressHeader = 52;
p2shHeader = 13;
}
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Donu extends Coin {
public Donu() {
super("Donu", "DONU", new DonuAddressValidator());
}
public static class DonuAddressValidator extends Base58AddressValidator {
public DonuAddressValidator() {
super(new DonuParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[N][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class DonuParams extends NetworkParametersAdapter {
public DonuParams() {
addressHeader = 53;
p2shHeader = 5;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.drgl.msg")
public class Dragonglass extends Coin {
public Dragonglass() {
super("Dragonglass", "DRGL", new RegexAddressValidator("^(dRGL)[1-9A-HJ-NP-Za-km-z]{94}$"));
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Emercoin extends Coin {
public Emercoin() {
super("Emercoin", "EMC", new Base58AddressValidator(new EmercoinMainNetParams()), Network.MAINNET);
}
public static class EmercoinMainNetParams extends NetworkParametersAdapter {
public EmercoinMainNetParams() {
this.addressHeader = 33;
this.p2shHeader = 92;
}
}
}

View file

@ -0,0 +1,53 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.AddressValidator;
import bisq.asset.Coin;
import java.util.Arrays;
import org.bitcoinj.core.Base58;
import org.bitcoinj.core.AddressFormatException;
public class Ergo extends Coin {
public Ergo() {
super("Ergo", "ERG", new ErgoAddressValidator());
}
public static class ErgoAddressValidator implements AddressValidator {
@Override
public AddressValidationResult validate(String address) {
try {
byte[] decoded = Base58.decode(address);
if (decoded.length < 4) {
return AddressValidationResult.invalidAddress("Input too short: " + decoded.length);
}
if (decoded[0] != 1 && decoded[0] != 2 && decoded[0] != 3) {
return AddressValidationResult.invalidAddress("Invalid prefix");
}
} catch (AddressFormatException e) {
return AddressValidationResult.invalidAddress(e);
}
return AddressValidationResult.validAddress();
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.EtherAddressValidator;
public class Ether extends Coin {
public Ether() {
super("Ether", "ETH", new EtherAddressValidator());
}
}

View file

@ -0,0 +1,29 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.EtherAddressValidator;
import bisq.asset.I18n;
public class EtherClassic extends Coin {
public EtherClassic() {
super("Ether Classic", "ETC", new EtherAddressValidator(I18n.DISPLAY_STRINGS.getString("account.altcoin.popup.validation.ETC")));
}
}

View file

@ -0,0 +1,38 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Faircoin extends Coin {
public Faircoin() {
super("Faircoin", "FAIR", new Base58AddressValidator(new Faircoin.FaircoinParams()));
}
public static class FaircoinParams extends NetworkParametersAdapter {
public FaircoinParams() {
addressHeader = 95;
p2shHeader = 36;
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
public class FourtyTwo extends Coin {
public FourtyTwo() {
super("FourtyTwo", "FRTY", new CryptoNoteAddressValidator(0x1cbd67, 0x13271817));
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Fujicoin extends Coin {
public Fujicoin() {
super("Fujicoin", "FJC", new Base58AddressValidator(new FujicoinParams()));
}
public static class FujicoinParams extends NetworkParametersAdapter {
public FujicoinParams() {
addressHeader = 36;
p2shHeader = 16;
}
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Galilel extends Coin {
public Galilel() {
super("Galilel", "GALI", new Base58AddressValidator(new GalilelMainNetParams()));
}
public static class GalilelMainNetParams extends NetworkParametersAdapter {
public GalilelMainNetParams() {
this.addressHeader = 68;
this.p2shHeader = 16;
}
}
}

View file

@ -0,0 +1,56 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class GambleCoin extends Coin {
public GambleCoin() {
super("GambleCoin", "GMCN", new GambleCoinAddressValidator());
}
public static class GambleCoinAddressValidator extends Base58AddressValidator {
public GambleCoinAddressValidator() {
super(new GambleCoinParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[C][a-km-zA-HJ-NP-Z1-9]{33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class GambleCoinParams extends NetworkParametersAdapter {
public GambleCoinParams() {
super();
addressHeader = 28;
p2shHeader = 18;
}
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.*;
public class Genesis extends Coin {
public Genesis() {
super("Genesis", "GENX", new GenesisAddressValidator());
}
public static class GenesisAddressValidator extends Base58AddressValidator {
public GenesisAddressValidator() {
super(new GenesisParams());
}
@Override
public AddressValidationResult validate(String address) {
if (address.startsWith("S")) {
return super.validate(address);
}else if (address.startsWith("genx")){
return AddressValidationResult.invalidAddress("Bech32 GENX addresses are not supported on bisq");
}else if (address.startsWith("C")){
return AddressValidationResult.invalidAddress("Legacy GENX addresses are not supported on bisq");
}
return AddressValidationResult.invalidStructure();
}
}
public static class GenesisParams extends NetworkParametersAdapter {
public GenesisParams() {
addressHeader = 28;
p2shHeader = 63;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.GrinAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.grin.msg")
public class Grin extends Coin {
public Grin() {
super("Grin", "GRIN", new GrinAddressValidator());
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Hatch extends Coin {
public Hatch() {
super("Hatch", "HATCH", new Base58AddressValidator(new HatchMainNetParams()), Network.MAINNET);
}
public static class HatchMainNetParams extends NetworkParametersAdapter {
public HatchMainNetParams() {
this.addressHeader = 76;
this.p2shHeader = 16;
}
}
}

View file

@ -0,0 +1,37 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Helium extends Coin {
public Helium() {
super("Helium", "HLM", new Base58AddressValidator(new HeliumParams()));
}
public static class HeliumParams extends NetworkParametersAdapter {
public HeliumParams() {
addressHeader = 63;
p2shHeader = 5;
}
}
}

View file

@ -0,0 +1,69 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.AddressValidator;
import bisq.asset.Coin;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Base58;
public class Horizen extends Coin {
public Horizen() {
super("Horizen", "ZEN", new HorizenAddressValidator());
}
public static class HorizenAddressValidator implements AddressValidator {
@Override
public AddressValidationResult validate(String address) {
byte[] byteAddress;
try {
// Get the non Base58 form of the address and the bytecode of the first two bytes
byteAddress = Base58.decodeChecked(address);
} catch (AddressFormatException e) {
// Unhandled Exception (probably a checksum error)
return AddressValidationResult.invalidAddress(e);
}
int version0 = byteAddress[0] & 0xFF;
int version1 = byteAddress[1] & 0xFF;
// We only support public ("zn" (0x20,0x89), "t1" (0x1C,0xB8))
// and multisig ("zs" (0x20,0x96), "t3" (0x1C,0xBD)) addresses
// Fail for private addresses
if (version0 == 0x16 && version1 == 0x9A)
// Address starts with "zc"
return AddressValidationResult.invalidAddress("", "validation.altcoin.zAddressesNotSupported");
if (version0 == 0x1C && (version1 == 0xB8 || version1 == 0xBD))
// "t1" or "t3" address
return AddressValidationResult.validAddress();
if (version0 == 0x20 && (version1 == 0x89 || version1 == 0x96))
// "zn" or "zs" address
return AddressValidationResult.validAddress();
// Unknown Type
return AddressValidationResult.invalidStructure();
}
}
}

View file

@ -0,0 +1,56 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class IdaPay extends Coin {
public IdaPay() {
super("IdaPay", "IDA", new IdaPayAddressValidator());
}
public static class IdaPayAddressValidator extends Base58AddressValidator {
public IdaPayAddressValidator() {
super(new IdaPayParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[CD][a-km-zA-HJ-NP-Z1-9]{33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class IdaPayParams extends NetworkParametersAdapter {
public IdaPayParams() {
super();
addressHeader = 29;
p2shHeader = 36;
}
}
}

View file

@ -0,0 +1,25 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Iridium extends Coin {
public Iridium() {
super("Iridium", "IRD", new RegexAddressValidator("^ir[1-9A-Za-z^OIl]{95}"));
}
}

View file

@ -0,0 +1,39 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Kekcoin extends Coin {
public Kekcoin() {
super("Kekcoin", "KEK", new Base58AddressValidator(new KekcoinParams()));
}
public static class KekcoinParams extends NetworkParametersAdapter {
public KekcoinParams() {
super();
addressHeader = 45;
p2shHeader = 88;
}
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class KnowYourDeveloper extends Coin {
public KnowYourDeveloper() {
super("Know Your Developer", "KYDC", new Base58AddressValidator(new KydMainNetParams()));
}
public static class KydMainNetParams extends NetworkParametersAdapter {
public KydMainNetParams() {
this.addressHeader = 78;
this.p2shHeader = 85;
}
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Kore extends Coin {
public Kore() {
super("Kore", "KORE", new Base58AddressValidator(new KoreMainNetParams()));
}
public static class KoreMainNetParams extends NetworkParametersAdapter {
public KoreMainNetParams() {
this.addressHeader = 45;
this.p2shHeader = 85;
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Krypton extends Coin {
public Krypton() {
super("Krypton", "ZOD", new RegexAddressValidator("^QQQ[1-9A-Za-z^OIl]{95}"));
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class LBRYCredits extends Coin {
public LBRYCredits() {
super("LBRY Credits", "LBC", new Base58AddressValidator(new LBRYCreditsMainNetParams()), Network.MAINNET);
}
public static class LBRYCreditsMainNetParams extends NetworkParametersAdapter {
public LBRYCreditsMainNetParams() {
this.addressHeader = 0x55;
this.p2shHeader = 0x7a;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.LiquidBitcoinAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.liquidbitcoin.msg")
public class LiquidBitcoin extends Coin {
public LiquidBitcoin() {
super("Liquid Bitcoin", "L-BTC", new LiquidBitcoinAddressValidator());
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Litecoin extends Coin {
public Litecoin() {
super("Litecoin", "LTC", new Base58AddressValidator(new LitecoinMainNetParams()), Network.MAINNET);
}
public static class LitecoinMainNetParams extends NetworkParametersAdapter {
public LitecoinMainNetParams() {
this.addressHeader = 48;
this.p2shHeader = 5;
}
}
}

View file

@ -0,0 +1,37 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class LitecoinPlus extends Coin {
public LitecoinPlus() {
super("LitecoinPlus", "LCP", new Base58AddressValidator(new LitecoinPlusMainNetParams()));
}
public static class LitecoinPlusMainNetParams extends NetworkParametersAdapter {
public LitecoinPlusMainNetParams() {
this.addressHeader = 75;
this.p2shHeader = 8;
}
}
}

View file

@ -0,0 +1,29 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class LitecoinZ extends Coin {
public LitecoinZ() {
super("LitecoinZ", "LTZ", new RegexAddressValidator("^L.*", "validation.altcoin.ltz.zAddressesNotSupported"));
}
}

View file

@ -0,0 +1,37 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Lytix extends Coin {
public Lytix() {
super("Lytix", "LYTX", new Base58AddressValidator(new LytixParams()));
}
public static class LytixParams extends NetworkParametersAdapter {
public LytixParams() {
addressHeader = 19;
p2shHeader = 11;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.msr.msg")
public class Masari extends Coin {
public Masari() {
super("Masari", "MSR", new CryptoNoteAddressValidator(28, 52));
}
}

View file

@ -0,0 +1,27 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
public class Mask extends Coin {
public Mask() {
super("Mask", "MASK", new CryptoNoteAddressValidator(123, 206));
}
}

View file

@ -0,0 +1,75 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.AddressValidator;
import bisq.asset.Coin;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Base58;
import java.util.Arrays;
import java.util.zip.CRC32;
import java.util.zip.Checksum;
public class Mile extends Coin {
public Mile() {
super("Mile", "MILE", new MileAddressValidator());
}
/**
* Mile address - base58(32 bytes of public key + 4 bytes of crc32)
*/
public static class MileAddressValidator implements AddressValidator {
public MileAddressValidator() {
}
@Override
public AddressValidationResult validate(String address) {
byte[] decoded;
try {
decoded = Base58.decode(address);
} catch (AddressFormatException e) {
return AddressValidationResult.invalidAddress(e.getMessage());
}
if (decoded.length != 32 + 4)
return AddressValidationResult.invalidAddress("Invalid address");
byte[] data = Arrays.copyOfRange(decoded, 0, decoded.length - 4);
byte[] addrChecksum = Arrays.copyOfRange(decoded, decoded.length - 4, decoded.length);
Checksum checksum = new CRC32();
checksum.update(data, 0, data.length);
long checksumValue = checksum.getValue();
if ((byte)(checksumValue & 0xff) != addrChecksum[0] ||
(byte)((checksumValue >> 8) & 0xff) != addrChecksum[1] ||
(byte)((checksumValue >> 16) & 0xff) != addrChecksum[2] ||
(byte)((checksumValue >> 24) & 0xff) != addrChecksum[3])
{
return AddressValidationResult.invalidAddress("Invalid address checksum");
}
return AddressValidationResult.validAddress();
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class MirQuiX extends Coin {
public MirQuiX() {
super("MirQuiX", "MQX", new RegexAddressValidator("^[M][a-km-zA-HJ-NP-Z1-9]{33}$"));
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class MoX extends Coin {
public MoX() {
super("MoX", "MOX", new RegexAddressValidator("^X[1-9A-Za-z^OIl]{96}"));
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class MobitGlobal extends Coin {
public MobitGlobal() {
super("MobitGlobal", "MBGL", new MobitGlobalAddressValidator());
}
public static class MobitGlobalAddressValidator extends Base58AddressValidator {
public MobitGlobalAddressValidator() {
super(new MobitGlobalParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[M][a-zA-Z1-9]{33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class MobitGlobalParams extends NetworkParametersAdapter {
public MobitGlobalParams() {
addressHeader = 50;
p2shHeader = 110;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.xmr.msg")
public class Monero extends Coin {
public Monero() {
super("Monero", "XMR", new CryptoNoteAddressValidator(18, 19, 42));
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class MonetaryUnit extends Coin {
public MonetaryUnit() {
super("MonetaryUnit", "MUE", new MonetaryUnitAddressValidator());
}
public static class MonetaryUnitAddressValidator extends Base58AddressValidator {
public MonetaryUnitAddressValidator() {
super(new MonetaryUnitParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[7][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class MonetaryUnitParams extends NetworkParametersAdapter {
public MonetaryUnitParams() {
addressHeader = 16;
p2shHeader = 76;
}
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Myce extends Coin {
public Myce() {
super("Myce", "YCE", new Base58AddressValidator(new MyceParams()));
}
public static class MyceParams extends NetworkParametersAdapter {
public MyceParams() {
addressHeader = 50;
p2shHeader = 85;
}
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.I18n;
import bisq.asset.RegexAddressValidator;
public class Namecoin extends Coin {
public Namecoin() {
super("Namecoin", "NMC", new NmcAddressValidator());
}
public static class NmcAddressValidator extends RegexAddressValidator {
public NmcAddressValidator() {
super("^[NM][a-zA-Z0-9]{33}$", I18n.DISPLAY_STRINGS.getString("account.altcoin.popup.validation.NMC"));
}
}
}

View file

@ -0,0 +1,35 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Navcoin extends Coin {
public Navcoin() {
super("Navcoin", "NAV", new Base58AddressValidator(new NavcoinParams()));
}
public static class NavcoinParams extends NetworkParametersAdapter {
public NavcoinParams() {
this.addressHeader = 53;
this.p2shHeader = 85;
}
}
}

View file

@ -0,0 +1,37 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Copyright © 2019 Oneiro NA, Inc.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Ndau extends Coin {
public Ndau() {
// note: ndau addresses contain an internal checksum which was deemed too complicated to include here.
// this regex performs superficial validation, but there is a large space of addresses marked valid
// by this regex which are not in fact valid ndau addresses. For actual ndau address validation,
// use the Address class in github.com/oneiro-ndev/ndauj (java) or github.com/oneiro-ndev/ndaumath/pkg/address (go).
super("ndau", "XND", new RegexAddressValidator("nd[anexbm][abcdefghijkmnpqrstuvwxyz23456789]{45}"));
}
}

View file

@ -0,0 +1,27 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Noir extends Coin {
public Noir() {
super("Noir", "NOR", new RegexAddressValidator("^[Z][_A-z0-9]*([_A-z0-9])*$"));
}
}

View file

@ -0,0 +1,27 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class NoteBlockchain extends Coin {
public NoteBlockchain() {
super("NoteBlockchain", "NTBC", new RegexAddressValidator("^[N][a-km-zA-HJ-NP-Z1-9]{26,33}$"));
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class PENG extends Coin {
public PENG() {
super("PENG Coin", "PENG", new RegexAddressValidator("^[P][a-km-zA-HJ-NP-Z1-9]{33}$"));
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class PIVX extends Coin {
public PIVX() {
super("PIVX", "PIVX", new PIVXAddressValidator());
}
public static class PIVXAddressValidator extends Base58AddressValidator {
public PIVXAddressValidator() {
super(new PIVXParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class PIVXParams extends NetworkParametersAdapter {
public PIVXParams() {
addressHeader = 30;
p2shHeader = 13;
}
}
}

View file

@ -0,0 +1,55 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class PZDC extends Coin {
public PZDC() {
super("PZDC", "PZDC", new PZDCAddressValidator());
}
public static class PZDCAddressValidator extends Base58AddressValidator {
public PZDCAddressValidator() {
super(new PZDCParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[P][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class PZDCParams extends NetworkParametersAdapter {
public PZDCParams() {
addressHeader = 55;
p2shHeader = 13;
}
}
}

View file

@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;
@AltCoinAccountDisclaimer("account.altcoin.popup.pars.msg")
public class ParsiCoin extends Coin {
public ParsiCoin() {
super("ParsiCoin", "PARS", new CryptoNoteAddressValidator(false, 0x90004));
}
}

View file

@ -0,0 +1,52 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58AddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
import bisq.asset.AddressValidationResult;
public class Particl extends Coin {
public Particl() {
super("Particl", "PART", new ParticlMainNetAddressValidator());
}
public static class ParticlMainNetParams extends NetworkParametersAdapter {
public ParticlMainNetParams() {
this.addressHeader = 56;
this.p2shHeader = 60;
}
}
public static class ParticlMainNetAddressValidator extends Base58AddressValidator {
public ParticlMainNetAddressValidator() {
super(new ParticlMainNetParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[RP][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
}

Some files were not shown because too many files have changed in this diff Show more