@Test public void getAltNetwork() throws Exception { class AltNetwork extends MainNetParams { AltNetwork() { super(); id = "alt.network"; addressHeader = 48; p2shHeader = 5; acceptableAddressCodes = new int[] { addressHeader, p2shHeader }; } } AltNetwork altNetwork = new AltNetwork(); Networks.register(altNetwork); NetworkParameters params = Address.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); assertEquals(altNetwork.getId(), params.getId()); params = Address.getParametersFromAddress("Xtqn4ks8sJS7iG7S7r1Jf37eFFSJGwh8a8"); assertEquals(MainNetParams.get().getId(), params.getId()); Networks.unregister(altNetwork); try { Address.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); fail(); } catch (AddressFormatException e) { } }
public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { try { return Address.fromBase58(null, address).getParameters(); } catch (WrongNetworkException e) { throw new RuntimeException(e); } }
Address extends VersionedChecksummedBytes { public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { try { return Address.fromBase58(null, address).getParameters(); } catch (WrongNetworkException e) { throw new RuntimeException(e); } } }
Address extends VersionedChecksummedBytes { public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { try { return Address.fromBase58(null, address).getParameters(); } catch (WrongNetworkException e) { throw new RuntimeException(e); } } Address(NetworkParameters params, int version, byte[] hash160);  Address(NetworkParameters params, byte[] hash160); @Deprecated  Address(@Nullable NetworkParameters params, String address); }
Address extends VersionedChecksummedBytes { public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { try { return Address.fromBase58(null, address).getParameters(); } catch (WrongNetworkException e) { throw new RuntimeException(e); } } Address(NetworkParameters params, int version, byte[] hash160);  Address(NetworkParameters params, byte[] hash160); @Deprecated  Address(@Nullable NetworkParameters params, String address); static Address fromP2SHHash(NetworkParameters params, byte[] hash160); static Address fromP2SHScript(NetworkParameters params, Script scriptPubKey); static Address fromBase58(@Nullable NetworkParameters params, String base58); byte[] getHash160(); boolean isP2SHAddress(); NetworkParameters getParameters(); static NetworkParameters getParametersFromAddress(String address); @Override Address clone(); }
Address extends VersionedChecksummedBytes { public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { try { return Address.fromBase58(null, address).getParameters(); } catch (WrongNetworkException e) { throw new RuntimeException(e); } } Address(NetworkParameters params, int version, byte[] hash160);  Address(NetworkParameters params, byte[] hash160); @Deprecated  Address(@Nullable NetworkParameters params, String address); static Address fromP2SHHash(NetworkParameters params, byte[] hash160); static Address fromP2SHScript(NetworkParameters params, Script scriptPubKey); static Address fromBase58(@Nullable NetworkParameters params, String base58); byte[] getHash160(); boolean isP2SHAddress(); NetworkParameters getParameters(); static NetworkParameters getParametersFromAddress(String address); @Override Address clone(); static final int LENGTH; }