Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dangerousfood/ce5dbc02eef5ab77a401db7ed3aadc1a to your computer and use it in GitHub Desktop.
Save dangerousfood/ce5dbc02eef5ab77a401db7ed3aadc1a to your computer and use it in GitHub Desktop.
public static List<Bytes32> generateZeroHashes(int height) {
List<Bytes32> zeroHashes = new ArrayList<Bytes32>();
for (int i = 0; i < height; i++) zeroHashes.add(Bytes32.ZERO);
for (int i = 0; i < height - 1; i++)
zeroHashes.set(i + 1, Hash.sha2_256(Bytes.concatenate(zeroHashes.get(i), zeroHashes.get(i))));
return zeroHashes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment