Skip to content

Commit

Permalink
corrected header length
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravm committed Apr 18, 2024
1 parent b19ac4e commit 9f9d309
Show file tree
Hide file tree
Showing 81 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions foo/src/create_txid/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ pub fn header(result_bytes: String) -> String {
let version: u32 = 4;
let prevblock = hex::decode("0000000000000000000000000000000000000000000000000000000000000000").unwrap();
let merkleroot = result_bytes.as_bytes().to_vec();
let merkleroot = hex::decode("d1fe103ffad8bed4e92fd99ce6a50f74ae1d356c3941efe2fbb51fcf8dfee4f5").unwrap();

let time: u32 = 1713454776;
let bits = hex::decode("1f00ffff").unwrap();
let mut nonce: u32 = 0;
Expand All @@ -76,11 +78,11 @@ pub fn header(result_bytes: String) -> String {
let mut attempt = header.clone();
attempt.extend_from_slice(&field(nonce, 4));

println!("{}",hex::encode(&attempt));
// println!("{}",hex::encode(&attempt));
let result = hash256(&attempt);

// Show result
println!("{:?}: {:?}", nonce, hex::encode(&result));
// println!("{:?}: {:?}", nonce, hex::encode(&result));


// End if we get a block hash below the target
Expand Down
2 changes: 1 addition & 1 deletion foo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fn main() {

// Convert the result back to natural byte order
let result_bytes = result.chars().collect::<String>();
println!("{}", result_bytes);
println!("the merkle root is: {}", result_bytes);
let header = create_txid::header::header(result_bytes.clone());
println!("header is :{}", header);

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file modified foo/target/debug/deps/foo-2f886419f31a566a
Binary file not shown.
Binary file modified foo/target/debug/foo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 9f9d309

Please sign in to comment.