public static String generateContractAddress(String address, BigInteger nonce) { byte[] result = generateContractAddress(Numeric.hexStringToByteArray(address), nonce); return Numeric.toHexString(result); } }
@Test public void testCreateContractAddress() { String address = "0x19e03255f667bdfd50a32722df860b1eeaf4d635"; assertThat(generateContractAddress(address, BigInteger.valueOf(209)), is("0xe41e694d8fa4337b7bffc7483d3609ae1ea068d5")); assertThat(generateContractAddress(address, BigInteger.valueOf(257)), is("0x59c21d36fbe415218e834683cb6616f2bc971ca9")); } }
public static String generateContractAddress(String address, BigInteger nonce) { byte[] result = generateContractAddress(Numeric.hexStringToByteArray(address), nonce); return Numeric.toHexString(result); } }