Skip to content

Commit

Permalink
Initial commit dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielgusn committed Apr 17, 2024
1 parent 4861ba5 commit f9310f5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
Binary file removed main
Binary file not shown.
6 changes: 6 additions & 0 deletions src/block/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ struct Block{
block_header: BlockHeader,
// TO DO: still need to define how we will represent the transactions in the block
transactions: String
}

impl Block {
fn get_block_header_hash() -> String {
String::from("Hello World!")
}
}
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::fmt::Write;
// use hex_literal::hex;

fn main() {
read_mempool("/home/gabriel/projects/code-challenge-2024-gabrielgusn/mempool/");
read_mempool("/home/gabriel/projects/bitcoin-mining-challenge/mempool/");

// let mut hasher = Sha256::new();
let first_block_header: BlockHeader = BlockHeader::new(String::from("00000000000000000000000000000000"), String::from("00000000000000000000000000000000"), Utc::now(), 128);
Expand All @@ -22,7 +22,8 @@ fn main() {

let mut context: Context = Context::new(&SHA256);

let target_hash: String = String::from("0000ffff00000000000000000000000000000000000000000000000000000000");
// let target_hash: String = String::from("0000ffff00000000000000000000000000000000000000000000000000000000");
let target_hash: String = String::from("00000cff00000000000000000000000000000000000000000000000000000000");

context.update(data.as_bytes());
context.update(&nonce.to_be_bytes());
Expand Down
Empty file added src/transactions/mod.rs
Empty file.
20 changes: 20 additions & 0 deletions src/transactions/tx.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#![allow(dead_code)]

use serde_json;
use ring::digest;

// #[derive!(Debug)]
pub struct TxInput{
script_sig: String,
tx_id: String,
vout: u64,
}

pub struct TxPrevOut {

}

pub struct Tx{
vin: TxInput,
tx_size: u64,
}

0 comments on commit f9310f5

Please sign in to comment.