@Test public void addressToScriptHash() { byte[] scriptHash = AddressUtils.addressToScriptHash("Aa63RMYRWHPRcrZNzUnq5SNrPqoV866Spu"); String script = "2102208aea0068c429a03316e37be0e3e8e21e6cda5442df4c5914a19b3a9b6de37568747476aa"; byte[] expected = Hash.sha256AndThenRipemd160(Numeric.hexStringToByteArray(script)); assertArrayEquals(scriptHash, expected); }
public static byte[] addressToScriptHash(String address) { if (!isValidAddress(address)) { throw new IllegalArgumentException("Not a valid NEO address."); } byte[] data = Base58.decode(address); byte[] buffer = new byte[20]; System.arraycopy(data, 1, buffer, 0, 20); return buffer; }
AddressUtils { public static byte[] addressToScriptHash(String address) { if (!isValidAddress(address)) { throw new IllegalArgumentException("Not a valid NEO address."); } byte[] data = Base58.decode(address); byte[] buffer = new byte[20]; System.arraycopy(data, 1, buffer, 0, 20); return buffer; } }
AddressUtils { public static byte[] addressToScriptHash(String address) { if (!isValidAddress(address)) { throw new IllegalArgumentException("Not a valid NEO address."); } byte[] data = Base58.decode(address); byte[] buffer = new byte[20]; System.arraycopy(data, 1, buffer, 0, 20); return buffer; }  }
AddressUtils { public static byte[] addressToScriptHash(String address) { if (!isValidAddress(address)) { throw new IllegalArgumentException("Not a valid NEO address."); } byte[] data = Base58.decode(address); byte[] buffer = new byte[20]; System.arraycopy(data, 1, buffer, 0, 20); return buffer; }  static boolean isValidAddress(String address); static byte[] addressToScriptHash(String address); static String scriptHashToAddress(byte[] scriptHash); }
AddressUtils { public static byte[] addressToScriptHash(String address) { if (!isValidAddress(address)) { throw new IllegalArgumentException("Not a valid NEO address."); } byte[] data = Base58.decode(address); byte[] buffer = new byte[20]; System.arraycopy(data, 1, buffer, 0, 20); return buffer; }  static boolean isValidAddress(String address); static byte[] addressToScriptHash(String address); static String scriptHashToAddress(byte[] scriptHash);  }