add block number #631130's hash of btc as beacon seed

This commit is contained in:
jiangyuanshu 2020-05-21 12:03:57 +08:00
parent a42ef24fc5
commit 2a7ba538db
1 changed files with 22 additions and 2 deletions

View File

@ -33,8 +33,28 @@ fn main() {
use rand::{SeedableRng};
use rand::chacha::ChaChaRng;
// Place beacon value here (2^42 SHA256 hash of Bitcoin block hash #534861)
let beacon_value: [u8; 32] = hex!("2bf41a959668e5b9b688e58d613b3dcc99ee159a880cf764ec67e6488d8b8af3");
// Place block hash here (block number #631130)
let mut beacon_value: [u8; 32] = hex!("00000000000000000008de28ff08672c5b85add6d51024b90fa9424dadc82691");
// Performs 2^n hash iterations over it
const N: usize = 32;
for i in 0..(1u64<<N) {
// Print 1024 of the interstitial states
// so that verification can be
// parallelized
if i % (1u64<<(N-10)) == 0 {
print!("{}: ", i);
for b in cur_hash.iter() {
print!("{:02x}", b);
}
println!("");
}
let mut h = Sha256::new();
h.input(&beacon_value);
h.result(&mut beacon_value);
}
print!("Final result of beacon: ");
for b in beacon_value.iter() {